:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #62716a;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --line: #e5e0d7;
  --jade: #0f8b75;
  --jade-dark: #086253;
  --coral: #e8583f;
  --gold: #d99a2b;
  --blue: #4267b2;
  --shadow: 0 18px 55px rgba(23, 33, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 139, 117, 0.16), transparent 34rem),
    linear-gradient(140deg, #fbfaf7 0%, #eef5f1 48%, #fff6ee 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 36px;
}

.topbar,
.section-heading,
.lesson-meta,
.word-item,
.ops-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 18px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow,
.lesson-meta,
.panel-note,
.metric-label,
.word-item small,
.section-heading span,
.heard-text {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
  letter-spacing: 0;
}

.plan-pill,
.login-button,
.text-pill {
  border: 1px solid rgba(15, 139, 117, 0.28);
  border-radius: 999px;
  background: rgba(15, 139, 117, 0.1);
  color: var(--jade-dark);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
  padding: 8px 14px;
}

.login-button {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.challenge,
.daily-list,
.history-card,
.upgrade-card,
.ops-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.challenge {
  padding: 20px;
}

.lesson-meta {
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.phrase-block {
  padding: 26px 0 22px;
  text-align: center;
}

.hanzi {
  margin-bottom: 10px;
  font-size: clamp(2.35rem, 11vw, 3.65rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.pinyin {
  margin-bottom: 8px;
  color: var(--jade-dark);
  font-size: 1.05rem;
  font-weight: 850;
}

.translation {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.audio-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.audio-panel {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.panel-label {
  margin-bottom: 4px;
  font-size: 0.92rem;
  font-weight: 850;
}

.panel-note {
  margin-bottom: 0;
  font-size: 0.8rem;
  line-height: 1.35;
}

.round-button {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--jade);
  color: white;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 950;
  box-shadow: 0 12px 24px rgba(15, 139, 117, 0.24);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    opacity 0.16s ease;
}

.round-button:hover {
  transform: translateY(-1px);
  background: var(--jade-dark);
}

.round-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.record {
  background: var(--coral);
  box-shadow: 0 12px 24px rgba(232, 88, 63, 0.22);
}

.record.is-recording {
  animation: pulse 1s infinite;
  background: #c93625;
}

.playback {
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(66, 103, 178, 0.18);
}

.voice-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #17211c;
  color: white;
}

.score-ring {
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #17211c 58%, transparent 59%),
    conic-gradient(var(--gold) 0deg, rgba(255, 255, 255, 0.18) 0deg);
}

.score-ring span {
  font-size: 1.95rem;
  font-weight: 950;
  line-height: 1;
}

.score-ring small {
  margin-top: -30px;
  font-weight: 850;
}

.score-copy {
  min-width: 0;
}

.score-label {
  margin-bottom: 4px;
  color: #a8dacf;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-copy h2 {
  margin-bottom: 6px;
  font-size: 1.18rem;
  line-height: 1.18;
}

.score-copy p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  line-height: 1.4;
}

.completion-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 139, 117, 0.22);
  border-radius: 8px;
  background: #f1fbf7;
}

.completion-card[hidden] {
  display: none;
}

.completion-card h2 {
  margin-bottom: 4px;
  font-size: 1rem;
  line-height: 1.22;
}

.completion-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.heard-text {
  min-height: 22px;
  margin: 10px 2px 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.progress-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.progress-row > div,
.ops-panel > div {
  padding: 13px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.metric-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.progress-row strong,
.ops-panel strong {
  font-size: 1.02rem;
}

.upgrade-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  margin-top: 16px;
  padding: 18px;
}

.upgrade-card h2 {
  margin-bottom: 7px;
  font-size: 1.15rem;
}

.upgrade-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.42;
}

.price-block {
  min-width: 132px;
  display: grid;
  gap: 8px;
  align-content: center;
  text-align: right;
}

.price-block strong {
  font-size: 1.1rem;
}

.price-block span {
  margin-top: -8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
  padding: 10px 12px;
}

.secondary-button.compact {
  padding: 7px 10px;
  font-size: 0.78rem;
}

.primary-button {
  background: var(--jade);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.daily-list,
.history-card,
.ops-panel {
  margin-top: 16px;
  padding: 16px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.02rem;
}

.word-list {
  display: grid;
}

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

.history-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.history-score {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 139, 117, 0.12);
  color: var(--jade-dark);
  font-weight: 950;
}

.history-copy strong,
.history-copy small {
  display: block;
}

.history-copy strong {
  margin-bottom: 2px;
  font-size: 0.98rem;
}

.history-copy small,
.history-time {
  color: var(--muted);
  font-size: 0.78rem;
}

.word-item {
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.word-item strong,
.word-item small {
  display: block;
}

.word-item strong {
  margin-bottom: 3px;
  font-size: 1.08rem;
}

.locked {
  color: var(--jade-dark);
  font-size: 0.8rem;
  font-weight: 850;
}

.ops-panel {
  align-items: stretch;
}

.ops-panel > div {
  flex: 1;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer a {
  color: var(--jade-dark);
  text-decoration: none;
  font-weight: 850;
}

.legal-page {
  margin: 0 auto;
  padding: 28px 18px 44px;
  width: min(100%, 760px);
  color: var(--ink);
}

.legal-page h1 {
  margin-bottom: 12px;
  font-size: 2rem;
}

.legal-page h2 {
  margin: 24px 0 8px;
  font-size: 1.08rem;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.6;
}

.legal-page a {
  color: var(--jade-dark);
  font-weight: 850;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@media (max-width: 460px) {
  .app-shell {
    padding-inline: 12px;
  }

  .challenge,
  .daily-list,
  .history-card,
  .upgrade-card,
  .ops-panel {
    padding: 14px;
  }

  .audio-compare,
  .completion-card,
  .upgrade-card,
  .ops-panel {
    grid-template-columns: 1fr;
  }

  .price-block {
    text-align: left;
  }

  .ops-panel {
    display: grid;
  }

  .ops-panel > div {
    width: 100%;
  }

  .audio-panel {
    min-height: 138px;
  }

  .score-ring {
    width: 88px;
    height: 88px;
  }

  .score-ring span {
    font-size: 1.62rem;
  }

  .history-item {
    grid-template-columns: auto 1fr;
  }

  .history-time {
    grid-column: 2;
  }
}
