/* StarVocab — fully self-contained. System fonts only, no external resources. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #FFF9F0;
  --card: #FFFFFF;
  --ink: #2B2620;
  --muted: #8A7F70;
  --line: #F0E6D8;
  --coral: #E86A4A;
  --coral-dark: #D14E2E;
  --teal: #2E7D6B;
  --mustard: #E9A13B;
  --gold: #F5B301;
  --star-off: #E5DCCB;
  --grad-1: linear-gradient(135deg, #F6C177 0%, #E86A4A 100%);
  --grad-2: linear-gradient(135deg, #7FB5A3 0%, #2E7D6B 100%);
  --grad-3: linear-gradient(135deg, #8EA8D8 0%, #5B6FA6 100%);
  --grad-4: linear-gradient(135deg, #D9A0B8 0%, #9B6B8F 100%);
  --grad-5: linear-gradient(135deg, #F2D38A 0%, #C98A2E 100%);
  --grad-6: linear-gradient(135deg, #A8C6A0 0%, #5E8C61 100%);
  --radius: 18px;
  --shadow: 0 4px 18px rgba(60, 40, 20, .08);
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}
#app { max-width: 520px; margin: 0 auto; padding: 0 16px 96px; }
.hidden { display: none !important; }
.view { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Picker / hero ---- */
.hero { text-align: center; padding: 40px 8px 8px; }
.logo {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px;
  background: var(--grad-1); color: #fff; font-size: 34px; line-height: 64px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 30px; letter-spacing: .5px; }
.hero h1 span { font-size: 20px; color: var(--coral); }
.hero-sub { color: var(--muted); margin-top: 6px; font-size: 15px; }
.hero-sub-en { color: var(--muted); font-size: 13px; }
.picker-list { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; }
.picker-card {
  display: block; width: 100%; text-align: left; background: var(--card);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 18px;
  cursor: pointer; box-shadow: var(--shadow); font: inherit; color: inherit;
}
.picker-card:active { transform: scale(.98); border-color: var(--coral); }
.picker-card h2 { font-size: 19px; margin-bottom: 2px; }
.picker-card .picker-en { color: var(--muted); font-size: 13px; }
.picker-card p { margin-top: 8px; font-size: 14px; color: #5A5044; }
.picker-tag {
  display: inline-block; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--coral); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px;
}
.picker-tag.teal { background: var(--teal); }
.picker-tag.navy { background: #5B6FA6; }
.fineprint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 22px; }

/* ---- Top bar / cards ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 2px 10px; }
.topbar-title { font-size: 21px; font-weight: 800; }
.topbar-sub { color: var(--muted); font-size: 13px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-top: 14px; box-shadow: var(--shadow);
}
.card h2 { font-size: 17px; margin-bottom: 8px; }
.btn-primary {
  display: block; width: 100%; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--coral); color: #fff; font: inherit; font-size: 17px; font-weight: 700;
  padding: 13px 20px; margin-top: 14px;
}
.btn-primary:active { background: var(--coral-dark); }
.btn-ghost {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  font: inherit; font-size: 13.5px; color: var(--ink); padding: 7px 14px; cursor: pointer;
}
.btn-ghost:active { border-color: var(--coral); color: var(--coral); }

/* ---- Streak / progress ---- */
.streak-row { display: flex; gap: 10px; margin-top: 8px; }
.streak-box {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 6px; text-align: center; box-shadow: var(--shadow);
}
.streak-num { display: block; font-size: 26px; font-weight: 800; color: var(--coral); line-height: 1.1; }
.streak-label { font-size: 12px; color: var(--muted); }
.progress-wrap { margin-top: 14px; }
.progress-bar { height: 10px; background: #F0E6D8; border-radius: 999px; overflow: hidden; }
.progress-bar.slim { margin: 10px 2px 0; }
.progress-fill { height: 100%; background: var(--grad-1); border-radius: 999px; transition: width .4s ease; }
.level-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.level-chip {
  flex: 1; min-width: 70px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 8px; font-size: 12.5px; text-align: center; color: var(--muted);
}
.level-chip b { display: block; font-size: 14px; color: var(--ink); }

/* ---- Journey ---- */
.journey-line { font-size: 16px; }
.journey-line strong { color: var(--coral); font-size: 20px; }
.journey-time { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.journey-done { color: var(--teal); font-weight: 700; margin-top: 10px; }

/* ---- Word card ---- */
.word-visual {
  border-radius: 14px; min-height: 190px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative; background: var(--grad-1);
}
.word-visual img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.word-visual .big-word {
  position: relative; z-index: 1; color: #fff; font-size: 42px; font-weight: 800;
  text-shadow: 0 2px 14px rgba(0,0,0,.25); padding: 20px; text-align: center; word-break: break-word;
}
.word-visual.g2 { background: var(--grad-2); }
.word-visual.g3 { background: var(--grad-3); }
.word-visual.g4 { background: var(--grad-4); }
.word-visual.g5 { background: var(--grad-5); }
.word-visual.g6 { background: var(--grad-6); }
.word-head { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.word-head .w { font-size: 28px; font-weight: 800; }
.word-head .pos { color: var(--muted); font-size: 14px; font-style: italic; }
.ph { color: var(--muted); font-size: 14px; }

/* ---- Pronunciation ---- */
.speak-btn {
  border: 0; background: #EEF4FF; color: #1A56DB; border-radius: 50%;
  width: 36px; height: 36px; font-size: 16px; cursor: pointer; flex: none; line-height: 1;
}
.speak-btn:active { background: #DCE8FF; }
.speak-btn.small { width: 26px; height: 26px; font-size: 12px; background: transparent; }
.star-detail-word .speak-btn.small { vertical-align: middle; }
.word-zh { font-size: 19px; font-weight: 700; margin-top: 6px; }
.word-en { color: var(--muted); font-size: 14px; margin-top: 2px; }
.word-ex {
  margin-top: 12px; background: #FFF7EC; border-left: 3px solid var(--mustard);
  border-radius: 8px; padding: 10px 12px; font-size: 15px;
}
.word-ex .ex-label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 2px; }
.meaning-hidden {
  margin-top: 12px; background: #F7F1E6; border: 1.5px dashed #D8C9AE; border-radius: 12px;
  padding: 22px 12px; text-align: center; color: var(--muted); font-size: 15px;
}
.mark-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-know, .btn-unknown {
  flex: 1; border: 0; border-radius: 999px; font: inherit; font-size: 16px; font-weight: 700;
  padding: 13px 10px; cursor: pointer;
}
.btn-know { background: var(--teal); color: #fff; }
.btn-unknown { background: #F3E9D8; color: #7A5A2E; }
.btn-know:active { filter: brightness(.92); }
.btn-unknown:active { filter: brightness(.94); }
.reveal-btn {
  display: block; width: 100%; margin-top: 14px; border: 1.5px solid var(--teal); background: #fff;
  color: var(--teal); border-radius: 999px; font: inherit; font-size: 15px; font-weight: 700;
  padding: 11px; cursor: pointer;
}

/* ---- Stars ---- */
.stars-mini { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: 6px 0 10px; }
.star { color: var(--star-off); font-size: 15px; line-height: 1; text-align: center; cursor: default; }
.star.lit { color: var(--gold); text-shadow: 0 0 6px rgba(245,179,1,.55); }
.stars-mini .star { font-size: 13px; }
.stars-full .level-block { margin-top: 18px; }
.stars-full .level-block h3 { font-size: 15px; margin-bottom: 8px; color: #5A5044; }
.stars-full .stars-mini { grid-template-columns: repeat(10, 1fr); gap: 4px; }
.stars-full .star { font-size: 22px; cursor: pointer; padding: 2px 0; }
.star-detail-word { font-size: 22px; font-weight: 800; }
.star-detail-zh { font-size: 16px; margin-top: 4px; }

/* ---- Session ---- */
.session-progress { font-weight: 800; font-size: 15px; }
.session-phase { font-size: 12.5px; color: var(--muted); }
#card-area { margin-top: 6px; }
.summary-num { font-size: 34px; font-weight: 800; color: var(--coral); }
.summary-line { margin-top: 6px; font-size: 15px; }
.empty-note { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 15px; }

/* ---- Unlock ---- */
.level-chip.locked { opacity: .65; }
.stars-full .star.locked { opacity: .5; cursor: pointer; }
.modal { position: fixed; inset: 0; background: rgba(30,25,15,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-box { background: var(--card); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 20px 18px 26px; }
.modal-box h3 { font-size: 18px; margin-bottom: 6px; }
.modal-box p { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.modal-box input { width: 100%; padding: 13px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 16px; font-family: inherit; letter-spacing: .1em; text-align: center; }
.modal-box .err { color: var(--coral-dark); font-size: 13px; min-height: 18px; text-align: center; margin-top: 6px; }
.modal-box .btn-primary { margin-top: 8px; }
.modal-box .close { display: block; margin: 10px auto 0; border: none; background: none; color: var(--muted); font-size: 14px; cursor: pointer; font-family: inherit; }

/* ---- Tab bar / footer ---- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar .tab {
  flex: 1; border: 0; background: none; font: inherit; padding: 10px 0 12px;
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px;
}
#tabbar .tab.active { color: var(--coral); font-weight: 700; }
.tab-ico { font-size: 19px; line-height: 1.1; }
.tab-label { font-size: 12px; }
.footer { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 22px; line-height: 1.7; }
.footer a { color: var(--teal); }
@media (min-width: 560px) {
  #app { padding-bottom: 110px; }
  .word-visual { min-height: 230px; }
  .modal { align-items: center; }
  .modal-box { border-radius: 18px; }
}
