:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #16211f;
  --muted: #66706c;
  --line: #dfe5df;
  --surface: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --gold: #d99725;
  --rose: #b94d63;
  --shadow: 0 14px 38px rgba(23, 35, 32, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.1), transparent 260px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 92px;
}

.topbar,
.mission-heading,
.practice-header,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 8vw, 2.2rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.icon-button,
.audio-button {
  min-width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  box-shadow: var(--shadow);
}

.progress-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.progress-panel > div,
.content-panel > div {
  min-height: 72px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.progress-panel strong {
  font-size: 1.2rem;
}

.content-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.content-panel strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
}

.mission-card,
.practice-area,
.tutorial-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mission-card {
  margin-bottom: 14px;
  padding: 16px;
}

.pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(217, 151, 37, 0.16);
  color: #85570e;
  font-size: 0.75rem;
  font-weight: 800;
}

.mission-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.mission-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px;
  border-radius: 8px;
  background: #f6faf8;
}

.check {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #d8eee9;
  color: var(--teal-dark);
  font-weight: 900;
}

.mission-name {
  margin: 0;
  font-weight: 800;
}

.mission-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.practice-area {
  padding: 16px;
}

.tutorial-panel {
  padding: 16px;
}

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

.tutorial-card {
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tutorial-card p,
.tutorial-card strong {
  margin-bottom: 0;
  line-height: 1.6;
}

.tutorial-point {
  margin-top: 8px;
  color: var(--teal-dark);
  font-weight: 800;
}

.tutorial-grid {
  display: grid;
  gap: 10px;
}

.tutorial-card.warning {
  background: #fff8e8;
}

.example-list {
  display: grid;
  gap: 10px;
}

.example-row {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 8px;
  background: #f6faf8;
}

.example-zh {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.example-pinyin {
  margin: 0;
  color: var(--teal-dark);
  font-weight: 800;
}

.example-ja {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.drill-question {
  margin-bottom: 10px;
  font-weight: 900;
}

.audio-button {
  padding: 0 13px;
  color: #fff;
  background: var(--teal);
  box-shadow: none;
}

.question-box {
  display: grid;
  place-items: center;
  min-height: 178px;
  margin: 16px 0 12px;
  padding: 18px;
  border-radius: 8px;
  background: #eef6f2;
  text-align: center;
}

.hanzi {
  margin-bottom: 6px;
  font-size: clamp(2.6rem, 18vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
}

.pinyin {
  margin-bottom: 12px;
  color: var(--teal-dark);
  font-size: 1.1rem;
  font-weight: 800;
}

.prompt {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.choices {
  display: grid;
  gap: 9px;
}

.choices.compact {
  gap: 8px;
}

.choice-button {
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.choice-button.correct {
  border-color: rgba(15, 118, 110, 0.5);
  background: #dff3ee;
}

.choice-button.wrong {
  border-color: rgba(185, 77, 99, 0.45);
  background: #f9e6ea;
}

.answer-panel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #fff8e8;
}

.answer-panel p {
  margin-bottom: 4px;
  font-weight: 800;
}

.answer-panel .note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.actions {
  margin-top: 14px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  flex: 1;
  background: var(--teal);
  color: #fff;
}

.secondary-button {
  width: 96px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.nav-item {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 4px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.nav-item.active {
  background: #dff3ee;
  color: var(--teal-dark);
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 30px;
  }

  .mission-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-panel {
    grid-template-columns: repeat(4, 1fr);
  }

  .tutorial-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
