:root {
  --bg: #f5f7f3;
  --paper: #ffffff;
  --ink: #18211f;
  --muted: #6c7773;
  --line: #dce5df;
  --green: #17745f;
  --green-dark: #0f5948;
  --mint: #dff3ec;
  --yellow: #f5c44f;
  --red: #c44e4e;
  --shadow: 0 16px 40px rgba(34, 53, 47, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(223, 243, 236, 0.75), rgba(245, 247, 243, 0.2) 42%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans Thai", system-ui,
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.72;
}

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

.hidden {
  display: none !important;
}

.landing,
.panel,
.training {
  min-height: calc(100vh - 36px);
}

.landing {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 28px;
  padding: 34px 0 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(23, 116, 95, 0.18);
  border-radius: 8px;
  background: var(--paper);
  color: var(--green);
  font-size: 54px;
  line-height: 1;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 18px;
  letter-spacing: 0;
}

.entry-grid {
  display: grid;
  gap: 12px;
  margin-top: clamp(72px, 22vh, 160px);
}

.entry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  box-shadow: 0 10px 24px rgba(34, 53, 47, 0.08);
}

.entry-card.primary {
  border-color: transparent;
  background: var(--green);
  color: #fff;
}

.entry-card.accent {
  border-color: rgba(196, 78, 78, 0.28);
  background: #fff8f2;
  color: #713c25;
}

.entry-card__title {
  font-size: 22px;
  font-weight: 800;
}

.entry-card__meta {
  color: inherit;
  opacity: 0.72;
  font-size: 13px;
}

.panel {
  padding-top: 10px;
}

.panel-head,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-head {
  justify-content: flex-start;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--green);
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(34, 53, 47, 0.08);
}

.ghost-btn,
.solid-btn,
.soft-btn,
.danger-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--green-dark);
}

.solid-btn {
  background: var(--green);
  color: #fff;
}

.soft-btn {
  background: var(--mint);
  color: var(--green-dark);
}

.danger-btn {
  background: #f8e2df;
  color: var(--red);
}

.login-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}

.login-form input {
  height: 50px;
  padding: 0 14px;
  font-size: 18px;
}

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

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

.training {
  padding-bottom: 24px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 6px;
  margin: 0 -4px 16px;
  padding: 8px 4px;
  overflow-x: auto;
  background: rgba(245, 247, 243, 0.94);
  backdrop-filter: blur(10px);
}

.tab {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.tab.active {
  background: var(--paper);
  color: var(--green);
  box-shadow: 0 6px 18px rgba(34, 53, 47, 0.08);
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.summary-grid,
.group-grid,
.sentence-grid {
  display: grid;
  gap: 10px;
}

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

.metric,
.card,
.group-card,
.sentence-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(34, 53, 47, 0.06);
}

.metric {
  min-height: 82px;
  padding: 12px;
}

.metric strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.today-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.course-entry-grid {
  display: grid;
  gap: 10px;
}

.course-entry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(228, 244, 238, 0.62);
}

.course-entry-card h4 {
  margin: 0 0 6px;
  font-size: 17px;
}

.course-entry-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.course-entry-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.course-entry-anchor {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.group-card {
  padding: 14px;
}

.group-card.locked {
  opacity: 0.58;
}

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

.group-title {
  margin: 0;
  font-size: 17px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.thai-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thai-chip {
  display: inline-grid;
  place-items: center;
  gap: 2px;
  min-width: 48px;
  min-height: 54px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

.thai-chip__main {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.thai-chip__reading {
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.hook-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hook-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 9px 4px 6px;
  border: 1px solid #f0ddb0;
  border-radius: 8px;
  background: #fff8e7;
  color: #76551a;
  font-size: 13px;
  font-weight: 800;
}

.hook-thumb {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
}

.hook-thumb svg {
  width: 24px;
  height: 24px;
}

.practice-shell {
  display: grid;
  gap: 12px;
}

.practice-card {
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.practice-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.prompt {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0 0 14px;
  border: 1px solid rgba(23, 116, 95, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3faf7);
  color: var(--ink);
  text-align: center;
  font-size: clamp(30px, 11vw, 68px);
  font-weight: 900;
  line-height: 1.12;
}

.prompt.text {
  padding: 18px;
  font-size: clamp(23px, 7vw, 34px);
}

.answer {
  min-height: 74px;
  padding: 12px;
  border-radius: 8px;
  background: #f9fbfa;
  color: var(--ink);
}

.answer.hidden-answer {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.answer-title {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.answer-main {
  margin: 0;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.35;
}

.answer-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.oral-lock-note {
  padding: 12px 14px;
  border: 1px dashed rgba(103, 130, 117, 0.42);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(246, 243, 234, 0.72);
  font-size: 14px;
  line-height: 1.45;
}

.practice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sentence-card {
  padding: 14px;
}

.section-title {
  margin: 18px 0 10px;
}

.section-title h3 {
  margin-bottom: 4px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.oral-course-grid,
.lesson-grid,
.lesson-blocks {
  display: grid;
  gap: 10px;
}

.review-audio-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.review-audio-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
}

.review-audio-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.review-audio-item audio {
  width: 100%;
}

.oral-course-card,
.lesson-row,
.lesson-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(34, 53, 47, 0.06);
}

.oral-course-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.oral-course-card-pending {
  background: rgba(246, 243, 234, 0.58);
}

.oral-course-card-pending h3,
.oral-course-card-pending .sentence-meta {
  color: var(--muted);
}

.oral-course-card h3 {
  margin-bottom: 6px;
}

.lesson-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
}

.lesson-row span {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.lesson-row strong {
  font-size: 16px;
}

.lesson-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.lesson-section {
  display: grid;
  gap: 10px;
}

.lesson-section + .lesson-section {
  margin-top: 8px;
}

.lesson-section__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.lesson-section__head::-webkit-details-marker {
  display: none;
}

.lesson-section__head h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.lesson-section__head h4::before {
  content: "›";
  color: var(--green);
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
}

.lesson-section[open] .lesson-section__head h4::before {
  transform: rotate(90deg);
}

.lesson-section__head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.lesson-section__body {
  display: grid;
  gap: 10px;
}

.lesson-block {
  padding: 12px;
}

.lesson-block p {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.65;
}

.text-block {
  background: #fbfcfb;
}

.audio-block {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 10px;
}

.audio-block audio {
  width: 100%;
  min-width: 0;
}

.audio-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.audio-meta strong {
  color: var(--green-dark);
  font-size: 16px;
}

.review-card {
  display: grid;
  gap: 14px;
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.review-prompt {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 18px;
  border: 1px solid rgba(23, 116, 95, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3faf7);
  color: var(--ink);
  text-align: center;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.25;
}

.review-waiting,
.review-answer {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: #f9fbfa;
}

.review-waiting span {
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 900;
}

.review-waiting small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.review-thai {
  margin: 0;
  color: var(--green-dark);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.35;
}

.review-answer audio {
  width: 100%;
}

.block-index {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--mint);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.sentence-zh {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 850;
}

.sentence-thai {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 24px;
  font-weight: 850;
}

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

.sentence-gloss {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sentence-gloss-chip {
  display: inline-grid;
  gap: 3px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid rgba(23, 32, 33, 0.1);
  border-radius: 10px;
  background: rgba(228, 244, 238, 0.62);
}

.sentence-gloss-chip b {
  color: var(--green-dark);
  font-size: 15px;
  line-height: 1.15;
}

.sentence-gloss-chip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.timer-face {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 52px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-controls {
  display: grid;
  gap: 10px;
}

.timer-control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.timer-controls select,
.timer-controls input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.timer-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.timer-content-card {
  margin-bottom: 12px;
}

.timer-mini-list {
  display: grid;
  gap: 8px;
}

.timer-mini-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.timer-mini-row:first-child {
  border-top: 0;
}

.timer-mini-row strong {
  font-size: 16px;
}

.timer-mini-row span {
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 850;
}

.share-form textarea {
  min-height: 160px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

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

.share-form input,
.share-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}

.share-form input {
  height: 46px;
  padding: 0 12px;
}

.lexicon-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.lexicon-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(34, 53, 47, 0.06);
}

.lexicon-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lexicon-thai {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.12;
}

.lexicon-pinyin {
  margin: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
}

.lexicon-card .group-actions {
  margin-top: 2px;
}

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

.share-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(34, 53, 47, 0.06);
}

.share-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.share-card__title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
}

.share-card__meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .app-shell {
    padding: 14px;
  }

  h1 {
    font-size: 30px;
  }

  .brand-mark {
    width: 68px;
    height: 68px;
    font-size: 48px;
  }

  .today-actions,
  .practice-actions {
    grid-template-columns: 1fr;
  }

  .oral-course-card,
  .lesson-row,
  .audio-block {
    grid-template-columns: 1fr;
  }

  .oral-course-card {
    align-items: stretch;
  }

  .lesson-row small {
    text-align: left;
  }

  .lesson-section__head {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .lesson-section__head span {
    text-align: left;
    white-space: normal;
  }

  .tab {
    font-size: 12px;
  }
}

/* MVP 1.0 UI refresh */
:root {
  --bg: #f5f7f3;
  --paper: #ffffff;
  --paper-soft: #fbfcfa;
  --ink: #15231f;
  --muted: #65736f;
  --line: #dde7e1;
  --green: #0f775f;
  --green-dark: #075644;
  --mint: #e4f4ec;
  --mint-strong: #c9ecd9;
  --blue: #0f62c8;
  --blue-soft: #e8f0ff;
  --amber: #f08b22;
  --amber-soft: #fff1df;
  --red: #c94d47;
  --shadow: 0 14px 34px rgba(21, 35, 31, 0.1);
  --shadow-soft: 0 8px 22px rgba(21, 35, 31, 0.07);
  --topbar-height: 78px;
}

html {
  background: #eef3ee;
}

body {
  background: #eef3ee;
  color: var(--ink);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans Thai", "Noto Sans SC",
    system-ui, sans-serif;
  line-height: 1.5;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button:active,
a:active {
  transform: scale(0.99);
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  padding: 0;
  background: var(--bg);
}

.landing,
.panel,
.training {
  min-height: 100vh;
}

.landing {
  gap: 22px;
  padding: 22px 20px 28px;
  background: var(--paper-soft);
}

.brand-block {
  align-items: flex-start;
  padding-top: 8px;
}

.brand-block > div:last-child {
  flex: 1;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 36px;
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

h1 {
  max-width: 260px;
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}

.entry-grid {
  gap: 12px;
  margin-top: clamp(48px, 16vh, 112px);
}

.entry-card {
  display: block;
  position: relative;
  min-height: 92px;
  padding: 18px 46px 18px 18px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.entry-card::after {
  content: ">";
  position: absolute;
  right: 18px;
  top: 50%;
  color: var(--muted);
  font-size: 24px;
  font-weight: 800;
  transform: translateY(-50%);
}

.entry-card.primary {
  background: var(--green);
  color: #fff;
}

.entry-card.primary::after {
  color: rgba(255, 255, 255, 0.82);
}

.entry-card.accent {
  border-color: rgba(240, 139, 34, 0.24);
  background: var(--amber-soft);
  color: #6c3b0c;
}

.entry-card__title {
  display: block;
  font-size: 23px;
  line-height: 1.15;
}

.entry-card__meta {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
}

.panel {
  padding: 18px 20px 28px;
  background: var(--bg);
}

.panel-head,
.topbar {
  gap: 12px;
}

.panel-head {
  margin-bottom: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-height);
  margin: 0 -20px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(221, 231, 225, 0.86);
  background: rgba(245, 247, 243, 0.94);
  backdrop-filter: blur(16px);
}

.topbar > div:first-child,
.hero-row > div,
.section-title > div,
.course-entry-card > div,
.oral-course-card > div {
  flex: 1;
  min-width: 0;
}

.training {
  padding: 0 20px 32px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: none;
}

.ghost-btn,
.solid-btn,
.soft-btn,
.danger-btn {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.solid-btn {
  background: var(--green);
  box-shadow: 0 8px 18px rgba(15, 119, 95, 0.18);
}

.soft-btn {
  background: var(--mint);
  color: var(--green-dark);
}

.ghost-btn {
  border-color: var(--line);
  color: var(--ink);
}

.danger-btn {
  background: #fae7e4;
}

.login-form,
.card,
.group-card,
.sentence-card,
.practice-card,
.review-card,
.lexicon-card,
.share-card,
.oral-course-card,
.lesson-row,
.lesson-block {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.login-form {
  padding: 18px;
}

.form-message {
  font-weight: 700;
}

.tabs {
  position: sticky;
  top: var(--topbar-height);
  z-index: 19;
  gap: 8px;
  margin: 0 -20px 16px;
  padding: 10px 20px;
  background: rgba(245, 247, 243, 0.95);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  min-width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.tab.active {
  border-color: var(--line);
  background: var(--paper);
  color: var(--green);
  box-shadow: var(--shadow-soft);
}

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

.page-hero {
  margin: 16px 0;
  padding: 18px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  box-shadow: var(--shadow);
}

.page-hero .eyebrow,
.page-hero p {
  color: rgba(255, 255, 255, 0.82);
}

.page-hero h3,
.page-hero p {
  margin: 0;
}

.page-hero h3 {
  color: #fff;
  font-size: 24px;
  word-break: keep-all;
}

.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.hero-row strong {
  color: #fff;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.knowledge-hero {
  background: var(--blue);
}

.oral-hero {
  background: #136a58;
}

.progress-track {
  height: 9px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 82px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.metric strong {
  color: var(--green);
  font-size: 27px;
  line-height: 1;
}

.metric span {
  font-size: 12px;
  letter-spacing: 0;
}

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

.section-title h3 {
  margin: 0 0 3px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.action-panel {
  padding: 0;
  margin-bottom: 12px;
}

.today-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.today-actions .solid-btn,
.today-actions .soft-btn,
.today-actions .ghost-btn {
  min-height: 50px;
}

.course-entry-grid {
  gap: 10px;
}

.course-entry-card {
  min-height: 82px;
  padding: 15px;
  background: var(--paper);
}

.course-entry-card--primary {
  border-color: rgba(15, 119, 95, 0.2);
  background: #f1faf5;
}

.course-entry-card h4,
.oral-course-card h3 {
  line-height: 1.2;
  word-break: keep-all;
}

.group-grid,
.sentence-grid,
.oral-course-grid,
.lesson-grid,
.lesson-blocks,
.lexicon-grid,
.share-list {
  gap: 12px;
}

.group-card {
  position: relative;
  padding: 16px;
}

.group-card.locked {
  filter: grayscale(0.18);
  opacity: 0.52;
}

.group-title {
  font-size: 18px;
}

.pill {
  min-height: 28px;
  background: var(--mint);
  color: var(--green-dark);
  letter-spacing: 0;
}

.thai-line {
  gap: 8px;
}

.thai-chip {
  min-width: 54px;
  min-height: 58px;
  border-color: #d8dfdc;
  background: #f8f9f8;
}

.thai-chip__main,
.sentence-thai,
.lexicon-thai,
.review-thai {
  font-family:
    "Noto Sans Thai", "Leelawadee UI", "Tahoma", "PingFang SC", system-ui,
    sans-serif;
}

.thai-chip__main {
  font-size: 25px;
}

.hook-chip {
  border-color: rgba(240, 139, 34, 0.24);
  background: var(--amber-soft);
  color: #744008;
}

.oral-course-card {
  min-height: 78px;
}

.oral-course-card-pending {
  box-shadow: none;
}

.lesson-row {
  min-height: 64px;
}

.lesson-section__head {
  padding: 12px 2px 6px;
}

.practice-shell {
  margin-top: 12px;
}

.practice-card,
.review-card {
  min-height: 310px;
  padding: 18px;
}

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

.prompt,
.review-prompt {
  border: 0;
  background: #f7faf8;
  box-shadow: inset 0 0 0 1px rgba(221, 231, 225, 0.92);
}

.answer,
.review-waiting,
.review-answer {
  background: #f7faf8;
}

.timer-stage {
  display: grid;
  gap: 14px;
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.timer-stage__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.timer-stage h3 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
}

.timer-face {
  width: 214px;
  min-height: 214px;
  height: 214px;
  margin: 4px auto 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--paper) 0 63%, transparent 64%),
    conic-gradient(var(--green) calc(var(--timer-progress) * 1%), #e1e8e4 0);
  color: var(--ink);
  font-size: 44px;
  box-shadow: none;
}

.timer-main-actions {
  grid-template-columns: 1.5fr 1fr;
}

.timer-settings-card {
  box-shadow: none;
}

.timer-control-row {
  grid-template-columns: 1fr auto;
}

.timer-controls select,
.timer-controls input,
.share-form input,
.share-form textarea,
.login-form input {
  border-color: var(--line);
  background: var(--paper-soft);
}

.timer-mini-row {
  border-color: var(--line);
}

.lexicon-card {
  box-shadow: var(--shadow-soft);
}

.lexicon-thai {
  color: var(--green-dark);
  font-size: 34px;
}

.share-form textarea {
  min-height: 128px;
}

.training.is-timer-mode .tabs {
  margin-bottom: 8px;
}

@media (max-width: 420px) {
  .landing,
  .panel,
  .training {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar,
  .tabs {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 31px;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
    font-size: 34px;
  }

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

  .practice-actions button {
    padding-left: 10px;
    padding-right: 10px;
  }

  .timer-main-actions {
    grid-template-columns: 1.5fr 1fr;
  }

  .timer-face {
    width: 196px;
    min-height: 196px;
    height: 196px;
    font-size: 40px;
  }

  .tab {
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .today-actions,
  .practice-actions,
  .timer-main-actions {
    grid-template-columns: 1fr;
  }

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

/* Sawasdee Core MVP skin, aligned with the UI reference package. */
:root {
  --sw-bg: #faf9fe;
  --sw-surface: #ffffff;
  --sw-surface-soft: #f4f3f8;
  --sw-surface-mid: #eeedf3;
  --sw-line: #e3e2e7;
  --sw-text: #1a1b1f;
  --sw-muted: #656b78;
  --sw-blue: #0070eb;
  --sw-blue-dark: #0058bc;
  --sw-blue-soft: #d8e2ff;
  --sw-orange: #fe9400;
  --sw-orange-soft: #ffdcbf;
  --sw-green: #008733;
  --sw-green-soft: #72fe88;
  --sw-danger: #ba1a1a;
  --sw-shadow: 0 8px 24px rgba(26, 27, 31, 0.08);
  --sw-shadow-soft: 0 4px 18px rgba(26, 27, 31, 0.05);
  --sw-radius: 16px;
  --sw-bottom-nav: 72px;
}

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

body {
  background: var(--sw-bg);
  color: var(--sw-text);
  font-family:
    "Plus Jakarta Sans", "Be Vietnam Pro", "Noto Sans SC", "Microsoft YaHei",
    "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
}

body::before,
body::after {
  display: none;
}

.app-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--sw-bg);
  box-shadow: 0 0 0 1px rgba(26, 27, 31, 0.04);
}

.landing,
.panel,
.training {
  min-height: 100vh;
  padding: 18px 20px calc(var(--sw-bottom-nav) + 20px);
  background: var(--sw-bg);
}

.landing {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.brand-block {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 2px 0 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sw-blue);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(0, 112, 235, 0.22);
}

.eyebrow {
  color: var(--sw-blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--sw-text);
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.18;
}

.landing::after {
  content: "";
  display: block;
  height: 132px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(0, 112, 235, 0.94), rgba(0, 135, 51, 0.82)),
    linear-gradient(45deg, transparent 55%, rgba(255, 255, 255, 0.22) 55%);
  box-shadow: var(--sw-shadow);
  order: 1;
}

.landing .brand-block {
  order: 0;
}

.entry-grid {
  order: 2;
  display: grid;
  gap: 12px;
}

.entry-card {
  min-height: 86px;
  padding: 18px 18px;
  border: 0;
  border-radius: var(--sw-radius);
  background: var(--sw-surface);
  color: var(--sw-text);
  box-shadow: var(--sw-shadow);
}

.entry-card::after {
  top: 50%;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--sw-blue-soft);
  color: var(--sw-blue-dark);
  transform: translateY(-50%);
}

.entry-card.primary {
  background: var(--sw-blue);
  color: #fff;
}

.entry-card.primary::after {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.entry-card.accent {
  background: #fff6ea;
  color: var(--sw-text);
}

.entry-card.accent::after {
  background: var(--sw-orange);
  color: #fff;
}

.entry-card__title {
  color: inherit;
  font-size: 18px;
  line-height: 1.25;
}

.entry-card__meta {
  margin-top: 5px;
  color: inherit;
  opacity: 0.72;
}

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

.panel-head,
.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: auto;
  margin: 0 -20px 14px;
  padding: 16px 20px 14px;
  background: rgba(250, 249, 254, 0.96);
  border-bottom: 1px solid var(--sw-line);
  box-shadow: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
}

.topbar h2,
.panel-head h2 {
  margin: 2px 0 0;
  font-size: 21px;
  line-height: 1.2;
}

.ghost-btn,
.solid-btn,
.soft-btn,
.danger-btn,
.icon-btn {
  min-height: 42px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: none;
}

.solid-btn {
  border-color: var(--sw-blue);
  background: var(--sw-blue);
  color: #fff;
}

.soft-btn,
.ghost-btn,
.icon-btn {
  border-color: transparent;
  background: var(--sw-surface-mid);
  color: var(--sw-blue-dark);
}

.danger-btn {
  border-color: transparent;
  background: #ffdad6;
  color: var(--sw-danger);
}

.login-form {
  padding: 18px;
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-radius);
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow);
}

.login-form input,
.timer-controls select,
.timer-controls input,
.share-form input,
.share-form textarea {
  min-height: 46px;
  border: 1px solid var(--sw-line);
  border-radius: 10px;
  background: var(--sw-surface-soft);
  color: var(--sw-text);
}

.form-message,
.section-title p,
.sentence-meta,
.answer-note,
.timer-hint,
.share-card__meta,
.lexicon-pinyin {
  color: var(--sw-muted);
}

.training {
  padding-top: 0;
}

.tabs {
  position: fixed;
  top: auto;
  right: max(0px, calc((100vw - 430px) / 2));
  bottom: 0;
  left: max(0px, calc((100vw - 430px) / 2));
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(50px, 1fr);
  gap: 0;
  margin: 0;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  height: var(--sw-bottom-nav);
  align-items: center;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--sw-line);
  box-shadow: 0 -8px 24px rgba(26, 27, 31, 0.08);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 50px;
  min-height: 54px;
  height: 54px;
  padding: 5px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sw-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: none;
}

.tab::before {
  content: "·";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: inherit;
  font-size: 18px;
  line-height: 1;
}

.tab[data-tab="today"]::before {
  content: "⌂";
}

.tab-link::before {
  content: "□";
}

.tab[data-tab="knowledge"]::before {
  content: "◇";
}

.tab[data-tab="sentences"]::before {
  content: "◌";
}

.tab[data-tab="timer"]::before {
  content: "◷";
}

.tab[data-tab="share"]::before {
  content: "+";
}

.tab[data-tab="lexicon"]::before {
  content: "Aa";
  font-size: 11px;
}

.tab.active {
  background: var(--sw-blue-soft);
  color: var(--sw-blue-dark);
  box-shadow: none;
}

.tab-page {
  padding-bottom: calc(var(--sw-bottom-nav) + 18px);
}

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

.metric {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-radius);
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow-soft);
}

.metric strong {
  color: var(--sw-blue);
  font-size: 30px;
}

.metric span {
  color: var(--sw-muted);
}

.card,
.group-card,
.sentence-card,
.course-entry-card,
.oral-course-card,
.lesson-row,
.lesson-block,
.share-card,
.lexicon-card,
.timer-stage,
.timer-settings-card {
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-radius);
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow-soft);
}

.card {
  padding: 16px;
}

.today-actions,
.practice-actions,
.timer-main-actions {
  gap: 10px;
}

.today-actions .solid-btn,
.practice-actions .solid-btn,
.timer-main-actions .solid-btn {
  background: var(--sw-blue);
}

.course-entry-grid,
.group-grid,
.sentence-grid,
.oral-course-grid,
.lesson-grid,
.lesson-blocks,
.lexicon-grid,
.share-list {
  gap: 12px;
}

.course-entry-card {
  min-height: 86px;
  padding: 16px;
}

.course-entry-card--primary,
.course-entry-card:nth-child(1) {
  border-color: transparent;
  background: var(--sw-blue);
  color: #fff;
}

.course-entry-card:nth-child(2) {
  border-color: transparent;
  background: #fff3e1;
}

.course-entry-card:nth-child(3) {
  border-color: transparent;
  background: #effff2;
}

.course-entry-card--primary h4,
.course-entry-card--primary p,
.course-entry-card--primary .course-entry-link {
  color: #fff;
}

.course-entry-link {
  color: var(--sw-blue-dark);
}

.group-card {
  padding: 16px;
}

.group-card.locked {
  opacity: 0.56;
}

.group-title {
  font-size: 17px;
}

.pill {
  border: 0;
  background: var(--sw-blue-soft);
  color: var(--sw-blue-dark);
}

.thai-chip {
  border: 0;
  border-radius: 12px;
  background: var(--sw-surface-soft);
}

.thai-chip__main,
.sentence-thai,
.lexicon-thai,
.review-thai,
.prompt {
  font-family:
    "Noto Sans Thai", "Leelawadee UI", "Tahoma", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
}

.thai-chip__main {
  color: var(--sw-blue-dark);
}

.hook-chip {
  border: 0;
  background: var(--sw-orange-soft);
  color: #6a3b00;
}

.section-title {
  margin: 6px 0 12px;
}

.section-title h3 {
  font-size: 19px;
}

.oral-course-card,
.lesson-row {
  min-height: 78px;
  padding: 15px;
}

.oral-course-card:nth-child(3n + 1) {
  background: var(--sw-blue);
  color: #fff;
}

.oral-course-card:nth-child(3n + 2) {
  background: #fff3e1;
}

.oral-course-card:nth-child(3n + 3) {
  background: #ecfff0;
}

.oral-course-card:nth-child(3n + 1) h3,
.oral-course-card:nth-child(3n + 1) .sentence-meta,
.oral-course-card:nth-child(3n + 1) .course-entry-link {
  color: #fff;
}

.lesson-section {
  border-bottom: 1px solid var(--sw-line);
}

.lesson-section__head {
  padding: 13px 2px 8px;
}

.audio-block {
  background: var(--sw-surface-soft);
}

.practice-shell {
  margin-top: 12px;
}

.practice-card,
.review-card {
  min-height: 320px;
  padding: 18px;
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-radius);
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow);
}

.prompt,
.review-prompt {
  border: 0;
  border-radius: 14px;
  background: var(--sw-surface-soft);
  box-shadow: none;
}

.answer,
.review-waiting,
.review-answer {
  border: 0;
  border-radius: 14px;
  background: var(--sw-surface-soft);
}

.review-thai,
.answer-main,
.lexicon-thai {
  color: var(--sw-blue);
}

.timer-stage {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--sw-surface);
}

.timer-face {
  width: 214px;
  min-height: 214px;
  height: 214px;
  border: 8px solid transparent;
  background:
    radial-gradient(circle, var(--sw-surface) 0 61%, transparent 62%),
    conic-gradient(var(--sw-blue) calc(var(--timer-progress) * 1%), var(--sw-line) 0);
  color: var(--sw-blue-dark);
  font-size: 42px;
  box-shadow: none;
}

.timer-stage.timer-hot .timer-face {
  background:
    radial-gradient(circle, var(--sw-surface) 0 61%, transparent 62%),
    conic-gradient(var(--sw-orange) calc(var(--timer-progress) * 1%), var(--sw-line) 0);
  color: #6a3b00;
}

.timer-mini-row {
  border-color: var(--sw-line);
}

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

.lexicon-card {
  padding: 16px;
}

.lexicon-thai {
  font-size: 34px;
}

.share-form {
  border-radius: var(--sw-radius);
}

.share-card__title {
  color: var(--sw-blue-dark);
}

@media (min-width: 760px) {
  body {
    background:
      linear-gradient(90deg, #f0f2f8 0, #faf9fe 28%, #faf9fe 72%, #eef2f8 100%);
  }

  .app-shell {
    min-height: 100vh;
  }
}

@media (max-width: 420px) {
  .landing,
  .panel,
  .training {
    padding-right: 16px;
    padding-left: 16px;
  }

  .panel-head,
  .topbar {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  h1 {
    font-size: 27px;
  }

  .summary-grid,
  .today-actions,
  .practice-actions,
  .timer-main-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timer-face {
    width: 190px;
    min-height: 190px;
    height: 190px;
    font-size: 38px;
  }
}

@media (max-width: 340px) {
  .summary-grid,
  .today-actions,
  .practice-actions,
  .timer-main-actions {
    grid-template-columns: 1fr;
  }
}
