/* Chòn — two-tone theme: white + cobalt blue. Mobile first, desktop from 960px. */
:root {
  --paper: #ffffff;
  --blue: #1d4fa3;          /* cobalt: the only ink colour */
  --blue-deep: #163f86;
  --blue-mid: #5d8bd1;
  --blue-soft: #e8effa;     /* light fills: banner, calendar header, examples */
  --blue-line: #c9d8f0;
  --white: #ffffff;
  --ink-soft: rgba(29, 79, 163, 0.62);
  --danger: #c0392b;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(22, 63, 134, 0.10);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Itim", var(--font);
  --font-han-hand: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--blue);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { flex: none; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  appearance: none; border: 0; border-radius: 999px;
  padding: 13px 22px; font: 600 15px var(--font); cursor: pointer;
  background: var(--blue); color: var(--white);
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--blue-deep); }
.btn:focus-visible, .swipe-btn:focus-visible svg { outline: 3px solid var(--blue-mid); outline-offset: 2px; }
.btn:focus:not(:focus-visible) { outline: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; }

.icon-btn, .round-btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-grid; place-items: center;
  color: var(--blue); background: transparent;
}
.icon-btn { width: 40px; height: 40px; border-radius: 50%; }
.icon-btn:hover, .icon-btn.on { background: var(--blue-soft); }
.icon-btn svg { width: 22px; height: 22px; }
.round-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: var(--white); box-shadow: var(--shadow); }
.round-btn.light { background: var(--blue-soft); color: var(--blue); box-shadow: none; }
.round-btn svg { width: 16px; height: 16px; }

.brand { font-family: var(--font-hand); color: var(--blue); line-height: 1; }

/* ── Login ───────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-card .brand { font-size: 64px; }
.login-card .han { font-family: var(--font-han-hand); font-size: 26px; margin: 6px 0 28px; }
.code-input {
  width: 100%; font: 600 26px var(--font); letter-spacing: 0.5em; text-align: center;
  padding: 14px 12px; border-radius: 18px; border: 1.5px solid var(--blue);
  background: var(--white); color: var(--blue); outline: none; margin-bottom: 12px;
}
.code-input::placeholder { color: var(--blue-line); }
.code-input:focus { box-shadow: 0 0 0 4px var(--blue-soft); }
.login .btn { width: 100%; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 10px; }

/* ── Header ──────────────────────────────────────────── */
.top .wrap { display: flex; align-items: center; gap: 12px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: var(--white);
  display: grid; place-items: center;
  font: 700 17px var(--font-hand);
}
.logo .brand { font-size: 30px; }
.topnav { display: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

main { padding: 4px 0 120px; }

.title { font-family: var(--font-hand); font-weight: 400; font-size: 34px; margin: 4px 0 18px; }
.col-title { font-size: 17px; font-weight: 600; margin: 0 0 12px; color: var(--blue); }

/* ── Calendar ────────────────────────────────────────── */
.cal { margin-bottom: 18px; }
.cal-head { display: flex; align-items: center; justify-content: center; gap: 14px; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.cal-head span { min-width: 120px; text-align: center; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-week {
  background: var(--blue-soft); border-radius: 999px; padding: 10px 0;
  font-size: 12px; font-weight: 700; margin-bottom: 6px;
}
.cal-week .we { color: var(--blue-mid); }
.cal-grid span {
  height: 40px; display: grid; place-items: center;
  font-size: 14px; border-radius: 10px; margin: 2px;
}
.cal-grid .out { color: var(--blue-line); }
.cal-grid span { grid-auto-flow: row; align-content: center; gap: 1px; line-height: 1.1; }
.cal-grid small { font-size: 9px; font-weight: 700; opacity: 0.85; }
.cal-grid .today { font-weight: 700; outline: 1.5px solid var(--blue); }
/* study time per day: light → dark */
.cal-grid .l1, .cal-legend .l1 { background: #d6e3f6; }
.cal-grid .l2, .cal-legend .l2 { background: #9dbbe7; }
.cal-grid .l3, .cal-legend .l3 { background: #5d8bd1; color: var(--white); }
.cal-grid .l4, .cal-legend .l4 { background: var(--blue); color: var(--white); }
.cal-grid .exam { outline: 1.5px dashed var(--blue); outline-offset: -3px; font-weight: 700; }

/* ── Exam banner ─────────────────────────────────────── */
.banner {
  background: var(--blue-soft);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 24px;
}
.banner-kicker { font-size: 13px; font-weight: 600; }
.banner-days { font-family: var(--font-hand); font-size: 40px; line-height: 1.1; margin: 2px 0; }
.banner-sub { font-size: 12px; color: var(--ink-soft); }
.banner-han { font-family: var(--font-han-hand); font-size: 40px; transform: rotate(-6deg); }

/* ── Right column: blue race card ────────────────────── */
.race {
  background: var(--blue);
  color: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--white); color: var(--blue);
  display: grid; place-items: center;
  font: 400 17px var(--font-hand);
  border: 3px solid var(--blue-mid);
}
.race-title { font-size: 20px; font-weight: 600; letter-spacing: 0.02em; text-align: center; margin-bottom: 18px; }
.stats { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 14px; }
.stats li { display: flex; align-items: center; gap: 14px; }
.stats svg { width: 26px; height: 26px; opacity: 0.9; }
.stats b { display: block; font-size: 18px; font-weight: 600; }
.stats small { font-size: 12px; opacity: 0.7; }
.stamps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.stamps i { width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed rgba(255, 255, 255, 0.6); }
.stamps i.on { background: var(--white); border-style: solid; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--white); color: var(--blue);
  border-radius: 999px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.pill-btn svg { width: 16px; height: 16px; }

/* ── Shared bits ─────────────────────────────────────── */
.btn.line { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn.line:hover { background: var(--blue-soft); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; border-width: 2px; }
a.banner { color: inherit; text-decoration: none; }
a.banner:hover { outline: 1.5px solid var(--blue); }
.cal-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); margin: 8px 4px 0; }
.cal-legend { gap: 4px; }
.cal-legend .dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.cal-legend .dot.exam { outline: 1.5px dashed var(--blue); margin-left: 12px; }

/* weekly leaderboard inside the blue card */
.board { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.board li {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 8px 12px;
}
.board li.me { background: rgba(255, 255, 255, 0.22); }
.board .rank { width: 16px; font-weight: 700; opacity: 0.8; }
.board .who { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.board .who small { display: block; font-weight: 400; font-size: 11px; opacity: 0.75; }
.board b { font-size: 18px; }
.board .avatar.sm { border-color: rgba(255, 255, 255, 0.5); }

/* ── Ôn từ: swipe deck ───────────────────────────────── */
.wrap.review { max-width: 520px; }
@media (min-width: 960px) { .wrap.review { max-width: 560px; } }
.review-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.review-count { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.progress { height: 6px; background: var(--blue-soft); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.3s; }
.loading { color: var(--ink-soft); text-align: center; padding: 40px 0; }

.deck { position: relative; margin-bottom: 18px; }
.deck-shadow {
  position: absolute; inset: 14px 14px -10px; border-radius: 28px;
  background: var(--blue-soft); z-index: 0;
}
.flash {
  position: relative; z-index: 1;
  background: var(--white);
  border: 1.5px solid var(--blue);
  border-radius: 28px;
  padding: 8px;
  display: flex; flex-direction: column;
  touch-action: pan-y;               /* horizontal drags are ours, vertical scroll stays native */
  user-select: none; -webkit-user-select: none;
  cursor: grab;
  box-shadow: var(--shadow);
  --yes: 0; --no: 0;
}
.flash:active { cursor: grabbing; }
.flash:focus-visible { outline: 3px solid var(--blue-mid); outline-offset: 3px; }
.flash.enter { transform: scale(0.96); opacity: 0; transition: none !important; }
.flash:not(.enter) { transition: opacity 0.2s, transform 0.2s; }
.tag {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue);
}
.tag.new { background: var(--blue); color: var(--white); }
.tag.line { background: transparent; border: 1px dashed var(--blue-line); font-weight: 600; }

/* The "photo": the word itself, big, at the top of the profile */
.photo {
  position: relative; flex: none;
  min-height: 300px;
  border-radius: 22px;
  background: var(--white);
  color: var(--blue);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 52px 18px 24px;
  transition: min-height 0.25s;
}
.photo-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 6px; align-items: center; }
.photo-sound {
  margin-left: auto; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blue-soft); color: var(--blue); display: grid; place-items: center;
}
.photo-sound:hover { background: var(--blue-line); }
.photo-sound svg { width: 20px; height: 20px; }
.hanzi {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 104px; line-height: 1.1; font-weight: 500; text-align: center;
}
.hanzi.long { font-size: 76px; }
.hanzi.xlong { font-size: 52px; }
/* name line, shown after flipping: "ān pái  An Bài" + meaning */
.caption { text-align: center; margin-top: 10px; }
.caption .name { font-size: 24px; font-weight: 700; display: flex; align-items: baseline; justify-content: center; gap: 10px; flex-wrap: wrap; }
.caption .hanviet { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.caption .gloss { font-size: 16px; margin-top: 2px; }
.flash.flipped .photo { min-height: 0; padding: 52px 18px 14px; }
.flash.flipped .hanzi { font-size: 72px; }
.flash.flipped .hanzi.long { font-size: 60px; }
.flash.flipped .hanzi.xlong { font-size: 44px; }

/* Profile sections under the photo */
.answer { padding: 6px 10px 6px; }
.sec { padding: 16px 0 4px; border-bottom: 1px solid var(--blue-soft); }
.sec:last-child { border-bottom: 0; }
.sec h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.senses { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.senses li { font-size: 16px; }
.pos {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; margin-right: 6px;
  border-radius: 999px; background: var(--blue-soft); vertical-align: 2px;
}
.mnemonic { margin: 0 0 8px; font-size: 15px; line-height: 1.55; }
.char-cards { display: grid; gap: 10px; margin-bottom: 8px; }
.char-card { display: flex; gap: 12px; align-items: flex-start; }
.char-big {
  flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--blue-soft);
  display: grid; place-items: center; font-size: 30px; font-family: "Noto Sans SC", "PingFang SC", sans-serif;
}
.char-info { min-width: 0; }
.char-head { font-size: 14px; margin-bottom: 6px; }
.parts { display: flex; flex-wrap: wrap; gap: 6px; }
.part { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--blue-line); }
.part b { font-family: "Noto Sans SC", "PingFang SC", sans-serif; font-weight: 600; }
.part.sem { border-color: var(--blue); }
.part.phon { border-style: dashed; }
.examples { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.examples li { background: var(--blue-soft); border-radius: 14px; padding: 10px 12px; }
.ex-zh { font-size: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ex-py { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.ex-vi { font-size: 14px; margin-top: 2px; }

/* the profile scrolls; horizontal drags still swipe */
.flash { max-height: min(680px, calc(100vh - 280px)); max-height: min(680px, calc(100dvh - 280px)); overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 960px) { .flash { max-height: min(680px, calc(100vh - 300px)); } }
@media (max-width: 639px) {
  /* leave room for the ✕ / ✓ buttons under the card */
  .flash { max-height: calc(100vh - 250px); max-height: calc(100dvh - 250px); }
}

.writers { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.writer { display: grid; justify-items: center; gap: 8px; }
.writer-pad {
  width: 150px; height: 150px; border: 1.5px solid var(--blue-line); border-radius: 14px;
  touch-action: none;   /* drawing must not scroll or swipe the card */
  cursor: crosshair;
  /* 米字格 practice grid */
  background:
    linear-gradient(var(--blue-soft), var(--blue-soft)) center / 100% 1px no-repeat,
    linear-gradient(var(--blue-soft), var(--blue-soft)) center / 1px 100% no-repeat,
    linear-gradient(45deg, transparent calc(50% - 0.5px), var(--blue-soft) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(-45deg, transparent calc(50% - 0.5px), var(--blue-soft) 50%, transparent calc(50% + 0.5px));
}
.writer-actions { display: flex; gap: 6px; }
.write-note { font-size: 12px; color: var(--ink-soft); margin: 0; min-height: 16px; text-align: center; max-width: 170px; }

/* "Nhớ rồi" / "Chưa nhớ" stamps fade in while dragging */
.stamp {
  position: absolute; top: 18px; z-index: 2;
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid currentColor;
  display: grid; place-items: center;
  pointer-events: none; opacity: 0;
}
.stamp svg { width: 32px; height: 32px; }
.stamp.yes { right: 20px; color: var(--blue); transform: rotate(12deg); opacity: var(--yes); background: var(--white); }
.stamp.no { left: 20px; color: var(--danger); transform: rotate(-12deg); opacity: var(--no); background: var(--white); }

.swipe-actions { display: flex; justify-content: center; gap: 28px; margin: 8px 0 10px; }
.swipe-btn {
  appearance: none; cursor: pointer; background: var(--white);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; color: var(--blue); font: 600 13px var(--font);
}
.swipe-btn svg {
  width: 64px; height: 64px; padding: 16px; border-radius: 50%;
  border: 2px solid currentColor; box-shadow: var(--shadow); transition: transform 0.1s, background 0.15s;
}
.swipe-btn:hover svg { transform: scale(1.06); }
.swipe-btn.yes svg { background: var(--blue); color: var(--white); border-color: var(--blue); }
.swipe-btn.no { color: var(--danger); }
.keys-hint { display: none !important; }
@media (hover: hover) and (pointer: fine) { .keys-hint { display: flex !important; } }

/* first-visit guide */
.coach {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(18, 48, 74, 0.35);
  display: grid; place-items: center; padding: 16px;
}
.coach-card {
  background: var(--white); border-radius: var(--radius); padding: 24px 22px;
  width: min(380px, 100%); box-shadow: 0 20px 50px rgba(22, 63, 134, 0.25);
}
.coach-card h2 { font: 400 28px var(--font-hand); margin-bottom: 14px; }
.coach-card ul { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.coach-card li { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.4; }
.coach-ic {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--blue-soft); font-size: 18px;
}
.coach-ic svg { width: 20px; height: 20px; }
.coach-ic.yes { background: var(--blue); color: var(--white); }
.coach-ic.no { color: var(--danger); border: 1.5px solid var(--danger); background: var(--white); }
.coach-card .btn { width: 100%; }
/* Focus mode on phones: no tab bar on the review page, so the swipe buttons stay visible. */
body[data-page="review"] .tabbar { display: none; }
body[data-page="review"] main { padding-bottom: 24px; }
@media (max-width: 639px) {
  .review .title { font-size: 28px; }
  .top .wrap { height: 60px; }
}

.review-done { text-align: center; padding: 30px 0; }
.done-han { font-family: var(--font-han-hand); font-size: 64px; transform: rotate(-6deg); }
.review-done h2 { font-size: 22px; margin: 10px 0 6px; }
.review-done p { color: var(--ink-soft); margin: 0 0 22px; }

.about { margin-top: 28px; font-size: 13px; color: var(--ink-soft); }
.about h2 { font-size: 14px; color: var(--blue); margin-bottom: 6px; }
.about p { margin: 0 0 4px; }

/* ── "Sắp có" pages (Giáo trình, Drama) ──────────────── */
.soon-page {
  max-width: 520px; margin: 24px auto; text-align: center;
  border: 1.5px dashed var(--blue-line); border-radius: var(--radius); padding: 36px 24px;
}
.soon-page svg { width: 56px; height: 56px; }
.soon-page h2 { font-size: 22px; margin: 10px 0 6px; }
.soon-page p { color: var(--ink-soft); margin: 0 0 22px; }

/* ── Drama list ──────────────────────────────────────── */
.dramas { display: grid; gap: 18px; max-width: 720px; }
.drama-card { border: 1.5px solid var(--blue); border-radius: var(--radius); padding: 18px; }
.drama-cast { display: flex; margin-bottom: 14px; }
.drama-cast img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 3px solid var(--white); margin-right: -10px; box-shadow: 0 2px 6px rgba(22, 63, 134, 0.15); }
.drama-no { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.drama-head h2 { font: 400 30px var(--font-hand); margin: 2px 0 0; font-family: "ZCOOL KuaiLe", var(--font-hand); }
.drama-vi { margin: 0; font-weight: 600; }
.drama-about { margin: 8px 0 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.drama-eps { display: grid; gap: 8px; margin-top: 14px; }
.drama-ep {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--blue-soft); border-radius: 14px; padding: 12px 14px;
}
.drama-ep:hover { background: var(--blue-line); }
.ep-no { font-size: 12px; font-weight: 700; white-space: nowrap; }
.ep-title { flex: 1; font-weight: 600; }
.ep-title small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-soft); }
.ep-level { display: block; font-size: 11px; font-weight: 700; color: var(--blue-mid); margin-top: 2px; letter-spacing: 0.02em; }
.ep-play { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: var(--white); display: grid; place-items: center; font-size: 13px; }
.ep-seen { font-size: 11px; font-weight: 700; background: var(--white); border-radius: 999px; padding: 3px 9px; }
.drama-people { margin-top: 12px; }
.drama-people summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.drama-people ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.drama-people li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.drama-people img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.drama-people small { display: block; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }

/* ── Tôi: settings + members ─────────────────────────── */
.settings { max-width: 640px; }
.panel-card { border: 1.5px solid var(--blue); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel-card h2 { font-size: 18px; margin-bottom: 14px; }
.panel-card h3 { font-size: 15px; margin: 18px 0 10px; }
.hint { font-size: 13px; color: var(--ink-soft); margin: -6px 0 12px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13px; font-weight: 600; }
.field small { font-size: 12px; color: var(--ink-soft); }
.field input, .field select {
  font: 500 15px var(--font); color: var(--blue);
  border: 1.5px solid var(--blue-line); border-radius: 12px; padding: 11px 12px; background: var(--white);
  width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.form-actions { display: flex; align-items: center; gap: 12px; }
.saved { font-size: 13px; font-weight: 600; }
.saved.bad { color: var(--danger); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.member-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px dashed var(--blue-line); padding-bottom: 10px; }
.member-list .who { flex: 1; min-width: 140px; font-weight: 600; }
.member-list .who small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-soft); }
.member-list .avatar.sm { background: var(--blue-soft); border-color: var(--blue-line); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.add-member { border-top: 1.5px dashed var(--blue-line); margin-top: 6px; }

/* ── Phone order: countdown, tasks, race, then calendar ── */
.dash { display: flex; flex-direction: column; }
.col-left { display: contents; }            /* let calendar and banner be ordered on their own */
.title { order: 0; }
.banner { order: 1; }
.col-right { order: 3; }
.cal { order: 4; }
.banner-days { font-size: 32px; white-space: nowrap; }
.banner-han { white-space: nowrap; font-size: 34px; }
.cal-grid span { height: 36px; }

/* ── Phone: bottom tab bar (blue pill) ───────────────── */
.tabbar {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(528px, calc(100% - 32px));
  background: var(--blue); color: var(--white);
  border-radius: 999px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px;
  box-shadow: 0 10px 30px rgba(22, 63, 134, 0.3);
  z-index: 20;
}
.tabbar a {
  text-decoration: none; display: flex; flex-direction: column; align-items: center;
  gap: 3px; font-size: 11px; opacity: 0.72; padding: 4px 0;
}
.tabbar a[aria-current="page"] { opacity: 1; font-weight: 700; }
.tabbar svg { width: 22px; height: 22px; }

/* ── Tablet ──────────────────────────────────────────── */
@media (min-width: 640px) {
  .wrap { max-width: 720px; }
}

/* ── Desktop: top navigation + three columns, no tab bar ── */
@media (min-width: 960px) {
  .wrap { max-width: 1180px; padding: 0 40px; }
  .tabbar { display: none; }
  main { padding: 8px 0 48px; }

  .top .wrap { height: 88px; gap: 32px; }
  .topnav { display: flex; gap: 36px; margin: 0 auto; }
  .topnav a { text-decoration: none; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; opacity: 0.75; padding: 6px 0; border-bottom: 2px solid transparent; }
  .topnav a:hover { opacity: 1; }
  .topnav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--blue); }
  .top-actions { margin-left: 0; }

  .dash {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-areas:
      "title title"
      "left  right";
    column-gap: 40px;
    align-items: start;
  }
  .title { grid-area: title; font-size: 44px; margin: 0 0 24px; }
  .col-left { grid-area: left; display: block; }
  .cal-grid span { height: 40px; }
  .banner-days { font-size: 40px; }
  .banner-han { font-size: 40px; }
  .col-right { grid-area: right; }
  .race { padding: 28px 26px; }
  .banner { margin-bottom: 0; }
}

/* login: browse without a code */
.login-browse { display: block; margin-top: 14px; text-align: center; font-size: 14px; color: var(--muted, #4c6a85); text-decoration: none; }
.login-browse:hover { text-decoration: underline; }
.ep-lock { font-size: 13px; color: #8aa2c9; white-space: nowrap; }

/* sign-in with Google */
.signin { text-align: center; }
.signin-lead { margin: 4px 0 18px; color: var(--ink-soft); line-height: 1.5; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
  background: #fff; color: #1f1f1f; border: 1.5px solid var(--blue-line); box-shadow: none; }
.google-btn:hover { background: var(--blue-soft); }
.google-btn svg { width: 20px; height: 20px; }
.signin-note { margin: 16px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }

/* Drama plan page */
.shop { max-width: 640px; }
.shop-lead { margin: -6px 0 22px; color: var(--ink-soft); line-height: 1.6; }
.shop-status { background: var(--blue-soft); border-radius: 16px; padding: 14px 18px; margin-bottom: 18px; line-height: 1.5; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan { position: relative; display: grid; gap: 4px; text-align: left; padding: 22px 20px; border-radius: var(--radius);
  border: 2px solid var(--blue-line); background: #fff; color: var(--blue); font-family: var(--font); cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.plan:hover { border-color: var(--blue-mid); }
.plan.on, .plan.best.on { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.plan.best { border-color: var(--blue-mid); }
.plan-tag { position: absolute; top: -11px; right: 14px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan-name { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.plan-price { font-size: 30px; font-weight: 700; }
.plan-sub { font-size: 13px; color: var(--ink-soft); }
.pay { margin-top: 26px; border: 1.5px solid var(--blue-soft); border-radius: var(--radius); padding: 22px; text-align: center; }
.pay h2 { margin: 0 0 14px; font-size: 20px; }
.pay-qr { width: 240px; max-width: 100%; aspect-ratio: 1; border-radius: 12px; background: var(--blue-soft); }
.pay-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; text-align: left; margin: 16px auto 0; max-width: 380px; }
.pay-info dt { color: var(--ink-soft); font-size: 14px; }
.pay-info dd { margin: 0; font-weight: 600; word-break: break-all; }
.pay-copy { margin-left: 6px; border: 1px solid var(--blue-line); background: #fff; color: var(--blue); border-radius: 999px; font: 600 12px var(--font); padding: 2px 10px; cursor: pointer; }
.pay-wait { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0 6px; font-size: 14px; line-height: 1.5; }
.pay-note { margin: 0; font-size: 13px; color: var(--ink-soft); }
.spin { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--blue-line); border-top-color: var(--blue); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-done { text-align: center; padding: 30px 10px; }
.pay-done-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 32px; }
.pay-done h2 { margin: 0 0 6px; }
.pay-done p { color: var(--ink-soft); margin: 0 0 18px; }
.shop-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--blue-soft); font-size: 14px; color: var(--ink-soft); }
.link-btn { border: 0; background: none; color: var(--blue); font: 600 14px var(--font); cursor: pointer; text-decoration: underline; }
@media (max-width: 480px) { .plans { grid-template-columns: 1fr; } }
.cust-sum { font-weight: 600; margin: 0 0 10px; }
.member-list .empty { color: var(--ink-soft); padding: 8px 0; }
.shop { padding-bottom: 120px; }
.packs { grid-template-columns: repeat(3, 1fr); }
.shop-h2 { margin: 28px 0 14px; font-size: 20px; }
.balance { display: flex; align-items: baseline; gap: 8px; margin: 0 0 18px; padding: 14px 18px; border-radius: 16px; background: var(--blue-soft); }
.balance b { font-size: 30px; }
.open-ep { border: 2px solid var(--blue); border-radius: var(--radius); padding: 20px; margin-bottom: 8px; }
.open-ep-kicker { margin: 0 0 4px; font-size: 13px; color: var(--ink-soft); }
.open-ep h2 { margin: 0 0 14px; font-size: 20px; }
.open-ep-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.open-ep-note { margin: 12px 0 0; font-size: 14px; color: var(--ink-soft); }
@media (max-width: 560px) { .packs { grid-template-columns: 1fr; } }
