/* ============================================================
   SCHOLAR'S GRIMOIRE V2  |  WGC-Studios
   Shared Design System
   ============================================================ */

:root {
  --black: #09090e;
  --deep: #101018;
  --surface: #15151e;
  --surface2: #1c1c28;
  --surface3: #232333;
  --magenta: #e0147a;
  --magenta-soft: #ff4fa3;
  --magenta-dim: rgba(224,20,122,0.13);
  --blue: #4a9eff;
  --blue-dim: rgba(74,158,255,0.13);
  --emerald: #00c97a;
  --emerald-dim: rgba(0,201,122,0.11);
  --gold: #f0c040;
  --gold-dim: rgba(240,192,64,0.13);
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --text-faint: #44445a;
  --border: rgba(255,255,255,0.07);
  --border-m: rgba(224,20,122,0.28);
  --border-g: rgba(0,201,122,0.22);
  --sidebar: 300px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: 68px 1fr;
  height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  background: var(--deep);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  z-index: 50;
}
.topbar-left { display: flex; flex-direction: column; justify-content: center; }
.topbar-title {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--magenta);
  text-shadow: 0 0 22px rgba(224,20,122,0.4);
}
.topbar-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  background: var(--deep);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0 80px;
  scrollbar-width: thin;
  scrollbar-color: var(--magenta-dim) transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--magenta-dim); border-radius: 3px; }

.nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: var(--text-faint);
  text-transform: uppercase;
  padding: 14px 22px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 1rem;
  color: var(--text-dim);
  text-decoration: none;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); border-left-color: var(--magenta); }
.nav-item.active .ni { color: var(--magenta); }
.ni { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-sub {
  padding: 7px 22px 7px 57px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-faint);
  transition: all 0.2s;
  border-left: 3px solid transparent;
  text-decoration: none;
  display: block;
}
.nav-sub:hover { color: var(--text-dim); background: var(--surface); }

/* ── MAIN ────────────────────────────────────────────────── */
.main {
  overflow-y: auto;
  background: var(--black);
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

.page { padding: 32px 36px; min-height: 100%; }

/* ── SECTION HEADER ──────────────────────────────────────── */
.sec-hdr {
  margin-bottom: 26px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sec-hdr-left { flex: 1; }
.sec-title {
  font-family: 'Cinzel', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--magenta);
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.sec-sub { font-size: 0.85rem; color: var(--text-dim); font-style: italic; }
.sec-tagline {
  font-size: 0.82rem;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 5px;
  line-height: 1.5;
}
.subsec {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--emerald);
  margin: 20px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-m); }
.card-title {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.04em;
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-body { font-size: 0.9rem; color: var(--text); line-height: 1.75; }

/* Video resource cards */
.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 10px;
}
.video-card a {
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  color: var(--blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  transition: color 0.2s;
}
.video-card a:hover { color: var(--magenta-soft); }
.video-card p { font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; }
.video-section { margin-bottom: 24px; }
.video-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── FORMULA BOX ─────────────────────────────────────────── */
.fbox {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--magenta);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.83rem;
  color: var(--magenta-soft);
}

/* ── STEPS ───────────────────────────────────────────────── */
.step { display: flex; gap: 11px; margin: 8px 0; align-items: flex-start; }
.snum {
  background: var(--magenta);
  color: white;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 3px;
}
.stxt { font-size: 0.88rem; color: var(--text); line-height: 1.65; }

/* ── TAGS ────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}
.tag.hiset { background: var(--emerald-dim); color: var(--emerald); border: 1px solid var(--border-g); }
.tag.basic { background: var(--blue-dim); color: var(--blue); border: 1px solid var(--blue-dim); }
.tag.new { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold-dim); }

/* ── HIGHLIGHTS ──────────────────────────────────────────── */
.hl { color: var(--magenta-soft); font-weight: 600; }
.hlb { color: var(--blue); font-weight: 600; }
.hlg { color: var(--emerald); font-weight: 600; }
.hlo { color: var(--gold); font-weight: 600; }

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ── DIAGRAM ─────────────────────────────────────────────── */
.diagram {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 10px 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── EXAMPLE BOX ─────────────────────────────────────────── */
.example-box {
  background: var(--surface2);
  border: 1px solid var(--emerald-dim);
  border-left: 3px solid var(--emerald);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 10px 0;
}
.example-box .ex-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--emerald);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.example-box .ex-body { font-size: 0.85rem; color: var(--text-dim); line-height: 1.7; }

/* ── MATH GRID ───────────────────────────────────────────── */
.math-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }

/* ── ABBREVIATION TABLE ──────────────────────────────────── */
.abbr-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 12px 0; }
.abbr-table th, .abbr-table td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.abbr-table th { background: var(--surface3); color: var(--magenta); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; letter-spacing: 0.06em; }
.abbr-table td:first-child { font-family: 'JetBrains Mono', monospace; color: var(--blue); font-weight: 600; }
.abbr-table td:last-child { color: var(--text-dim); }

/* ── PUNCTUATION FLIP CARDS ──────────────────────────────── */
.flip-wrap { margin-bottom: 14px; }
.flip-card { cursor: pointer; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); transition: border-color 0.2s; }
.flip-card:hover { border-color: var(--border-m); }
.flip-front { background: var(--surface); padding: 18px 22px; display: block; }
.flip-back { background: var(--surface2); border-top: 1px solid var(--border-m); padding: 18px 22px; display: none; }
.flip-card.flipped .flip-back { display: block; }
.flip-hint { font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; color: var(--text-faint); margin-top: 10px; letter-spacing: 0.06em; }
.flip-back-title { font-family: 'Cinzel', serif; font-size: 0.82rem; color: var(--magenta); margin-bottom: 10px; letter-spacing: 0.04em; }

/* ── VOCABULARY FLIP CARDS (3D) ──────────────────────────── */
.vocab-grade {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--magenta);
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-m);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 8px; }
.vfc-wrap { perspective: 1000px; height: 140px; }
.vfc {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s ease;
  cursor: pointer;
}
.vfc.flipped { transform: rotateY(180deg); }
.vfc-front, .vfc-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 14px 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.vfc-front { background: var(--surface); }
.vfc-back { background: var(--surface2); transform: rotateY(180deg); border-color: var(--blue-dim); overflow-y: auto; }
.vfc-front:hover { border-color: var(--blue); }
.vw { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--blue); margin-bottom: 3px; }
.vp { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; color: var(--emerald); margin-bottom: 3px; letter-spacing: 0.04em; }
.vhint { font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; color: var(--text-faint); margin-top: 8px; }
.vdef { font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; margin-bottom: 6px; }
.vsent { font-size: 0.76rem; color: var(--text-faint); font-style: italic; line-height: 1.4; }

/* ── ESSAY CARDS ─────────────────────────────────────────── */
.essay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 12px;
}
.essay-type {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--magenta);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.essay-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  background: var(--magenta-dim);
  color: var(--magenta-soft);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-m);
}
.essay-body { font-size: 0.87rem; color: var(--text-dim); line-height: 1.7; }

/* Model essay display */
.model-essay {
  background: var(--surface);
  border: 1px solid var(--border-m);
  border-radius: 12px;
  margin-bottom: 18px;
  overflow: hidden;
}
.model-essay-hdr {
  background: var(--surface2);
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.model-essay-hdr:hover { background: var(--surface3); }
.model-essay-title { font-family: 'Cinzel', serif; font-size: 0.92rem; color: var(--magenta); }
.model-essay-body { display: none; padding: 20px 22px; }
.model-essay-body.open { display: block; }
.essay-text { font-size: 0.88rem; color: var(--text-dim); line-height: 1.85; }
.essay-text p { margin-bottom: 14px; }

/* ── TEST TIPS ───────────────────────────────────────────── */
.tip-card {
  background: var(--surface);
  border: 1px solid var(--emerald-dim);
  border-left: 4px solid var(--emerald);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.tip-title { font-family: 'Cinzel', serif; font-size: 0.9rem; color: var(--emerald); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.tip-body { font-size: 0.87rem; color: var(--text-dim); line-height: 1.7; }

/* ── SCIENCE / CHEMISTRY ACCORDION ──────────────────────── */
.sci-accordion { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sci-acc-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.2s;
}
.sci-acc-hdr:hover { background: var(--surface2); }
.sci-acc-title { font-family: 'Cinzel', serif; font-size: 0.92rem; color: var(--blue); letter-spacing: 0.04em; }
.sci-acc-arrow { color: var(--text-faint); transition: transform 0.3s; font-size: 0.8rem; }
.sci-acc-hdr.open .sci-acc-arrow { transform: rotate(90deg); }
.sci-acc-body { display: none; padding: 16px 18px; background: var(--surface2); border-top: 1px solid var(--border); }
.sci-acc-body.open { display: block; }

/* ── QUIZ BOX ────────────────────────────────────────────── */
.quiz-box {
  background: var(--surface);
  border: 1px solid var(--border-m);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 14px;
}
.quiz-pool-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.quiz-q { font-size: 0.88rem; color: var(--text); margin-bottom: 10px; font-style: italic; line-height: 1.55; }
.quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.quiz-opt {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text-dim);
  transition: all 0.2s;
  text-align: left;
}
.quiz-opt:hover { border-color: var(--blue); color: var(--text); }
.quiz-opt.correct { background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald); }
.quiz-opt.wrong { background: rgba(224,20,122,0.1); border-color: var(--magenta); color: var(--magenta-soft); }
.quiz-opt:disabled { pointer-events: none; }
.quiz-feedback { font-size: 0.82rem; margin-top: 8px; padding: 8px 12px; border-radius: 6px; display: none; line-height: 1.5; }
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: var(--emerald-dim); color: var(--emerald); }
.quiz-feedback.wrong-fb { background: rgba(224,20,122,0.1); color: var(--magenta-soft); }
.quiz-next-btn {
  margin-top: 10px;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  display: none;
}
.quiz-next-btn.show { display: inline-block; }
.quiz-next-btn:hover { border-color: var(--emerald); color: var(--emerald); }
.quiz-score-line { font-size: 0.78rem; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; margin-bottom: 8px; }

/* ── DOCUMENT CARDS (Social Studies / Poli Sci) ──────────── */
.doc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.doc-hdr { padding: 14px 18px; background: var(--surface2); border-bottom: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.doc-hdr-title { font-family: 'Cinzel', serif; font-size: 0.92rem; color: var(--magenta); letter-spacing: 0.04em; }
.doc-body { display: none; padding: 18px; font-size: 0.86rem; color: var(--text-dim); line-height: 1.75; max-height: 500px; overflow-y: auto; }
.doc-body.open { display: block; }
.doc-section-title { font-family: 'Cinzel', serif; font-size: 0.82rem; color: var(--blue); margin: 14px 0 6px; letter-spacing: 0.04em; }
.doc-text { font-size: 0.85rem; color: var(--text-dim); line-height: 1.75; margin-bottom: 8px; }
.doc-quote { background: var(--surface2); border-left: 3px solid var(--magenta); padding: 10px 16px; margin: 12px 0; font-style: italic; font-size: 0.85rem; color: var(--text); line-height: 1.75; border-radius: 0 8px 8px 0; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--magenta-dim);
  border: 1px solid var(--border-m);
  color: var(--magenta-soft);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  margin-bottom: 14px;
}
.link-btn:hover { background: var(--magenta); color: white; }

/* ── GEOGRAPHY MAPS ──────────────────────────────────────── */
.map-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.map-tab {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-dim);
  transition: all 0.2s;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}
.map-tab:hover { border-color: var(--blue); color: var(--blue); }
.map-tab.active { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.map-frame { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.map-frame iframe { width: 100%; height: 100%; border: none; }

/* ── LIBRARY ─────────────────────────────────────────────── */
.lib-sec { margin-bottom: 28px; }
.lib-sec-title { font-family: 'Cinzel', serif; font-size: 0.95rem; color: var(--emerald); letter-spacing: 0.06em; margin-bottom: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--emerald-dim); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 9px; }
.book-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 13px; cursor: pointer; transition: all 0.2s; text-decoration: none; display: block; }
.book-card:hover { border-color: var(--emerald); background: var(--surface2); transform: translateY(-2px); box-shadow: 0 6px 18px var(--emerald-dim); }
.be { font-size: 1.3rem; margin-bottom: 5px; }
.bt { font-size: 0.8rem; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
.ba { font-size: 0.7rem; color: var(--text-faint); font-style: italic; }
.lib-footer { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-top: 22px; display: flex; align-items: flex-start; gap: 12px; }
.lib-links { display: flex; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.lib-link { font-size: 0.76rem; color: var(--blue); text-decoration: none; border: 1px solid var(--blue-dim); padding: 3px 9px; border-radius: 20px; transition: all 0.2s; }
.lib-link:hover { background: var(--blue-dim); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s;
  margin-right: 7px;
  margin-top: 7px;
  font-family: 'Crimson Pro', serif;
}
.btn:hover { border-color: var(--magenta); color: var(--magenta); }
.btn.primary { background: var(--magenta); color: white; border-color: var(--magenta); }
.btn.primary:hover { background: var(--magenta-soft); }
.btn.emerald { background: var(--emerald-dim); color: var(--emerald); border-color: var(--border-g); }
.btn.emerald:hover { background: var(--emerald); color: white; }
.btn.gold { background: var(--gold-dim); color: var(--gold); border-color: var(--gold-dim); }
.btn.gold:hover { background: var(--gold); color: var(--black); }

/* ── GAMES ───────────────────────────────────────────────── */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; margin-bottom: 22px; }
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
}
.game-card:hover { border-color: var(--magenta); transform: translateY(-3px); box-shadow: 0 10px 28px var(--magenta-dim); }
.gi { font-size: 2.3rem; margin-bottom: 9px; }
.gt { font-family: 'Cinzel', serif; font-size: 0.92rem; color: var(--magenta); margin-bottom: 5px; }
.gd { font-size: 0.79rem; color: var(--text-dim); }
.game-back { background: none; border: 1px solid var(--border); color: var(--text-dim); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 0.82rem; margin-bottom: 18px; transition: all 0.2s; }
.game-back:hover { border-color: var(--magenta); color: var(--magenta); }

/* Crossword */
.cw-grid-wrap { display: inline-grid; gap: 2px; margin: 14px 0; }
.cw-cell { width: 42px; height: 42px; background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; position: relative; }
.cw-cell.black { background: var(--black); border-color: var(--black); }
.cw-cell input { width: 100%; height: 100%; background: none; border: none; text-align: center; color: var(--text); font-size: 1rem; font-weight: 700; text-transform: uppercase; outline: none; cursor: pointer; }
.cw-cell input:focus { background: var(--magenta-dim); }
.cw-cell input.correct { color: var(--emerald); }
.cw-cell input.wrong { color: var(--magenta-soft); }
.cw-num { position: absolute; top: 2px; left: 3px; font-size: 0.55rem; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; pointer-events: none; }
.clues-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 14px; }
.clue-head { font-family: 'Cinzel', serif; font-size: 0.85rem; color: var(--magenta); margin-bottom: 9px; letter-spacing: 0.05em; }
.clue { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 7px; line-height: 1.45; }
.clue span { color: var(--blue); font-family: 'JetBrains Mono', monospace; }

/* Word Search */
.ws-grid-wrap { display: inline-grid; gap: 1px; margin: 14px 0; background: var(--surface2); border-radius: 8px; padding: 8px; }
.ws-cell { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--text-dim); cursor: pointer; border-radius: 3px; transition: all 0.15s; user-select: none; }
.ws-cell:hover { background: var(--surface3); color: var(--text); }
.ws-cell.selected { background: var(--blue-dim); color: var(--blue); }
.ws-cell.found { background: var(--emerald-dim); color: var(--emerald); font-weight: 700; }
.ws-words-wrap { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; max-height: 160px; overflow-y: auto; padding: 4px; }
.ws-word { font-size: 0.78rem; padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em; }
.ws-word.found { background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald); text-decoration: line-through; }

/* Sudoku */
.sdk-grid { display: inline-grid; grid-template-columns: repeat(9, 1fr); gap: 1px; background: var(--text-faint); border: 2px solid var(--magenta); border-radius: 8px; overflow: hidden; margin: 14px 0; }
.sdk-cell { width: 44px; height: 44px; background: var(--surface2); display: flex; align-items: center; justify-content: center; }
.sdk-cell input { width: 100%; height: 100%; background: none; border: none; text-align: center; color: var(--text); font-size: 1.05rem; font-weight: 600; outline: none; cursor: pointer; }
.sdk-cell.given input { color: var(--magenta); pointer-events: none; }
.sdk-cell input:focus { background: var(--blue-dim); }
.sdk-cell.br { border-right: 2px solid rgba(255,255,255,0.2); }
.sdk-cell.bb { border-bottom: 2px solid rgba(255,255,255,0.2); }

/* Match Game */
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: all 0.2s;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.match-card:hover { border-color: var(--blue); color: var(--text); }
.match-card.selected { background: var(--magenta-dim); border-color: var(--magenta); color: var(--magenta-soft); }
.match-card.matched { background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald); pointer-events: none; }
.match-card.wrong { background: rgba(224,20,122,0.1); border-color: var(--magenta); animation: shake 0.3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* ── PERCIA PANEL ────────────────────────────────────────── */
.percia-panel {
  position: fixed;
  top: 68px;
  right: 0;
  width: 380px;
  height: calc(100vh - 68px);
  background: var(--deep);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}
.percia-panel.open { transform: translateX(0); }

.percia-panel-hdr {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.percia-panel-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--magenta);
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.percia-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--magenta-dim);
  border: 1px solid var(--border-m);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--magenta-soft);
  flex-shrink: 0;
}
.percia-panel-context {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.percia-close-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-faint);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}
.percia-close-btn:hover { border-color: var(--magenta); color: var(--magenta); }

.percia-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.percia-msgs::-webkit-scrollbar { width: 3px; }

.pmsg { display: flex; gap: 8px; max-width: 92%; }
.pmsg.user { align-self: flex-end; flex-direction: row-reverse; }
.pmsg-bubble { padding: 9px 13px; border-radius: 12px; font-size: 0.85rem; line-height: 1.6; }
.pmsg.user .pmsg-bubble { background: var(--magenta); color: white; border-bottom-right-radius: 3px; }
.pmsg.ai .pmsg-bubble { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.pmsg-av { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; flex-shrink: 0; margin-top: 2px; }
.pmsg.ai .pmsg-av { background: var(--surface3); color: var(--emerald); }
.pmsg.user .pmsg-av { background: var(--magenta-dim); color: var(--magenta); }

.percia-typing { display: flex; gap: 4px; align-items: center; padding: 6px 0; }
.percia-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: typing 1.2s infinite; }
.percia-typing span:nth-child(2) { animation-delay: 0.2s; }
.percia-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0);background:var(--text-faint)} 30%{transform:translateY(-6px);background:var(--magenta-soft)} }

.percia-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.percia-input-row { display: flex; gap: 8px; }
.percia-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  height: 40px;
  transition: border-color 0.2s;
}
.percia-input:focus { border-color: var(--magenta); }
.percia-input::placeholder { color: var(--text-faint); }
.percia-mic-btn, .percia-send-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  color: var(--text-dim);
  flex-shrink: 0;
}
.percia-mic-btn:hover { border-color: var(--blue); color: var(--blue); }
.percia-mic-btn.listening { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); animation: pulse 1s infinite; }
.percia-send-btn { background: var(--magenta); border-color: var(--magenta); color: white; }
.percia-send-btn:hover { background: var(--magenta-soft); }
.percia-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(74,158,255,0.3)} 50%{box-shadow:0 0 0 8px rgba(74,158,255,0)} }

.percia-voice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}
.percia-voice-toggle {
  width: 28px;
  height: 16px;
  background: var(--surface3);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
.percia-voice-toggle.on { background: var(--emerald); }
.percia-voice-toggle::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}
.percia-voice-toggle.on::after { left: 14px; }

/* Floating Percia button in sections */
.percia-section-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--magenta-dim);
  border: 1px solid var(--border-m);
  color: var(--magenta-soft);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  transition: all 0.2s;
  margin-left: auto;
}
.percia-section-btn:hover { background: var(--magenta); color: white; }

/* Percia overlay backdrop */
.percia-backdrop {
  position: fixed;
  inset: 0;
  top: 68px;
  background: rgba(0,0,0,0.35);
  z-index: 199;
  display: none;
}
.percia-backdrop.show { display: block; }

/* ── TRIALS OF HERA ──────────────────────────────────────── */
.trials-hero {
  background: linear-gradient(135deg, var(--surface2) 0%, #1a1220 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.trials-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(240,192,64,0.05) 0%, transparent 70%);
  pointer-events: none;
}
.trials-glyph { font-size: 2.5rem; margin-bottom: 12px; filter: drop-shadow(0 0 16px rgba(240,192,64,0.5)); }
.trials-title { font-family: 'Cinzel', serif; font-size: 1.8rem; font-weight: 700; color: var(--gold); letter-spacing: 0.08em; margin-bottom: 6px; text-shadow: 0 0 28px rgba(240,192,64,0.4); }
.trials-sub { font-size: 0.88rem; color: var(--text-faint); font-style: italic; }

.trials-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 28px; }
.trials-subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.25s;
}
.trials-subject-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 8px 24px var(--gold-dim); }
.tscard-icon { font-size: 1.8rem; margin-bottom: 8px; }
.tscard-title { font-family: 'Cinzel', serif; font-size: 0.88rem; color: var(--gold); margin-bottom: 4px; }
.tscard-desc { font-size: 0.78rem; color: var(--text-dim); }

/* Practice mode */
.practice-arena { display: none; }
.practice-arena.active { display: block; }
.practice-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.practice-progress-bar { flex: 1; height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.practice-progress-fill { height: 100%; background: var(--emerald); border-radius: 3px; transition: width 0.4s; }
.practice-counter { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }

.practice-q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 14px;
}
.practice-q-text { font-size: 0.96rem; color: var(--text); line-height: 1.65; margin-bottom: 16px; }
.practice-opts { display: flex; flex-direction: column; gap: 8px; }
.practice-opt {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 0.87rem;
  color: var(--text-dim);
  text-align: left;
  transition: all 0.2s;
}
.practice-opt:hover { border-color: var(--gold); color: var(--text); }
.practice-opt.correct { background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald); pointer-events: none; }
.practice-opt.wrong { background: rgba(224,20,122,0.1); border-color: var(--magenta); color: var(--magenta-soft); pointer-events: none; }
.practice-explanation {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface2);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.6;
  display: none;
}
.practice-explanation.show { display: block; }

/* Timed mode */
.timed-arena { display: none; }
.timed-arena.active { display: block; }

.peacock-timer-wrap {
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.peacock-timer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}
.peacock-time-display { font-size: 1.1rem; color: var(--gold); font-weight: 700; }
.peacock-feather-bar { position: relative; height: 22px; background: var(--surface2); border-radius: 11px; overflow: hidden; border: 1px solid var(--gold-dim); }
.peacock-feather-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #c8a020 100%);
  border-radius: 11px;
  transition: width 1s linear;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
}
.peacock-feather-fill.warning { background: linear-gradient(90deg, #e07020 0%, #c05010 100%); }
.peacock-feather-fill.critical { background: linear-gradient(90deg, var(--magenta) 0%, var(--magenta-soft) 100%); }
.peacock-eye { font-size: 0.9rem; }
.peacock-q-count { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--text-faint); }

.timed-q-card {
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 14px;
}
.timed-q-text { font-size: 0.96rem; color: var(--text); line-height: 1.65; margin-bottom: 16px; }
.timed-opts { display: flex; flex-direction: column; gap: 8px; }
.timed-opt {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 0.87rem;
  color: var(--text-dim);
  text-align: left;
  transition: all 0.2s;
}
.timed-opt:hover { border-color: var(--gold); color: var(--text); }
.timed-opt.selected { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* Victory screen */
.trials-result { text-align: center; padding: 40px 24px; }
.trials-result-icon { font-size: 4rem; margin-bottom: 16px; }
.trials-result-title { font-family: 'Cinzel', serif; font-size: 1.6rem; color: var(--gold); letter-spacing: 0.08em; margin-bottom: 10px; }
.trials-result-score { font-size: 2.5rem; color: var(--emerald); font-family: 'JetBrains Mono', monospace; margin: 12px 0; }
.trials-result-msg { font-size: 0.92rem; color: var(--text-dim); line-height: 1.7; max-width: 480px; margin: 0 auto 24px; }

/* ── MYTHOLOGY SECTION (special treatment) ───────────────── */
.myth-section { background: linear-gradient(135deg, var(--surface) 0%, #1a1628 100%); }
.myth-card {
  background: linear-gradient(135deg, var(--surface2) 0%, #1a1628 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.myth-card:hover { border-color: var(--gold); }
.myth-card-title { font-family: 'Cinzel', serif; font-size: 0.95rem; color: var(--gold); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.myth-card-body { font-size: 0.88rem; color: var(--text-dim); line-height: 1.75; }

/* ── WELCOME PAGE ────────────────────────────────────────── */
.welcome-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 68px); text-align: center; padding: 40px 24px; }
.welcome-glyph { font-size: 3.5rem; margin-bottom: 20px; filter: drop-shadow(0 0 18px rgba(224,20,122,0.5)); animation: pglow 3s ease-in-out infinite; }
@keyframes pglow { 0%,100%{filter:drop-shadow(0 0 18px rgba(224,20,122,0.5))} 50%{filter:drop-shadow(0 0 32px rgba(224,20,122,0.85))} }
.welcome-title { font-family: 'Cinzel', serif; font-size: 2rem; font-weight: 700; color: var(--magenta); letter-spacing: 0.05em; margin-bottom: 4px; text-shadow: 0 0 28px rgba(224,20,122,0.35); }
.welcome-sub { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-faint); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 10px; }
.welcome-greeting { font-size: 1.05rem; color: var(--text-dim); font-style: italic; margin-bottom: 28px; }
.welcome-greeting span { color: var(--emerald); font-style: normal; font-weight: 600; }
.wcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 780px; width: 100%; margin-top: 12px; }
.wcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; cursor: pointer; transition: all 0.25s; text-align: left; text-decoration: none; display: block; }
.wcard:hover { border-color: var(--magenta); background: var(--surface2); transform: translateY(-2px); box-shadow: 0 8px 22px var(--magenta-dim); }
.wc-icon { font-size: 1.5rem; margin-bottom: 8px; }
.wc-title { font-family: 'Cinzel', serif; font-size: 0.78rem; color: var(--magenta); letter-spacing: 0.05em; margin-bottom: 3px; }
.wc-desc { font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; }

/* ── CHAT (percia.html full page) ────────────────────────── */
.chat-page-wrap { display: flex; flex-direction: column; height: calc(100vh - 68px - 64px); max-width: 760px; margin: 0 auto; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 0; display: flex; flex-direction: column; gap: 12px; }
.chat-msgs::-webkit-scrollbar { width: 3px; }
.msg { display: flex; gap: 9px; max-width: 85%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: 0.87rem; line-height: 1.6; }
.msg.user .msg-bubble { background: var(--magenta); color: white; border-bottom-right-radius: 4px; }
.msg.ai .msg-bubble { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-av { width: 27px; height: 27px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; flex-shrink: 0; margin-top: 2px; }
.msg.ai .msg-av { background: var(--surface3); color: var(--emerald); }
.msg.user .msg-av { background: var(--magenta-dim); color: var(--magenta); }
.chat-row { display: flex; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; color: var(--text); font-family: 'Crimson Pro', serif; font-size: 0.92rem; outline: none; transition: border-color 0.2s; resize: none; height: 44px; }
.chat-input:focus { border-color: var(--magenta); }
.chat-input::placeholder { color: var(--text-faint); }
.chat-send { background: var(--magenta); color: white; border: none; border-radius: 10px; padding: 10px 17px; cursor: pointer; font-size: 1rem; transition: all 0.2s; flex-shrink: 0; }
.chat-send:hover { background: var(--magenta-soft); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-mic { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; cursor: pointer; font-size: 1rem; transition: all 0.2s; color: var(--text-dim); flex-shrink: 0; }
.chat-mic:hover { border-color: var(--blue); color: var(--blue); }
.chat-mic.listening { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); animation: pulse 1s infinite; }
.context-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ctx-btn { font-size: 0.75rem; padding: 5px 12px; border: 1px solid var(--border); border-radius: 20px; cursor: pointer; color: var(--text-faint); background: var(--surface); transition: all 0.2s; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em; }
.ctx-btn:hover { border-color: var(--magenta); color: var(--magenta); }
.ctx-btn.active { background: var(--magenta-dim); border-color: var(--magenta); color: var(--magenta-soft); }

/* ── SPOTIFY / MUSIC PLAYER ──────────────────────────────── */
.spotify-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 14px; }
.spotify-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.spotify-title { font-family: 'Cinzel', serif; font-size: 0.9rem; color: var(--emerald); letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px; }
.spotify-embed-frame { width: 100%; border: none; display: block; border-radius: 0; }
.spotify-connect-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.spotify-connect-text { font-size: 0.8rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.spotify-connect-btn { display: flex; align-items: center; gap: 7px; background: #1DB954; color: #000; border: none; border-radius: 20px; padding: 7px 16px; cursor: pointer; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; transition: opacity 0.2s; white-space: nowrap; }
.spotify-connect-btn:hover { opacity: 0.85; }
.spotify-connect-btn svg { width: 14px; height: 14px; }
.spotify-connected-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
.spotify-avatar { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; }
.spotify-username { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--emerald); flex: 1; }
.spotify-disconnect-btn { background: none; border: 1px solid var(--border); color: var(--text-faint); border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 0.68rem; font-family: 'JetBrains Mono', monospace; transition: border-color 0.2s; }
.spotify-disconnect-btn:hover { border-color: var(--magenta); color: var(--magenta); }
.spotify-section { padding: 12px 16px; border-top: 1px solid var(--border); }
.spotify-section-label { font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; color: var(--text-faint); letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 8px; }
.spotify-playlist-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.spotify-playlist-list::-webkit-scrollbar { width: 3px; }
.spotify-playlist-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.spotify-playlist-item:hover { background: var(--surface3); }
.spotify-playlist-img { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; flex-shrink: 0; background: var(--surface3); }
.spotify-playlist-name { font-size: 0.82rem; color: var(--text); line-height: 1.3; }
.spotify-playlist-count { font-size: 0.68rem; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }
.spotify-search-row { display: flex; gap: 6px; }
.spotify-search-input { flex: 1; background: var(--surface3); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; color: var(--text); font-size: 0.82rem; outline: none; transition: border-color 0.2s; }
.spotify-search-input:focus { border-color: var(--emerald); }
.spotify-search-input::placeholder { color: var(--text-faint); }
.spotify-search-btn { background: var(--emerald-dim); border: 1px solid var(--emerald); color: var(--emerald); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 0.8rem; transition: opacity 0.2s; white-space: nowrap; }
.spotify-search-btn:hover { opacity: 0.8; }
.spotify-results { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.spotify-result-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; transition: background 0.15s; }
.spotify-result-item:hover { background: var(--surface3); }
.spotify-result-img { width: 30px; height: 30px; border-radius: 3px; object-fit: cover; background: var(--surface3); flex-shrink: 0; }
.spotify-result-name { font-size: 0.8rem; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotify-mood-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.spotify-mood-chip { background: var(--surface3); border: 1px solid var(--border); color: var(--text-dim); border-radius: 14px; padding: 4px 12px; cursor: pointer; font-size: 0.74rem; font-family: 'JetBrains Mono', monospace; transition: all 0.15s; }
.spotify-mood-chip:hover { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-dim); }
.spotify-loading { font-size: 0.75rem; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; padding: 8px 0; }
.el-badge { display: inline-flex; align-items: center; gap: 5px; font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; color: var(--blue); border: 1px solid var(--blue-dim); border-radius: 10px; padding: 2px 8px; }

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 28px 20px 20px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.footer-logo { height: 32px; opacity: 0.75; }
.footer-name { font-family: 'Cinzel', serif; font-size: 0.85rem; color: var(--text-faint); letter-spacing: 0.1em; }
.footer-copy { font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; color: var(--text-faint); letter-spacing: 0.08em; }

/* ── GOOGLE AUTH ─────────────────────────────────────────── */
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  margin-left: auto;
}
.auth-btn:hover { border-color: var(--blue); color: var(--blue); }
.auth-user { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; margin-left: auto; }
.auth-avatar { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); }

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn 0.3s ease forwards; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar: 260px; }
  .wcards { grid-template-columns: repeat(2, 1fr); }
  .math-grid { grid-template-columns: 1fr; }
  .percia-panel { width: 320px; }
}
@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .wcards { grid-template-columns: 1fr; }
  .page { padding: 20px 16px; }
  .percia-panel { width: 100%; }
}
