:root {
  --bg: #090d12;
  --bg-soft: #101722;
  --panel: #121a25;
  --panel-strong: #182332;
  --text: #eef4f8;
  --muted: #92a0ad;
  --line: #253344;
  --primary: #66e0c2;
  --primary-dark: #35b99a;
  --primary-soft: rgba(102, 224, 194, 0.14);
  --danger: #ff8c7a;
  --danger-bg: rgba(255, 140, 122, 0.11);
  --warn-bg: rgba(235, 191, 91, 0.12);
  --shadow: 0 20px 65px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(102, 224, 194, 0.13), transparent 34rem),
    linear-gradient(180deg, #090d12 0%, #0b1018 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button,
textarea,
input {
  font: inherit;
}

button {
  min-height: 44px;
}

.shell {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2.2rem);
}

h2 {
  margin-bottom: 14px;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-button,
.button,
.button-secondary,
.button-danger,
.icon-button,
.feature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.nav-button {
  padding: 10px 14px;
}

.nav-button.active,
.button {
  border-color: rgba(102, 224, 194, 0.82);
  background: var(--primary);
  color: #06110f;
}

.button,
.button-secondary,
.button-danger {
  width: 100%;
  padding: 12px 16px;
  font-weight: 800;
}

.button:hover,
.nav-button.active:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: var(--panel-strong);
}

.button-secondary:hover,
.nav-button:hover,
.icon-button:hover,
.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.button-danger {
  border-color: rgba(255, 140, 122, 0.42);
  background: var(--danger-bg);
  color: var(--danger);
}

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

.compact-button {
  width: auto;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.app {
  display: grid;
  gap: 16px;
}

.hero,
.panel {
  background: rgba(18, 26, 37, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  min-height: 310px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: end;
  padding: clamp(24px, 5vw, 42px);
}

.hero-copy h2 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 1.04;
}

.hero-copy p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

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

.landing-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.practice-scope-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-card {
  min-height: 180px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  padding: 20px;
  text-align: left;
}

.feature-card span {
  color: var(--primary);
  font-weight: 900;
}

.feature-card strong {
  display: block;
  font-size: 1.25rem;
}

.feature-card small {
  color: var(--muted);
  font-size: 0.96rem;
}

.panel {
  padding: 20px;
}

.plain-panel {
  padding: 12px 0;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

.actions,
.compact-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.mode-picker button {
  display: grid;
  gap: 4px;
  text-align: left;
}

.mode-picker small {
  font-weight: 500;
  opacity: 0.78;
}

.actions > button,
.actions > a {
  flex: 1 1 180px;
}

.compact-actions > button {
  width: auto;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}

.notice {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
}

.notice.warn {
  background: var(--warn-bg);
}

.textarea {
  display: block;
  width: 100%;
  min-height: 170px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d131c;
  color: var(--text);
  resize: vertical;
}

.file-picker {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #0d131c;
  color: var(--muted);
}

.file-picker input {
  width: 100%;
}

.category-list,
.entry-list,
.wrong-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-item,
.entry-item,
.wrong-item,
.check-row,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d131c;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.entry-item,
.wrong-item {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.entry-row,
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-name,
.english {
  font-weight: 850;
}

.english {
  font-size: clamp(1.08rem, 4vw, 1.55rem);
  overflow-wrap: anywhere;
}

.english.large {
  font-size: clamp(1.65rem, 7vw, 3rem);
}

.chinese {
  font-size: 1.08rem;
  color: #c7d1d9;
}

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

.icon-button {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  color: var(--primary);
  font-size: 1.15rem;
  line-height: 1;
}

.play-large {
  width: 68px;
  height: 68px;
  justify-self: center;
  font-size: 1.45rem;
}

.practice-card {
  min-height: 410px;
  display: grid;
  align-content: center;
  gap: 22px;
  text-align: center;
}

.progress {
  color: var(--primary);
  font-weight: 900;
}

.hidden-answer {
  min-height: 104px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 12px;
}

.check-row input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.stat {
  padding: 14px;
}

.stat strong {
  display: block;
  color: var(--primary);
  font-size: 1.55rem;
}

@media (max-width: 820px) {
  .shell {
    padding: 16px;
  }

  .topbar,
  .hero,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    display: flex;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: stretch;
  }

  .nav-button {
    flex: 1 1 30%;
  }

  .landing-grid,
  .grid,
  .mode-picker,
  .summary {
    grid-template-columns: 1fr;
  }

  .category-item,
  .entry-row,
  .result-row {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-actions > button {
    flex: 1 1 120px;
  }

  .panel {
    padding: 16px;
  }
}
