:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --panel: #ffffff;
  --panel-strong: #eef6f1;
  --ink: #17201d;
  --muted: #66736f;
  --line: #dbe4df;
  --primary: #1f5d50;
  --primary-strong: #123f37;
  --accent: #df6f52;
  --gold: #c9971f;
  --blue: #4169a8;
  --danger: #b94747;
  --ok: #22734f;
  --shadow: 0 14px 40px rgba(23, 32, 29, 0.08);
  --radius: 8px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f9fbfa 0, #f3f6f5 42%, #edf3ef 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  max-width: 920px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 16px calc(94px + env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 44px;
  gap: 12px;
  align-items: center;
  padding: 10px 0 18px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--primary);
  box-shadow: var(--shadow);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.icon-button,
.nav-item,
.choice,
.task-row,
.pill-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--primary);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button svg,
.nav-item svg,
.button-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.band {
  margin-bottom: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.band.soft {
  background: var(--panel-strong);
  box-shadow: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.countdown-box {
  display: grid;
  min-height: 132px;
  align-content: space-between;
  padding: 16px;
  color: #ffffff;
  background: var(--primary);
  border-radius: var(--radius);
}

.countdown-box .big {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.countdown-box .sub {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.goal-box {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  background: #fff7eb;
  border: 1px solid #f0d7ad;
  border-radius: var(--radius);
}

.goal-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201, 151, 31, 0.2);
  color: #593f0d;
}

.goal-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title p,
.muted {
  color: var(--muted);
}

.muted,
.section-title p {
  margin-bottom: 0;
  line-height: 1.5;
}

.focus-list,
.recite-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.focus-list li,
.recite-list li {
  padding: 10px 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.45;
}

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

.task-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.task-row.done {
  border-color: rgba(34, 115, 79, 0.35);
  background: #f0faf3;
}

.task-check {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #ffffff;
  background: #c5d0cb;
  border-radius: 8px;
}

.task-row.done .task-check {
  background: var(--ok);
}

.task-minutes {
  color: var(--muted);
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric {
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 22px;
}

.module-bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 74px 1fr 52px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #e5ece8;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.bar-fill.blue {
  background: var(--blue);
}

.bar-fill.gold {
  background: var(--gold);
}

.reminder-row,
.filter-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.reminder-row input,
.filter-row select,
.subjective-select {
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.primary-button,
.secondary-button,
.danger-button,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius);
  line-height: 1;
}

.primary-button {
  color: #ffffff;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--line);
}

.danger-button {
  color: #ffffff;
  background: var(--danger);
}

.pill-button {
  min-height: 36px;
  color: var(--primary);
  background: #edf7f2;
  border: 1px solid #cde1d8;
}

.flashcard {
  display: grid;
  gap: 14px;
  min-height: 280px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card-meta,
.question-meta,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  color: var(--primary);
  background: #eef7f2;
  border: 1px solid #d0e4da;
  border-radius: 8px;
  font-size: 12px;
}

.badge.gold {
  color: #66480a;
  background: #fff6df;
  border-color: #ecd28d;
}

.badge.red {
  color: #7c2e2e;
  background: #fff1ef;
  border-color: #efc7c0;
}

.flashcard h3 {
  margin-bottom: 0;
  font-size: 22px;
}

.flashcard .front,
.flashcard .back {
  margin-bottom: 0;
  line-height: 1.65;
}

.flashcard .back {
  padding: 12px;
  background: #f8fbfa;
  border: 1px dashed #b8c9c1;
  border-radius: var(--radius);
}

.question-panel {
  display: grid;
  gap: 14px;
}

.question-stem {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.55;
}

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

.choice {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.choice.selected {
  border-color: var(--primary);
  background: #eff8f3;
}

.choice.correct {
  border-color: rgba(34, 115, 79, 0.48);
  background: #edf9f2;
}

.choice.wrong {
  border-color: rgba(185, 71, 71, 0.45);
  background: #fff0ef;
}

.choice-key {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--primary);
  background: #eef7f2;
  border-radius: 8px;
  font-weight: 700;
}

.explanation {
  padding: 12px;
  background: #f7faf8;
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.6;
}

.textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.65;
}

.score-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.chat-log {
  display: grid;
  gap: 10px;
  max-height: 470px;
  overflow: auto;
  padding-right: 2px;
}

.message {
  width: min(88%, 640px);
  padding: 12px;
  border-radius: var(--radius);
  line-height: 1.6;
}

.message.user {
  justify-self: end;
  color: #ffffff;
  background: var(--primary);
}

.message.coach {
  justify-self: start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.chat-form input {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bottom-nav {
  position: fixed;
  right: max(12px, calc((100vw - 920px) / 2 + 12px));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 920px) / 2 + 12px));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 46px rgba(23, 32, 29, 0.14);
  backdrop-filter: blur(14px);
}

.nav-item {
  display: grid;
  gap: 4px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
}

.nav-item.active {
  color: #ffffff;
  background: var(--primary);
}

.empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  background: #f8fbfa;
  border: 1px dashed #bdcbc5;
  border-radius: var(--radius);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px 12px calc(92px + env(safe-area-inset-bottom));
  }

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

  .bar-row {
    grid-template-columns: 68px 1fr 46px;
  }

  .task-row {
    grid-template-columns: 26px 1fr;
  }

  .task-minutes {
    grid-column: 2;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) {
  .two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}
