:root {
  color-scheme: light;
  --ink: #211a2d;
  --muted: #746d7d;
  --muted-light: #9b94a4;
  --purple: #7350c9;
  --purple-dark: #50329d;
  --purple-soft: #eee9fb;
  --orange: #ec7137;
  --orange-soft: #fff0e7;
  --green: #218864;
  --green-soft: #e7f5ef;
  --red: #ce4e52;
  --surface: #ffffff;
  --page: #f8f6fa;
  --line: #e8e3eb;
  --progress-track: #e8eee9;
  --progress-start: #218864;
  --progress-end: #50bd8d;
  --chart-grid: #e8e3f1;
  --chart-target: #e6a06f;
  --chart-stroke: #7350c9;
  --shadow: 0 16px 42px rgba(73, 49, 101, 0.09);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: #ebe7ee;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(255, 122, 26, .28); outline-offset: 2px; }
.app-shell {
  position: relative;
  width: min(430px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px calc(98px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  background: var(--page);
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: -18px -20px 0;
  padding: max(20px, env(safe-area-inset-top)) 20px 14px;
  background: rgba(247, 245, 252, .94);
  border-bottom: 1px solid rgba(233, 229, 242, .72);
  backdrop-filter: blur(18px);
}
.target-block span, .step-label {
  display: block;
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.target-block h1 { margin: 2px 0 0; font-size: 30px; line-height: 1; letter-spacing: -.03em; }
.target-block p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #dcd3ff;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 13px;
  font-weight: 800;
}
.score-pill strong {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--purple);
  color: white;
  font-size: 13px;
}
.view { display: none; padding-top: 16px; }
.view.active { display: block; animation: view-in .22s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.progress-copy, .section-title, .test-heading, .description-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.view[data-view="find"] > .progress-copy { align-items: center; }
h2 { margin: 6px 0 0; font-size: 25px; line-height: 1.14; letter-spacing: -.025em; }
.prompt-target {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 6px 0 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 34px;
  font-weight: 850;
  line-height: 1.14;
  letter-spacing: -.025em;
}
.prompt-target small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0;
}
.round-count, .status-chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 12px;
  font-weight: 800;
}
.score-round {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px 5px 11px;
}
.score-round b {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--purple);
  color: white;
  font-size: 13px;
  white-space: nowrap;
}
.clue-form {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.clue-form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 750; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.input-row input, .meaning-form input {
  min-width: 0;
  height: 50px;
  padding: 0 15px;
  border: 1.5px solid #ded8ec;
  border-radius: 16px;
  background: #fbfaff;
  color: var(--ink);
  font-size: 16px;
}
.input-row input::placeholder, .meaning-form input::placeholder { color: var(--muted-light); }
.input-row button, .meaning-form button, .primary-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  background: var(--purple);
  color: white;
  font-weight: 850;
  box-shadow: 0 9px 20px rgba(96,55,215,.20);
}
.input-row button:active, .meaning-form button:active, .primary-button:active, .candidate-row:active { transform: scale(.98); }
.clue-strip { display: flex; flex-wrap: wrap; gap: 8px; min-height: 38px; margin-top: 10px; }
.clue-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #dcd3ff;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-weight: 800;
}
.clue-chip-copy { display: inline-flex; align-items: baseline; gap: 6px; }
.clue-chip-copy small { font-size: 9px; font-weight: 850; }
.clue-chip .remove-mark { color: #8d82ad; font-size: 17px; line-height: 1; }
.clue-chip.translated-clue {
  border-color: #efaaaa;
  background: #fff0f0;
  color: var(--red);
}
.clue-chip.translated-clue .clue-chip-copy small,
.clue-chip.translated-clue .remove-mark { color: #bd5656; }
.input-row button:disabled { cursor: wait; opacity: .66; }
.empty-clues { color: var(--muted-light); font-size: 13px; align-self: center; }
.description-row { align-items: center; margin-top: 3px; }
.description-actions { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.result-source-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.match-mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 42px);
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  background: #ece8f4;
  box-shadow: inset 0 1px 4px rgba(35, 24, 63, .10);
  isolation: isolate;
}
.match-mode-switch::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 3px;
  left: 3px;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--purple);
  box-shadow: 3px 4px 10px rgba(57, 38, 111, .24);
  transition: transform .24s cubic-bezier(.22, .78, .25, 1), background .2s;
}
.match-mode-switch.is-free::before { transform: translateX(42px); background: var(--orange); }
.match-mode-switch button {
  position: relative;
  z-index: 1;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  transition: color .2s;
}
.match-mode-switch button.is-active { color: white; }
.prompt-target.free-mode { color: var(--orange); cursor: default; font-size: 27px; }
.prompt-target.free-mode:disabled { opacity: 1; }
.description-question { display: flex; min-width: 0; align-items: center; margin: 0 2px; color: var(--ink); font-size: 13px; font-weight: 750; }
.description-question .description-label {
  flex: 0 0 auto;
  margin-right: 8px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
}
.description-prompt-window { display: block; height: 1.45em; overflow: hidden; white-space: nowrap; }
.description-prompt-track { display: flex; flex-direction: column; transform: translateY(0); transition: transform .46s cubic-bezier(.22,.78,.25,1); }
.description-prompt-track > span { display: block; height: 1.45em; line-height: 1.45; }
.description-prompt-track.rolling { transform: translateY(-1.45em); }
.description-prompt-track.resetting { transition: none; }
.results-section { margin-top: 3px; }
.one-tap-match {
  width: calc(100% - 16px);
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 10px 8px 0;
  border: 1px solid color-mix(in srgb, var(--purple) 24%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--purple-soft) 68%, #fff);
  color: var(--purple-dark);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--purple) 8%, transparent);
}
.one-tap-match[hidden] { display: none; }
.one-tap-match span { font-size: 14px; font-weight: 650; }
.one-tap-match small { color: var(--muted); font-size: 11px; font-weight: 500; }
.one-tap-match:active { transform: scale(.985); }

body[data-theme="dark"] .one-tap-match {
  border-color: #3c321f;
  background: rgba(23, 19, 12, .94);
  color: var(--orange);
  box-shadow: 7px 10px 22px rgba(0, 0, 0, .4);
}
body[data-theme="dark"] .one-tap-match small { color: #92918d; }
.text-button { padding: 8px 0 8px 12px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 750; }
.results-list { margin-top: 0; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.candidate-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: white;
  color: var(--ink);
  text-align: left;
  border-bottom: 1px solid var(--line);
  transition: background .18s, transform .12s;
}
.candidate-row:last-child { border-bottom: 0; }
.candidate-row:hover { background: #faf8ff; }
.candidate-row.correct-target { background: #fbf9ff; }
.rank { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #f0edf6; color: var(--muted); font-size: 12px; font-weight: 850; }
.candidate-row.correct-target .rank { background: var(--purple); color: white; }
.candidate-word { display: flex; flex-direction: column; gap: 3px; }
.candidate-word strong { font-size: 17px; letter-spacing: -.01em; }
.candidate-word small { color: var(--muted); font-size: 12px; }
.candidate-word small span {
  margin-left: 7px;
  color: var(--muted-light);
  font-size: 10px;
}
.percent { color: var(--purple-dark); font-size: 16px; font-weight: 900; }
.empty-results { padding: 30px 20px; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.55; }
.empty-results strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 15px; }
.empty-results span { display: block; }
.inline-feedback { min-height: 22px; margin: 10px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.inline-feedback:empty { display: none; }
.inline-feedback.success { color: var(--green); font-weight: 750; }
.inline-feedback.error { color: var(--red); font-weight: 750; }
.review-hub { display: grid; gap: 12px; margin-top: 18px; }
.review-cover {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 142px;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(96,55,215,.11);
  border-radius: 26px;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}
.review-cover::after { content: ""; position: absolute; z-index: -1; right: -34px; bottom: -54px; width: 150px; height: 150px; border: 32px solid rgba(255,255,255,.34); border-radius: 50%; }
.clue-cover { background: linear-gradient(135deg, #eee9fb, #fbfaff); }
.final-cover { background: linear-gradient(135deg, #fff0e7, #fffaf7); }
.library-cover { background: linear-gradient(135deg, #e7f5ef, #f9fffc); }
.cover-number { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: rgba(255,255,255,.66); color: var(--purple); font-size: 17px; font-weight: 950; box-shadow: inset 0 0 0 1px rgba(96,55,215,.08); }
.final-cover .cover-number { color: var(--orange); }
.library-cover .cover-number { color: var(--green); }
.cover-copy { display: flex; min-width: 0; flex-direction: column; }
.cover-copy small { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .04em; }
.cover-copy strong { margin-top: 5px; font-size: 22px; line-height: 1.1; }
.cover-copy em { margin-top: 8px; color: var(--muted); font-size: 11px; font-style: normal; line-height: 1.4; }
.cover-badge { align-self: flex-start; padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.72); color: var(--purple-dark); font-size: 10px; font-weight: 850; white-space: nowrap; }
.review-panel[hidden], .review-hub[hidden] { display: none; }
#finalTestContent[hidden], .meaning-form[hidden] { display: none; }
.review-page-header { align-items: center; }
.review-title-row { display: flex; min-width: 0; align-items: center; gap: 11px; }
.review-title-row h2 { margin: 0; white-space: nowrap; }
.review-panel { margin-top: 8px; }
.panel-back {
  position: static;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #dcd3ff;
  border-radius: 50%;
  background: white;
  color: var(--purple);
  box-shadow: 0 7px 18px rgba(69,34,181,.09);
}
.panel-back[hidden] { display: none; }
.panel-back::before {
  content: "";
  width: 10px;
  height: 10px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: translateX(2px) rotate(45deg);
}
.panel-heading { margin-top: 7px; }
.panel-heading h2 { margin-top: 4px; }
.review-empty, .library-empty { width: 100%; padding: 22px 15px; border: 1px dashed #d9d2e8; border-radius: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.review-action { width: 100%; min-height: 46px; margin-top: 8px; border-radius: 14px; background: var(--purple); color: white; font-weight: 850; }
.review-action[hidden] { display: none; }
.review-card, .final-test-card {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.review-caption, .final-test-card > p, #finalTestContent > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.review-clues { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 18px; }
.review-clue-term,
.review-clue-result { display: inline-flex; min-width: 0; max-width: 100%; align-items: center; gap: 8px; }
.review-clue { max-width: 100%; padding: 8px 12px; border-radius: 11px; background: var(--purple-soft); color: var(--purple-dark); font-weight: 550; line-height: 1; overflow-wrap: anywhere; }
.review-clue-connector { color: var(--muted); font-size: 18px; font-weight: 500; }
.review-clue-arrow { color: var(--orange); font-size: 23px; font-weight: 600; line-height: 1; }
.review-clue-unknown { display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 11px; border-radius: 12px; background: var(--purple); color: white; font-size: 21px; font-weight: 600; line-height: 1; box-shadow: 0 7px 17px rgba(96,55,215,.22); }
.review-options { display: grid; gap: 10px; }
.review-option { position: relative; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 56px; border: 1.5px solid #ded8ec; border-radius: 16px; background: #fbfaff; color: var(--ink); font-size: 19px; text-align: center; font-weight: 800; }
.review-option-letter { position: absolute; top: 50%; left: 16px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #f0edf6; color: var(--muted); font-size: 13px; font-weight: 650; transform: translateY(-50%); }
.review-option-word { min-width: 0; overflow-wrap: anywhere; }
.review-option.correct { border-color: var(--purple); background: var(--purple-soft); color: var(--purple-dark); }
.review-option.wrong { border-color: #efaaaa; background: #fff0f0; color: var(--red); }
.review-option.correct .review-option-letter { background: var(--purple); color: white; }
.review-option.wrong .review-option-letter { background: var(--red); color: white; }
#reviewFeedback.inline-feedback.success,
#meaningFeedback.inline-feedback.success { color: var(--purple); }
.final-test-card { margin-top: 16px; }
.final-test-card > p, #finalTestContent > p { margin-top: 16px; }
.meaning-form { display: grid; gap: 10px; margin-top: 16px; }
.meaning-form button { width: 100%; }
.library-search { display: block; margin-top: 16px; }
.library-search > span { display: block; margin: 0 2px 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.library-search input { width: 100%; height: 48px; padding: 0 15px; border: 1.5px solid #ded8ec; border-radius: 15px; background: white; color: var(--ink); font-size: 15px; box-shadow: 0 8px 24px rgba(69,34,181,.07); }
.alphabet-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 13px; }
.alphabet-grid button { aspect-ratio: 1; border: 1px solid #e3deed; border-radius: 10px; background: white; color: var(--muted); font-size: 11px; font-weight: 850; }
.alphabet-grid button.active { border-color: var(--purple); background: var(--purple); color: white; }
.alphabet-grid button:disabled { cursor: default; opacity: .28; }
.library-editor { margin-top: 14px; padding: 14px; border: 1px solid #dcd3ff; border-radius: 18px; background: var(--purple-soft); }
.library-editor[hidden] { display: none; }
.library-editor > div { display: flex; align-items: baseline; gap: 8px; }
.library-editor > div small { color: var(--muted); font-size: 10px; }
.library-editor > div strong { color: var(--purple-dark); font-size: 18px; }
.library-editor form { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 10px; }
.library-editor input { min-width: 0; height: 42px; padding: 0 12px; border: 1px solid #d9d0f7; border-radius: 12px; background: white; }
.library-editor form button { padding: 0 14px; border-radius: 12px; background: var(--purple); color: white; font-weight: 850; }
.library-result-heading { display: flex; align-items: center; justify-content: space-between; margin: 17px 2px 9px; }
.library-result-heading strong { font-size: 14px; }
.library-result-heading span { color: var(--muted); font-size: 11px; }
.library-list { display: grid; gap: 9px; }
.library-word-row { width: 100%; min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 7px 8px 7px 14px; border: 1px solid var(--line); border-radius: 18px; background: white; color: var(--ink); box-shadow: 0 9px 25px rgba(69,34,181,.07); user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
.library-word-row:not(.delete-revealed) { grid-template-columns: minmax(0, 1fr); }
.library-word-row.delete-revealed { border-color: rgba(215,73,73,.28); }
.library-word-open { min-width: 0; min-height: 50px; display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.library-word-open:focus-visible { outline: 2px solid rgba(240, 162, 58, .35); outline-offset: 2px; border-radius: 11px; }
.library-word-main, .library-clue-list { display: flex; min-width: 0; flex-direction: column; justify-content: center; }
.library-target-line { display: flex; min-width: 0; align-items: center; gap: 7px; }
.library-word-main strong { min-width: 0; overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.library-pronounce { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--purple-soft); color: var(--purple); transition: transform .16s ease, background .16s ease; }
.library-pronounce svg { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.library-pronounce:hover { transform: scale(1.05); }
.library-pronounce.playing { background: var(--purple); color: white; animation: pronunciation-pulse .8s ease infinite alternate; }
@keyframes pronunciation-pulse { to { box-shadow: 0 0 0 5px rgba(240, 162, 58, .13); } }
.library-clue-list > span { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; }
.library-clue-list i { padding: 6px 9px; border-radius: 9px; background: var(--purple-soft); color: var(--purple-dark); font-size: 12px; font-style: normal; font-weight: 850; }
.library-word-open > b { color: var(--purple); font-size: 10px; white-space: nowrap; }
.library-delete { min-width: 44px; min-height: 38px; padding: 0 8px; border-radius: 12px; background: #fff0f0; color: var(--red); font-size: 10px; font-weight: 850; white-space: nowrap; animation: delete-reveal .18s ease both; }
@keyframes delete-reveal { from { opacity: 0; transform: translateX(8px); } }
.library-delete.confirming { background: var(--red); color: white; }
.archive-dashboard { display: grid; gap: 12px; margin-top: 18px; }
.daily-goal-card, .learning-card, .ranking-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.dashboard-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dashboard-heading.compact { align-items: center; }
.dashboard-kicker { display: block; color: var(--orange); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.dashboard-heading h3 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.02em; }
.goal-score { color: var(--purple); font-size: 22px; line-height: 1; white-space: nowrap; }
.goal-score-actions { display: grid; justify-items: end; gap: 7px; }
.edit-goal-button { padding: 3px 0 3px 8px; background: transparent; color: var(--purple); font-size: 11px; font-weight: 850; }
.edit-goal-button[hidden], .goal-form[hidden] { display: none; }
.goal-score span { color: var(--muted-light); font-size: 14px; }
.goal-score small { color: var(--muted); font-size: 11px; }
.goal-progress { height: 10px; margin-top: 16px; overflow: hidden; border-radius: 999px; background: var(--progress-track); }
.goal-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--progress-start), var(--progress-end)); transition: width .3s ease; }
.goal-progress-copy { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.goal-form { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.goal-form label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.goal-form > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.goal-form input { min-width: 0; height: 42px; padding: 0 12px; border: 1.5px solid #ded8ec; border-radius: 13px; background: #fbfaff; color: var(--ink); }
.goal-form button { min-width: 68px; border-radius: 13px; background: var(--purple); color: white; font-weight: 850; }
.goal-form > small { display: block; margin-top: 7px; color: var(--muted-light); font-size: 10px; }
.curve-total, .my-rank { padding: 6px 9px; border-radius: 999px; background: var(--purple-soft); color: var(--purple-dark); font-size: 11px; font-weight: 850; }
.learning-chart { margin-top: 10px; }
.learning-chart svg { display: block; width: 100%; height: 118px; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1.5; }
.chart-goal-line { stroke: var(--chart-target); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-line { fill: none; stroke: var(--chart-stroke); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-value { fill: var(--muted); font-size: 9px; font-weight: 850; }
.chart-point { fill: white; stroke: var(--chart-stroke); stroke-width: 3; }
.chart-point.reached { fill: var(--orange); stroke: var(--orange); }
.chart-labels { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: -10px; color: var(--muted-light); font-size: 9px; text-align: center; }
.ranking-columns { display: grid; grid-template-columns: 28px 32px minmax(0, 1fr) auto; gap: 9px; margin: 13px 9px 0; color: var(--muted-light); font-size: 9px; font-weight: 750; }
.ranking-columns span:last-child { text-align: right; }
.ranking-scroll { position: relative; margin-top: 7px; }
.ranking-list {
  display: grid;
  gap: 7px;
  max-height: 258px;
  padding-right: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ranking-list::-webkit-scrollbar { display: none; }
.ranking-list:focus-visible { outline: 2px solid rgba(240, 162, 58, .35); outline-offset: 3px; border-radius: 13px; }
.ranking-scrollbar {
  position: absolute;
  top: 3px;
  right: 2px;
  bottom: 3px;
  width: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dedbe1;
}
.ranking-scrollbar[hidden] { display: none; }
.ranking-scrollbar span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 36px;
  border-radius: inherit;
  background: linear-gradient(180deg, #f5b84f, #ec8d2f);
  box-shadow: 0 0 8px rgba(240, 162, 58, .22);
  cursor: grab;
  touch-action: none;
}
.ranking-scrollbar span:active { cursor: grabbing; }
.ranking-row { display: grid; grid-template-columns: 28px 32px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 46px; padding: 6px 9px; border-radius: 12px; background: #faf9fd; }
.ranking-row.is-me { background: var(--purple-soft); color: var(--purple-dark); }
.ranking-position { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #ebe7f2; color: var(--muted); font-size: 11px; font-weight: 900; }
.ranking-row:nth-child(1) .ranking-position { background: #fff0c7; color: #9b6900; }
.ranking-row:nth-child(2) .ranking-position { background: #edeef2; color: #626778; }
.ranking-row:nth-child(3) .ranking-position { background: #f6e1d2; color: #9a562b; }
.ranking-name { display: flex; min-width: 0; align-items: baseline; gap: 7px; font-size: 13px; font-weight: 850; }
.ranking-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-avatar { display: grid; place-items: center; width: 30px; height: 30px; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 16px; font-style: normal; line-height: 1; }
.ranking-name small { color: var(--purple); font-size: 9px; }
.ranking-row > strong { font-size: 12px; }
.settings-button {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid #dcd3ff;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 13px;
  font-weight: 850;
}
.profile-identity { display: flex; align-items: center; gap: 12px; }
.profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 2px solid #2c302e;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--purple-soft), var(--surface));
  box-shadow: 0 9px 24px rgba(69,34,181,.12);
  font-size: 27px;
  line-height: 1;
  clip-path: circle(50% at 50% 50%);
}
.profile-avatar > span { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: 50%; clip-path: circle(50% at 50% 50%); }
.profile-avatar img, .ranking-avatar img, .avatar-upload-preview img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 999px; clip-path: circle(50% at 50% 50%); }
.profile-avatar img { transform: scale(1.18); }
.ranking-avatar img, .avatar-upload-preview img { transform: scale(1.06); }
.profile-avatar::after {
  content: none;
}
.settings-modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(24,16,49,.42);
  backdrop-filter: blur(5px);
}
.settings-modal[hidden] { display: none; }
.settings-sheet {
  width: min(394px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(23,18,45,.27);
  animation: modal-up .28s ease both;
}
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings-heading span { color: var(--purple); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.settings-heading h2 { margin-top: 3px; }
.settings-heading button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 24px;
  line-height: 1;
}
#settingsForm { display: grid; gap: 14px; margin-top: 18px; }
.settings-field > span, .theme-field legend, .avatar-field legend { color: var(--ink); font-size: 12px; font-weight: 850; }
.settings-field input {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1.5px solid #ded8ec;
  border-radius: 15px;
  background: #fbfaff;
  color: var(--ink);
}
.theme-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.avatar-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.avatar-upload {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  cursor: default;
}
.avatar-upload-preview {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  clip-path: circle(50% at 50% 50%);
  background: var(--purple-soft);
  font-size: 25px;
}
.avatar-upload-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.avatar-upload-copy strong { color: var(--ink); font-size: 13px; }
.avatar-upload-copy small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.avatar-upload-controls { display: flex; align-items: center; justify-content: flex-end; }
.avatar-upload-action { display: block; padding: 7px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--purple-dark); font-size: 10px; font-weight: 900; cursor: pointer; }
.avatar-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.avatar-upload:focus-within { outline: 3px solid rgba(255, 122, 26, .28); outline-offset: 2px; }
.avatar-feedback { min-height: 14px; margin: 6px 2px 0; color: var(--muted); font-size: 10px; }
.avatar-feedback:empty { display: none; }
.avatar-feedback.success { color: var(--green); }
.avatar-feedback.error { color: var(--red); }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.theme-options label {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.theme-options label:has(input:checked) { border-color: var(--purple); background: var(--purple-soft); color: var(--purple-dark); }
.theme-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-dot { width: 14px; height: 14px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #d8d2e5; }
.theme-dot.purple { background: #7350c9; }
.theme-dot.orange { background: #e8622b; }
.theme-dot.dark { background: #000; }
.recent-logs { padding: 14px; border-radius: 18px; background: var(--purple-soft); }
.recent-logs > div:first-child { display: flex; align-items: center; justify-content: space-between; }
.recent-logs > div:first-child strong { font-size: 13px; }
.recent-logs > div:first-child span { color: var(--muted); font-size: 10px; }
#recentLogsList { display: grid; gap: 8px; margin-top: 10px; }
.log-row { display: grid; grid-template-columns: 9px 1fr; align-items: start; gap: 9px; }
.log-mark { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--purple); }
.log-mark.retry, .log-mark.delete { background: var(--red); }
.log-mark.final { background: var(--green); }
.log-mark.clue { background: var(--orange); }
.log-row > span:last-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.log-row strong { color: var(--ink); font-size: 11px; font-weight: 750; }
.log-row small { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.logs-empty { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.log-upload {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  padding: 8px 11px;
  border: 1px solid rgba(115,80,201,.2);
  border-radius: 14px;
  background: rgba(255,255,255,.5);
  color: var(--ink);
  text-align: left;
}
.log-upload-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: var(--purple); color: white; font-size: 18px; font-weight: 900; }
.log-upload > span:last-child { display: grid; gap: 2px; }
.log-upload strong { font-size: 12px; }
.log-upload small { color: var(--muted); font-size: 9px; }
.log-upload:disabled { cursor: wait; opacity: .58; }
.log-upload-feedback { min-height: 14px; margin: 7px 2px -2px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.log-upload-feedback.success { color: var(--green); }
.log-upload-feedback.error { color: var(--red); }
.save-settings { min-height: 50px; border-radius: 16px; background: var(--purple); color: white; font-weight: 850; box-shadow: 0 9px 20px rgba(96,55,215,.20); }
.save-settings:disabled { cursor: wait; opacity: .55; }
.target-editor-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#customTargetForm { display: grid; gap: 14px; margin-top: 18px; }
.translation-status { display: block; min-height: 15px; margin-top: 6px; color: var(--muted-light); font-size: 10px; font-weight: 650; }
.translation-status.loading { color: var(--orange); }
.translation-status.success { color: var(--green); }
.translation-status.manual { color: var(--purple); }
.translation-status.error { color: var(--red); }
.target-form-actions { display: grid; grid-template-columns: .72fr 1.28fr; gap: 9px; }
.target-cancel { min-height: 50px; border-radius: 16px; background: var(--purple-soft); color: var(--purple-dark); font-weight: 850; }
.target-next-button {
  width: 100%;
  min-height: 48px;
  margin-top: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 84%, var(--purple-soft));
  color: var(--muted);
  font-size: 14px;
  font-weight: 620;
  letter-spacing: .01em;
  box-shadow: 0 7px 18px rgba(34, 26, 56, .06);
}
.target-next-button:active { transform: scale(.985); }
body[data-theme="dark"] .target-next-button {
  border-color: #303432;
  background: #0d100f;
  color: #d0cfcb;
  box-shadow: 6px 8px 18px rgba(0, 0, 0, .26);
}
body.modal-open { overflow: hidden; }
.auth-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background: #000;
  color: #f3f1ec;
}
.auth-screen[hidden] { display: none; }
body.auth-locked { overflow: hidden; background: #000; }
body.auth-locked .app-shell,
body.auth-locked > .modal-layer,
body.auth-locked > .settings-modal { visibility: hidden; }
.auth-shell { width: min(394px, 100%); min-height: calc(100dvh - 44px); display: grid; align-content: center; gap: 22px; margin: 0 auto; }
.auth-brand { display: flex; align-items: center; gap: 11px; padding: 0 5px; }
.auth-logo { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; background: #f0a23a; color: #160d07; font-size: 21px; font-weight: 950; box-shadow: 5px 6px 14px rgba(32,93,128,.28); }
.auth-brand > span:last-child { display: grid; gap: 2px; }
.auth-brand b { color: #f3f1ec; font-size: 15px; letter-spacing: .14em; }
.auth-brand small { color: #85817b; font-size: 10px; }
.auth-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 25px;
  border: 1px solid #292d2b;
  border-radius: 30px;
  background: #0b0c0c;
  box-shadow: 9px 12px 24px rgba(32,93,128,.28);
}
.auth-orbit { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.auth-orbit-one { top: -64px; right: -76px; width: 190px; height: 190px; border: 34px solid rgba(168,117,245,.14); }
.auth-orbit-two { top: 62px; right: -38px; width: 92px; height: 92px; border: 18px solid rgba(87,196,147,.09); }
.auth-heading > span { color: #f0a23a; font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.auth-heading h1 { max-width: 270px; margin: 7px 0 0; color: #f3f1ec; font-size: 27px; line-height: 1.12; letter-spacing: -.025em; }
.auth-heading p { margin: 9px 0 0; color: #aaa69e; font-size: 12px; line-height: 1.55; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 20px; padding: 4px; border-radius: 15px; background: #111312; }
.auth-tabs button { min-height: 39px; border-radius: 12px; background: transparent; color: #817e78; font-size: 12px; font-weight: 850; }
.auth-tabs button.active { background: #2c1b06; color: #f0a23a; box-shadow: inset 0 0 0 1px #59401c; }
.auth-form { display: grid; gap: 11px; margin-top: 16px; }
.auth-form[hidden] { display: none; }
.auth-form label { display: grid; gap: 6px; }
.auth-form label > span { color: #aaa69e; font-size: 10px; font-weight: 800; }
.auth-form input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #2a2e2c; border-radius: 14px; background: #101312; color: #f3f1ec; font-size: 14px; box-shadow: 3px 4px 9px rgba(32,93,128,.20); }
.auth-form input::placeholder { color: #65635e; }
.auth-form input:focus-visible { outline-color: rgba(240,162,58,.38); }
.auth-primary { min-height: 48px; margin-top: 2px; border-radius: 15px; background: #f0a23a; color: #160d07; font-size: 14px; font-weight: 900; box-shadow: 5px 7px 14px rgba(32,93,128,.24); }
.auth-code-note { margin: -2px 2px 0; color: #817e78; font-size: 10px; }
.auth-code-note strong { color: #57c493; letter-spacing: .06em; }
.auth-feedback { min-height: 17px; margin: 10px 2px 0; color: #aaa69e; font-size: 11px; line-height: 1.45; }
.auth-feedback.error { color: #df7a7d; font-weight: 750; }
.auth-feedback.success { color: #57c493; font-weight: 750; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 5px 0 10px; color: #65635e; font-size: 9px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #252927; }
.guest-entry { width: 100%; min-height: 53px; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 9px 12px 9px 15px; border: 1px solid #2c302e; border-radius: 16px; background: #111312; color: #f3f1ec; text-align: left; }
.guest-entry span, .guest-entry small { grid-column: 1; }
.guest-entry span { font-size: 13px; font-weight: 850; }
.guest-entry small { margin-top: 2px; color: #817e78; font-size: 9px; }
.guest-entry b { grid-column: 2; grid-row: 1 / 3; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: #21163a; color: #a875f5; font-size: 17px; }
.logout-button { min-height: 44px; border: 1px solid #493034; border-radius: 15px; background: #211214; color: #df7a7d; font-size: 12px; font-weight: 850; }
body[data-theme="orange"] {
  --ink: #2d201b;
  --muted: #7d6d65;
  --muted-light: #a1948d;
  --purple: #dd642e;
  --purple-dark: #a8431c;
  --purple-soft: #ffede3;
  --orange: #dd642e;
  --orange-soft: #fff0e8;
  --green: #2a8661;
  --green-soft: #e7f4ed;
  --page: #fff8f4;
  --line: #eadfd9;
  --progress-track: #e6eee8;
  --progress-start: #277d5d;
  --progress-end: #69ad8d;
  --chart-grid: #eee1da;
  --chart-target: #d58d63;
  --chart-stroke: #c65b2d;
  --shadow: 0 16px 42px rgba(111,67,45,.09);
  background: #f1e7e1;
}
body[data-theme="orange"] .clue-cover { background: linear-gradient(135deg, #fff1e8, #fffaf7); }
body[data-theme="orange"] .final-cover { background: linear-gradient(135deg, #ffe7d8, #fff7f1); }
body[data-theme="orange"] .library-cover { background: linear-gradient(135deg, #eaf6ef, #fbfffc); }
body[data-theme="purple"],
body[data-theme="orange"] {
  --progress-track: #fff0c5;
  --progress-start: #f4b21f;
  --progress-end: #ffd45f;
}
body[data-theme="purple"] .goal-progress span,
body[data-theme="orange"] .goal-progress span {
  box-shadow: 0 0 10px rgba(244, 178, 31, .18);
}
body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f1ec;
  --muted: #aaa69e;
  --muted-light: #74716b;
  --purple: #f0a23a;
  --purple-dark: #f0a23a;
  --purple-soft: #251706;
  --orange: #f0a23a;
  --orange-soft: #2c1b06;
  --green: #57c493;
  --green-soft: #0a2217;
  --red: #df7a7d;
  --surface: #0b0c0c;
  --page: #000000;
  --line: #252927;
  --progress-track: #2b210f;
  --progress-start: #d98b28;
  --progress-end: #f6c453;
  --chart-grid: #2c2041;
  --chart-target: #f0a23a;
  --chart-stroke: #a875f5;
  --shadow: none;
  background: #000000;
}
.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 0;
  width: min(430px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
}
.nav-item { min-height: 54px; border-radius: 16px; background: transparent; color: var(--muted); }
.nav-item span, .nav-item small { display: block; }
.nav-item span { font-size: 14px; font-weight: 850; }
.nav-item small { margin-top: 2px; font-size: 10px; }
.nav-item.active { background: var(--purple-soft); color: var(--purple-dark); }
body[data-theme="dark"] .bottom-nav {
  border-top-color: #252927;
  background: rgba(2,3,3,.97);
  box-shadow: 0 -12px 32px rgba(0,0,0,.55);
}
body[data-theme="dark"] .nav-item { color: #817e78; }
body[data-theme="dark"] .nav-item.active { background: #251706; color: #f0a23a; }
body[data-theme="dark"] .app-shell { background: #000; }
body[data-theme="dark"] .settings-modal,
body[data-theme="dark"] .modal-layer { background: rgba(0,0,0,.82); }
body[data-theme="dark"] .settings-button { border-color: #2c302e; }
body[data-theme="dark"] .profile-avatar { border-color: #2c302e; background: linear-gradient(145deg, #101c25, #090a09); box-shadow: none; }
body[data-theme="dark"] .clue-form,
body[data-theme="dark"] .results-list,
body[data-theme="dark"] .review-card,
body[data-theme="dark"] .final-test-card,
body[data-theme="dark"] .daily-goal-card,
body[data-theme="dark"] .learning-card,
body[data-theme="dark"] .ranking-card,
body[data-theme="dark"] .settings-sheet,
body[data-theme="dark"] .victory-card {
  border-color: #252927;
  background: #0b0c0c;
  box-shadow: 7px 9px 18px rgba(32,93,128,.28);
}
body[data-theme="dark"] .input-row input,
body[data-theme="dark"] .meaning-form input,
body[data-theme="dark"] .review-option,
body[data-theme="dark"] .library-search input,
body[data-theme="dark"] .library-editor input,
body[data-theme="dark"] .goal-form input,
body[data-theme="dark"] .settings-field input {
  border-color: #2a2e2c;
  background: #101312;
  color: var(--ink);
  box-shadow: 3px 4px 9px rgba(32,93,128,.24);
}
body[data-theme="dark"] .candidate-row,
body[data-theme="dark"] .library-word-row { border-color: #202422; background: #080a09; }
body[data-theme="dark"] .library-pronounce { border-color: #3a2a16; background: #251706; color: #f0a23a; }
body[data-theme="dark"] .library-pronounce.playing { background: #f0a23a; color: #160d07; }
body[data-theme="dark"] .candidate-row:hover,
body[data-theme="dark"] .candidate-row.correct-target { background: #12100d; }
body[data-theme="dark"] .rank { background: #171918; color: #918d85; }
body[data-theme="dark"] .candidate-row.correct-target .rank { background: var(--purple); color: #160d07; }
body[data-theme="dark"] .clue-chip { border-color: #614116; background: #251706; color: #f0a23a; }
body[data-theme="dark"] .result-source-badge { background: #211b34; color: #b9a4ff; }
body[data-theme="dark"] .match-mode-switch { background: #17141e; box-shadow: inset 0 0 0 1px #2c2836; }
body[data-theme="dark"] .clue-chip .remove-mark { color: #b5792c; }
body[data-theme="dark"] .clue-cover { background: linear-gradient(135deg, #111c25, #070808); border-color: #2c302e; }
body[data-theme="dark"] .final-cover { background: linear-gradient(135deg, #101d27, #080909); border-color: #2c302e; }
body[data-theme="dark"] .library-cover { background: linear-gradient(135deg, #0d1d25, #070808); border-color: #2c302e; }
body[data-theme="dark"] .clue-cover::after { border-color: rgba(240,162,58,.22); }
body[data-theme="dark"] .final-cover::after { border-color: rgba(85,183,245,.20); }
body[data-theme="dark"] .library-cover::after { border-color: rgba(87,196,147,.20); }
body[data-theme="dark"] .cover-number,
body[data-theme="dark"] .cover-badge { background: #111; box-shadow: inset 0 0 0 1px #292929; }
body[data-theme="dark"] .panel-back { border-color: #2c302e; background: #0e151a; }
body[data-theme="dark"] .review-clue { border: 1px solid #4b3320; background: #1d140e; color: #c8a9ff; }
body[data-theme="dark"] .review-clue-connector { color: #8c8983; }
body[data-theme="dark"] .review-clue-unknown { background: #9d69ff; color: #fff; box-shadow: 0 7px 18px rgba(157,105,255,.26); }
body[data-theme="dark"] .review-option.correct { border-color: #a875f5; background: #1d1230; color: #c9a7ff; box-shadow: inset 0 0 0 1px rgba(168,117,245,.16); }
body[data-theme="dark"] .review-option.wrong,
body[data-theme="dark"] .clue-chip.translated-clue { border-color: #61383a; background: #261315; color: #e78c8f; }
body[data-theme="dark"] #reviewFeedback.inline-feedback.success,
body[data-theme="dark"] #meaningFeedback.inline-feedback.success { color: #a875f5; }
body[data-theme="dark"] .alphabet-grid button { border-color: #292c2a; background: #0d0f0e; color: #aaa69e; }
body[data-theme="dark"] .alphabet-grid button.active { border-color: var(--purple); background: var(--purple); color: #160d07; }
body[data-theme="dark"] .library-editor,
body[data-theme="dark"] .recent-logs { border-color: #2c302e; background: #0b161d; }
body[data-theme="dark"] .log-upload { border-color: #2c302e; background: #10171c; }
body[data-theme="dark"] .goal-progress span { box-shadow: 0 0 14px rgba(240,162,58,.24); }
body[data-theme="dark"] .chart-point { fill: #000; }
body[data-theme="dark"] .chart-point.reached { fill: var(--green); stroke: var(--green); }
body[data-theme="dark"] .ranking-row { background: #111312; }
body[data-theme="dark"] .ranking-row.is-me { background: #251706; color: #f0a23a; }
body[data-theme="dark"] .ranking-scrollbar { background: #262927; }
body[data-theme="dark"] .ranking-position { background: #1b1d1c; color: #d5d2cc; }
body[data-theme="dark"] .ranking-row:nth-child(1) .ranking-position { background: #30200d; color: #f0a23a; }
body[data-theme="dark"] .ranking-row:nth-child(2) .ranking-position { background: #242625; color: #d1d1cc; }
body[data-theme="dark"] .ranking-row:nth-child(3) .ranking-position { background: #2b1d0d; color: #d99131; }
body[data-theme="dark"] .theme-options label,
body[data-theme="dark"] .avatar-upload,
body[data-theme="dark"] .avatar-upload-preview { border-color: #2c302e; background: #0b1014; }
body[data-theme="dark"] .theme-options label:has(input:checked) { border-color: var(--purple); background: #251706; color: #f0a23a; }
body[data-theme="dark"] .saved-formula { border-color: #38291f; background: #100c09; }
body[data-theme="dark"] .formula-clue { background: #1d140e; }
body[data-theme="dark"] .library-delete { background: #261315; color: #e78c8f; }
body[data-theme="dark"] .library-delete.confirming { background: var(--red); color: #000; }
body[data-theme="dark"] .input-row button,
body[data-theme="dark"] .meaning-form button,
body[data-theme="dark"] .primary-button,
body[data-theme="dark"] .goal-form button,
body[data-theme="dark"] .save-settings,
body[data-theme="dark"] .review-action { color: #160d07; box-shadow: none; }
body[data-theme="dark"] .score-pill strong,
body[data-theme="dark"] .score-round b { color: #160d07; }
body[data-theme="dark"] button:focus-visible,
body[data-theme="dark"] input:focus-visible { outline-color: rgba(240,162,58,.42); }
.modal-layer {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(24px, calc(env(safe-area-inset-top) + 12px)) 20px max(24px, calc(env(safe-area-inset-bottom) + 12px));
  background: rgba(18, 12, 35, .54);
  backdrop-filter: blur(10px);
}
.modal-layer[hidden] { display: none; }
body:has(#victoryModal:not([hidden])) .bottom-nav {
  z-index: 40;
}
.victory-card {
  width: min(368px, 100%);
  max-height: calc(100dvh - max(48px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 24px));
  overflow-y: auto;
  padding: 30px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: white;
  box-shadow: 12px 18px 50px rgba(23,18,45,.30);
  text-align: center;
  animation: modal-center .34s cubic-bezier(.22,.8,.28,1) both;
}
@keyframes modal-center { from { opacity: 0; transform: translateY(8px) scale(.94); } }
.victory-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--orange); color: white; font-size: 32px; font-weight: 900; box-shadow: 0 12px 25px rgba(255,179,35,.24); }
.victory-card > p:first-of-type { margin: 0; color: var(--orange); font-size: 12px; font-weight: 850; letter-spacing: .08em; }
.victory-card h2 { margin: 8px 0 0; font-size: 30px; line-height: 1.15; letter-spacing: -.035em; }
.saved-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
  padding: 15px 14px;
  border: 1px solid #ded6fb;
  border-radius: 18px;
  background: #faf9ff;
  color: var(--purple-dark);
  font-size: 14px;
  font-weight: 500;
}
.formula-clue-group { display: contents; }
.formula-term,
.formula-result {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.formula-clue {
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--purple-soft);
  font-weight: 500;
  line-height: 1;
  overflow-wrap: anywhere;
}
.formula-connector { color: #a198b7; font-size: 16px; font-weight: 500; }
.formula-arrow { color: var(--orange); font-size: 19px; line-height: 1; }
.formula-target {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 11px;
  background: var(--purple);
  color: white;
  font-weight: 550;
  line-height: 1;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 14px rgba(96,55,215,.18);
}
.saved-note { margin: 14px 8px 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.primary-button { width: 100%; min-height: 52px; border-radius: 17px; }
.secondary-button { width: 100%; min-height: 44px; margin-top: 8px; background: transparent; color: var(--muted); font-weight: 750; }
@media (min-width: 431px) {
  .app-shell { min-height: calc(100dvh - 28px); margin: 14px auto; border-radius: 34px; box-shadow: 0 28px 80px rgba(23,18,45,.18); }
  .bottom-nav { bottom: 14px; border-radius: 0 0 34px 34px; }
}
@media (max-width: 360px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .app-header { margin-left: -15px; margin-right: -15px; padding-left: 15px; padding-right: 15px; }
  .target-block h1 { font-size: 27px; }
  h2 { font-size: 22px; }
  .input-row button { padding: 0 14px; }
}
@media (max-height: 760px) {
  .auth-screen { padding-top: 12px; padding-bottom: 12px; }
  .auth-shell { min-height: calc(100dvh - 24px); gap: 12px; }
  .auth-logo { width: 37px; height: 37px; font-size: 18px; }
  .auth-card { padding: 19px 20px; border-radius: 24px; }
  .auth-heading h1 { margin-top: 4px; font-size: 23px; }
  .auth-heading p { margin-top: 5px; }
  .auth-tabs { margin-top: 12px; }
  .auth-form { gap: 8px; margin-top: 11px; }
  .auth-form input { height: 42px; }
  .auth-primary { min-height: 44px; }
  .auth-feedback { margin-top: 6px; }
  .auth-divider { margin: 2px 0 7px; }
  .guest-entry { min-height: 48px; }
  .app-shell {
    padding-top: 12px;
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }
  .view { padding-top: 8px; }
  .step-label { font-size: 9px; }
  .prompt-target {
    gap: 7px;
    margin-top: 3px;
    font-size: 28px;
  }
  .prompt-target small { font-size: 13px; }
  .round-count { font-size: 11px; }
  .score-round {
    gap: 5px;
    padding: 3px 4px 3px 9px;
  }
  .score-round b {
    min-width: 25px;
    height: 25px;
    padding: 0 6px;
    font-size: 11px;
  }
  .clue-form {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 18px;
  }
  .clue-form label {
    margin-bottom: 5px;
    font-size: 11px;
  }
  .input-row { gap: 7px; }
  .input-row input {
    height: 40px;
    border-radius: 13px;
    font-size: 14px;
  }
  .input-row button {
    min-height: 40px;
    padding: 0 15px;
    border-radius: 13px;
    font-size: 14px;
  }
  .clue-strip {
    gap: 6px;
    min-height: 29px;
    margin-top: 7px;
  }
  .clue-chip {
    min-height: 29px;
    padding: 0 10px;
    font-size: 13px;
  }
  .description-row { margin-top: 1px; }
  .description-actions { gap: 6px; }
  .result-source-badge { padding: 3px 7px; font-size: 9px; }
  .description-question { font-size: 11px; }
  .description-question .description-label {
    margin-right: 6px;
    font-size: 9px;
  }
  .results-section { margin-top: 1px; }
  .section-title { align-items: center; }
  .text-button {
    padding: 3px 0 3px 10px;
    font-size: 11px;
  }
  .results-list {
    margin-top: 0;
    border-radius: 18px;
  }
  .candidate-row {
    min-height: 49px;
    grid-template-columns: 26px 1fr auto;
    gap: 8px;
    padding: 4px 13px;
  }
  .rank {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
  .candidate-word { gap: 1px; }
  .candidate-word strong { font-size: 15px; }
  .candidate-word small { font-size: 10px; }
  .candidate-word small span {
    margin-left: 5px;
    font-size: 9px;
  }
  .percent { font-size: 14px; }
  .bottom-nav {
    padding-top: 5px;
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }
  .nav-item {
    min-height: 45px;
    border-radius: 13px;
  }
  .nav-item span { font-size: 12px; }
  .nav-item small { margin-top: 0; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}



/* 2026-09 editorial dark system */
.view-orbits,
.sheet-orbits { display: none; }

body[data-theme="dark"] {
  --ink: #f7f6f2;
  --muted: #aaa8a3;
  --muted-light: #74736f;
  --purple: #9d69ff;
  --purple-dark: #bd9aff;
  --purple-soft: #20172f;
  --orange: #ffb323;
  --orange-soft: #2b1b05;
  --red: #ff5f68;
  --surface: rgba(12, 14, 13, .91);
  --page: #000;
  --line: #292d2b;
  --progress-track: #2a2b29;
  --progress-start: #ffbd36;
  --progress-end: #ffd461;
  --chart-grid: #242624;
  --chart-target: #e6ad36;
  --chart-stroke: #9457ff;
  --shadow: 9px 12px 28px rgba(92, 49, 0, .20);
  font-family: "Avenir Next", Avenir, "SF Pro Display", "PingFang SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  letter-spacing: -.01em;
}

body[data-theme="dark"] .app-shell {
  padding-top: 0;
  padding-left: 14px;
  padding-right: 14px;
  background: #000;
}

body[data-theme="dark"] .view {
  position: relative;
  isolation: isolate;
  padding-top: max(142px, calc(env(safe-area-inset-top) + 32px));
}

body[data-theme="dark"] .view > *:not(.view-orbits) {
  position: relative;
  z-index: 1;
}

body[data-theme="dark"] .view-orbits,
body[data-theme="dark"] .sheet-orbits {
  position: absolute;
  z-index: 0;
  top: -74px;
  right: -164px;
  display: block;
  width: 610px;
  max-width: none;
  height: auto;
  pointer-events: none;
  user-select: none;
}

body[data-theme="dark"] .view[data-view="find"] > .progress-copy {
  min-height: 80px;
  align-items: center;
  padding: 0 12px 2px;
}

.target-word-group { display: flex; align-items: flex-start; gap: 14px; }

body[data-theme="dark"] .prompt-target {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0;
  color: #fff;
  font-size: 36px;
  font-weight: 750;
  letter-spacing: -.045em;
}

body[data-theme="dark"] .prompt-target small {
  color: #8f8f91;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
}

.target-pronounce {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: 1px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #151716;
  color: var(--ink);
  box-shadow: 5px 7px 16px rgba(0, 0, 0, .34);
}

.target-pronounce[hidden] { display: none; }
.target-pronounce svg { width: 21px; height: 21px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.target-pronounce.playing { color: #15100a; background: var(--orange); animation: pronunciation-pulse .8s ease infinite alternate; }

body[data-theme="dark"] .score-round {
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #949491;
  font-size: 11px;
  font-weight: 650;
}

body[data-theme="dark"] .score-round b {
  display: flex;
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1;
  white-space: nowrap;
}

.current-score-value { color: var(--orange); font-size: 28px; font-weight: 850; }
.current-score-goal { align-self: flex-end; padding-bottom: 2px; color: #8f8e92; font-size: 14px; font-weight: 600; }

body[data-theme="dark"] .clue-form {
  margin-top: 10px;
  padding: 15px;
  border: 1px solid #292d2b;
  border-radius: 24px;
  background: rgba(12, 15, 14, .97);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .clue-form label {
  margin-bottom: 8px;
  color: #dfded9;
  font-size: 12px;
  font-weight: 650;
}

body[data-theme="dark"] .input-row { gap: 9px; }
body[data-theme="dark"] .input-row input,
body[data-theme="dark"] .meaning-form input {
  height: 48px;
  border: 1px solid #565a57;
  border-radius: 17px;
  background: rgba(11, 14, 13, .72);
  box-shadow: none;
}
body[data-theme="dark"] .input-row button,
body[data-theme="dark"] .meaning-form button,
body[data-theme="dark"] .primary-button,
body[data-theme="dark"] .save-settings,
body[data-theme="dark"] .review-action {
  min-height: 48px;
  border-radius: 17px;
  background: #ffb323;
  color: #160f06;
  box-shadow: 6px 8px 20px rgba(100, 54, 0, .24);
}

body[data-theme="dark"] .clue-strip {
  min-height: 38px;
  gap: 9px;
  margin: 10px 2px 7px;
}

body[data-theme="dark"] .clue-chip {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #6a4511;
  border-radius: 999px;
  background: rgba(56, 35, 7, .76);
  color: var(--orange);
  font-size: 15px;
  box-shadow: 5px 7px 17px rgba(79, 43, 0, .16);
}
body[data-theme="dark"] .clue-chip.translated-clue { border-color: #6d3236; background: #2b1215; color: var(--red); }
body[data-theme="dark"] .clue-chip.translated-clue .remove-mark { color: #ef858a; }
body[data-theme="dark"] .result-source-badge { display: none !important; }

body[data-theme="dark"] .description-row {
  min-height: 38px;
  margin: 0 2px 5px;
}
body[data-theme="dark"] .description-question { color: #f3f2ef; font-size: 13px; }
body[data-theme="dark"] .description-question .description-label { color: var(--orange); font-size: 11px; }
body[data-theme="dark"] .match-mode-switch { height: 34px; grid-template-columns: repeat(2, 48px); padding: 3px; background: #17141e; box-shadow: inset 0 0 0 1px #332b41; }
body[data-theme="dark"] .match-mode-switch::before { width: 48px; height: 28px; background: var(--purple); }
body[data-theme="dark"] .match-mode-switch.is-free::before { transform: translateX(48px); background: #ffb323; }
body[data-theme="dark"] .match-mode-switch button { font-size: 12px; }
body[data-theme="dark"] .match-mode-switch.is-free button.is-active { color: #171006; }

body[data-theme="dark"] .results-list {
  display: grid;
  gap: 7px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body[data-theme="dark"] .candidate-row,
body[data-theme="dark"] .candidate-row:last-child {
  min-height: 61px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 8px 15px;
  border: 1px solid #272b29;
  border-radius: 21px;
  background: rgba(10, 12, 11, .98);
  box-shadow: 5px 7px 16px rgba(0, 0, 0, .28);
}
body[data-theme="dark"] .candidate-row:hover { background: #121512; }
body[data-theme="dark"] .candidate-word { flex-direction: row; align-items: baseline; gap: 16px; }
body[data-theme="dark"] .candidate-word strong { font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
body[data-theme="dark"] .candidate-word small { color: #8e8d8a; font-size: 13px; }
body[data-theme="dark"] .rank { width: 31px; height: 31px; background: #1b1d1c; color: #c3c2bf; font-size: 12px; }
body[data-theme="dark"] .percent { color: var(--orange); font-size: 18px; font-weight: 800; }

body[data-theme="dark"] .bottom-nav {
  width: min(430px, calc(100% - 2px));
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 10px 26px max(10px, env(safe-area-inset-bottom));
  border: 1px solid #202321;
  border-bottom: 0;
  border-radius: 36px 36px 0 0;
  background: rgba(5, 6, 6, .96);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, .54), 18px 16px 40px rgba(99, 54, 0, .28);
}
body[data-theme="dark"] .nav-item { min-height: 58px; display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 999px; color: #8f908e; }
body[data-theme="dark"] .nav-item svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body[data-theme="dark"] .nav-item span { font-size: 12px; font-weight: 650; }
body[data-theme="dark"] .nav-item.active { background: rgba(55, 34, 11, .76); color: var(--orange); box-shadow: inset 0 0 0 1px rgba(255, 174, 28, .18), 6px 8px 18px rgba(74, 40, 0, .20); }

body[data-theme="dark"] .review-page-header {
  min-height: 66px;
  align-items: flex-end;
  padding: 0 10px;
}
body[data-theme="dark"] .review-title-row h2 { margin: 0; color: #fff; font-size: 34px; font-weight: 750; letter-spacing: -.045em; }
body[data-theme="dark"] #reviewCount { padding: 0 0 5px; background: transparent; color: #9c9b98; font-size: 12px; }
body[data-theme="dark"] .review-hub { gap: 11px; margin-top: 14px; }
body[data-theme="dark"] .review-cover {
  min-height: 145px;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px;
  border: 1px solid #2b2f2d;
  border-radius: 26px;
  background: rgba(12, 14, 13, .98);
  box-shadow: var(--shadow);
}
body[data-theme="dark"] .clue-cover,
body[data-theme="dark"] .final-cover,
body[data-theme="dark"] .library-cover { border-color: #2b2f2d; background: rgba(12, 14, 13, .98); }
body[data-theme="dark"] .review-cover::after { right: auto; bottom: -76px; left: -58px; width: 158px; height: 158px; border: 28px solid rgba(255, 179, 35, .18); }
body[data-theme="dark"] .final-cover::after { border-color: rgba(255, 95, 104, .16); }
body[data-theme="dark"] .library-cover::after { border-color: rgba(157, 105, 255, .16); }
body[data-theme="dark"] .cover-number { width: auto; height: auto; border-radius: 0; background: transparent; color: rgba(255, 179, 35, .48); box-shadow: none; font-size: 48px; font-weight: 500; letter-spacing: -.06em; }
body[data-theme="dark"] .final-cover .cover-number { color: rgba(255, 95, 104, .50); }
body[data-theme="dark"] .library-cover .cover-number { color: rgba(157, 105, 255, .48); }
body[data-theme="dark"] .cover-copy small { color: #b8b7b3; font-size: 10px; }
body[data-theme="dark"] .cover-copy strong { margin-top: 5px; color: #fff; font-size: 22px; font-weight: 720; }
body[data-theme="dark"] .cover-copy em { margin-top: 7px; color: #93928e; font-size: 10px; }
body[data-theme="dark"] .cover-badge { padding: 8px 11px; border: 1px solid #6b4715; background: #2b1b05; color: var(--orange); }

body[data-theme="dark"] .panel-back { border-color: #343836; background: #141615; color: var(--orange); box-shadow: 5px 7px 16px rgba(0, 0, 0, .34); }
body[data-theme="dark"] .review-panel { margin-top: 12px; }
body[data-theme="dark"] .panel-heading h2 { color: #fff; font-size: 25px; }
body[data-theme="dark"] .step-label { color: var(--orange); }
body[data-theme="dark"] .review-card,
body[data-theme="dark"] .final-test-card {
  border: 1px solid #292d2b;
  border-radius: 24px;
  background: rgba(11, 13, 12, .98);
  box-shadow: var(--shadow);
}
body[data-theme="dark"] .review-clue { border: 1px solid #4b3320; border-radius: 11px; background: #1d140e; color: #c8a9ff; }
body[data-theme="dark"] .review-option { border: 1px solid #303432; border-radius: 17px; background: #0d100f; color: #f2f1ed; box-shadow: 5px 7px 14px rgba(0, 0, 0, .22); }
body[data-theme="dark"] .review-option-letter { background: #1b1d1c; color: #b8b7b3; }
body[data-theme="dark"] .review-option.correct { border-color: #9d69ff; background: #211631; color: #c8a9ff; }
body[data-theme="dark"] .review-option.wrong { border-color: #8e3d43; background: #2b1316; color: #ff858c; }
body[data-theme="dark"] .review-option.correct .review-option-letter { background: #9d69ff; color: #fff; }
body[data-theme="dark"] .review-option.wrong .review-option-letter { background: #8e3d43; color: #fff; }
body[data-theme="dark"] #reviewFeedback.inline-feedback.success,
body[data-theme="dark"] #meaningFeedback.inline-feedback.success { color: #b58cff; }

body[data-theme="dark"] .library-search input,
body[data-theme="dark"] .library-editor input { border-color: #3c403e; border-radius: 17px; background: #0d100f; box-shadow: none; }
body[data-theme="dark"] .alphabet-grid { gap: 7px; }
body[data-theme="dark"] .alphabet-grid button { border-color: #292d2b; border-radius: 11px; background: #0e100f; color: #a5a49f; }
body[data-theme="dark"] .alphabet-grid button.active { border-color: #6b4715; background: #2b1b05; color: var(--orange); }
body[data-theme="dark"] .library-editor { border-color: #34283f; background: #171020; box-shadow: var(--shadow); }
body[data-theme="dark"] .library-word-row { border-color: #292d2b; border-radius: 19px; background: #0d100f; box-shadow: 5px 7px 16px rgba(0, 0, 0, .28); }
body[data-theme="dark"] .library-clue-list i { background: #2b1b05; color: var(--orange); }
body[data-theme="dark"] .library-pronounce { border-color: #5d3d12; background: #2b1b05; color: var(--orange); }

body[data-theme="dark"] .profile-identity { gap: 13px; }
body[data-theme="dark"] .profile-avatar { width: 58px; height: 58px; border: 1px solid #3a3e3b; background: #111; box-shadow: 7px 9px 19px rgba(0, 0, 0, .36); }
body[data-theme="dark"] .profile-identity h2 { margin-top: 3px; color: #fff; font-size: 28px; }
body[data-theme="dark"] .settings-button { min-height: 42px; padding: 0 16px; border: 1px solid #343836; background: #111413; color: #deddd9; box-shadow: 6px 8px 17px rgba(0, 0, 0, .30); }
body[data-theme="dark"] .archive-dashboard { gap: 11px; margin-top: 16px; }
body[data-theme="dark"] .daily-goal-card,
body[data-theme="dark"] .learning-card,
body[data-theme="dark"] .ranking-card {
  padding: 17px;
  border: 1px solid #292d2b;
  border-radius: 24px;
  background: rgba(11, 13, 12, .98);
  box-shadow: var(--shadow);
}
body[data-theme="dark"] .dashboard-kicker { color: #a7a6a2; font-size: 10px; }
body[data-theme="dark"] .dashboard-heading h3 { color: #fff; font-size: 20px; }
body[data-theme="dark"] .goal-score { color: var(--orange); font-size: 24px; }
body[data-theme="dark"] .goal-progress { background: #2a2b29; }
body[data-theme="dark"] .goal-progress span { background: #ffbd36; box-shadow: 0 0 14px rgba(255, 179, 34, .20); }
body[data-theme="dark"] .edit-goal-button { color: var(--orange); }
body[data-theme="dark"] .curve-total,
body[data-theme="dark"] .my-rank { border: 1px solid #664313; background: #2b1b05; color: var(--orange); }
body[data-theme="dark"] .chart-goal-line { stroke: #e4aa32; stroke-width: 1.4; stroke-dasharray: 5 4; }
body[data-theme="dark"] .chart-goal-label { fill: #e8b54a; font-size: 8px; font-weight: 800; }
body[data-theme="dark"] .chart-line { stroke: #9457ff; }
body[data-theme="dark"] .chart-point { fill: #090a09; stroke: #9457ff; }
body[data-theme="dark"] .chart-point.over-goal { fill: #ff5f68; stroke: #ff5f68; }
body[data-theme="dark"] .chart-value.over-goal { fill: #ff6f77; }
body[data-theme="dark"] .ranking-row { background: #101211; }
body[data-theme="dark"] .ranking-row.is-me { background: #241707; color: var(--orange); }
body[data-theme="dark"] .ranking-scrollbar { background: #272a28; }
body[data-theme="dark"] .ranking-scrollbar span { background: #ffb323; box-shadow: none; }

body[data-theme="dark"] .settings-modal { background: rgba(0, 0, 0, .84); backdrop-filter: blur(14px); }
body[data-theme="dark"] .settings-sheet {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  border: 1px solid #292d2b;
  background: #050606;
  box-shadow: 14px 20px 48px rgba(75, 40, 0, .28);
}
body[data-theme="dark"] .settings-sheet > *:not(.sheet-orbits) { position: relative; z-index: 1; }
body[data-theme="dark"] .sheet-orbits { top: -112px; right: -244px; width: 650px; opacity: .82; }
body[data-theme="dark"] .settings-heading { min-height: 78px; align-items: flex-end; }
body[data-theme="dark"] .settings-heading span { color: #a5a49f; }
body[data-theme="dark"] .settings-heading h2 { color: #fff; font-size: 30px; }
body[data-theme="dark"] .settings-heading button { background: #171918; color: var(--orange); }
body[data-theme="dark"] #settingsForm { gap: 13px; margin-top: 16px; }
body[data-theme="dark"] .avatar-upload,
body[data-theme="dark"] .theme-options label,
body[data-theme="dark"] .settings-field input { border-color: #303432; background: #0d100f; box-shadow: none; }
body[data-theme="dark"] .avatar-upload-action { background: #2b1b05; color: var(--orange); }
body[data-theme="dark"] .theme-options label:has(input:checked) { border-color: #694613; background: #2b1b05; color: var(--orange); }
body[data-theme="dark"] .recent-logs { border: 1px solid #292d2b; background: #0c0e0d; }
body[data-theme="dark"] .log-upload { border-color: #5b3c12; background: #211608; }
body[data-theme="dark"] .log-upload-icon { background: var(--orange); color: #171006; }
body[data-theme="dark"] .logout-button { border-color: #673438; background: #241214; color: #f38389; }

@media (max-height: 880px) {
  body[data-theme="dark"] .view { padding-top: max(104px, calc(env(safe-area-inset-top) + 32px)); }
  body[data-theme="dark"] .view-orbits { top: -78px; right: -154px; width: 560px; }
  body[data-theme="dark"] .view[data-view="find"] > .progress-copy { min-height: 66px; }
  body[data-theme="dark"] .prompt-target { font-size: 31px; }
  .target-pronounce { width: 39px; height: 39px; }
  body[data-theme="dark"] .clue-form { margin-top: 6px; padding: 11px 13px; border-radius: 20px; }
  body[data-theme="dark"] .input-row input { height: 41px; }
  body[data-theme="dark"] .input-row button { min-height: 41px; }
  body[data-theme="dark"] .clue-strip { min-height: 31px; margin-top: 7px; margin-bottom: 4px; }
  body[data-theme="dark"] .clue-chip { min-height: 31px; font-size: 13px; }
  body[data-theme="dark"] .description-row { min-height: 33px; margin-bottom: 3px; }
  body[data-theme="dark"] .candidate-row,
  body[data-theme="dark"] .candidate-row:last-child { min-height: 50px; padding-top: 5px; padding-bottom: 5px; }
  body[data-theme="dark"] .candidate-word strong { font-size: 17px; }
  body[data-theme="dark"] .percent { font-size: 16px; }
  body[data-theme="dark"] .review-cover { min-height: 121px; }
  body[data-theme="dark"] .cover-number { font-size: 42px; }
  body[data-theme="dark"] .bottom-nav { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  body[data-theme="dark"] .nav-item { min-height: 50px; }
}

@media (max-height: 800px) {
  body[data-theme="dark"] .app-shell {
    padding-top: 0;
    padding-bottom: calc(54px + env(safe-area-inset-bottom));
  }
  body[data-theme="dark"] .view { padding-top: max(78px, calc(env(safe-area-inset-top) + 32px)); }
  body[data-theme="dark"] .view-orbits { top: -86px; right: -132px; width: 500px; }
  body[data-theme="dark"] .view[data-view="find"] > .progress-copy { min-height: 53px; padding-bottom: 0; }
  body[data-theme="dark"] .prompt-target { gap: 0; font-size: 26px; }
  body[data-theme="dark"] .prompt-target small { font-size: 11px; }
  .target-word-group { gap: 9px; }
  .target-pronounce { width: 34px; height: 34px; }
  .target-pronounce svg { width: 17px; height: 17px; }
  .current-score-value { font-size: 22px; }
  .current-score-goal { font-size: 11px; }
  body[data-theme="dark"] .score-round { gap: 1px; font-size: 9px; }
  body[data-theme="dark"] .clue-form { margin-top: 4px; padding: 8px 10px; border-radius: 17px; }
  body[data-theme="dark"] .clue-form label { margin-bottom: 4px; font-size: 10px; }
  body[data-theme="dark"] .input-row { gap: 6px; }
  body[data-theme="dark"] .input-row input { height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13px; }
  body[data-theme="dark"] .input-row button { min-height: 36px; padding: 0 13px; border-radius: 12px; font-size: 13px; }
  body[data-theme="dark"] .clue-strip { min-height: 28px; gap: 6px; margin: 5px 2px 3px; }
  body[data-theme="dark"] .clue-chip { min-height: 28px; padding: 0 11px; font-size: 12px; }
  body[data-theme="dark"] .clue-chip .remove-mark { font-size: 14px; }
  body[data-theme="dark"] .description-row { min-height: 29px; margin-bottom: 2px; }
  body[data-theme="dark"] .description-question { font-size: 10px; }
  body[data-theme="dark"] .description-question .description-label { margin-right: 5px; font-size: 8px; }
  body[data-theme="dark"] .match-mode-switch { height: 28px; grid-template-columns: repeat(2, 40px); }
  body[data-theme="dark"] .match-mode-switch::before { width: 40px; height: 22px; }
  body[data-theme="dark"] .match-mode-switch.is-free::before { transform: translateX(40px); }
  body[data-theme="dark"] .match-mode-switch button { font-size: 10px; }
  body[data-theme="dark"] .results-list { gap: 5px; }
  body[data-theme="dark"] .candidate-row,
  body[data-theme="dark"] .candidate-row:last-child { min-height: 44px; grid-template-columns: 25px minmax(0, 1fr) auto; gap: 10px; padding: 4px 12px; border-radius: 16px; }
  body[data-theme="dark"] .rank { width: 24px; height: 24px; font-size: 9px; }
  body[data-theme="dark"] .candidate-word { gap: 11px; }
  body[data-theme="dark"] .candidate-word strong { font-size: 15px; }
  body[data-theme="dark"] .candidate-word small { font-size: 10px; }
  body[data-theme="dark"] .percent { font-size: 14px; }
  body[data-theme="dark"] .bottom-nav { gap: 12px; padding: 4px 24px max(4px, env(safe-area-inset-bottom)); }
  body[data-theme="dark"] .nav-item { min-height: 45px; gap: 0; }
  body[data-theme="dark"] .nav-item svg { width: 21px; height: 21px; }
  body[data-theme="dark"] .nav-item span { font-size: 10px; }
  body[data-theme="dark"] .review-page-header { min-height: 50px; }
  body[data-theme="dark"] .review-title-row h2 { font-size: 27px; }
  body[data-theme="dark"] .review-hub { gap: 8px; margin-top: 8px; }
  body[data-theme="dark"] .review-cover { min-height: 104px; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; padding: 13px; border-radius: 20px; }
  body[data-theme="dark"] .cover-number { font-size: 35px; }
  body[data-theme="dark"] .cover-copy strong { font-size: 18px; }
  body[data-theme="dark"] .cover-copy em { margin-top: 4px; font-size: 9px; }
  body[data-theme="dark"] .cover-badge { padding: 6px 8px; font-size: 9px; }
  body[data-theme="dark"] .review-cover::after { bottom: -94px; left: -72px; }
  body[data-theme="dark"] .panel-heading h2 { font-size: 21px; }
  body[data-theme="dark"] .review-card,
  body[data-theme="dark"] .final-test-card { margin-top: 12px; padding: 15px; border-radius: 20px; }
  body[data-theme="dark"] .review-clues { margin: 11px 0 12px; }
  body[data-theme="dark"] .review-option { min-height: 44px; }
  body[data-theme="dark"] .archive-dashboard { margin-top: 10px; }
  body[data-theme="dark"] .daily-goal-card,
  body[data-theme="dark"] .learning-card,
  body[data-theme="dark"] .ranking-card { padding: 14px; border-radius: 20px; }
}

/* Final-test completion: dismiss the finished question, then celebrate. */
.final-test-card {
  position: relative;
}

.final-test-word {
  display: inline-flex;
  align-items: center;
  margin: 0 3px;
  padding: 3px 10px 4px;
  border: 1px solid rgba(114, 70, 221, .22);
  border-radius: 11px;
  background: rgba(114, 70, 221, .10);
  color: var(--purple);
  font-size: 1.35em;
  font-weight: 760;
  line-height: 1.05;
  letter-spacing: .01em;
  vertical-align: -.08em;
}

.final-celebration-stage {
  position: relative;
  min-height: 360px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 24px;
}

.final-celebration-stage[hidden] {
  display: none;
}

.final-fireworks {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.final-celebration-copy {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 270px;
  padding: 48px 20px 38px;
  text-align: center;
  opacity: 0;
}

.final-celebration-copy span {
  color: var(--purple);
  font-size: 12px;
  font-weight: 680;
  letter-spacing: .14em;
}

.final-celebration-copy p {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 520;
}

.final-celebration-copy strong {
  color: var(--purple);
  font-size: 1.2em;
  font-weight: 760;
}

.final-next-button {
  position: relative;
  z-index: 2;
  margin: 0;
  opacity: 0;
}

.final-celebration-stage.is-active .final-celebration-copy {
  animation: final-celebration-copy-in .48s .42s ease-out forwards;
}

.final-celebration-stage.is-active .final-next-button {
  animation: final-next-button-in .46s .9s ease-out forwards;
}

.final-firework-burst {
  position: absolute;
  top: var(--burst-y);
  left: var(--burst-x);
  width: 6px;
  height: 6px;
  opacity: 0;
  animation: final-firework-core 1.1s var(--burst-delay) ease-out forwards;
}

.final-firework-burst::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: hsl(var(--burst-hue) 100% 64%);
  box-shadow: 0 0 13px hsl(var(--burst-hue) 100% 62% / .9);
}

.final-firework-burst i {
  --spark-angle: calc(var(--spark) * 30deg);
  position: absolute;
  top: 2px;
  left: 2px;
  width: 3px;
  height: 10px;
  border-radius: 999px;
  background: hsl(calc(var(--burst-hue) + var(--spark) * 7) 100% 68%);
  box-shadow: 0 0 8px currentColor;
  opacity: 0;
  transform: rotate(var(--spark-angle)) translateY(0) scale(.3);
  transform-origin: 50% 2px;
  animation: final-firework-spark 1.05s var(--burst-delay) cubic-bezier(.12, .6, .18, 1) forwards;
}

.final-test-card.is-dismissing {
  pointer-events: none;
  animation: final-test-card-dismiss .58s cubic-bezier(.4, 0, .2, 1) forwards;
}

@keyframes final-firework-core {
  0%, 7% { opacity: 0; transform: scale(.15); }
  15%, 52% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.5); }
}

@keyframes final-firework-spark {
  0%, 8% {
    opacity: 0;
    transform: rotate(var(--spark-angle)) translateY(0) scale(.25);
  }
  18% { opacity: 1; }
  72% { opacity: .9; }
  100% {
    opacity: 0;
    transform: rotate(var(--spark-angle)) translateY(calc(var(--distance) * -1)) scale(.05);
  }
}

@keyframes final-test-card-dismiss {
  0% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-16px) scale(.96); filter: blur(5px); }
}

@keyframes final-celebration-copy-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes final-next-button-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .final-fireworks { display: none; }
  .final-test-card.is-dismissing { animation-duration: .25s; }
  .final-celebration-copy,
  .final-next-button { opacity: 1; animation: none !important; }
}

body[data-theme="dark"] .final-test-word {
  border-color: #533a7d;
  background: #241738;
  color: #c9a8ff;
  box-shadow: 0 8px 20px rgba(116, 70, 221, .16);
}

body[data-theme="dark"] .final-celebration-copy span,
body[data-theme="dark"] .final-celebration-copy strong {
  color: #c9a8ff;
}

/* 2026-09 mobile rhythm and typography refinement */
body[data-theme="dark"] .view {
  padding-top: max(64px, calc(env(safe-area-inset-top) + 14px));
}

body[data-theme="dark"] .view-orbits {
  top: -112px;
  right: -154px;
  width: 552px;
}

body[data-theme="dark"] .prompt-target {
  font-weight: 620;
}

body[data-theme="dark"] .prompt-target small,
body[data-theme="dark"] .score-round,
body[data-theme="dark"] .candidate-word small,
body[data-theme="dark"] .cover-copy small,
body[data-theme="dark"] .cover-copy em,
body[data-theme="dark"] .dashboard-kicker,
body[data-theme="dark"] .goal-progress-copy,
body[data-theme="dark"] .ranking-columns,
body[data-theme="dark"] .library-result-heading span {
  font-weight: 500;
}

.current-score-value { font-weight: 560; }
.current-score-goal { font-weight: 500; }

body[data-theme="dark"] .clue-form label {
  font-size: 13px;
  font-weight: 520;
}

body[data-theme="dark"] .input-row button,
body[data-theme="dark"] .meaning-form button,
body[data-theme="dark"] .primary-button,
body[data-theme="dark"] .save-settings,
body[data-theme="dark"] .review-action,
body[data-theme="dark"] .clue-chip,
body[data-theme="dark"] .match-mode-switch button {
  font-weight: 650;
}

body[data-theme="dark"] .description-question {
  font-size: 13px;
  font-weight: 500;
}

body[data-theme="dark"] .description-question .description-label {
  font-size: 12px;
  font-weight: 620;
  letter-spacing: .02em;
}

body[data-theme="dark"] .candidate-word strong {
  font-weight: 600;
}

body[data-theme="dark"] .rank {
  font-weight: 600;
}

body[data-theme="dark"] .percent {
  font-weight: 700;
}

body[data-theme="dark"] .nav-item span {
  font-size: 12px;
  font-weight: 520;
}

body[data-theme="dark"] .review-title-row h2,
body[data-theme="dark"] .profile-identity h2,
body[data-theme="dark"] .settings-heading h2 {
  font-weight: 620;
}

body[data-theme="dark"] #reviewCount {
  font-size: 13px;
  font-weight: 500;
}

body[data-theme="dark"] .cover-copy small {
  font-size: 11px;
  letter-spacing: .025em;
}

body[data-theme="dark"] .cover-copy strong {
  font-weight: 610;
}

body[data-theme="dark"] .cover-copy em {
  font-size: 11.5px;
  line-height: 1.45;
}

body[data-theme="dark"] .cover-badge {
  font-size: 11px;
  font-weight: 650;
}

body[data-theme="dark"] .panel-heading h2,
body[data-theme="dark"] .dashboard-heading h3 {
  font-weight: 600;
}

body[data-theme="dark"] .step-label,
body[data-theme="dark"] .dashboard-kicker {
  font-size: 11px;
  font-weight: 560;
  letter-spacing: .06em;
}

body[data-theme="dark"] .review-caption,
body[data-theme="dark"] .final-test-card > p,
body[data-theme="dark"] #finalTestContent > p {
  font-weight: 450;
}

body[data-theme="dark"] .review-clue,
body[data-theme="dark"] .review-option {
  font-weight: 600;
}

body[data-theme="dark"] .library-search > span,
body[data-theme="dark"] .library-result-heading strong {
  font-size: 12px;
  font-weight: 540;
}

body[data-theme="dark"] .alphabet-grid button {
  font-size: 11.5px;
  font-weight: 560;
}

body[data-theme="dark"] .library-word-main strong {
  font-size: 18px;
  font-weight: 600;
}

body[data-theme="dark"] .library-clue-list > span {
  font-size: 12.5px;
}

body[data-theme="dark"] .library-clue-list i,
body[data-theme="dark"] .library-word-open > b {
  font-size: 11px;
  font-weight: 600;
}

body[data-theme="dark"] .library-list { gap: 11px; }
body[data-theme="dark"] .library-word-row { min-height: 70px; }

body[data-theme="dark"] .dashboard-kicker {
  color: #aaa9a5;
}

body[data-theme="dark"] .goal-score {
  font-weight: 680;
}

body[data-theme="dark"] .goal-progress-copy {
  font-size: 13px;
}

body[data-theme="dark"] .curve-total,
body[data-theme="dark"] .my-rank,
body[data-theme="dark"] .edit-goal-button {
  font-weight: 620;
}

.learning-chart { margin-top: 12px; }
.learning-chart svg { height: 126px; }
.chart-grid {
  stroke-width: .8;
  opacity: .85;
  vector-effect: non-scaling-stroke;
}
.chart-grid-soft {
  stroke-width: .55;
  opacity: .45;
}
.chart-goal-line {
  stroke-width: .95;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
}
.chart-area {
  fill: var(--chart-stroke);
  opacity: .075;
}
.chart-line {
  stroke-width: 1.9;
  vector-effect: non-scaling-stroke;
}
.chart-value {
  font-size: 8.5px;
  font-weight: 580;
}
.chart-point {
  stroke-width: 1.7;
  vector-effect: non-scaling-stroke;
}
.chart-labels {
  margin-top: -7px;
  padding: 0 3px;
  font-size: 9.5px;
  font-weight: 450;
}

body[data-theme="dark"] .chart-goal-line {
  stroke-width: .95;
  stroke-dasharray: 4 5;
}

body[data-theme="dark"] .chart-goal-label {
  font-size: 8.5px;
  font-weight: 580;
}

body[data-theme="dark"] .ranking-columns {
  font-size: 10px;
}

body[data-theme="dark"] .ranking-position,
body[data-theme="dark"] .ranking-name,
body[data-theme="dark"] .ranking-row > strong {
  font-weight: 600;
}

body[data-theme="dark"] .ranking-name b {
  font-weight: 500;
}

body[data-theme="dark"] #reviewCount {
  display: none !important;
}

body[data-theme="dark"] .settings-heading {
  min-height: 62px;
}

body[data-theme="dark"] #settingsForm {
  gap: 16px;
  margin-top: 18px;
}

body[data-theme="dark"] .settings-field > span,
body[data-theme="dark"] .theme-field legend,
body[data-theme="dark"] .avatar-field legend {
  font-size: 13px;
  font-weight: 560;
}

body[data-theme="dark"] .avatar-upload-copy strong,
body[data-theme="dark"] .recent-logs > div:first-child strong,
body[data-theme="dark"] .log-upload strong {
  font-size: 13px;
  font-weight: 600;
}

body[data-theme="dark"] .avatar-upload-copy small,
body[data-theme="dark"] .recent-logs > div:first-child span,
body[data-theme="dark"] .log-upload small {
  font-size: 10.5px;
  font-weight: 450;
}

body[data-theme="dark"] .theme-options label,
body[data-theme="dark"] .avatar-upload-action {
  font-weight: 600;
}

body[data-theme="dark"] #recentLogsList {
  gap: 10px;
  margin-top: 12px;
}

body[data-theme="dark"] .log-row {
  gap: 10px;
}

body[data-theme="dark"] .log-row strong {
  font-size: 12px;
  font-weight: 540;
}

body[data-theme="dark"] .log-row small {
  font-size: 10px;
  font-weight: 450;
}

@media (max-height: 800px) {
  body[data-theme="dark"] .app-shell {
    padding-bottom: calc(54px + env(safe-area-inset-bottom));
  }

  body[data-theme="dark"] .view {
    padding-top: max(44px, calc(env(safe-area-inset-top) + 12px));
  }

  body[data-theme="dark"] .view-orbits {
    top: -126px;
    right: -116px;
    width: 454px;
  }

  body[data-theme="dark"] .view[data-view="find"].active,
  body[data-theme="dark"] .view[data-view="review"].active {
    width: 100%;
    height: calc(100dvh - 84px - env(safe-area-inset-bottom));
    min-height: 0;
  }

  body[data-theme="dark"] .view[data-view="find"].active {
    display: flex;
    flex-direction: column;
  }

  body[data-theme="dark"] .view[data-view="find"] > .progress-copy {
    min-height: 54px;
    padding: 0 8px 2px;
  }

  body[data-theme="dark"] .prompt-target {
    gap: 1px;
    font-size: 29px;
  }

  body[data-theme="dark"] .prompt-target small {
    font-size: 12.5px;
  }

  .target-word-group { gap: 10px; }
  .target-pronounce { width: 36px; height: 36px; }
  .current-score-value { font-size: 23px; }
  .current-score-goal { font-size: 12px; }
  body[data-theme="dark"] .score-round { font-size: 10.5px; }

  body[data-theme="dark"] .clue-form {
    margin-top: 7px;
    padding: 10px 12px;
    border-radius: 19px;
  }

  body[data-theme="dark"] .clue-form label {
    margin-bottom: 6px;
    font-size: 12px;
  }

  body[data-theme="dark"] .input-row { gap: 8px; }
  body[data-theme="dark"] .input-row input {
    height: 40px;
    padding: 0 13px;
    border-radius: 13px;
    font-size: 14px;
  }

  body[data-theme="dark"] .input-row button {
    min-height: 40px;
    padding: 0 15px;
    border-radius: 13px;
    font-size: 14px;
  }

  body[data-theme="dark"] .clue-strip {
    min-height: 32px;
    gap: 7px;
    margin: 7px 2px 5px;
  }

  body[data-theme="dark"] .clue-chip {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
  }

  body[data-theme="dark"] .description-row {
    min-height: 34px;
    margin: 0 2px 6px;
  }

  body[data-theme="dark"] .description-question { font-size: 12px; }
  body[data-theme="dark"] .description-question .description-label {
    margin-right: 7px;
    font-size: 11px;
  }

  body[data-theme="dark"] .match-mode-switch {
    height: 32px;
    grid-template-columns: repeat(2, 44px);
  }

  body[data-theme="dark"] .match-mode-switch::before {
    width: 44px;
    height: 26px;
  }

  body[data-theme="dark"] .match-mode-switch.is-free::before {
    transform: translateX(44px);
  }

  body[data-theme="dark"] .match-mode-switch button { font-size: 11px; }

  body[data-theme="dark"] .results-section {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
  }

  body[data-theme="dark"] .results-list {
    height: clamp(290px, 47dvh, 370px);
    min-height: 0;
    flex: 0 0 auto;
    grid-auto-rows: minmax(52px, 1fr);
    gap: 7px;
  }

  body[data-theme="dark"] .candidate-row,
  body[data-theme="dark"] .candidate-row:last-child {
    min-height: 0;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 7px 13px;
    border-radius: 18px;
  }

  body[data-theme="dark"] .rank {
    width: 27px;
    height: 27px;
    font-size: 10px;
  }

  body[data-theme="dark"] .candidate-word { gap: 13px; }
  body[data-theme="dark"] .candidate-word strong { font-size: 16.5px; }
  body[data-theme="dark"] .candidate-word small { font-size: 11.5px; }
  body[data-theme="dark"] .percent { font-size: 15px; }

  body[data-theme="dark"] .view[data-view="review"].active {
    display: flex;
    flex-direction: column;
  }

  body[data-theme="dark"] .review-page-header {
    min-height: 52px;
    align-items: center;
    padding: 0 8px;
  }

  body[data-theme="dark"] .review-title-row h2 {
    font-size: 29px;
  }

  body[data-theme="dark"] .review-hub {
    min-height: 0;
    flex: 1;
    grid-template-rows: repeat(3, 136px);
    align-content: start;
    gap: 14px;
    margin: 14px 0 5px;
  }

  body[data-theme="dark"] .review-cover {
    min-height: 0;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 11px;
    padding: 16px;
    border-radius: 22px;
  }

  body[data-theme="dark"] .cover-number { font-size: 39px; }
  body[data-theme="dark"] .cover-copy strong { margin-top: 5px; font-size: 20px; }
  body[data-theme="dark"] .cover-copy em { margin-top: 7px; font-size: 11px; }
  body[data-theme="dark"] .cover-badge { padding: 7px 9px; font-size: 10.5px; }

  body[data-theme="dark"] .review-panel {
    min-height: 0;
    flex: 1;
    margin-top: 14px;
    overflow-y: auto;
  }

  body[data-theme="dark"] #clueReviewPanel:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  body[data-theme="dark"] #clueReviewPanel .review-card {
    display: flex;
    width: 100%;
    min-height: 360px;
    max-height: 430px;
    flex: 0 1 430px;
    flex-direction: column;
    margin-bottom: 5px;
  }

  body[data-theme="dark"] #clueReviewPanel .review-options:not(:empty) {
    min-height: 0;
    flex: 1;
    grid-template-rows: repeat(3, minmax(48px, 1fr));
    gap: 12px;
  }

  body[data-theme="dark"] #finalTestPanel:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  body[data-theme="dark"] #finalTestPanel .final-test-card:has(#finalTestContent:not([hidden])) {
    min-height: 360px;
  }

  body[data-theme="dark"] .panel-heading h2 { font-size: 23px; }
  body[data-theme="dark"] .review-card,
  body[data-theme="dark"] .final-test-card {
    margin-top: 16px;
    padding: 17px;
  }

  body[data-theme="dark"] .review-option { min-height: 47px; }

  body[data-theme="dark"] .archive-dashboard {
    gap: 14px;
    margin-top: 14px;
  }

  body[data-theme="dark"] .daily-goal-card,
  body[data-theme="dark"] .learning-card,
  body[data-theme="dark"] .ranking-card {
    padding: 16px;
    border-radius: 22px;
  }

  body[data-theme="dark"] .profile-identity h2 { font-size: 26px; }
body[data-theme="dark"] .dashboard-heading h3 { font-size: 19px; }
}

/* 2026-09 mobile library legibility and light-theme navigation fixes */
.nav-item svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-word-open {
  display: flex;
  align-items: center;
  gap: 14px;
}

.library-word-main {
  flex: 0 1 auto;
}

.library-clue-list {
  flex: 0 1 auto;
}

.library-target-line {
  align-items: center;
}

.library-word-main strong,
body[data-theme="dark"] .library-word-main strong {
  overflow: visible;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.12;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.library-clue-list > span,
body[data-theme="dark"] .library-clue-list > span {
  gap: 7px;
  font-size: 14px;
}

.library-clue-list i,
body[data-theme="dark"] .library-clue-list i {
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 600;
}

.library-word-open > b,
body[data-theme="dark"] .library-word-open > b {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 380px) {
  .library-word-open {
    gap: 8px;
  }

  .library-word-main strong,
  body[data-theme="dark"] .library-word-main strong {
    font-size: 18px;
  }

  .library-clue-list i,
  body[data-theme="dark"] .library-clue-list i {
    padding: 6px 8px;
    font-size: 13px;
  }
}

/* Remove redundant micro-labels and close the space they occupied. */
.panel-heading h2,
.dashboard-heading h3 {
  margin-top: 0;
}

.library-result-heading span {
  margin-left: auto;
}

body[data-theme="dark"] .profile-identity h2 {
  margin-top: 0;
}

/* Slight horizontal inset for the candidate stack. */
body[data-theme="dark"] .results-list {
  margin-right: 8px;
  margin-left: 8px;
}

/* Two-stage candidate loading: clue convergence, then row-by-row reveal. */
.results-list.is-loading {
  position: relative;
  min-height: 340px;
}

.candidate-loading-stack {
  display: grid;
  gap: 7px;
  opacity: .42;
}

.candidate-loading-row {
  pointer-events: none;
}

.candidate-loading-copy {
  display: flex;
  align-items: center;
  gap: 11px;
}

.candidate-loading-copy i,
.candidate-loading-score,
.candidate-row-skeleton i {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: #d9d6e0;
  opacity: .24;
}

.candidate-loading-copy i:first-child { width: min(34%, 112px); }
.candidate-loading-copy i:last-child { width: min(25%, 72px); }
.candidate-loading-score { width: 46px; }

.clue-convergence-overlay {
  position: absolute;
  z-index: 5;
  top: 8px;
  left: 50%;
  display: grid;
  width: min(324px, calc(100% - 18px));
  min-height: 196px;
  gap: 11px;
  padding: 16px 18px 14px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 34px;
  background: rgba(35, 32, 43, .72);
  box-shadow: 10px 14px 32px rgba(18, 11, 32, .22), inset 0 1px 0 rgba(255, 255, 255, .22);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  transform: translateX(-50%);
}

.clue-convergence-overlay strong {
  color: var(--purple-dark);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .03em;
}

.clue-convergence-motion {
  position: relative;
  width: 280px;
  height: 126px;
}

.matching-reels {
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 20px;
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 9px 18px rgba(0, 0, 0, .16);
}

.matching-reel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, .08);
}

.matching-reel:last-child { border-right: 0; }

.reel-viewport {
  position: absolute;
  top: 8px;
  right: 3px;
  bottom: 8px;
  left: 3px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
}

.reel-scroll {
  position: relative;
}

.reel-scroll span {
  display: flex;
  height: 24px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: rgba(255, 255, 255, .68);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matching-reel-one .reel-scroll {
  animation: reel-scroll-one 4.5s linear infinite;
}

.matching-reel-two .reel-scroll {
  animation: reel-scroll-two 4.5s linear infinite;
}

.matching-reel-three .reel-scroll {
  animation: reel-scroll-three 4.5s linear infinite;
}

.matching-reel-four .reel-scroll {
  animation: reel-scroll-four 4.5s linear infinite;
}

.matching-reel-five .reel-scroll {
  animation: reel-scroll-five 4.5s linear infinite;
}

.reel-check {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: calc(100% - 4px);
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: rgba(7, 8, 7, .98);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .045);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.55);
}

.reel-check svg {
  width: 24px;
  height: 24px;
  padding: 5px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 12px rgba(255, 179, 35, .7), 0 0 26px rgba(255, 179, 35, .32);
  fill: none;
  stroke: #080806;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.matching-reel-one .reel-check { animation: reel-check-one 4.5s ease-out infinite; }
.matching-reel-two .reel-check { animation: reel-check-two 4.5s ease-out infinite; }
.matching-reel-three .reel-check { animation: reel-check-three 4.5s ease-out infinite; }
.matching-reel-four .reel-check { animation: reel-check-four 4.5s ease-out infinite; }
.matching-reel-five .reel-check { animation: reel-check-five 4.5s ease-out infinite; }

.candidate-reveal-row {
  position: relative;
  overflow: hidden;
}

.candidate-reveal-row .candidate-word,
.candidate-reveal-row .percent {
  transition: opacity .22s ease, transform .26s cubic-bezier(.22, .8, .3, 1);
}

.candidate-reveal-row.is-pending {
  pointer-events: none;
}

.candidate-reveal-row.is-pending .candidate-word,
.candidate-reveal-row.is-pending .percent {
  opacity: 0;
  transform: translateY(5px);
}

.candidate-row-skeleton {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 15px;
  left: 63px;
  display: grid;
  grid-template-columns: minmax(76px, 30%) minmax(48px, 22%) 1fr;
  gap: 12px;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity .18s ease;
}

.candidate-row-skeleton i:nth-child(1) { width: 100%; }
.candidate-row-skeleton i:nth-child(2) { width: 100%; }
.candidate-row-skeleton i:nth-child(3) { width: 44px; justify-self: end; }
.candidate-reveal-row.is-pending .candidate-row-skeleton { opacity: 1; }

.candidate-score-track {
  position: absolute;
  z-index: 3;
  right: 13px;
  bottom: 3px;
  left: 13px;
  height: 3px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(128, 128, 128, .18);
  pointer-events: none;
  opacity: 0;
  transition: opacity .24s ease;
}

.candidate-score-track i {
  position: relative;
  display: block;
  width: var(--score-progress);
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  box-shadow: 0 0 9px rgba(255, 179, 35, .66);
}

.candidate-score-track i::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff8e8;
  box-shadow: 0 0 8px #fff, 0 0 17px var(--orange);
  transform: translateY(-50%);
}

.candidate-reveal-row.is-revealing .candidate-score-track { opacity: 1; }
.candidate-reveal-row.is-complete .candidate-score-track { opacity: .72; }
.candidate-reveal-row.is-complete .candidate-score-track i::after { opacity: 0; }

/* Keep candidate results comfortably legible on the dark mobile layout. */
body[data-theme="dark"] .candidate-word strong { font-size: 22px; }
body[data-theme="dark"] .candidate-word small { font-size: 15px; }
body[data-theme="dark"] .percent { font-size: 20px; }

body[data-theme="dark"] .candidate-loading-copy i,
body[data-theme="dark"] .candidate-loading-score,
body[data-theme="dark"] .candidate-row-skeleton i {
  background: #8b8d8b;
  opacity: .27;
}

body[data-theme="dark"] .clue-convergence-overlay {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(4, 4, 4, .86);
  box-shadow: 10px 14px 34px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .14);
}

body[data-theme="dark"] .clue-convergence-overlay strong { color: var(--orange); }

/* Directional module outlines: brighter at bottom-left/top-right, softer elsewhere. */
body[data-theme="dark"] .clue-form,
body[data-theme="dark"] .candidate-row,
body[data-theme="dark"] .review-cover,
body[data-theme="dark"] .review-card,
body[data-theme="dark"] .final-test-card,
body[data-theme="dark"] .library-word-row,
body[data-theme="dark"] .daily-goal-card,
body[data-theme="dark"] .learning-card,
body[data-theme="dark"] .ranking-card,
body[data-theme="dark"] .settings-sheet,
body[data-theme="dark"] .recent-logs,
body[data-theme="dark"] .log-upload,
body[data-theme="dark"] .victory-card {
  border-color: transparent;
  background:
    linear-gradient(var(--directional-surface, rgba(11, 13, 12, .98)), var(--directional-surface, rgba(11, 13, 12, .98))) padding-box,
    linear-gradient(45deg,
      rgba(148, 158, 153, .56) 0%,
      rgba(67, 74, 70, .18) 28%,
      rgba(43, 48, 45, .10) 70%,
      rgba(148, 158, 153, .56) 100%) border-box;
  box-shadow:
    9px 14px 24px rgba(0, 0, 0, .76),
    8px 14px 20px -10px rgba(151, 128, 89, .48);
}

body[data-theme="dark"] .clue-form { --directional-surface: rgba(12, 15, 14, .97); }
body[data-theme="dark"] .candidate-row { --directional-surface: rgba(10, 12, 11, .98); }
body[data-theme="dark"] .candidate-row:hover { --directional-surface: #121512; }
body[data-theme="dark"] .candidate-row.correct-target { --directional-surface: #12100d; }
body[data-theme="dark"] .review-cover { --directional-surface: rgba(12, 14, 13, .98); }
body[data-theme="dark"] .review-card,
body[data-theme="dark"] .final-test-card,
body[data-theme="dark"] .daily-goal-card,
body[data-theme="dark"] .learning-card,
body[data-theme="dark"] .ranking-card { --directional-surface: rgba(11, 13, 12, .98); }
body[data-theme="dark"] .library-word-row { --directional-surface: #0d100f; }
body[data-theme="dark"] .settings-sheet { --directional-surface: #050606; }
body[data-theme="dark"] .recent-logs { --directional-surface: #0c0e0d; }
body[data-theme="dark"] .log-upload { --directional-surface: #211608; }
body[data-theme="dark"] .victory-card { --directional-surface: #090b0a; }

/* Keep the three review choices compact while preserving a centered word. */
body[data-theme="dark"] #clueReviewPanel .review-card {
  min-height: 0;
  max-height: none;
  flex: 0 0 auto;
}

body[data-theme="dark"] #clueReviewPanel .review-options:not(:empty) {
  min-height: 0;
  flex: 0 0 auto;
  grid-template-rows: repeat(3, 64px);
  gap: 10px;
}

body[data-theme="dark"] .review-option {
  min-height: 64px;
  font-size: 22px;
}

@keyframes reel-scroll-one {
  0% { transform: translateY(0); }
  7% { transform: translateY(-162px); }
  14% { transform: translateY(-270px); }
  21% { transform: translateY(-348px); }
  26%, 100% { transform: translateY(-408px); }
}

@keyframes reel-scroll-two {
  0% { transform: translateY(0); }
  9% { transform: translateY(-156px); }
  18% { transform: translateY(-264px); }
  29% { transform: translateY(-350px); }
  38%, 100% { transform: translateY(-408px); }
}

@keyframes reel-scroll-three {
  0% { transform: translateY(0); }
  10% { transform: translateY(-150px); }
  23% { transform: translateY(-258px); }
  37% { transform: translateY(-350px); }
  50%, 100% { transform: translateY(-408px); }
}

@keyframes reel-scroll-four {
  0% { transform: translateY(0); }
  12% { transform: translateY(-144px); }
  28% { transform: translateY(-256px); }
  45% { transform: translateY(-350px); }
  62%, 100% { transform: translateY(-408px); }
}

@keyframes reel-scroll-five {
  0% { transform: translateY(0); }
  14% { transform: translateY(-138px); }
  32% { transform: translateY(-254px); }
  54% { transform: translateY(-352px); }
  74%, 100% { transform: translateY(-408px); }
}

@keyframes reel-check-one {
  0%, 25% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  27% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  33%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes reel-check-two {
  0%, 37% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  46%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes reel-check-three {
  0%, 49% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  53% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  59%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes reel-check-four {
  0%, 61% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  66% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  72%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes reel-check-five {
  0%, 73% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  79% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  85%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .reel-scroll { animation: none !important; opacity: 0; }
  .reel-check { animation: none !important; opacity: 1; transform: translate(-50%, -50%) scale(1); }
  .candidate-reveal-row .candidate-word,
  .candidate-reveal-row .percent,
  .candidate-score-track { transition: none; }
}

/* Refined light-theme target controls: quiet, compact, and visually balanced. */
body:not([data-theme="dark"]) .target-word-group {
  align-items: center;
  gap: 10px;
}

body:not([data-theme="dark"]) .target-pronounce {
  width: 36px;
  height: 36px;
  margin-top: 0;
  border: 1px solid color-mix(in srgb, var(--purple) 22%, transparent);
  background: var(--purple-soft);
  color: var(--purple-dark);
  box-shadow: none;
}

body:not([data-theme="dark"]) .target-pronounce svg {
  width: 17px;
  height: 17px;
}

body:not([data-theme="dark"]) .target-pronounce.playing {
  background: var(--purple);
  color: #fff;
}

body:not([data-theme="dark"]) .score-round {
  min-height: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  box-shadow: none;
}

body:not([data-theme="dark"]) .score-round b {
  display: inline-flex;
  width: max-content;
  min-width: 0;
  height: auto;
  align-items: baseline;
  gap: 4px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}

body:not([data-theme="dark"]) .current-score-value,
body[data-theme="orange"] .current-score-value {
  color: var(--purple-dark);
  font-size: 23px;
  font-weight: 620;
  line-height: 1;
}

body:not([data-theme="dark"]) .current-score-goal {
  align-self: auto;
  padding: 0 0 1px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

/* Light-theme matching animation uses one coherent theme palette. */
body:not([data-theme="dark"]) .clue-convergence-overlay {
  border-color: color-mix(in srgb, var(--purple) 18%, transparent);
  background: rgba(255, 255, 255, .84);
  box-shadow:
    9px 14px 30px color-mix(in srgb, var(--purple) 13%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .94);
  backdrop-filter: blur(22px) saturate(112%);
  -webkit-backdrop-filter: blur(22px) saturate(112%);
}

body:not([data-theme="dark"]) .clue-convergence-overlay strong {
  color: var(--purple-dark);
}

body:not([data-theme="dark"]) .matching-reels {
  border-color: color-mix(in srgb, var(--purple) 14%, transparent);
  background: color-mix(in srgb, var(--purple-soft) 72%, rgba(255, 255, 255, .78));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 7px 16px color-mix(in srgb, var(--purple) 8%, transparent);
}

body:not([data-theme="dark"]) .matching-reel {
  border-right-color: color-mix(in srgb, var(--purple) 10%, transparent);
}

body:not([data-theme="dark"]) .reel-scroll span {
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}

body:not([data-theme="dark"]) .reel-check {
  background: color-mix(in srgb, var(--purple-soft) 90%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--purple) 10%, transparent);
}

body:not([data-theme="dark"]) .reel-check svg {
  background: var(--purple);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--purple) 9%, transparent),
    0 7px 16px color-mix(in srgb, var(--purple) 24%, transparent);
  stroke: #fff;
}

body:not([data-theme="dark"]) .candidate-loading-copy i,
body:not([data-theme="dark"]) .candidate-loading-score,
body:not([data-theme="dark"]) .candidate-row-skeleton i {
  background: color-mix(in srgb, var(--purple) 22%, #d9d6e0);
}

body:not([data-theme="dark"]) .candidate-score-track i {
  background: var(--purple);
  box-shadow: 0 0 8px color-mix(in srgb, var(--purple) 34%, transparent);
}

body:not([data-theme="dark"]) .candidate-score-track i::after {
  background: #fff;
  box-shadow:
    0 0 7px #fff,
    0 0 14px color-mix(in srgb, var(--purple) 52%, transparent);
}

/* Candidate pronunciation sits beside the score without changing row selection. */
.candidate-row.with-pronunciation,
body[data-theme="dark"] .candidate-row.with-pronunciation {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.candidate-choice {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.candidate-pronounce {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple-dark);
  transition: transform .16s ease, background .16s ease, color .16s ease;
}

.candidate-pronounce:hover { transform: scale(1.05); }
.candidate-pronounce:active { transform: scale(.94); }
.candidate-pronounce svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.candidate-pronounce.playing {
  background: var(--purple);
  color: #fff;
  animation: pronunciation-pulse .8s ease infinite alternate;
}

body[data-theme="dark"] .candidate-pronounce {
  border-color: #5d3d12;
  background: #2b1b05;
  color: var(--orange);
}

body[data-theme="dark"] .candidate-pronounce.playing {
  background: var(--orange);
  color: #171006;
}

@media (max-height: 800px) {
  .candidate-row.with-pronunciation,
  body[data-theme="dark"] .candidate-row.with-pronunciation { gap: 8px; }
  .candidate-choice { gap: 9px; }
  .candidate-pronounce { width: 28px; height: 28px; }
  .candidate-pronounce svg { width: 14px; height: 14px; }
}

/* Vocabulary data: target growth, activation periods, and top clues. */
.data-cover { background: linear-gradient(135deg, #e8f4fb, #f9fcff); }
.data-cover .cover-number { color: #347eaa; }
.vocabulary-data-dashboard {
  display: grid;
  gap: 12px;
  padding: 4px 0 14px;
}
.vocabulary-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.vocabulary-summary-card,
.vocabulary-data-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.vocabulary-summary-card {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  padding: 15px;
}
.vocabulary-summary-card > span,
.vocabulary-data-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
}
.vocabulary-summary-card strong {
  margin-top: 8px;
  color: var(--purple-dark);
  font-size: 31px;
  font-weight: 620;
  line-height: 1;
}
.activation-summary strong { color: var(--orange); }
.vocabulary-summary-card small {
  margin-top: auto;
  padding-top: 9px;
  color: var(--muted-light);
  font-size: 9px;
  line-height: 1.35;
}
.vocabulary-data-card { padding: 16px; }
.vocabulary-data-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.vocabulary-data-heading h3 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 620;
}
.vocabulary-data-heading > strong {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 11px;
  font-weight: 620;
}
.vocabulary-trend-chart { margin-top: 8px; }
.vocabulary-trend-chart svg { display: block; width: 100%; height: 126px; overflow: visible; }
.vocabulary-trend-grid { stroke: var(--line); stroke-width: 1; }
.vocabulary-trend-area { fill: url(#targetTrendFill); }
#targetTrendFill stop { stop-color: var(--purple); }
.vocabulary-trend-line { fill: none; stroke: var(--purple); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.vocabulary-trend-point { fill: var(--surface); stroke: var(--purple); stroke-width: 2.4; }
.vocabulary-trend-point.latest { fill: var(--orange); stroke: var(--orange); }
.vocabulary-trend-label { fill: var(--muted-light); font-size: 8px; }
.vocabulary-trend-value { fill: var(--orange); font-size: 10px; font-weight: 650; }
.activation-period-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}
.activation-period-grid > div {
  min-width: 0;
  padding: 12px 8px;
  border-radius: 15px;
  background: var(--page);
  text-align: center;
}
.activation-period-grid span { display: block; color: var(--muted); font-size: 10px; }
.activation-period-grid strong { display: inline-block; margin-top: 6px; color: var(--purple-dark); font-size: 23px; font-weight: 620; line-height: 1; }
.activation-period-grid small { margin-left: 2px; color: var(--muted-light); font-size: 9px; }
.activation-ranking-list { display: grid; gap: 8px; margin-top: 13px; }
.activation-ranking-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 38px;
}
.activation-rank {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 10px;
  font-weight: 650;
}
.activation-word { position: relative; min-width: 0; padding: 0 0 8px; overflow: hidden; }
.activation-word strong { display: block; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 560; text-overflow: ellipsis; white-space: nowrap; }
.activation-word i { position: absolute; right: 0; bottom: 1px; left: 0; height: 3px; overflow: hidden; border-radius: 999px; background: var(--line); }
.activation-word i::after { content: ""; display: block; width: var(--activation-width); height: 100%; border-radius: inherit; background: var(--purple); }
.activation-ranking-row > b { color: var(--muted); font-size: 10px; font-weight: 550; white-space: nowrap; }
.vocabulary-data-empty { padding: 20px 12px; color: var(--muted); font-size: 12px; text-align: center; }

body[data-theme="dark"] .review-hub {
  grid-template-rows: repeat(4, minmax(104px, 1fr));
  gap: 10px;
  overflow-y: auto;
}
body[data-theme="dark"] .data-cover {
  border-color: #2b2f2d;
  background: rgba(12, 14, 13, .98);
}
body[data-theme="dark"] .data-cover::after { border-color: rgba(63, 167, 216, .17); }
body[data-theme="dark"] .data-cover .cover-number { color: rgba(74, 180, 231, .52); }
body[data-theme="dark"] #vocabularyDataPanel { padding: 0 2px 12px; }
body[data-theme="dark"] .vocabulary-summary-card,
body[data-theme="dark"] .vocabulary-data-card {
  border-color: transparent;
  background:
    linear-gradient(rgba(11, 13, 12, .98), rgba(11, 13, 12, .98)) padding-box,
    linear-gradient(45deg, rgba(148, 158, 153, .48), rgba(48, 54, 51, .12) 45%, rgba(148, 158, 153, .42)) border-box;
  box-shadow: 8px 12px 22px rgba(0, 0, 0, .62);
}
body[data-theme="dark"] .vocabulary-summary-card > span,
body[data-theme="dark"] .vocabulary-data-heading span { color: #999994; }
body[data-theme="dark"] .vocabulary-summary-card strong { color: #fff; }
body[data-theme="dark"] .activation-summary strong { color: var(--orange); }
body[data-theme="dark"] .vocabulary-summary-card small { color: #777873; }
body[data-theme="dark"] .vocabulary-data-heading h3 { color: #f5f4f0; }
body[data-theme="dark"] .vocabulary-data-heading > strong { background: #211708; color: var(--orange); }
body[data-theme="dark"] .vocabulary-trend-grid { stroke: #242825; }
body[data-theme="dark"] #targetTrendFill stop { stop-color: var(--orange); }
body[data-theme="dark"] .vocabulary-trend-line { stroke: var(--orange); }
body[data-theme="dark"] .vocabulary-trend-point { fill: #0b0d0c; stroke: var(--orange); }
body[data-theme="dark"] .vocabulary-trend-point.latest { fill: #fff4d8; }
body[data-theme="dark"] .activation-period-grid > div { background: #101211; box-shadow: inset 0 0 0 1px #242825; }
body[data-theme="dark"] .activation-period-grid span { color: #8c8d88; }
body[data-theme="dark"] .activation-period-grid strong { color: #f4f2ec; }
body[data-theme="dark"] .activation-rank { background: #211708; color: var(--orange); }
body[data-theme="dark"] .activation-word strong { color: #f1f0ec; }
body[data-theme="dark"] .activation-word i { background: #242724; }
body[data-theme="dark"] .activation-word i::after { background: var(--orange); }
body[data-theme="dark"] .activation-ranking-row > b { color: #989994; }

@media (max-height: 800px) {
  body[data-theme="dark"] .review-hub { grid-template-rows: repeat(4, 96px); gap: 8px; }
  body[data-theme="dark"] .review-cover { padding: 12px 13px; }
  .vocabulary-data-dashboard { gap: 9px; }
  .vocabulary-summary-card { min-height: 96px; padding: 12px; }
  .vocabulary-summary-card strong { font-size: 27px; }
  .vocabulary-data-card { padding: 13px; }
}

/* Candidate cards: restore a calmer rhythm after adding pronunciation. */
.results-list,
body[data-theme="dark"] .results-list {
  gap: 11px;
}

.candidate-row.with-pronunciation,
body[data-theme="dark"] .candidate-row.with-pronunciation,
.candidate-row.with-pronunciation:last-child,
body[data-theme="dark"] .candidate-row.with-pronunciation:last-child {
  min-height: 72px;
  gap: 13px;
  padding: 11px 15px 13px;
}

.candidate-choice {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 13px;
}

.candidate-row.with-pronunciation .candidate-word,
body[data-theme="dark"] .candidate-row.with-pronunciation .candidate-word {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.12;
}

.candidate-row.with-pronunciation .candidate-word strong,
body[data-theme="dark"] .candidate-row.with-pronunciation .candidate-word strong {
  max-width: 100%;
  font-size: 21px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.candidate-row.with-pronunciation .candidate-word small,
body[data-theme="dark"] .candidate-row.with-pronunciation .candidate-word small {
  font-size: 13px;
  line-height: 1.2;
}

.candidate-row.with-pronunciation .rank,
body[data-theme="dark"] .candidate-row.with-pronunciation .rank {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.candidate-row.with-pronunciation .percent,
body[data-theme="dark"] .candidate-row.with-pronunciation .percent {
  font-size: 19px;
  font-weight: 750;
}

.candidate-row.with-pronunciation .candidate-pronounce {
  width: 34px;
  height: 34px;
}

.candidate-row.with-pronunciation .candidate-score-track {
  right: 14px;
  bottom: 4px;
  left: 14px;
}

@media (max-height: 800px) {
  .results-list,
  body[data-theme="dark"] .results-list {
    gap: 8px;
  }

  .candidate-row.with-pronunciation,
  body[data-theme="dark"] .candidate-row.with-pronunciation,
  .candidate-row.with-pronunciation:last-child,
  body[data-theme="dark"] .candidate-row.with-pronunciation:last-child {
    min-height: 62px;
    gap: 10px;
    padding: 8px 13px 10px;
    border-radius: 18px;
  }

  .candidate-choice { gap: 10px; }

  .candidate-row.with-pronunciation .candidate-word strong,
  body[data-theme="dark"] .candidate-row.with-pronunciation .candidate-word strong {
    font-size: 18px;
  }

  .candidate-row.with-pronunciation .candidate-word small,
  body[data-theme="dark"] .candidate-row.with-pronunciation .candidate-word small {
    font-size: 12px;
  }

  .candidate-row.with-pronunciation .rank,
  body[data-theme="dark"] .candidate-row.with-pronunciation .rank,
  .candidate-row.with-pronunciation .candidate-pronounce {
    width: 29px;
    height: 29px;
  }

  .candidate-row.with-pronunciation .percent,
  body[data-theme="dark"] .candidate-row.with-pronunciation .percent {
    font-size: 17px;
  }
}
