/* China + Korea Adventure HQ — mobile-first */
:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --ink: #2b2620;
  --muted: #8a7f72;
  --accent: #e4572e;
  --accent-ink: #ffffff;
  --line: #eee4d4;
  --gold: #c9a227;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(60, 40, 20, .08);
  /* city accents */
  --shanghai-1: #0f2a4a; --shanghai-2: #c9a227;
  --beijing-1: #8e1f1f;  --beijing-2: #d4a017;
  --chengdu-1: #2e7d4f;  --chengdu-2: #f08a24;
  --seoul-1: #2b3a67;    --seoul-2: #7fd1c0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 84px; }
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: rgba(250, 246, 239, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.xp-badge {
  background: #2b2620; color: #ffd76a; font-weight: 700; font-size: 14px;
  padding: 6px 12px; border-radius: 999px;
}
#screens { padding: 0 0 24px; }
.screen { display: none; padding: 16px 16px 8px; animation: fadein .25s ease; }
.screen.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; padding: 18px 8px 6px; }
.hero-kicker { font-size: 12px; letter-spacing: 3px; color: var(--muted); font-weight: 700; }
.hero h1 { font-size: 34px; line-height: 1.1; margin: 6px 0; }
.hero-sub { color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.countdown-card {
  background: #2b2620; color: #fff; border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.countdown-card .big { font-size: 44px; font-weight: 800; color: #ffd76a; }
.countdown-card .lbl { font-size: 13px; opacity: .8; margin-top: 4px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 17px; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }

.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  font-size: 18px; padding: 6px 12px; cursor: pointer;
}
.btn-primary {
  display: block; width: 100%; border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font-size: 17px; font-weight: 800; padding: 15px; border-radius: 16px; margin: 10px 0;
}
.btn-small {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 9px 14px; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 8px;
}
.btn-ghost {
  border: 1px solid var(--line); background: transparent; border-radius: 12px;
  padding: 10px 14px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.btn-ghost.danger, .danger { color: #b3261e; border-color: #eec9c4; }

.tired-fab {
  display: block; width: 100%; margin: 16px 0 4px; padding: 16px;
  font-size: 18px; font-weight: 800; border: none; cursor: pointer;
  border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #7c5cbf, #4a90d9);
  box-shadow: var(--shadow);
}

/* progress */
.progress-wrap { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.progress-bar { flex: 1; height: 10px; background: #efe7d6; border-radius: 999px; overflow: hidden; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent)); border-radius: 999px; transition: width .4s; }
#unlock-pct { font-size: 13px; font-weight: 800; color: var(--muted); }

/* checklist rows */
.check-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 4px; border-bottom: 1px dashed var(--line); cursor: pointer;
}
.check-row:last-child { border-bottom: none; }
.check-box {
  flex: 0 0 26px; height: 26px; border-radius: 9px; border: 2px solid #d8c9ae;
  display: flex; align-items: center; justify-content: center; font-size: 15px; background: #fff;
}
.check-row.done .check-box { background: #2e7d4f; border-color: #2e7d4f; color: #fff; }
.check-row.done .check-text { text-decoration: line-through; color: var(--muted); }
.check-text { flex: 1; font-size: 15px; }
.check-xp { font-size: 12px; color: var(--gold); font-weight: 800; white-space: nowrap; }

/* city cards */
.city-card {
  border-radius: 22px; overflow: hidden; margin: 12px 0; cursor: pointer;
  color: #fff; box-shadow: var(--shadow); border: none; width: 100%; text-align: left; padding: 0;
  display: block;
}
.city-card .city-banner { padding: 22px 18px; position: relative; }
.city-card h3 { margin: 0; font-size: 24px; }
.city-card .cn { font-size: 15px; opacity: .85; }
.city-card .tagline { font-size: 14px; opacity: .9; margin-top: 6px; }
.city-card .lockline { font-size: 13px; margin-top: 10px; background: rgba(0,0,0,.28); display: inline-block; padding: 5px 12px; border-radius: 999px; }
.city-shanghai .city-banner { background: linear-gradient(135deg, var(--shanghai-1), #274b73); }
.city-beijing .city-banner { background: linear-gradient(135deg, var(--beijing-1), #b23a2a); }
.city-chengdu .city-banner { background: linear-gradient(135deg, var(--chengdu-1), #57a773); }
.city-seoul .city-banner { background: linear-gradient(135deg, var(--seoul-1), #4a6fa5); }

.theme-shanghai { --c1: var(--shanghai-1); --c2: var(--shanghai-2); }
.theme-beijing { --c1: var(--beijing-1); --c2: var(--beijing-2); }
.theme-chengdu { --c1: var(--chengdu-1); --c2: var(--chengdu-2); }
.theme-seoul { --c1: var(--seoul-1); --c2: var(--seoul-2); }
.city-hero { border-radius: 22px; padding: 26px 20px; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: var(--shadow); }
.city-hero h2 { margin: 0; font-size: 30px; }
.city-hero .cn-big { font-size: 40px; opacity: .9; }
.city-hero p { opacity: .92; font-size: 15px; }
.pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.22); margin: 2px 4px 2px 0; }
.spot { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.spot:last-child { border: none; }
.spot b { font-size: 15px; }
.spot p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.mission-lock { background: #f4ecdd; border-radius: 12px; padding: 12px; font-size: 14px; color: var(--muted); }

/* food passport */
.passport-city { font-weight: 800; font-size: 16px; margin: 16px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.dish {
  display: flex; gap: 12px; align-items: center; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 8px 0; cursor: pointer;
}
.dish .stamp {
  flex: 0 0 52px; height: 52px; border-radius: 50%;
  border: 2px dashed #cbbfa8; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: #faf6ef; transition: all .2s;
}
.dish.stamped .stamp { border: 2px solid #2e7d4f; background: #e9f5ec; transform: rotate(-8deg); }
.dish.stamped { border-color: #2e7d4f; }
.dish b { font-size: 15px; }
.dish .alt { font-size: 13px; color: var(--muted); }
.dish p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* quiz */
.quiz-q { font-size: 18px; font-weight: 800; margin: 6px 0 12px; }
.quiz-opt {
  display: block; width: 100%; text-align: left; margin: 8px 0; padding: 14px;
  border: 2px solid var(--line); background: #fff; border-radius: 14px; font-size: 15px; cursor: pointer;
}
.quiz-opt.correct { border-color: #2e7d4f; background: #e9f5ec; }
.quiz-opt.wrong { border-color: #b3261e; background: #fdecea; }
.quiz-opt:disabled { opacity: .85; cursor: default; }
.quiz-explain { background: #f4ecdd; border-radius: 12px; padding: 12px; font-size: 14px; margin: 10px 0; }
.quiz-progress { font-size: 13px; color: var(--muted); font-weight: 700; }

/* phrase cards */
.phrase-card { background: linear-gradient(135deg, #2b2620, #4a3f30); color: #fff; border-radius: 18px; padding: 20px; margin: 10px 0; }
.phrase-card .p-big { font-size: 34px; font-weight: 800; }
.phrase-card .p-py { font-size: 17px; color: #ffd76a; font-weight: 700; margin-top: 4px; }
.phrase-card .p-en { font-size: 15px; opacity: .9; margin-top: 6px; }
.phrase-card .p-use { font-size: 13px; opacity: .7; margin-top: 8px; font-style: italic; }
.lang-cat { font-weight: 800; font-size: 15px; margin: 18px 0 4px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; font-size: 13px; }
.lang-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 1px dashed var(--line); font-size: 15px; }
.lang-row .l1 { font-weight: 700; }
.lang-row .l2 { color: var(--muted); text-align: right; font-size: 14px; }
.seg { display: flex; background: #efe7d6; border-radius: 14px; padding: 4px; margin: 10px 0; }
.seg-btn { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 10px; font-size: 15px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* itinerary */
.itin-day { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.itin-date { flex: 0 0 64px; text-align: center; }
.itin-date .dow { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.itin-date .dnum { font-size: 22px; font-weight: 800; }
.itin-body { flex: 1; }
.itin-body b { font-size: 15px; }
.itin-note { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 14px; margin-top: 6px; font-family: inherit; resize: vertical; }

/* journal */
.j-entry { padding: 12px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.j-entry:last-child { border: none; }
.j-entry .j-date { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.j-entry b { font-size: 16px; }
.j-entry p { margin: 4px 0 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.form-card label { display: block; font-size: 13px; font-weight: 800; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.form-card input[type="date"], .form-card input[type="text"], .form-card textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px; font-family: inherit; background: #fff;
}
.mood-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mood-btn { font-size: 26px; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 10px; cursor: pointer; }
.mood-btn.sel { border-color: var(--accent); background: #fff4ee; }
.form-row { display: flex; gap: 10px; margin-top: 14px; }
.form-row .btn-primary { margin: 0; }
.days-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days-grid .dg { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.days-grid input { width: 56px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 16px; text-align: center; }

/* menu */
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 15px; font-size: 16px; cursor: pointer; margin: 4px 0; text-align: left;
}
.menu-item span { flex: 1; font-weight: 700; }
.menu-item em { font-style: normal; color: var(--muted); font-size: 13px; }
.menu-item .tag { background: #e9f5ec; color: #2e7d4f; font-weight: 800; padding: 3px 10px; border-radius: 999px; font-size: 11px; }

/* tired */
.tired-opt { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 10px 0; }
.tired-opt .t-ico { font-size: 30px; }
.tired-opt b { font-size: 16px; display: block; margin: 4px 0; }
.tired-opt p { margin: 0; font-size: 14px; color: var(--muted); }

/* map */
.map-card { padding: 8px; }
#memory-svg { width: 100%; height: auto; display: block; }

/* tabbar */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 20px; color: var(--muted); padding: 6px 0;
}
.tab span { font-size: 11px; font-weight: 700; }
.tab.active { color: var(--accent); }

/* ===== features.js additions: readiness, flashcards, guides, lessons ===== */

/* readiness ring */
.ready-card { padding: 18px; }
.ready-row { display: flex; gap: 16px; align-items: center; }
.ready-meta { flex: 1; }
.ready-meta h3 { margin: 0 0 4px; }
.ring-txt { font-size: 22px; font-weight: 800; fill: #2b2620; }
.ring-fg { transition: none; }
.streak { display: inline-block; background: #fff4ee; border: 1px solid #f0cfa8; color: #b3541e; font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 999px; margin: 6px 0; }
.weekly-mini { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.wm-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); font-weight: 800; margin-bottom: 4px; }
.ready-hero { display: flex; gap: 18px; align-items: center; }
.auto-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #2e7d4f; background: #e9f5ec; padding: 2px 8px; border-radius: 999px; }

/* level-up toast */
.level-toast {
  position: fixed; top: 18px; left: 50%; transform: translate(-50%, -80px);
  z-index: 99; display: flex; gap: 12px; align-items: center;
  background: #2b2620; color: #fff; border-radius: 18px; padding: 14px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3); transition: transform .45s cubic-bezier(.2,.9,.3,1.2);
  max-width: 88vw;
}
.level-toast.show { transform: translate(-50%, 0); }
.level-toast .lt-star { font-size: 30px; }
.level-toast b { color: #ffd76a; }

/* flashcards */
.fcard { background: linear-gradient(135deg, #2b2620, #4a3f30); color: #fff; border-radius: 18px; padding: 34px 20px; margin: 12px 0; cursor: pointer; min-height: 190px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.f-big { font-size: 36px; font-weight: 800; }
.f-py { font-size: 18px; color: #ffd76a; font-weight: 700; margin-top: 6px; }
.f-en { font-size: 24px; font-weight: 800; }
.f-hint { font-size: 12px; opacity: .55; margin-top: 12px; }
.f-btns { display: flex; gap: 10px; margin-top: 4px; }
.f-btns .btn-ghost { flex: 1; margin: 0; }
.f-btns .btn-primary { flex: 1.4; }

/* script lessons */
.script-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.script-cell { background: #faf6ef; border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.script-cell .sc { font-size: 30px; font-weight: 800; }
.script-cell .sc.sm { font-size: 20px; }
.script-cell .sr { font-size: 14px; font-weight: 800; color: var(--accent); }
.script-cell .st { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.tips { margin: 6px 0; padding-left: 20px; }
.tips li { margin: 6px 0; font-size: 15px; }

/* dialogues */
.dlg-line { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 8px 0; cursor: pointer; }
.dlg-say { font-size: 18px; font-weight: 800; }
.dlg-py { font-size: 14px; color: var(--accent); font-weight: 700; margin-top: 2px; }
.dlg-en { display: none; font-size: 15px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-style: italic; }
.dlg-tap { font-size: 11px; color: #c0a87e; margin-top: 6px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.dlg-line.open .dlg-en { display: block; }
.dlg-line.open .dlg-tap { display: none; }
.dlg-line.open { border-color: var(--gold); }

/* guides */
.g-ico { font-size: 24px; flex: 0 0 34px; }
.verify-banner { background: #fff7e6; border: 2px solid #e8b93c; border-radius: 14px; padding: 14px; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.verify-tag { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #8a5a00; background: #fff7e6; border: 1px solid #e8b93c; padding: 3px 10px; border-radius: 999px; margin-top: 8px; }
#guide-body .card p { font-size: 15px; }

/* packing */
.pack-cities { font-size: 11px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }

/* itinerary templates */
.tpl { border-top: 1px dashed var(--line); padding: 12px 0; }
.tpl:first-of-type { border-top: none; }
.tpl-head b { font-size: 16px; }
.tpl-days { margin: 8px 0; }
.tpl-day { font-size: 14px; padding: 6px 0; border-bottom: 1px dotted #f0e6d2; }
.tpl-day:last-child { border: none; }
.tpl-day b { color: var(--accent); }

/* culture cards */
.wx-box { background: #eef4ff; border: 1px solid #c9d8f2; border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 14px; }
.wx-box p { margin: 6px 0 0; }
.wx-pack { font-weight: 700; }
.dec-box { background: #f7f0ff; border: 1px solid #dccdf2; border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 14px; }
.dec-box p { margin: 6px 0 0; }
.etiq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.etiq-do, .etiq-dont { border-radius: 12px; padding: 12px; font-size: 13px; }
.etiq-do { background: #e9f5ec; }
.etiq-dont { background: #fdecea; }
.etiq-do ul, .etiq-dont ul { margin: 6px 0 0; padding-left: 16px; }
.etiq-do li, .etiq-dont li { margin: 4px 0; }

/* why-go lines */
.why { font-size: 13px; color: var(--accent); font-weight: 700; margin-top: 3px; }

/* dish extras */
.d-order { font-size: 13px; color: var(--ink); margin-top: 4px; }
.d-price { display: inline-block; font-size: 12px; font-weight: 800; color: #2e7d4f; background: #e9f5ec; padding: 2px 10px; border-radius: 999px; margin-top: 4px; }

/* language tools */
.lang-tools { margin: 10px 0 4px; }
.lt-row { display: flex; flex-wrap: wrap; gap: 2px; }
.lt-row .btn-small { margin: 4px 4px 4px 0; }

/* city motifs — deepen per-city identity */
.theme-shanghai .city-hero, .city-shanghai .city-banner { border-bottom: 3px double var(--shanghai-2); }
.theme-shanghai h2, .city-shanghai h3 { letter-spacing: .5px; }
.theme-beijing .city-hero, .city-beijing .city-banner { border-bottom: 4px solid var(--beijing-2); }
.theme-chengdu .city-hero, .city-chengdu .city-banner { border-radius: 26px; }
.theme-seoul .city-hero, .city-seoul .city-banner { box-shadow: 0 0 34px rgba(127, 209, 192, .35), var(--shadow); }
.culture-card { border-left: 5px solid var(--gold); }

/* level-up star pop */
@keyframes starpop { 0% { transform: scale(.4) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.level-toast.show .lt-star { animation: starpop .5s ease; }

/* flashcard button row spacing */
.f-btns { margin-top: 10px; }

/* respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .screen { animation: none; }
}
