/* ===== Fonts (local) ===== */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/Outfit-ext-400.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/Outfit-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/Outfit-ext-500.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/Outfit-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/Outfit-ext-600.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/Outfit-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Design tokens ===== */
:root {
  --bg: #0a0c10;
  --bg2: #0e1118;
  --bg-card: #12151d;
  --bg-card-hover: #181d2a;
  --bg-segment: #191c24;
  --text: #e6edf3;
  --text-dim: #7d8590;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #58a6ff;
  --focus-ring: rgba(88, 166, 255, 0.5);
  --radius: 16px;
  --radius-sm: 12px;

  --dots: #f0883e;       --dots-bg: #2b1a0e;
  --emf: #ff66c4;        --emf-bg: #2a0a1f;
  --ultraviolet: #ccff00; --ultraviolet-bg: #1f2100;
  --freezing: #58a6ff;   --freezing-bg: #0d1b30;
  --orbs: #00e5ff;       --orbs-bg: #00252a;
  --writing: #ffbf00;    --writing-bg: #2e2200;
  --box: #bc8cff;        --box-bg: #1a0d2e;

  --danger: #f85149;     --danger-bg: #2d0e0e;
  --success: #3fb950;    --success-bg: #0d2818;
  --glow: rgba(88, 166, 255, 0.06);
}

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); height: 100%; }
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ===== Layout ===== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  position: relative;
}

/* ── Load animations ── */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardAppear {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

header {
  text-align: center;
  margin-bottom: 28px;
  animation: fadeInDown 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.logo {
  height: 56px;
  width: auto;
  opacity: 0.92;
  filter: drop-shadow(0 0 20px rgba(88, 166, 255, 0.15));
}

/* ===== Evidence filter buttons ===== */
.evidence-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}
.evidence-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.2s, background 0.2s, color 0.2s, opacity 0.2s, transform 0.15s ease;
}
.evidence-btn:active {
  transform: scale(0.94);
}
.evidence-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}
.evidence-btn.active-include {
  border-color: var(--active-clr);
  background: var(--active-bg);
  color: var(--active-clr);
  font-weight: 600;
}
.evidence-btn.active-exclude {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}
.evidence-btn.impossible {
  opacity: 0.25;
  pointer-events: none;
  text-decoration: line-through;
}

/* Icon expand animation inside buttons */
.ev-icon {
  display: inline-flex;
  align-items: center;
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease, margin 0.2s ease;
}
.evidence-btn.active-include .ev-icon,
.evidence-btn.active-exclude .ev-icon {
  width: 17px;
  margin-right: 2px;
}
.ev-icon svg { flex-shrink: 0; }

/* ===== Controls ===== */
.controls-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.reset-btn {
  font-family: inherit;
  font-size: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.95);
  transition: opacity 0.3s ease, border-color 0.2s, color 0.2s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.reset-btn:active {
  transform: scale(0.94);
}
.reset-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.reset-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ===== Search ===== */
.search-box {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}
.search-box input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  width: 100%;
  max-width: 340px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(88, 166, 255, 0.12);
}
.search-box input::placeholder { color: var(--text-dim); }
.search-box input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.ghosts-count {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

/* ===== Ghost Cards ===== */

/* Isolate each card's paint & style — prevents cascade recalc */
.ghost-card-wrapper {
  contain: paint style;
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease;
  overflow: hidden;
  animation: cardAppear 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 0.025s);
}

.ghost-card-wrapper.filtered-out {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

/* After transition completes, fully remove from layout */
.ghost-card-wrapper.hidden {
  display: none;
}

.ghost-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  min-height: 0;
  overflow: hidden;
  transition: border-color 0.25s ease, margin-bottom 0.3s ease;
}
.ghost-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.ghost-card-wrapper.filtered-out .ghost-card {
  margin-bottom: 0;
  border-width: 0;
}

/* Card header */
.ghost-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.ghost-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.ghost-name {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ghost-name a { color: inherit; transition: color 0.15s; }
.ghost-name a:hover { color: var(--accent); text-decoration: none; }
.ghost-en {
  color: var(--text-dim);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Minimize button */
.ghost-minimize {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.ghost-minimize:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.ghost-minimize .chevron-icon {
  transition: transform 0.3s ease;
}
.ghost-card.minimized .ghost-minimize .chevron-icon {
  transform: rotate(-90deg);
}

/* Card body collapse */
.ghost-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease;
  overflow: hidden;
}
.ghost-card.minimized .ghost-body {
  grid-template-rows: 0fr;
  opacity: 0;
}
.ghost-body > .ghost-body-inner {
  overflow: hidden;
  min-height: 0;
}

/* About section */
.ghost-about {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 0 18px 14px;
}
.ghost-about strong {
  color: var(--text);
  font-weight: 600;
}

/* Traits section */
.ghost-traits {
  background: var(--bg-segment);
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ghost-trait {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  align-items: flex-start;
}
.ghost-trait:last-child { margin-bottom: 0; }
.ghost-trait-icon {
  flex-shrink: 0;
  width: 18px;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.str-text { color: #fca5a5; }
.wk-text { color: #7ee787; }
.trait-label { font-weight: 600; }

/* Evidence tags */
.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px 14px;
}
.evidence-tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: filter 0.15s;
  cursor: pointer;
}
.evidence-tag:hover {
  filter: brightness(1.3);
  text-decoration: none;
}
.evidence-tag.dots       { background: var(--dots-bg);       color: var(--dots);       border-color: #4a2a1a; }
.evidence-tag.emf        { background: var(--emf-bg);        color: var(--emf);        border-color: #4a1a3a; }
.evidence-tag.ultraviolet { background: var(--ultraviolet-bg); color: var(--ultraviolet); border-color: #3a4a1a; }
.evidence-tag.freezing   { background: var(--freezing-bg);   color: var(--freezing);   border-color: #1a2a4a; }
.evidence-tag.orbs       { background: var(--orbs-bg);       color: var(--orbs);       border-color: #0a3a40; }
.evidence-tag.writing    { background: var(--writing-bg);    color: var(--writing);    border-color: #4a3a0a; }
.evidence-tag.box        { background: var(--box-bg);        color: var(--box);        border-color: #2a1a4a; }

.guar-label {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--accent);
  margin-left: 4px;
  opacity: 0.85;
  font-style: italic;
}

/* No results */
.no-results {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}
