:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --primary: #2d6a4f;
  --primary-light: #52b788;
  --accent: #d4a017;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e1d8;
  --word-hover: rgba(82, 183, 136, 0.18);
  --word-active: rgba(82, 183, 136, 0.35);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 12px;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.tagline {
  display: block;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.7);
  margin-top: 1px;
}
.level-badge {
  background: var(--accent);
  color: #1a1a1a;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: 0.05em;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.mydict-link {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 7px 5px 9px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, border-color 0.2s;
  line-height: 1;
}
.mydict-link:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.45); }
.mydict-link:active { transform: scale(0.97); }
.md-icon { font-size: 0.95rem; }
.md-label { white-space: nowrap; letter-spacing: 0.01em; }
.md-count {
  background: var(--accent);
  color: #1a1a1a;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 1.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 460px) {
  .md-label { display: none; }
  .mydict-link { padding: 5px 7px; }
  .tagline { display: none; }
}
.lang-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 3px;
}

/* My Dictionary modal */
.mydict-modal {
  position: fixed;
  z-index: 400;
  bottom: 0; left: 0; right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s ease;
}
@media (min-width: 640px) {
  .mydict-modal {
    bottom: auto; top: 50%; left: 50%; right: auto;
    transform: translate(-50%, -50%);
    width: 480px;
    border-radius: var(--radius);
    animation: fadeIn 0.18s ease;
  }
}
.mydict-body { overflow-y: auto; padding: 0.6rem 1rem 1rem; }
.mydict-empty { color: var(--text-muted); text-align: center; padding: 2rem 1rem; font-size: 0.9rem; }
.mydict-item {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.3rem;
}
.mydict-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.mydict-word { font-size: 1.05rem; font-weight: 700; color: var(--primary); font-family: var(--font-serif); cursor: pointer; }
.mydict-count {
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 12px;
  flex-shrink: 0;
}
.mydict-mean { font-size: 0.85rem; color: var(--text); margin-top: 2px; }
.mydict-times { font-size: 0.68rem; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.lang-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn.active {
  background: white;
  color: var(--primary);
}

/* Main */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

/* Story List — linear path, one story after another */
.story-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 560px;
  margin: 0 auto;
}

.story-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.story-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.story-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.2rem;
}
.story-card-main { flex: 1; min-width: 0; }
.story-card.done .story-num { background: var(--accent); color: #1a1a1a; }
.story-status {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.story-status.done { color: var(--primary); }
.story-status.locked { color: var(--text-muted); }

/* Locked (future) stories: greyed out, not clickable */
.story-card.locked {
  opacity: 0.45;
  filter: grayscale(1);
  cursor: default;
  pointer-events: auto;
}
.story-card.locked:hover {
  border-color: transparent;
  transform: none;
  box-shadow: var(--shadow);
}
.story-card.locked .story-num { background: var(--text-muted); }
.story-card-emoji {
  font-size: 2rem;
  margin-bottom: 0.6rem;
  display: block;
}
.story-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.story-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-style: italic;
}
.story-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  background: #e8f5ee;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
}
.story-card-arc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.arc-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

/* Login */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--primary);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.login-logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); text-align: center; }
.login-sub { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-bottom: 0.5rem; }
.login-card input {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  outline: none;
}
.login-card input:focus { border-color: var(--primary-light); }
.login-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.25rem;
}
.login-btn:hover { background: var(--primary-light); }
.login-error { color: #c0392b; font-size: 0.8rem; text-align: center; font-weight: 600; }
.user-chip {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}
.user-chip:hover { background: rgba(255,255,255,0.25); }
@media (max-width: 460px) { .user-chip span { display: none; } }

/* Floating progression tracker */
.tracker {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 150;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 0.45rem 0.9rem;
  display: flex;
  gap: 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}
.tracker .tr-item { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.tracker .tr-item small { font-weight: 500; color: var(--text-muted); font-size: 0.68rem; }

/* Vocabulary section */
.vocab-section { margin-top: 2rem; }
.vocab-h {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.15rem;
}
.vocab-sub { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; font-style: italic; }
.vocab-book { margin-bottom: 1.1rem; }
.vocab-book-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.vocab-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.vocab-chip {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.vocab-chip:hover { border-color: var(--primary-light); transform: translateY(-1px); }
.vocab-chip small { font-size: 0.66rem; color: var(--text-muted); font-weight: 500; }
.vocab-cat {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 1rem 0 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid var(--primary-light);
}
.vocab-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.vocab-is { font-family: var(--font-serif); font-weight: 600; color: var(--text); }
.vocab-tr { color: var(--text-muted); text-align: right; }

/* Reader */
.hidden { display: none !important; }

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0;
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.back-btn:hover { text-decoration: underline; }

.story-meta {
  margin-bottom: 1.5rem;
}
.story-meta h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Scene */
.story-text {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.scene-art {
  width: calc(100% + 3rem);
  margin: -1.5rem -1.5rem 1.1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block;
}
.scene-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  display: block;
}
.scene-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  font-family: var(--font-serif);
}
.scene-body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text);
}
.scene-body p { margin-bottom: 0.9em; }
.para {
  position: relative;
  padding-left: 2.5rem;
}
.para-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: none;
  background: #e3e0d8;
  color: var(--text-muted);
  font-size: 0.62rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.para-btn:hover { background: var(--primary-light); color: #fff; }
.para-btn:active { transform: translateY(-50%) scale(0.92); }
.para.reading .para-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}
@media (max-width: 420px) {
  .para { padding-left: 2.1rem; }
  .para-btn { width: 1.4rem; height: 1.4rem; }
}

/* Play bar */
.play-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.9rem;
}
.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.play-btn:hover { background: var(--primary-light); }
.play-btn:active { transform: scale(0.96); }
.play-btn.loading { opacity: 0.6; cursor: wait; }
.play-seek {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
  height: 4px;
}
.play-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 2.5rem;
  text-align: right;
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: -0.4rem 0 0.9rem;
  padding: 0 0.3rem;
}
.speed-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.speed-opts {
  display: flex;
  gap: 6px;
  flex: 1;
}
.speed-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--surface);
  color: var(--text-muted);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.3rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.1;
}
.speed-opt b { font-size: 0.82rem; }
.speed-opt small { font-size: 0.66rem; opacity: 0.8; font-variant-numeric: tabular-nums; }
.speed-opt:hover { border-color: var(--primary-light); }
.speed-opt.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Clickable words */
.w {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s;
  padding: 1px 1px;
}
.w.known {
  border-bottom: 1px dotted rgba(45, 106, 79, 0.4);
}
.w:hover { background: var(--word-hover); border-bottom-color: transparent; }
.w.active { background: var(--word-active); }

/* First-time tappable-words hint */
.word-hint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #e8f5ee;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}
.word-hint::before { content: "💡"; font-size: 1rem; }
.word-hint #wordHintText { flex: 1; }
.word-hint-x {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.word-hint-x:hover { background: var(--primary-light); }
.w.speaking {
  background: var(--accent);
  color: #1a1a1a;
  box-shadow: 0 0 0 2px var(--accent);
}

/* Quiz */
.quiz { margin-bottom: 1.25rem; }
.quiz:empty { display: none; }
/* Interstitial quiz page */
.quiz-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.5rem 0;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.quiz-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.quiz-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.quiz-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 0;
}
.quiz-back:hover { color: var(--primary); text-decoration: underline; }
.quiz-continue {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.quiz-continue:hover { background: var(--primary-light); }
.quiz-continue:active { transform: scale(0.96); }
.quiz-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.quiz-q {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.8rem;
}
.quiz-qtext {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
  line-height: 1.4;
}
.quiz-opts { display: flex; flex-direction: column; gap: 0.45rem; }
.quiz-opt {
  text-align: left;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.quiz-opt:hover { border-color: var(--primary-light); }
.quiz-q.answered .quiz-opt { cursor: default; }
.quiz-q.answered .quiz-opt:hover { border-color: var(--border); }
.quiz-opt.correct {
  border-color: var(--primary);
  background: #e8f5ee;
  font-weight: 700;
}
.quiz-opt.correct::after {
  content: "✓";
  position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%);
  color: var(--primary); font-weight: 800;
}
.quiz-opt.wrong {
  border-color: #c0392b;
  background: #fdecea;
}
.quiz-opt.wrong::after {
  content: "✕";
  position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%);
  color: #c0392b; font-weight: 800;
}
.quiz-feedback {
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.55rem;
}
.quiz-feedback.ok { color: var(--primary); }
.quiz-feedback.no { color: #c0392b; }

/* Nav */
.story-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.nav-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  background: #e8f5ee;
}
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.scene-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  flex: 1;
}

/* Word Popup */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
}
.popup {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem 1.5rem 2rem;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  margin: 0 auto;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 640px) {
  .popup {
    position: fixed;
    bottom: auto;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius);
    min-width: 320px;
    max-width: 420px;
    animation: fadeIn 0.18s ease;
  }
  @keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
  }
}
.popup-close {
  position: absolute;
  top: 0.75rem; right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.popup-word {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-serif);
  margin-bottom: 0.2rem;
}
.popup-pronunciation {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-style: italic;
}
.popup-pos {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.popup-translation {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.7rem;
  line-height: 1.4;
}
.ctx-label {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
  margin-right: 0.5rem;
}
/* Other meanings: clearly subordinate / de-emphasised */
.popup-also {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
  line-height: 1.4;
  background: #f3f1ea;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}
.also-label {
  display: block;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}
.forms-btn {
  margin-top: 0.9rem;
  width: 100%;
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary-light);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.forms-btn:hover { background: #e8f5ee; }
.forms-btn[hidden] { display: none; }

/* All-forms modal */
.forms-modal {
  position: fixed;
  z-index: 400;
  bottom: 0; left: 0; right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s ease;
}
@media (min-width: 640px) {
  .forms-modal {
    bottom: auto; top: 50%; left: 50%; right: auto;
    transform: translate(-50%, -50%);
    width: 460px;
    border-radius: var(--radius);
    animation: fadeIn 0.18s ease;
  }
}
.forms-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem 1.3rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.forms-word { font-size: 1.3rem; font-weight: 800; color: var(--primary); font-family: var(--font-serif); }
.forms-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.forms-head .popup-close { position: static; }
.forms-body { overflow-y: auto; padding: 0.6rem 1.3rem 1rem; }
.forms-group-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0.9rem 0 0.35rem;
}
.form-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  font-size: 0.92rem;
}
.form-row .fr-form { font-weight: 600; font-family: var(--font-serif); }
.form-row .fr-tag { color: var(--text-muted); font-size: 0.8rem; text-align: right; }
.form-row.current { background: var(--accent); }
.form-row.current .fr-tag { color: #5a4a10; }

/* Organized paradigm tables */
.ft-section {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 1.1rem 0 0.2rem;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid var(--primary-light);
}
.ft-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0.85rem 0 0.3rem;
}
.ftable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}
.ftable th, .ftable td {
  padding: 0.3rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.ftable thead th {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
.ftable tbody th {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  width: 1%;
}
.ftable td { font-family: var(--font-serif); color: var(--text); }
.ftable td.fc-cur { background: var(--accent); font-weight: 700; border-radius: 4px; }
.ftable td.fc-x { color: var(--border); }
.ft-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
}
.ft-line-k {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.ft-line b, .ftable b { color: #4a3c0a; }
.forms-id {
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 0.5rem 1.3rem 1rem;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.popup-examples { display: flex; flex-direction: column; gap: 0.6rem; }
.ex-item {
  border-left: 3px solid var(--primary-light);
  padding-left: 0.75rem;
}
.ex-is {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.45;
}
.ex-is b { color: var(--primary); }
.ex-tr {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 1px;
}
