:root {
  --bg: #FFF6E5;
  --ink: #3B2F2A;
  --ink-soft: #8A7358;
  --card: #FFFFFF;
  --line: #F4E7D4;
  --orange: #FF8A3D;
  --orange-deep: #E8890C;
  --green: #2F9E5F;
  --red: #E8553D;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(92, 64, 35, 0.1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.app {
  max-width: 880px;
  margin: 0 auto;
}

.page {
  padding: 16px 16px calc(48px + env(safe-area-inset-bottom));
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-block;
  border-radius: 999px;
  padding: 13px 24px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #FFB347, #FF8A3D);
  box-shadow: 0 8px 18px rgba(255, 138, 61, 0.35);
  transition: transform 0.12s ease;
}

.btn:active { transform: scale(0.97); }
.btn.wide { display: block; width: 100%; text-align: center; }

.btn.ghost {
  background: #fff;
  color: var(--orange);
  box-shadow: 0 6px 16px rgba(92, 64, 35, 0.12);
}

.btn.danger {
  background: #fff;
  color: var(--red);
  box-shadow: 0 6px 16px rgba(232, 85, 61, 0.16);
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFD166, #FF8A3D);
  transition: width 0.4s ease;
}

.progress-track.small { height: 7px; }

/* ---------- 首页 ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 16px;
}

.avatar-box {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.who { flex: 1; min-width: 0; }
.who .name { font-size: 19px; font-weight: 800; }
.who .sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

.star-pill {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: #FFF1D6;
  color: #A96A17;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.hero {
  position: relative;
  padding: 20px;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  right: -40px;
  top: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.55), rgba(255, 209, 102, 0));
}

.vehicle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.vehicle-emoji {
  font-size: 54px;
  line-height: 1;
  animation: floaty 3s ease-in-out infinite;
}

.vehicle-name { font-size: 18px; font-weight: 800; }
.vehicle-line { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

.next { margin-top: 16px; }

.next-text {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 7px;
}

.hero .btn { margin-top: 16px; }

.quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.quick-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.quick-card:active { transform: scale(0.97); }
.quick-emoji { font-size: 26px; }
.quick-name { font-size: 14px; font-weight: 800; }
.quick-desc { font-size: 11px; color: var(--ink-soft); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 4px 10px;
}

.section-title { font-size: 17px; font-weight: 800; }
.section-sub { font-size: 13px; color: var(--ink-soft); }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  border-radius: 18px;
  text-align: left;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform 0.12s ease;
}

.book-card:active { transform: scale(0.97); }
.book-top { display: flex; align-items: center; justify-content: space-between; }

.book-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #FFC978, #FF9A4D);
}

.book-icon.big { width: 44px; height: 44px; border-radius: 14px; font-size: 18px; }

.book-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #A96A17;
  font-weight: 700;
}

.book-title { font-size: 14px; font-weight: 800; line-height: 1.3; }
.book-count { font-size: 11px; color: var(--ink-soft); }

.book-card.color-sun { background: linear-gradient(160deg, #FFF4DC, #FFE6B8); }
.book-card.color-mint { background: linear-gradient(160deg, #E7F8EE, #CDEFDD); }
.book-card.color-sky { background: linear-gradient(160deg, #E6F3FD, #CCE6FA); }
.book-card.color-peach { background: linear-gradient(160deg, #FFEFE5, #FFDCC8); }
.book-card.color-grape { background: linear-gradient(160deg, #F0EAFB, #DFD2F6); }
.book-card.color-rose { background: linear-gradient(160deg, #FDECF1, #F9D5E0); }
.book-card.color-lemon { background: linear-gradient(160deg, #FCF9E1, #F6EEBA); }
.book-card.color-aqua { background: linear-gradient(160deg, #E4F7F5, #C9EEEA); }
.book-card.color-lilac { background: linear-gradient(160deg, #F2EAFB, #E1D1F4); }
.book-card.color-coral { background: linear-gradient(160deg, #FFEDE8, #FFD6CC); }
.book-card.color-navy { background: linear-gradient(160deg, #EAF0FB, #D3DEF4); }

.footer-note {
  margin-top: 26px;
  text-align: center;
  font-size: 12px;
  color: #B3A493;
}

/* ---------- 顶部导航 ---------- */

.nav-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 14px;
}

.back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
  flex: none;
}

.nav-title {
  flex: 1;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.nav-stars {
  flex: none;
  min-width: 40px;
  text-align: right;
  font-size: 14px;
  font-weight: 800;
  color: var(--orange-deep);
}

/* ---------- 点读页 ---------- */

.book-hero { padding: 16px; }

.book-hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-hero-info { display: flex; flex-direction: column; }
.book-hero-title { font-size: 17px; font-weight: 800; }
.book-hero-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.book-hero-progress {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}

.tip-line {
  font-size: 12px;
  color: #A2937F;
  margin: 14px 4px 6px;
}

.section { margin-top: 16px; }

.section-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 4px 8px;
}

.section-title { font-size: 15px; font-weight: 800; }
.section-note { font-size: 11px; color: #A2937F; }

.syl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.syl {
  position: relative;
  padding: 12px 34px 12px 14px;
  min-width: 72px;
  min-height: 54px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(92, 64, 35, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.syl.long {
  font-size: 16px;
  font-weight: 600;
  padding: 12px 34px 12px 16px;
  justify-content: flex-start;
}

.syl:active { transform: scale(0.96); }

.syl.playing {
  box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.65), var(--shadow);
  background: #FFF9EC;
}

.syl.done { background: #FFFDF5; }

.syl-text { pointer-events: none; }

.mark {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #CFC1AE;
  line-height: 1;
}

.mark.on { color: var(--orange-deep); }
.mark:active { transform: scale(0.88); }

/* ---------- 闯关 ---------- */

.gstart {
  padding: 22px 18px;
  text-align: center;
}

.gstart-emoji { font-size: 46px; animation: floaty 3s ease-in-out infinite; }
.gstart-title { font-size: 19px; font-weight: 800; margin-top: 8px; }
.gstart-sub { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.mode-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.mode-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 999px;
  background: #F5EBD9;
  color: #8A7358;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.mode-btn.on {
  background: linear-gradient(135deg, #FFE3AD, #FFC96B);
  color: #A96A17;
  box-shadow: 0 6px 16px rgba(255, 179, 71, 0.32);
}

.choose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  background: #FFF9EE;
  border-radius: 14px;
}

.choose-label { font-size: 13px; color: var(--ink-soft); }

.choose-value {
  flex: 1;
  max-width: 62%;
  border: none;
  background: transparent;
  text-align: right;
  font-size: 14px;
  font-weight: 800;
  color: var(--orange-deep);
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 0;
}

.gstart-best { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.gstart-btn { margin-top: 16px; }
.gstart-tip { margin-top: 10px; font-size: 12px; color: #B3A493; }

.ghead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ghead-left {
  flex: 1;
  font-size: 16px;
  font-weight: 800;
}

.ghead-left.urgent {
  color: var(--red);
  animation: pulse 0.9s ease-in-out infinite;
}

.ghead-right {
  font-size: 15px;
  font-weight: 800;
  color: var(--orange-deep);
}

.gplay {
  padding: 20px 16px 22px;
  text-align: center;
}

.speaker {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 132px;
  height: 132px;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(160deg, #FFE9BE, #FFD076);
  box-shadow: 0 10px 24px rgba(255, 179, 71, 0.35);
  font-size: 12px;
  font-weight: 700;
  color: #A96A17;
}

.speaker:active { transform: scale(0.96); }
.speaker-icon { font-size: 42px; line-height: 1; }

.speaker-icon.playing { animation: pulse 0.8s ease-in-out infinite; }

.gq-tip {
  margin-top: 18px;
  font-size: 14px;
  color: var(--ink-soft);
  min-height: 22px;
}

.gq-tip.ok {
  color: var(--green);
  font-weight: 800;
  font-size: 17px;
  animation: pop 0.35s ease;
}

.gq-tip.bad { color: var(--red); font-weight: 700; }
.gcorrect { color: var(--orange-deep); font-weight: 800; font-size: 17px; }

.gcombo {
  min-height: 20px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: var(--orange-deep);
  animation: pop 0.3s ease;
}

.goptions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.goption {
  padding: 20px 8px;
  border-radius: 16px;
  background: #FFF9EE;
  border: 2px solid transparent;
  font-size: 24px;
  font-weight: 700;
  transition: transform 0.1s ease;
}

.goption:active { transform: scale(0.97); }

.goption.correct {
  background: #E6F7EC;
  border-color: #6FD08C;
  color: #237a45;
}

.goption.wrong {
  background: #FDECE8;
  border-color: #F1A08E;
  color: #B23A24;
}

.gresult { padding: 28px 20px; text-align: center; }
.gresult-emoji { font-size: 56px; animation: pop 0.4s ease; }
.gresult-title { font-size: 18px; font-weight: 800; margin-top: 10px; }
.gresult-score { font-size: 30px; font-weight: 800; color: var(--orange-deep); margin-top: 8px; }
.gresult-stars { font-size: 14px; margin-top: 6px; }
.gresult-bonus { color: var(--green); }
.gresult-best { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

.gnew {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #FFF3D6;
  color: #A96A17;
  font-size: 13px;
  font-weight: 700;
}

.gresult-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.gresult-btns .btn { flex: 1; }

/* ---------- 座驾 ---------- */

.badge-summary {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.badge-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px 12px;
  text-align: center;
  opacity: 0.62;
}

.badge-card.on {
  opacity: 1;
  background: linear-gradient(165deg, #fff, color-mix(in srgb, var(--badge-color) 22%, #fff));
}

.badge-emoji { font-size: 34px; line-height: 1.2; }
.badge-name { font-size: 14px; font-weight: 800; margin-top: 4px; }
.badge-line { font-size: 11px; color: var(--ink-soft); margin-top: 2px; min-height: 28px; }
.badge-stars { font-size: 12px; font-weight: 800; color: var(--orange-deep); margin-top: 4px; }

/* ---------- 我的 ---------- */

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

.me-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.me-row.column { flex-direction: column; align-items: stretch; }

.me-label {
  font-size: 14px;
  font-weight: 700;
  flex: none;
}

.me-input {
  flex: 1;
  border: none;
  background: #FFF9EE;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

.avatar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.avatar-pick {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #FFF9EE;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-pick.on {
  background: #FFE9BE;
  box-shadow: 0 0 0 2px #FFC96B inset;
}

.seg {
  display: flex;
  margin-left: auto;
  background: #FFF9EE;
  border-radius: 999px;
  padding: 3px;
}

.seg-btn {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.seg-btn.on { background: #fff; color: var(--orange-deep); box-shadow: 0 3px 8px rgba(92, 64, 35, 0.12); }

.me-title { font-size: 15px; font-weight: 800; }
.me-desc { font-size: 12px; color: var(--ink-soft); margin: 6px 0 12px; }

.code-box {
  width: 100%;
  height: 76px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: Menlo, Consolas, monospace;
  color: var(--ink-soft);
  background: #FFFDF8;
  resize: vertical;
  outline: none;
}

.me-split { height: 14px; }

/* ---------- 动画 ---------- */

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pop {
  0% { transform: scale(0.7); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- 大屏（iPad） ---------- */

@media (min-width: 720px) {
  .page { padding: 26px 28px calc(60px + env(safe-area-inset-bottom)); }
  body { font-size: 17px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .syl { font-size: 23px; min-width: 88px; min-height: 62px; }
  .goption { font-size: 28px; padding: 26px 8px; }
  .quick-emoji { font-size: 30px; }
}
