:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --ink: #1d2422;
  --muted: #55605c;
  --line: #e3ddd2;
  --brand: #0b6e69;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ef;
  --accent: #8a5a00;
  --accent-soft: #fdf1d6;
  --good: #1e6b34;
  --good-soft: #e5f4e8;
  --bad: #a1261c;
  --bad-soft: #fbe9e7;
  --warn: #7a5400;
  --warn-soft: #fff4d6;
  --radius: 14px;
  --focus: 3px solid #1a56db;
  font-size: 100%;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--brand); }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.2rem; }
[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; inset-inline-start: .5rem; top: .5rem; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 10; transform: translateY(-300%); }
.skip-link:focus { transform: none; } /* v0.2.11: không đẩy ra ngoài lề trái (tiếng Ả Rập phải-sang-trái bị tràn ngang) */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem clamp(1rem, 4vw, 2rem); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); text-decoration: none; min-height: 44px; }
.draft-banner {
  margin: 0; padding: .5rem 1rem; text-align: center; font-size: .95rem;
  background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #f0dca3;
}
main { max-width: 1080px; margin: 0 auto; padding: clamp(1rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 3rem; }
.footer { max-width: 1080px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 2.5rem; border-top: 1px solid var(--line); font-size: .95rem; }
.footer p { margin: .25rem 0; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .95rem; }
.eyebrow { color: var(--brand); font-weight: 600; letter-spacing: .02em; margin: 0 0 .5rem; }
.vi, .phrase-vi { font-weight: 600; }
.loading { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 3.5vw, 2rem); margin: 0 0 1.5rem; }
.card.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }

/* ---------- buttons ---------- */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 44px; min-width: 44px; padding: .6rem 1.1rem;
  border-radius: 10px; border: 2px solid transparent; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #09595a; }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.btn-secondary:hover { background: var(--brand-soft); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f3efe7; }
.btn-audio { background: var(--brand-soft); color: #064c49; border-color: #bfdcd8; }
.option span, .actions .btn { white-space: normal; }
.btn-lang { width: 100%; font-size: 1.15rem; background: var(--surface); color: var(--ink); border-color: var(--line); padding: 1rem; }
.btn-lang:hover, .btn-lang[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); }
.link-quiet { color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.link-quiet:hover { text-decoration: underline; }

/* ---------- language ---------- */
.lang-select { text-align: center; }
.lang-list { display: grid; gap: .75rem; max-width: 360px; margin: 1.5rem auto; }

/* ---------- discover ---------- */
.hero {
  position: relative;
  background: linear-gradient(135deg, #0b6e69 0%, #0f5d73 55%, #3a4f7a 100%);
  color: #fff; border-radius: calc(var(--radius) + 4px);
  padding: clamp(1.5rem, 6vw, 3.5rem); margin-bottom: 2rem;
}
.hero .eyebrow { color: #f4d58d; }
.hero h1 { max-width: 20ch; }
.hero .lead { font-size: 1.15rem; max-width: 62ch; }
.hero .invite { font-weight: 600; max-width: 62ch; }
.hero .btn-primary { background: #f4c542; color: #1d2422; }
.hero .btn-primary:hover { background: #ffd65e; }
.hero .btn-secondary { background: transparent; color: #fff; border-color: #fff; }
.hero .btn-secondary:hover { background: rgba(255,255,255,.12); }
.hero :focus-visible { outline-color: #f4d58d; }
.skip-intro { position: absolute; top: .75rem; right: 1rem; color: #fff; font-size: .95rem; min-height: 44px; display: inline-flex; align-items: center; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
@media (max-width: 560px) {
  .skip-intro { position: static; margin-bottom: .5rem; }
  .cta-row .btn { width: 100%; }
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.vn-card { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--brand); border-radius: var(--radius); padding: 1.2rem; }
.vn-card.group-nature { border-top-color: #2f7d3a; }
.vn-card.group-heritage { border-top-color: #8c4a2f; }
.vn-card.group-culture { border-top-color: #7b3f8c; }
.vn-card.group-food { border-top-color: #c0601a; }
.vn-card.group-everyday { border-top-color: #3a6ea5; }
.vn-card.featured {
  grid-column: 1 / -1; border-top-color: #c98a00;
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%);
}
.vn-card.featured h3 { font-size: 1.45rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: #f0ece4; color: var(--muted); }
.chip-featured { background: #c98a00; color: #1d1600; }
.chip-draft { background: var(--warn-soft); color: var(--warn); }
.sources summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.sources ul { padding-left: 1.2rem; margin: 0; font-size: .92rem; }
.sources li { margin-bottom: .35rem; overflow-wrap: anywhere; }
.media-note { margin-top: 1rem; }
.related { list-style: none; padding: 0; }
.related a { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.ready { text-align: center; margin-top: 2rem; }

/* ---------- mission 0 ---------- */
.motives { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1.25rem 0; }
.motives legend { font-weight: 700; padding: 0 .4rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-check { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .9rem; border: 2px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--surface); }
.chip-check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.chip-check input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }
.can-do li { margin-bottom: .3rem; }
.badge { display: inline-block; background: var(--good-soft); color: var(--good); font-weight: 700; padding: .5rem .9rem; border-radius: 10px; }

/* ---------- lesson ---------- */
.lesson { max-width: 760px; margin: 0 auto; }
.lesson-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.progress { height: 8px; background: #ece6db; border-radius: 99px; overflow: hidden; margin: .25rem 0 1rem; }
.progress-bar { height: 100%; background: var(--brand); width: 0; transition: width .3s ease; }
.stage { margin-bottom: .75rem; background: var(--brand-soft); color: #064c49; }
.stage-mastery { background: var(--accent-soft); color: var(--accent); }
.scene { font-size: 1.15rem; }

.phrases { list-style: none; padding: 0; display: grid; gap: .75rem; }
.phrase { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.phrase p { margin: .2rem 0; }
.phrase .phrase-vi { font-size: 1.4rem; color: #064c49; }
.audio { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.audio .hint { flex-basis: 100%; margin: 0; }
.transcript summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.transcript .phrase-vi { font-size: 1.3rem; }

.options { border: 0; padding: 0; margin: 1rem 0; display: grid; gap: .6rem; }
.option { display: flex; align-items: center; gap: .75rem; min-height: 52px; padding: .65rem 1rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); font-size: 1.1rem; }
.option:hover { border-color: #9ccfc9; }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.option:has(input:disabled) { cursor: default; }
.option input { width: 1.25rem; height: 1.25rem; accent-color: var(--brand); flex-shrink: 0; }

.order-answer { min-height: 3rem; font-size: 1.4rem; font-weight: 600; padding: .5rem .8rem; border-bottom: 2px dashed var(--line); margin: .5rem 0 1rem; color: #064c49; }
.tiles { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.tile { min-height: 48px; min-width: 56px; padding: .4rem 1rem; font: inherit; font-size: 1.2rem; font-weight: 600; border: 2px solid var(--brand); color: #064c49; background: var(--surface); border-radius: 10px; cursor: pointer; }
.tile:disabled { opacity: .35; cursor: default; }

label { font-weight: 600; display: block; margin-bottom: .35rem; }
.chip-check, .option { font-weight: 500; margin: 0; }
.text-input { width: 100%; font: inherit; font-size: 1.15rem; min-height: 48px; padding: .6rem .8rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.text-input:focus { border-color: var(--brand); }

.chat { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .6rem; margin: 0 0 1rem; }
.bubble { max-width: 85%; padding: .65rem .9rem; border-radius: 14px; display: flex; flex-direction: column; gap: .15rem; }
.bubble.host { background: #f0ece4; align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.you { background: var(--brand-soft); align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.current .phrase-vi { font-size: 1.3rem; }
.bubble .who { font-size: .8rem; font-weight: 700; color: var(--muted); }
.bubble .meaning { color: var(--muted); font-size: .95rem; }

.feedback { margin: 1rem 0 0; border-radius: 12px; }
.feedback:empty { display: none; }
.feedback.good, .feedback.bad, .feedback.warn { padding: .8rem 1rem; }
.feedback.good { background: var(--good-soft); color: #154d25; border-left: 6px solid var(--good); }
.feedback.bad { background: var(--bad-soft); color: #7d1d15; border-left: 6px solid var(--bad); }
.feedback.warn { background: var(--warn-soft); color: var(--warn); border-left: 6px solid #c98a00; }
.feedback p { margin: .2rem 0; }
.fb-title { font-weight: 700; }
.actions { margin-top: 1.25rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.actions.stack { flex-direction: column; align-items: stretch; }
@media (max-width: 560px) { .actions .btn-lg { width: 100%; } }

.result { text-align: center; }
.result .score { font-size: 1.2rem; font-weight: 700; }
.result.fail .review-list { text-align: left; }
.review-list li { margin-bottom: .75rem; }
.error { border-color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.cta-row{display:flex;flex-wrap:wrap;gap:12px;margin-top:8px}
