/* =========================
   Lexikon — WORKING styles.css
   (matches your HTML exactly)
   Fixes:
   - translation disappearing
   - text not wrapping
   - keeps glass UI + highlights + POS colors
   ========================= */

:root{
  --font-ui: "Avenir Next", "Helvetica Neue", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-text: "Iowan Old Style", "Palatino", "Book Antiqua", "Georgia", serif;

  --bg0:#05070c;
  --bg1:#0b1020;

  --panel: rgba(14, 18, 30, .66);
  --panel2: rgba(14, 18, 30, .84);
  --ink: #e7e9f3;
  --muted: rgba(255,255,255,.58);
  --muted2: rgba(255,255,255,.40);
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.18);

  /* Shared tokens for modals/buttons */
  --bg: rgba(12, 16, 26, 0.94);
  --bg-soft: rgba(255,255,255,0.05);
  --fg: var(--ink);
  --text: var(--ink);
  --border: rgba(255,255,255,0.12);
  --accent: #8bd0ff;
  --accent-2: #a3ffce;
  --accent-glow: rgba(139,208,255,0.3);
  --card: var(--panel2);

  --hiA: rgba(181,255,207,.22);
  --hiB: rgba(181,255,207,.06);

  --shadow: 0 18px 40px rgba(0,0,0,.46);
  --inner: inset 0 1px 0 rgba(255,255,255,.06);
}

body[data-theme="light"]{
  --bg0: #f7f5ef;
  --bg1: #fbf9f3;
  --panel: rgba(255,255,255,.86);
  --panel2: rgba(255,255,255,.92);
  --ink: #1f2430;
  --muted: rgba(20,24,32,.62);
  --muted2: rgba(20,24,32,.42);
  --line: rgba(20,24,32,.12);
  --line-strong: rgba(20,24,32,.18);
  --bg: rgba(255,255,255,.94);
  --bg-soft: rgba(0,0,0,0.04);
  --border: rgba(20,24,32,.16);
  --accent: #3b6cff;
  --accent-2: #2bb07f;
  --accent-glow: rgba(59,108,255,.22);
  --hiA: rgba(59,108,255,.16);
  --hiB: rgba(59,108,255,.05);
  --shadow: 0 16px 34px rgba(26,34,52,.16);
  --inner: inset 0 1px 0 rgba(255,255,255,.65);
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }

body{
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1000px 600px at 20% 0%, rgba(90,140,255,.22), transparent 60%),
    radial-gradient(1000px 600px at 85% 8%, rgba(0,255,200,.12), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0)),
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.02) 0px,
      rgba(255,255,255,0.02) 1px,
      transparent 1px,
      transparent 6px
    );
}

body[data-theme="light"]{
  background:
    radial-gradient(900px 600px at 12% 0%, rgba(59,108,255,.14), transparent 60%),
    radial-gradient(900px 600px at 85% 6%, rgba(43,176,127,.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0)),
    repeating-linear-gradient(
      135deg,
      rgba(0,0,0,0.02) 0px,
      rgba(0,0,0,0.02) 1px,
      transparent 1px,
      transparent 6px
    );
}

/* =========================
   Topbar
   ========================= */

.topbar{
  position: sticky;
  top: 0;
  z-index: 70;
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  gap: 12px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(14,18,30,.78), rgba(8,10,16,.55));
  backdrop-filter: blur(14px);
  flex-wrap: wrap;
}

.menu-btn{
  display: inline-flex;
}

.menu-panel{
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 18px 26px;
  background: linear-gradient(180deg, rgba(14,18,30,.96), rgba(10,14,24,.98));
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 36px rgba(0,0,0,.35);
  transform: translateX(-100%);
  transition: transform 220ms ease;
  z-index: 80;
  pointer-events: auto;
  overflow-y: auto;
}

.menu-panel.open{
  transform: translateX(0);
}

body[data-theme="light"] .menu-panel{
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,245,240,.98));
  border-right: 1px solid rgba(0,0,0,0.08);
  box-shadow: 18px 0 36px rgba(26,34,52,.18);
}

.menu-panel .nav-btn,
.menu-panel .nav-link{
  width: 100%;
  justify-content: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  min-height: 44px;
  font-size: 0.95rem;
}

.menu-panel .switch{
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  min-height: 44px;
  width: 100%;
}

body[data-theme="light"] .menu-panel .switch{
  background: rgba(0,0,0,0.03);
}

.menu-section{
  display: grid;
  gap: 8px;
  padding: 10px 6px 2px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

body[data-theme="light"] .menu-section{
  border-top: 1px solid rgba(0,0,0,0.08);
}

.menu-title{
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted2);
  margin: 4px 6px 2px;
}

.menu-recent-list{
  display: grid;
  gap: 8px;
}

.menu-recent-item{
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.menu-recent-item:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
}

body[data-theme="light"] .menu-recent-item{
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.08);
}

.menu-recent-item .menu-recent-title{
  font-weight: 600;
  font-size: 0.92rem;
}

.menu-recent-item .menu-recent-meta{
  font-size: 0.78rem;
  color: var(--muted2);
}

.menu-brand{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 6px;
}

.menu-brand .logo{
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.menu-brand .brand-title{
  font-weight: 700;
}

.menu-close{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  align-self: flex-end;
}

.menu-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 60;
}

.menu-backdrop.open{
  opacity: 1;
  pointer-events: auto;
}

body[data-theme="light"] .topbar{
  background:
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(250,250,248,.72));
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 250px;
}

.logo{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  font-weight: 750;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}

.brand-title{ font-weight: 680; letter-spacing:.01em; }
.brand-sub{ font-size:.82rem; color: var(--muted2); margin-top:2px; }

.topbar-group{
  display:flex;
  align-items:flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.controls-group{
  display:flex;
  align-items:flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.toggles-group{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
}

.links-group{
  display:flex;
  gap: 10px;
  align-items:center;
}

.select-wrap{
  display:flex;
  flex-direction:column;
  gap: 6px;
}

.label{
  font-size:.78rem;
  color: var(--muted2);
}

select{
  min-width: 190px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  outline: none;
}

select:focus{
  border-color: rgba(139,208,255,.38);
  box-shadow: 0 0 0 3px rgba(139,208,255,.12);
}

.toggle{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size:.86rem;
  color: var(--muted);
  user-select:none;
}

.toggle input{
  width: 16px;
  height: 16px;
  accent-color: rgba(139,208,255,.90);
}

/* =========================
   Layout
   ========================= */

.layout{
  max-width: 1200px;
  margin: 22px auto 0;
  padding: 0 18px 18px;
  display:grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 18px;
}

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  select{ min-width: 160px; }
}

@media (max-width: 720px){
  .topbar{
    align-items: stretch;
    gap: 8px;
    padding: 12px 12px 10px;
  }

  .topbar-group{
    width: 100%;
    justify-content: space-between;
  }

  .controls-group{
    width: 100%;
    gap: 10px;
  }

  .controls-group .select-wrap{
    flex: 1 1 100%;
    min-width: 0;
  }

  .controls-group select{
    width: 100%;
  }

  .toggles-group{
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  #annotationSearch{
    width: 100%;
  }

  .layout{
    margin-top: 12px;
    padding: 0 12px 16px;
  }

  .columns{
    padding: 10px 12px 8px;
    gap: 12px;
  }

  .card-head{
    padding: 12px;
  }

  .hint{
    padding: 8px 12px 12px;
  }

  .compare-actions{
    padding: 0 12px 12px;
  }

  .layout-resizer{
    display: none;
  }

  .ai-panel{
    margin: 12px 0 0;
  }

  .ai-head{
    flex-wrap: wrap;
    gap: 8px;
  }

  .ai-btn{
    flex: 1 1 140px;
  }
}

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

.card{
  background:
    linear-gradient(180deg, rgba(20,26,40,.72), rgba(10,14,24,.86));
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  box-shadow: var(--shadow), var(--inner);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

body[data-theme="light"] .card{
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,248,244,.92));
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 12px 28px rgba(26,34,52,.12), var(--inner);
}

.reader,
.inspector {
  resize: vertical;
  overflow: auto;
  min-height: 320px;
}

.card-head{
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent);
}

body[data-theme="light"] .card-head{
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: linear-gradient(180deg, rgba(0,0,0,.03), transparent);
}

.card-body{
  padding: 14px 16px 16px;
}

#title{
  margin:0;
  font-size: 1.18rem;
  letter-spacing: .01em;
}

.meta{
  margin-top: 6px;
  font-size: .86rem;
  color: var(--muted2);
}

/* =========================
   Reader columns
   ========================= */

.columns{
  display:grid;
  grid-template-columns: 1.1fr 0.9fr; /* Greek slightly wider */
  gap: 16px;
  padding: 14px 16px 10px;
}

@media (max-width: 980px){
  .columns{ grid-template-columns: 1fr; }
}

.col h3{
  margin: 0 0 10px;
  font-size: .95rem;
  color: rgba(255,255,255,.82);
  letter-spacing: .01em;
}

/* IMPORTANT: wrapping lives on containers */
.text{
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(8, 11, 18, .58);

  white-space: normal;        /* ✅ wrap */
  overflow-wrap: anywhere;    /* ✅ never overflow off-screen */
  word-break: normal;
}

body[data-theme="light"] .text{
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.86);
}

/* Greek typography */
#original{
  font-family: var(--font-text);
  font-size: 1.05rem;
  line-height: 1.75;
  letter-spacing: .01em;
}

/* Translation MUST be visible */
#translation{
  font-family: var(--font-text);
  display:block;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: .96rem;
  line-height: 1.7;
  color: rgba(235,238,248,.95);
}

body[data-theme="light"] #translation{
  color: rgba(20,24,32,.88);
}

/* Hint */
.hint{
  padding: 10px 16px 14px;
  color: var(--muted2);
  font-size: .84rem;
}

/* =========================
   Tokens + Sentences
   ========================= */

/* Do NOT set nowrap here — it kills wrapping */
.word{
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 5px;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
  color: var(--ink);
}

.word:hover{
  background: rgba(255,255,255,.14);
  box-shadow: 0 0 0 1px rgba(255,255,255,.06);
}

.word.active{
  background: rgba(255,255,255,.28);
  color: #fff !important;
}

body[data-theme="light"] .word:hover{
  background: rgba(0,0,0,.06);
  box-shadow: 0 0 0 1px rgba(0,0,0,.04);
}

body[data-theme="light"] .word.active{
  background: rgba(0,0,0,.14);
  color: #111 !important;
}

/* Sentence wrapper must remain inline so text flows naturally */
.sentence{
  display: inline;
  border-radius: 8px;
}

/* Highlight — subtle, directional */
#original .sentence.active-sentence{
  background: linear-gradient(to right, var(--hiA), var(--hiB));
  box-shadow: inset 3px 0 0 rgba(181,255,207,.65);
}

#translation .sentence.active-sentence{
  background: rgba(181,255,207,.14);
  border-radius: 6px;
  padding: 1px 2px;
}

/* =========================
   POS colors (Greek only)
   ========================= */

#original .word.pos-noun{ color: #8bd0ff; }
#original .word.pos-verb{ color: #ff8b8b; }
#original .word.pos-adj{ color: #9cffc7; }
#original .word.pos-particle{ color: #a6e6ff; }
#original .word.pos-pron{ color: #ffcc80; }

body[data-theme="light"] #original .word.pos-noun{ color: #1f5fa5; }
body[data-theme="light"] #original .word.pos-verb{ color: #b63b3b; }
body[data-theme="light"] #original .word.pos-adj{ color: #1c7a56; }
body[data-theme="light"] #original .word.pos-particle{ color: #2a6f92; }
body[data-theme="light"] #original .word.pos-pron{ color: #a55e18; }

/* keep active readable over POS */
#original .word.active{
  color:#fff !important;
}

/* =========================
   Inspector
   ========================= */

.inspector-body{
  padding: 16px;
  font-size: .95rem;
  line-height: 1.65;
}

.inspector-body strong{
  font-size: 1.18rem;
  letter-spacing: .01em;
}
.inspector-body em{ color: var(--muted); font-style: normal; }

.nav-buttons{
  display:flex;
  gap: 10px;
}

.inspector-toggles{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.nav-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: var(--ink);
  cursor:pointer;
  min-height: 40px;
  text-decoration: none;
  transition: background .12s ease, transform .06s ease, box-shadow .12s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

body[data-theme="light"] .nav-btn{
  background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,.01));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.nav-btn:hover{
  background: rgba(139,208,255,.16);
  box-shadow: 0 0 0 3px rgba(139,208,255,.10), inset 0 1px 0 rgba(255,255,255,.08);
}

.nav-btn:active{ transform: translateY(1px); }

.nav-btn:disabled{
  opacity: .45;
  cursor:not-allowed;
}

.nav-btn.subtle{
  background: rgba(255,255,255,.05);
}

.icon-btn{
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.icon-btn.active{
  border-color: rgba(139,208,255,0.5);
  box-shadow: 0 0 0 3px rgba(139,208,255,0.14);
}

.nav-link{
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.05);
  color: var(--ink);
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}

body[data-theme="light"] .nav-link{
  background: rgba(0,0,0,.02);
}

.nav-link.subtle-link{
  background: transparent;
}

.nav-link:hover{
  background: rgba(139,208,255,.14);
  border-color: rgba(139,208,255,.38);
}

.nav-link:active{
  transform: translateY(1px);
}

/* =========================
   Footer
   ========================= */

.footer{
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 18px 22px;
  text-align:center;
  color: rgba(255,255,255,.35);
  font-size: .78rem;
}

.speaker-Socrates { border-left: 4px solid #8bd0ff; }
.speaker-Diotima { border-left: 4px solid #ffb4e6; }
.speaker-Alcibiades { border-left: 4px solid #ff8b8b; }


/* ------------------------------
   AI PANEL (Inspector)
-------------------------------- */

.ai-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;

  /* glass look */
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .ai-panel{
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow:
    0 10px 30px rgba(26,34,52,0.12),
    inset 0 1px 0 rgba(255,255,255,.65);
}

.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-title {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
  user-select: none;
}

.ai-credits {
  margin: 2px 0 10px;
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-credits-ring {
  --pct: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    conic-gradient(
      rgba(255, 255, 255, 0.9) var(--pct),
      rgba(255, 255, 255, 0.18) 0
    );
  position: relative;
  opacity: 0.9;
}

.ai-credits-ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
}

body[data-theme="light"] .ai-credits-ring {
  background:
    conic-gradient(
      rgba(0, 0, 0, 0.85) var(--pct),
      rgba(0, 0, 0, 0.16) 0
    );
}

body[data-theme="light"] .ai-credits-ring::after {
  background: rgba(255, 255, 255, 0.9);
}

.ai-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
  white-space: nowrap;
}

.ai-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.ai-btn:active {
  transform: translateY(0px);
  opacity: 0.9;
}

.ai-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ai-output {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  white-space: pre-wrap;      /* preserve line breaks from AI */
  word-break: break-word;
}

/* optional: nicer paragraphs if you later render markdown-ish text */
.ai-output p {
  margin: 0 0 10px 0;
}

/* inline code-ish styling */
.ai-output code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
  padding: 0.15em 0.35em;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

/* blockquote styling (if AI outputs quoted Greek/English) */
.ai-output blockquote {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
}

/* loading shimmer (apply class ai-loading on ai-output) */
.ai-output.ai-loading {
  position: relative;
  min-height: 46px;
  color: rgba(255, 255, 255, 0.55);
}

.ai-output.ai-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.00) 0%,
    rgba(255,255,255,0.06) 40%,
    rgba(255,255,255,0.00) 80%
  );
  animation: aiShimmer 1.2s infinite;
  pointer-events: none;
}

@keyframes aiShimmer {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(40%); }
}

/* error styling (apply class ai-error on ai-output) */
.ai-output.ai-error {
  color: rgba(255, 190, 190, 0.92);
  border: 1px solid rgba(255, 120, 120, 0.20);
  background: rgba(255, 80, 80, 0.08);
  padding: 10px 12px;
  border-radius: 12px;
}

/* ------------------------------
   Podcast Panel
-------------------------------- */

.podcast-panel{
  grid-column: 1 / -1;
}

.podcast-controls{
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.podcast-audio{
  width: 100%;
  margin-top: 12px;
  accent-color: var(--accent);
}

.podcast-audio::-webkit-media-controls-panel{
  background: rgba(255,255,255,0.08);
}

.podcast-audio::-webkit-media-controls-play-button{
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

body[data-theme="light"] .podcast-audio::-webkit-media-controls-panel{
  background: rgba(0,0,0,0.04);
}

.podcast-player{
  margin-top: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

body[data-theme="light"] .podcast-player{
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.podcast-play{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.podcast-play:hover{
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(139,208,255,0.12);
}

.podcast-track{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.podcast-time{
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 44px;
  text-align: center;
}

.podcast-seek{
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  outline: none;
}

body[data-theme="light"] .podcast-seek{
  background: rgba(0,0,0,0.1);
}

.podcast-seek::-webkit-slider-thumb{
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,208,255,0.18);
}

.podcast-seek::-moz-range-thumb{
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 3px rgba(139,208,255,0.18);
}

.podcast-volume{
  display: grid;
  grid-template-columns: auto 90px;
  align-items: center;
  gap: 8px;
}

.podcast-volume-icon{
  font-size: 0.9rem;
  opacity: 0.7;
}

.podcast-volume-slider{
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  outline: none;
}

body[data-theme="light"] .podcast-volume-slider{
  background: rgba(0,0,0,0.1);
}

.podcast-volume-slider::-webkit-slider-thumb{
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.podcast-volume-slider::-moz-range-thumb{
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

@media (max-width: 820px){
  .podcast-player{
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }
  .podcast-volume{
    grid-column: 1 / -1;
    justify-self: end;
  }
}


.hide-translation .columns {
  grid-template-columns: 1fr;
}

.ai-thinking {
  opacity: 0.6;
  font-style: italic;
}

.ai-link-note {
  margin: 10px 0 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted2);
  font-size: 0.9rem;
}

.ai-link-note strong {
  color: var(--ink);
}


/* === TRANSLATION TOGGLE — FINAL OVERRIDE === */
.reader.hide-translation #translation {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}


.reader.hide-translation #headtranslation {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}


.app-loading .reader,
.app-loading .inspector,
.app-loading .ai-panel {
  opacity: 0.4;
  pointer-events: none;
}

.app-loading-indicator {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.6);
  z-index: 200;
}

.app-loading-indicator.hidden {
  display: none;
}

.loading-card {
  width: min(420px, 90vw);
  background: rgba(18, 20, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.loading-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink);
}

.loading-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(139, 208, 255, 0.9), rgba(255, 214, 140, 0.9));
  transition: width 200ms ease;
}

.loading-meta {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted2);
}

.survey-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.6);
  z-index: 220;
}

.survey-modal-content {
  width: min(420px, 90vw);
  background: rgba(18, 20, 28, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.survey-lede {
  color: var(--muted2);
  margin: 6px 0 14px;
}

.survey-required {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(255, 214, 140, 0.2);
  color: rgba(255, 214, 140, 0.95);
}

.survey-rating {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.survey-rating-btn {
  flex: 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  padding: 8px 0;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.survey-rating-btn.active {
  border-color: rgba(139, 208, 255, 0.6);
  background: rgba(139, 208, 255, 0.18);
  transform: translateY(-1px);
}

.survey-modal textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

.survey-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* =========================
   Toggle Switches
   ========================= */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 0.86rem;
  color: var(--muted);
}

/* hide native checkbox */
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* track */
.switch .slider {
  width: 38px;
  height: 22px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  position: relative;
  transition: background 160ms ease;
}

/* knob */
.switch .slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

/* checked state */
.switch input:checked + .slider {
  background: rgba(139,208,255,0.85);
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

/* label text */
.switch-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.switch input:checked + .slider {
  box-shadow: 0 0 0 3px rgba(255, 185, 34, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .switch .slider,
  .switch .slider::before {
    transition: none;
  }
}

.hidden {
  display: none;
}


/* =========================
   Landing Page (Refined)
   ========================= */

body.landing {
  background:
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

/* --- top nav --- */

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

/* --- main hero --- */

.landing-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 90px 20px 60px;
  text-align: center;
}

.landing-main h1 {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.landing-tagline {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 44px;
}

/* --- actions --- */

.landing-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-actions .btn {
  padding: 11px 18px;
  border-radius: 14px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.btn.primary {
  background: rgba(139,208,255,0.85);
  color: #000;
}

.btn.primary.large {
  padding: 12px 20px;
  font-size: 0.95rem;
  border-radius: 12px;
  font-weight: 650;
}

.btn.glow {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, rgba(139,208,255,0.9), rgba(163,255,206,0.9));
  color: #041019;
  border: none;
  box-shadow: 0 14px 32px rgba(139,208,255,0.28);
}

.btn.glow::after {
  content: "";
  position: absolute;
  inset: -40% -10%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.5), transparent 50%);
  opacity: 0.4;
  pointer-events: none;
  transition: transform 160ms ease, opacity 160ms ease;
}

.btn.glow:hover::after {
  transform: translateY(-6px);
  opacity: 0.6;
}

.btn.ghost.softer {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
  color: var(--text);
}

.btn.ghost.softer:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
}

.btn.primary:hover {
  background: rgba(139,208,255,1);
}

.btn.subtle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn.subtle:hover {
  border-color: rgba(139,208,255,0.5);
}

/* --- footer --- */

.landing-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 28px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted2);
  border-top: 1px solid var(--line);
}


/* =========================
   Library
   ========================= */

.library {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

.library h1 {
  margin-bottom: 22px;
}

.library-list {
  display: grid;
  gap: 14px;
}

.library-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 18px;
  flex-wrap: wrap;
}

.library-search-input {
  flex: 1 1 280px;
  min-width: 220px;
  padding: 10px 12px;

  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);

  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;

  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.library-search-input::placeholder {
  color: var(--muted2);
}

.library-search-input:focus {
  border-color: rgba(139, 208, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 3px rgba(139, 208, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.library-search-count {
  font-size: 0.85rem;
  color: var(--muted2);
}

.library-item {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 140ms ease, transform 80ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.library-item:hover {
  background: rgba(139,208,255,0.12);
  border-color: rgba(139,208,255,0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
}

.library-title {
  font-size: 1rem;
  font-weight: 600;
}

.library-meta {
  font-size: 0.85rem;
  color: var(--muted2);
}

.btn {
  padding: 0.8rem 1.8rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.btn.ghost:hover {
  background: var(--bg-soft);
}

.word.has-annotation {
  text-decoration: underline dotted rgba(181,255,207,.6);
}

/* =========================
   Annotation input
   ========================= */

#annotationInput {
  width: 100%;
  min-height: 90px;
  resize: vertical;

  padding: 10px 12px;
  margin-top: 6px;

  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);

  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;

  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

#annotationInput::placeholder {
  color: var(--muted2);
}

/* focus state */
#annotationInput:focus {
  border-color: rgba(139, 208, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 3px rgba(139, 208, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#annotationInput.has-note {
  background: rgba(181, 255, 207, 0.06);
}

.library-author {
  margin-bottom: 2.5rem;
}

.library-author-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.library-author-works {
  display: grid;
  gap: 0.75rem;
}

.compare-actions {
  margin-top: 1rem;
}

.compare-links {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.compare-links svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.compare-windows {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
}

.compare-window {
  position: absolute;
  width: min(420px, 90vw);
  max-height: 70vh;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(18, 20, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

.compare-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
}

.compare-window-header:active {
  cursor: grabbing;
}

.compare-window-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.compare-window-actions {
  display: inline-flex;
  gap: 6px;
}

.compare-window-body {
  padding: 12px;
  overflow: auto;
}

.compare-window-body .text {
  font-size: 0.95rem;
}

.compare-window.connecting {
  border-color: rgba(139, 208, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(139, 208, 255, 0.25);
}

.compare-link-line {
  pointer-events: none;
}

.nav-btn.active {
  background: rgba(139, 208, 255, 0.18);
  border-color: rgba(139, 208, 255, 0.55);
}

.word-connecting {
  background: rgba(255, 214, 140, 0.2);
  border-radius: 4px;
}

.compare-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}

.compare-modal.hidden {
  display: none;
}

.compare-modal-content {
  width: min(420px, 90vw);
  background: rgba(16, 18, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.compare-modal-body {
  display: grid;
  gap: 12px;
  margin: 12px 0 18px;
}

.compare-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.has-shared-annotation {
  background: rgba(150, 150, 150, 0.15);
}

#annotationSearch {
  min-width: 220px;
  width: 260px;
  padding: 10px;

  margin-top: 6px;

  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);

  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;

  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

#annotationSearch:focus,
#annotationSearch:active {
  border-color: rgba(120, 255, 170, 0.7);
  background: rgba(120, 255, 170, 0.08);
  box-shadow: 0 0 0 3px rgba(120, 255, 170, 0.26);
}

.annotation-status {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.annotation-status.error {
  color: #ffcccc;
  background: rgba(255,80,80,0.08);
  border-color: rgba(255,120,120,0.26);
}

.annotation-status.success {
  color: #b9ffd8;
  background: rgba(120,255,170,0.08);
  border-color: rgba(120,255,170,0.26);
}

.flashcard-adder {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}

.flashcard-adder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.flashcard-picker {
  font-size: 0.95rem;
  color: var(--muted);
}

.flashcard-picker-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.flashcard-picker-row input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--ink);
}

.flashcard-hint {
  font-size: 0.85rem;
  color: var(--muted2);
}

/* =========================
   Flashcards Page
   ========================= */

.flashcards-page .topbar {
  position: static;
}

.flashcards-shell {
  max-width: 1200px;
  margin: 22px auto 40px;
  padding: 0 18px 20px;
}

.flashcards-hero {
  padding: 20px;
  margin-bottom: 18px;
}

.flashcards-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
}

@media (max-width: 1000px) {
  .flashcards-grid {
    grid-template-columns: 1fr;
  }
}

.empty-state {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
}

.set-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flashcard-set {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.flashcard-set.active {
  border-color: rgba(139,208,255,0.5);
  background: rgba(139,208,255,0.06);
}

.flashcard-set-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.set-title {
  font-weight: 650;
}

.set-meta {
  color: var(--muted2);
  font-size: 0.9rem;
}

.flashcard-set-actions {
  display: flex;
  gap: 8px;
}

.flashcard-set-actions .danger {
  color: #ffb3b3;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-actions {
  display: flex;
  gap: 8px;
}

.review-actions .active {
  border-color: rgba(139,208,255,0.5);
  background: rgba(139,208,255,0.08);
}

.flashcard-review-card {
  min-height: 220px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.flip-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255,255,255,0.02);
}

.fc-face {
  display: none;
}

.flip-card .front {
  display: block;
}

.flip-card.show-back .front {
  display: none;
}

.flip-card.show-back .back {
  display: block;
}

.fc-term {
  font-size: 1.2rem;
  font-weight: 650;
}

.fc-sub {
  margin-top: 6px;
  color: var(--muted);
}

.fc-sub.subtle {
  color: var(--muted2);
}

.fc-translation {
  margin-top: 8px;
  color: var(--muted);
  font-style: italic;
}

.review-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.review-buttons {
  display: flex;
  gap: 8px;
}

.set-cards-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.flashcard-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.flashcard-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}

.fc-word {
  font-weight: 640;
}

.fc-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.fc-meta.subtle {
  color: var(--muted2);
}

/* =========================
   Memorize Page
   ========================= */

.memorize-page .topbar {
  position: static;
}

.memorize-shell {
  max-width: 1200px;
  margin: 22px auto 40px;
  padding: 0 18px 20px;
}

.memorize-hero {
  padding: 20px;
  margin-bottom: 18px;
}

.memorize-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
}

@media (max-width: 1000px) {
  .memorize-grid {
    grid-template-columns: 1fr;
  }
}

.selection-body {
  max-height: 70vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sentence-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 6px 0;
}

.sentence-text {
  line-height: 1.4;
}

.practice-body {
  min-height: 260px;
}

.practice-input {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  margin-top: 6px;
}

.practice-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.practice-feedback {
  margin-top: 10px;
}

.practice-feedback .success {
  color: #a7ffc7;
}

.practice-feedback .error {
  color: #ffb3b3;
}

.diff-list {
  padding-left: 16px;
  margin: 4px 0 0;
}

.answer-text {
  margin-top: 4px;
  color: var(--muted);
}

.prompt-mode {
  font-size: 0.9rem;
  color: var(--muted2);
}

.practice-prompt {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}


/* =========================
   Upgrade Page
   ========================= */

body.upgrade {
  background:
    radial-gradient(1000px 600px at 20% 0%, rgba(90,140,255,.22), transparent 60%),
    radial-gradient(1000px 600px at 85% 8%, rgba(0,255,200,.12), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

.upgrade-shell {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 18px 40px;
}

.upgrade-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 22px;
  padding: 24px;
}

@media (max-width: 900px) {
  .upgrade-hero {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted2);
  margin: 0 0 8px;
}

.upgrade-hero h1 {
  margin: 0 0 14px;
  font-size: 2rem;
  letter-spacing: 0.01em;
}

.lede {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 18px;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 10px 0 8px;
}

.price-tag {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 180px;
}

.price {
  font-size: 1.4rem;
  font-weight: 700;
}

.price-sub {
  color: var(--muted2);
  font-size: 0.9rem;
}

.upgrade-cta-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.cta-title {
  font-weight: 650;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.perk-grid {
  display: grid;
  gap: 10px;
}

.perk {
  display: flex;
  gap: 10px;
  line-height: 1.5;
  color: var(--muted);
}

.perk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(139,208,255,0.9);
  box-shadow: 0 0 0 6px rgba(139,208,255,0.12);
  margin-top: 6px;
}

.fine-print {
  color: var(--muted2);
  margin-top: 12px;
  font-size: 0.9rem;
}

/* =========================
   Library Page
   ========================= */

.library-shell {
  max-width: 1100px;
  margin: 30px auto 60px;
  padding: 0 18px;
}

.library-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  padding: 20px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .library-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hide-on-mobile {
    display: none !important;
  }
}

.library-hero-stats {
  display: grid;
  gap: 10px;
}

.library-hero .stat {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
}

.library-hero .stat-label {
  color: var(--muted2);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.library-hero .stat-value {
  font-weight: 620;
}

.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.bookmark-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}

.bookmark-label {
  font-weight: 650;
}

.bookmark-meta {
  color: var(--muted2);
  font-size: 0.9rem;
}

.bookmark-actions {
  display: flex;
  gap: 8px;
}
