:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #111111;
  --panel-strong: #171717;
  --line: #2b2b2b;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --soft: #d6d6d6;
  --ok: #a6e3a1;
  --bad: #ffb4a8;
  --focus: #f2f2f2;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
}

h1 {
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.02;
}

h2 {
  font-size: 20px;
}

.source-note {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
}

.control-strip,
.stats-grid,
.practice-card,
.side-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 17, 17, 0.86);
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(160px, 0.8fr) 110px auto auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  margin-bottom: 12px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #090909;
}

.mode-tab,
.ghost-button,
.primary-button,
.speak-button {
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #101010;
}

.mode-tab {
  padding: 0 10px;
  color: var(--muted);
  border-color: transparent;
}

.mode-tab.is-active {
  color: #080808;
  background: var(--text);
}

.field-label,
.check-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.field-label select {
  width: 100%;
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #090909;
}

.check-label {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #090909;
  user-select: none;
}

.check-label input {
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  accent-color: var(--text);
}

.ghost-button,
.primary-button,
.speak-button {
  padding: 0 16px;
}

.primary-button {
  border-color: var(--text);
  color: #050505;
  background: var(--text);
}

.ghost-button:hover,
.speak-button:hover,
.text-button:hover {
  border-color: #595959;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--line);
}

.stats-grid article {
  padding: 16px;
  background: var(--panel);
}

.stats-grid span,
.answer-panel span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
}

.practice-card {
  min-width: 0;
  padding: 20px;
}

.card-head,
.side-head,
.answer-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.prompt-zone {
  display: grid;
  gap: 14px;
  margin: 34px 0 22px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.prompt-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.prompt-text {
  min-height: 96px;
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: clamp(36px, 8vw, 78px);
  font-weight: 500;
  line-height: 1.12;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.prompt-text.is-hidden {
  letter-spacing: 0.08em;
  color: var(--soft);
}

.speak-button {
  width: fit-content;
}

.answer-form {
  display: grid;
  gap: 10px;
}

.answer-form label {
  color: var(--muted);
  font-size: 13px;
}

.answer-form input {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: #080808;
  font-size: 22px;
}

.answer-form input:focus {
  border-color: var(--focus);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feedback {
  min-height: 36px;
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.6;
}

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

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

.answer-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0b0b;
}

.answer-panel div {
  min-width: 0;
}

.answer-panel strong {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 16px;
}

.side-head {
  margin-bottom: 10px;
}

.side-head h2 {
  font-size: 16px;
}

.text-button {
  min-height: 30px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}

.word-list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding-right: 4px;
}

.word-list.empty {
  color: var(--muted);
  font-size: 14px;
}

.word-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0b0b;
}

.word-item strong {
  font-weight: 500;
}

.word-item span {
  color: var(--muted);
  font-size: 13px;
}

.word-item.is-done {
  opacity: 0.48;
}

.word-item.is-current {
  border-color: var(--text);
}

@media (max-width: 900px) {
  .topbar,
  .practice-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .source-note {
    text-align: left;
  }

  .control-strip {
    grid-template-columns: 1fr 1fr;
  }

  .mode-tabs {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .control-strip,
  .stats-grid,
  .practice-layout {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    gap: 1px;
  }

  .prompt-zone {
    padding: 18px;
  }

  .prompt-text {
    min-height: 78px;
    font-size: 38px;
  }

  .answer-panel {
    display: grid;
  }

  .answer-panel .primary-button {
    width: 100%;
  }
}
