/* ============================================================
   GRE Word Lab — quiet, focused "exam training tool" system
   Dark-first, dual-theme. JetBrains Mono for words, sans for UI.
   Single emerald accent · red for errors · amber for low confidence.
   ============================================================ */

:root {
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  /* dark (default) */
  --bg: #0d0f13;
  --surface: #15181e;
  --surface-2: #1b1f26;
  --raise: #1f242c;
  --ink: #e7e9ec;
  --ink-2: #c2c7cd;
  --muted: #878d96;
  --faint: #5b626b;
  --line: #262b33;
  --line-2: #323843;
  --accent: #2dd4a0;
  --accent-ink: #06231a;
  --accent-soft: #15302a;
  --good: #2dd4a0;
  --good-soft: #15302a;
  --bad: #f0796b;
  --bad-soft: #371f1d;
  --warn: #e0b257;
  --warn-soft: #312818;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.34), 0 12px 32px rgba(0, 0, 0, 0.36);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #ececea;
  --raise: #fafaf9;
  --ink: #191c1f;
  --ink-2: #3c4046;
  --muted: #6f757c;
  --faint: #a6abb1;
  --line: #e5e5e1;
  --line-2: #d6d6d1;
  --accent: #0c8f5f;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4ec;
  --good: #0c8f5f;
  --good-soft: #e6f4ec;
  --bad: #c23b32;
  --bad-soft: #fbece8;
  --warn: #a9750f;
  --warn-soft: #f7efdb;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.05), 0 10px 26px rgba(20, 30, 25, 0.06);

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

.mono {
  font-family: var(--mono);
}

::placeholder {
  color: var(--faint);
}

::-webkit-scrollbar {
  height: 9px;
  width: 9px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 99px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes greIn {
  from {
    transform: translateY(6px);
  }
  to {
    transform: none;
  }
}

/* ---------- base controls ---------- */
button,
input,
select {
  font: inherit;
  color: var(--ink);
}

button {
  cursor: pointer;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
  background: var(--raise);
  color: var(--ink);
  font-size: 14px;
}

select {
  cursor: pointer;
}

input:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
}

/* ---------- shell ---------- */
.app-shell {
  max-width: 1460px;
  margin: 0 auto;
  padding: 18px 18px 40px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  flex: none;
}

.brand-text {
  min-width: 0;
}

.brand-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  flex: 1 1 520px;
  justify-content: flex-end;
  min-width: 0;
}

.stat-primary {
  flex: 1 1 230px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 15px;
  box-shadow: var(--shadow);
}

.stat-primary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.stat-primary-num {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.stat-primary-num strong {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-primary-num span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.stat-primary-pct {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.stat-primary .meter {
  margin-top: 9px;
  height: 6px;
}

.stat-mini-group {
  display: flex;
  gap: 8px;
  flex: 1 1 240px;
  min-width: 0;
}

.stat-mini {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 12px;
  box-shadow: var(--shadow);
}

.stat-mini strong {
  display: block;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-mini strong.bad {
  color: var(--bad);
}

.stat-mini span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
  white-space: nowrap;
}

.theme-toggle {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 15px;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- main grid ---------- */
.main-grid {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ---------- control panel ---------- */
.control-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  padding: 15px;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
}

.field {
  margin-bottom: 13px;
}

.field:last-of-type {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--faint);
  pointer-events: none;
}

.search-wrap input {
  padding-left: 32px;
}

.meter {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.meter-block {
  border-top: 1px solid var(--line);
  margin: 15px 0;
  padding-top: 15px;
}

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

.meter-head span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.meter-head b {
  font-family: var(--mono);
  color: var(--ink);
}

.meter-head span:last-child {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
}

.mini-map {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.dot {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: none;
}

.dot.known {
  background: var(--accent);
  border-color: var(--accent);
}

.dot.hard {
  background: var(--bad);
  border-color: var(--bad);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: 11px;
  font-size: 11px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.legend-dot.known {
  background: var(--accent);
  border-color: var(--accent);
}

.legend-dot.hard {
  background: var(--bad);
  border-color: var(--bad);
}

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--raise);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ghost {
  flex: 1;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.ghost:hover {
  color: var(--ink);
  border-color: var(--line-2);
}

.ghost.danger:hover {
  color: var(--bad);
  border-color: var(--bad);
}

/* ---------- workspace ---------- */
.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  flex: none;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.tab:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.tab.active:hover {
  filter: brightness(1.05);
  background: var(--accent);
}

.tab-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--faint);
}

.tab-badge:empty {
  display: none;
}

.tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.2);
  color: var(--accent-ink);
}

.status {
  padding: 9px 18px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.status:empty {
  display: none;
}

.view {
  padding: 18px;
  min-height: 560px;
}

/* ---------- shared view bits ---------- */
.view-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.view-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.view-head h2 .mono {
  font-weight: 700;
}

.view-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.section-anim {
  animation: greIn 0.22s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--raise);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.16s ease, color 0.16s ease, filter 0.16s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  filter: brightness(1.06);
  color: var(--accent-ink);
}

.btn.good {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.btn.bad {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.btn.good:hover,
.btn.bad:hover {
  filter: brightness(1.08);
  color: inherit;
}

/* pronounce buttons */
.speak-btn {
  flex: none;
  min-height: 0;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.speak-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.speak-btn.large {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

.pronounce-word {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  text-align: left;
  font-family: var(--mono);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  transition: color 0.16s ease;
}

.pronounce-word:hover {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

/* tags */
.tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
}

.tag.good {
  color: var(--good);
  background: var(--good-soft);
}

.tag.mute {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
}

.tag.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.tag.pol {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

/* ---------- TODAY ---------- */
.word-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) minmax(120px, 1.2fr) minmax(120px, 1.3fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--raise);
}

.word-row .word-head {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.word-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.word-title .pronounce-word {
  font-size: 17px;
  font-weight: 600;
}

.word-pos {
  color: var(--faint);
  font-size: 12px;
  font-family: var(--mono);
}

.word-zh {
  min-width: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.word-hook {
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.mark-btn {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.mark-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mark-btn.on-known {
  border-color: var(--good);
  background: var(--good);
  color: var(--accent-ink);
}

.mark-btn.on-hard {
  border-color: var(--bad);
  background: var(--bad);
  color: #fff;
}

/* ---------- FLASH ---------- */
.stage-narrow {
  max-width: 680px;
  margin: 0 auto;
}

.stage-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
}

.stage-meta .mono {
  font-family: var(--mono);
}

.flash-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raise);
  padding: 34px 26px;
  text-align: center;
}

.flash-word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.flash-word {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(40px, 8vw, 72px);
  line-height: 1.04;
}

.flash-pos {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}

.flash-answer {
  border-top: 1px dashed var(--line);
  margin-top: 22px;
  padding-top: 22px;
  min-height: 148px;
  text-align: left;
}

.flash-answer .zh {
  font-size: 19px;
  font-weight: 650;
  color: var(--ink);
}

.flash-answer .en {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

.flash-answer .hook {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.flash-hidden {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.flash-hidden .hint {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  font-size: 13px;
}

.flash-hidden .hint .pill {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.flash-hidden .hint .dir {
  color: var(--faint);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.action-row .btn {
  flex: 1 1 100px;
  min-height: 42px;
}

.action-row .btn.primary {
  flex: 1 1 130px;
}

/* ---------- CHOICE / SYN quiz ---------- */
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 16px;
}

.quiz-head .score {
  font-family: var(--mono);
  color: var(--ink-2);
}

.quiz-word-wrap {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.quiz-word {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(32px, 6vw, 52px);
}

.quiz-pos {
  text-align: center;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 18px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.option:hover {
  border-color: var(--line-2);
}

.option .mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  color: transparent;
}

.option .opt-text {
  flex: 1;
}

.option.correct {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.option.correct .mark {
  background: var(--good);
  color: var(--accent-ink);
}

.option.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.option.wrong .mark {
  background: var(--bad);
  color: #fff;
}

.option.dim {
  color: var(--muted);
}

.option.answered {
  cursor: default;
}

.feedback {
  min-height: 24px;
  margin-top: 14px;
  font-weight: 700;
  font-size: 14px;
  color: transparent;
}

.feedback.ok {
  color: var(--good);
}

.feedback.no {
  color: var(--bad);
}

/* ---------- SPELLING ---------- */
.spell-stage {
  max-width: 620px;
  margin: 0 auto;
}

.spell-masked {
  text-align: center;
  margin-bottom: 8px;
}

.spell-masked .quiz-word {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: clamp(30px, 6vw, 48px);
  color: var(--faint);
}

.spell-masked.checked .quiz-word {
  color: var(--ink);
}

.spell-masked.checked.ok .quiz-word {
  color: var(--good);
}

.spell-meaning {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin: 6px 0 2px;
}

.spell-hook {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

.spell-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.spell-form input {
  flex: 1 1 200px;
  min-width: 0;
  min-height: 46px;
  border-radius: 9px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.04em;
}

.spell-form .btn {
  flex: none;
  min-height: 46px;
}

.feedback.spell {
  text-align: center;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.04em;
}

/* ---------- SE (6选2) ---------- */
.se-stage {
  max-width: 780px;
  margin: 0 auto;
}

.se-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  background: var(--accent-soft);
  margin-bottom: 14px;
}

.se-banner .step {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
}

.se-banner .theme {
  font-weight: 650;
  font-size: 14px;
  color: var(--ink);
}

.se-banner .dir {
  color: var(--muted);
  font-size: 12.5px;
}

.se-stem {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 16px;
}

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

.se-step2 .step {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.se-counter {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.se-counter.full {
  color: var(--accent);
}

.se-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.se-option {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  min-height: 50px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.14s ease, background 0.14s ease;
}

.se-option:hover {
  border-color: var(--line-2);
}

.se-letter {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--muted);
}

.se-word {
  flex: 1;
  font-family: var(--mono);
  font-size: 15px;
}

.se-opt-mark {
  font-weight: 700;
  font-size: 14px;
}

.se-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.se-option.selected .se-letter {
  background: var(--accent);
  color: var(--accent-ink);
}

.se-option.correct {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
  cursor: default;
}

.se-option.correct .se-letter {
  background: var(--good);
  color: var(--accent-ink);
}

.se-option.correct .se-opt-mark {
  color: var(--good);
}

.se-option.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
  cursor: default;
}

.se-option.wrong .se-letter {
  background: var(--bad);
  color: #fff;
}

.se-option.wrong .se-opt-mark {
  color: var(--bad);
}

.se-option.dim {
  color: var(--muted);
  cursor: default;
}

.se-verify {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raise);
  padding: 14px 16px;
  margin-top: 16px;
  animation: greIn 0.2s ease;
}

.se-verify .step {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.se-verify-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.se-verify-line {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

.se-verify-line .hit {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--good);
  padding: 0 4px;
  border-bottom: 2px solid var(--good);
}

.se-explain {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 11px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

/* ---------- SYNONYMS ---------- */
.syn-quiz {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--raise);
  padding: 16px;
  margin-bottom: 16px;
}

.syn-quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.syn-quiz-head .left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.syn-quiz-head .pronounce-word {
  font-weight: 700;
  font-size: 26px;
}

.syn-quiz-head .meaning {
  color: var(--muted);
  font-size: 13px;
}

.syn-quiz-head .label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.syn-quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.syn-quiz-opt {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.14s ease;
}

.syn-quiz-opt:hover {
  border-color: var(--line-2);
}

.syn-quiz-opt.correct {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.syn-quiz-opt.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.syn-quiz-opt.dim {
  color: var(--muted);
}

.syn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 11px;
}

.syn-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--raise);
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.syn-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.syn-card-head h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
}

.syn-card-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  font-family: var(--mono);
}

.pol-chip {
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
  color: var(--muted);
}

.pol-chip.pos {
  color: var(--good);
}

.pol-chip.neg {
  color: var(--bad);
}

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-family: var(--mono);
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  transition: border-color 0.14s ease, color 0.14s ease, filter 0.14s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.core {
  font-weight: 600;
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.chip.core:hover {
  filter: brightness(1.08);
}

/* ---------- LIBRARY ---------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--line);
}

th.col-index {
  width: 54px;
}

th.col-status {
  width: 78px;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr.zebra td {
  background: var(--raise);
}

td.cell-index {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

td .pronounce-word {
  font-weight: 600;
  font-size: 14px;
}

td .cell-pos {
  color: var(--faint);
  font-size: 11px;
  font-family: var(--mono);
  margin-top: 2px;
}

td.cell-zh {
  color: var(--ink-2);
  line-height: 1.5;
}

td.cell-group {
  color: var(--muted);
}

.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
}

.status-pill.known {
  color: var(--good);
  background: var(--good-soft);
}

.status-pill.hard {
  color: var(--bad);
  background: var(--bad-soft);
}

.lib-mem-btn {
  display: block;
  margin-top: 5px;
  min-height: 0;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.lib-mem-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- MEMORY THEATER ---------- */
.memory-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: stretch;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.memory-art {
  display: grid;
  place-items: center;
  min-height: 280px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.memory-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.memory-content {
  min-width: 0;
}

.memory-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.memory-title .pronounce-word {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.memory-grid article {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  min-height: 120px;
}

.memory-grid h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.memory-grid p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

.image-prompt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 12px;
  border: 1px dashed var(--line-2);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
}

.image-prompt strong {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.image-prompt p {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.image-prompt button {
  flex: none;
  min-height: 0;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  align-self: start;
}

.image-prompt button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.memory-mini {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

.memory-mini strong {
  color: var(--ink);
}

.memory-mini button {
  margin-left: 8px;
  min-height: 0;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.memory-mini button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- empty ---------- */
.empty {
  padding: 48px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .control-panel {
    position: static;
  }
  .stat-strip {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .word-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .row-actions button {
    flex: 1;
  }
  .memory-card {
    grid-template-columns: 1fr;
  }
  .image-prompt {
    grid-template-columns: 1fr;
  }
  .image-prompt button {
    justify-self: start;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding: 12px 12px 32px;
  }
  .stat-mini-group {
    flex: 1 1 100%;
  }
  .stat-primary {
    flex: 1 1 100%;
  }
  .option-grid,
  .se-grid {
    grid-template-columns: 1fr;
  }
  .memory-grid {
    grid-template-columns: 1fr;
  }
  .view {
    padding: 14px;
  }
  .flash-card {
    padding: 26px 16px;
  }
}
