:root {
  --bg: #f6f2e9;
  --bg-deep: #eee7d9;
  --surface: #fffdf8;
  --surface-2: #f0eadf;
  --surface-3: #e8dfce;
  --ink: #24211c;
  --ink-soft: #4a453d;
  --muted: #756f64;
  --line: #ded5c5;
  --line-strong: #cfc3af;
  --red: #9f1d20;
  --red-dark: #721619;
  --red-soft: #f6e5e3;
  --jade: #1e6a58;
  --jade-dark: #155142;
  --jade-soft: #e2f0ea;
  --gold: #a96c18;
  --gold-soft: #f6ecd8;
  --blue: #315a83;
  --shadow: 0 18px 50px rgba(71, 55, 27, 0.08);
  --shadow-soft: 0 8px 24px rgba(71, 55, 27, 0.06);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 460px at 92% -8%, rgba(159, 29, 32, 0.11), transparent 62%),
    radial-gradient(700px 420px at -8% 14%, rgba(30, 106, 88, 0.08), transparent 58%),
    linear-gradient(180deg, #faf7ef 0%, var(--bg) 42%, #f1ebdf 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(49, 90, 131, 0.4);
  outline-offset: 3px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(102px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  color: #fff9ee;
  background: linear-gradient(145deg, #b3262a, var(--red-dark));
  box-shadow: 0 8px 18px rgba(114, 22, 25, 0.22);
  font-family: "Songti SC", "STSong", serif;
  font-size: 25px;
  font-weight: 700;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.streak-chip,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(207, 195, 175, 0.82);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 4px 14px rgba(71, 55, 27, 0.04);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.streak-chip {
  min-height: 40px;
  padding: 0 13px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.streak-chip .icon {
  width: 17px;
  height: 17px;
  fill: rgba(159, 29, 32, 0.09);
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
}

.view {
  display: grid;
  gap: 16px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  padding: 2px 2px 0;
}

.page-head h1,
.page-title {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(25px, 6.5vw, 34px);
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-subtitle,
.hero-copy,
.muted {
  color: var(--muted);
}

.page-subtitle {
  max-width: 33em;
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.65;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(114, 22, 25, 0.11);
  border-radius: var(--radius-xl);
  color: #fff8ed;
  background:
    radial-gradient(360px 180px at 96% 0%, rgba(255, 230, 190, 0.2), transparent 64%),
    linear-gradient(135deg, #a3262a 0%, #841c20 58%, #681417 100%);
  box-shadow: 0 24px 54px rgba(114, 22, 25, 0.2);
}

.hero-card::after {
  position: absolute;
  right: -46px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 248, 237, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255, 248, 237, 0.035), 0 0 0 58px rgba(255, 248, 237, 0.025);
  content: "";
  pointer-events: none;
}

.hero-kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 9px;
  color: rgba(255, 248, 237, 0.68);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.hero-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(23px, 6vw, 31px);
  font-weight: 700;
  line-height: 1.24;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 31em;
  margin: 10px 0 0;
  color: rgba(255, 248, 237, 0.7);
  font-size: 12px;
  line-height: 1.7;
}

.goal-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  font-size: 12px;
  font-weight: 700;
}

.goal-number {
  color: #fff8ed;
  font-size: 26px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1;
}

.goal-number small {
  margin-left: 3px;
  color: rgba(255, 248, 237, 0.58);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.goal-track {
  position: relative;
  z-index: 1;
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 248, 237, 0.18);
}

.goal-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f6d9a3, #fff9ef);
  transition: width 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.button:active {
  transform: translateY(1px) scale(0.995);
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.button-primary {
  border-color: rgba(114, 22, 25, 0.2);
  color: #fff8ed;
  background: linear-gradient(135deg, #b3262a, var(--red-dark));
  box-shadow: 0 12px 24px rgba(114, 22, 25, 0.2);
}

.hero-card .button-primary {
  color: var(--red-dark);
  background: #fff8ed;
  box-shadow: 0 12px 26px rgba(72, 10, 12, 0.16);
}

.button-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.hero-card .button-secondary {
  border-color: rgba(255, 248, 237, 0.24);
  color: #fff8ed;
  background: rgba(255, 248, 237, 0.1);
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.button-ghost {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.button-small {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
}

.button-full {
  width: 100%;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 76px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  text-align: left;
}

.quick-card[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.quick-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: var(--red);
  background: var(--red-soft);
}

.quick-card.is-jade .quick-icon {
  color: var(--jade);
  background: var(--jade-soft);
}

.quick-icon .icon {
  width: 19px;
  height: 19px;
}

.quick-title {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.quick-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.quick-arrow {
  width: 17px;
  height: 17px;
  color: var(--line-strong);
}

.section {
  display: grid;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.section-link {
  border: 0;
  padding: 0;
  color: var(--red);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.source-card {
  text-align: left;
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.7);
}

.source-card.is-muted {
  opacity: 0.55;
}

.source-badge {
  display: inline-flex;
  max-width: 100%;
  padding: 3px 7px;
  overflow: hidden;
  border-radius: 99px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card:nth-child(2) .source-badge {
  color: var(--jade);
  background: var(--jade-soft);
}

.source-card:nth-child(3) .source-badge {
  color: var(--gold);
  background: var(--gold-soft);
}

.source-name {
  margin: 9px 0 3px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-count {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1;
}

.source-count small {
  margin-left: 2px;
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
}

.license-note {
  margin: 0;
  padding: 3px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.license-note a,
.about-box a,
.feedback-card a {
  color: var(--red);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.loading-card,
.empty-card,
.error-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 46px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 248, 0.8);
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 18px;
  color: #fff8ed;
  background: var(--red);
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
  box-shadow: 0 12px 26px rgba(114, 22, 25, 0.2);
}

.loading-card h1,
.empty-card h1,
.error-card h1 {
  margin: 4px 0 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
}

.loading-card p,
.empty-card p,
.error-card p {
  max-width: 32em;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.loading-track {
  width: min(260px, 74%);
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}

.loading-track span {
  display: block;
  width: 28%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #d37a6d);
  animation: loading-slide 1.25s ease-in-out infinite;
}

.loading-count {
  min-height: 16px;
  color: var(--red) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

@keyframes loading-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(390%); }
}

.quiz-shell {
  display: grid;
  gap: 14px;
}

.quiz-top {
  display: grid;
  gap: 9px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 99px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 10px;
  font-weight: 800;
}

.source-pill.is-jade {
  color: var(--jade);
  background: var(--jade-soft);
}

.source-pill.is-gold {
  color: var(--gold);
  background: var(--gold-soft);
}

.quiz-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.quiz-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #d47d6e);
  transition: width 280ms ease;
}

.question-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-index {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.question-index::before {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
  content: "";
}

.question-stem {
  margin: 0;
  color: var(--ink);
  font-size: clamp(15px, 4.1vw, 17px);
  font-weight: 650;
  line-height: 1.85;
  white-space: pre-wrap;
}

.options {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 54px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink-soft);
  background: #fffefa;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.option:hover {
  border-color: var(--line-strong);
  background: #fffdf8;
}

.option:active {
  transform: scale(0.995);
}

.option-letter {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 700;
}

.option-text {
  font-size: 13px;
  line-height: 1.65;
}

.option.is-selected {
  border-color: rgba(159, 29, 32, 0.5);
  background: var(--red-soft);
}

.option.is-selected .option-letter {
  border-color: var(--red);
  color: #fff8ed;
  background: var(--red);
}

.option.is-correct {
  border-color: rgba(30, 106, 88, 0.48);
  background: var(--jade-soft);
}

.option.is-correct .option-letter {
  border-color: var(--jade);
  color: #fff;
  background: var(--jade);
}

.option.is-wrong {
  border-color: rgba(159, 29, 32, 0.5);
  background: var(--red-soft);
}

.option.is-wrong .option-letter {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.option.is-dim {
  opacity: 0.55;
}

.option:disabled {
  cursor: default;
}

.quiz-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.answer-state {
  min-height: 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.answer-state strong {
  color: var(--red);
}

.feedback-card {
  display: grid;
  gap: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow-soft);
  animation: rise-in 220ms ease both;
}

.feedback-card.is-correct {
  border-color: rgba(30, 106, 88, 0.25);
  background: linear-gradient(180deg, rgba(226, 240, 234, 0.72), rgba(255, 253, 248, 0.92));
}

.feedback-card.is-wrong {
  border-color: rgba(159, 29, 32, 0.2);
  background: linear-gradient(180deg, rgba(246, 229, 227, 0.65), rgba(255, 253, 248, 0.92));
}

.feedback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.feedback-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.feedback-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.feedback-answer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--jade-dark);
  background: var(--jade-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
}

.explanation {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.explanation-label {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.explanation p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.reason-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.reason-chip {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.reason-chip.is-on {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.result-card {
  display: grid;
  gap: 18px;
  padding: 25px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.result-kicker {
  margin: 0;
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.result-score {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(52px, 16vw, 78px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.result-score small {
  margin-left: 4px;
  color: var(--muted);
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0;
}

.result-copy {
  max-width: 28em;
  margin: -7px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.result-stat {
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--surface-2);
}

.result-stat strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 500;
}

.result-stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.result-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}

.wrong-list {
  display: grid;
  gap: 9px;
}

.wrong-card {
  display: grid;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 4px 16px rgba(71, 55, 27, 0.035);
}

.wrong-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wrong-stem {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wrong-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.due-pill {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 99px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 9px;
  font-weight: 800;
}

.due-pill.is-later {
  color: var(--jade);
  background: var(--jade-soft);
}

.wrong-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--shadow-soft);
}

.stat-card.is-accent {
  color: #fff8ed;
  border-color: transparent;
  background: linear-gradient(135deg, #9f1d20, #711619);
  box-shadow: 0 16px 34px rgba(114, 22, 25, 0.16);
}

.stat-value {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.stat-card.is-accent .stat-label {
  color: rgba(255, 248, 237, 0.64);
}

.chart-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.chart-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.chart-head span {
  color: var(--muted);
  font-size: 10px;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 116px;
}

.chart-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: end;
  height: 116px;
  text-align: center;
}

.chart-bar-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 92px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, transparent, rgba(222, 213, 197, 0.22));
}

.chart-bar {
  display: block;
  width: min(24px, 62%);
  min-height: 3px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #b64545, var(--red));
}

.chart-column.is-today .chart-bar {
  background: linear-gradient(180deg, #d39a55, var(--gold));
}

.chart-label {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.source-stats {
  display: grid;
  gap: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.stat-row {
  display: grid;
  gap: 6px;
}

.stat-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  font-weight: 700;
}

.stat-row-head span:last-child {
  color: var(--muted);
  font-weight: 500;
}

.stat-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}

.stat-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.stat-row:nth-child(2) .stat-fill {
  background: var(--jade);
}

.stat-row:nth-child(3) .stat-fill {
  background: var(--gold);
}

.empty-card {
  padding: 38px 24px;
}

.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: var(--red);
  background: var(--red-soft);
}

.empty-icon .icon {
  width: 23px;
  height: 23px;
}

.tabbar {
  position: fixed;
  right: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  width: min(100%, 760px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 8px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid rgba(207, 195, 175, 0.74);
  background: rgba(250, 247, 239, 0.86);
  box-shadow: 0 -12px 30px rgba(71, 55, 27, 0.04);
  transform: translateX(50%);
  backdrop-filter: blur(18px);
}

.tab {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 48px;
  padding: 5px 4px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.tab .icon {
  width: 20px;
  height: 20px;
}

.tab.is-active {
  color: var(--red);
  background: rgba(159, 29, 32, 0.055);
}

.sheet {
  width: calc(100% - 22px);
  max-width: 680px;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(207, 195, 175, 0.7);
  border-radius: 25px 25px 0 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(40, 28, 12, 0.24);
}

.sheet::backdrop {
  background: rgba(35, 27, 18, 0.42);
  backdrop-filter: blur(4px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 13px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
}

.sheet-body {
  display: grid;
  gap: 20px;
  max-height: calc(90dvh - 73px);
  padding: 17px 20px calc(24px + var(--safe-bottom));
  overflow: auto;
}

.setting-group {
  display: grid;
  gap: 10px;
}

.setting-label {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.setting-copy {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 37px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.segmented button.is-on {
  color: var(--red);
  background: var(--surface);
  box-shadow: 0 3px 10px rgba(71, 55, 27, 0.07);
}

.source-toggle {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 58px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.source-toggle-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 14px;
  font-weight: 800;
}

.source-toggle:nth-of-type(2) .source-toggle-icon {
  color: var(--jade);
  background: var(--jade-soft);
}

.source-toggle:nth-of-type(3) .source-toggle-icon {
  color: var(--gold);
  background: var(--gold-soft);
}

.source-toggle-copy strong {
  display: block;
  font-size: 12px;
}

.source-toggle-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.source-switch {
  position: relative;
  width: 39px;
  height: 23px;
  border-radius: 99px;
  background: var(--surface-3);
  transition: background-color 150ms ease;
}

.source-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  content: "";
  transition: transform 150ms ease;
}

.source-toggle.is-on .source-switch {
  background: var(--jade);
}

.source-toggle.is-on .source-switch::after {
  transform: translateX(16px);
}

.data-actions {
  display: grid;
  gap: 8px;
}

.data-actions .button {
  justify-content: flex-start;
  border-color: var(--line);
  background: var(--surface);
}

.data-actions .is-danger {
  color: var(--red);
}

.about-box {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(240, 234, 223, 0.4);
  font-size: 10px;
  line-height: 1.65;
}

.about-box strong {
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(82px + var(--safe-bottom));
  z-index: 40;
  max-width: min(86vw, 460px);
  padding: 10px 15px;
  border: 1px solid rgba(207, 195, 175, 0.8);
  border-radius: 999px;
  color: #fff8ed;
  background: rgba(36, 33, 28, 0.92);
  box-shadow: 0 12px 28px rgba(35, 27, 18, 0.2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  margin: 20px;
  padding: 20px;
  border-radius: 16px;
  background: var(--red-soft);
  text-align: center;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 680px) {
  .app-shell {
    padding-right: 26px;
    padding-left: 26px;
  }

  .hero-card {
    padding: 26px;
  }

  .question-card {
    padding: 25px;
  }

  .sheet {
    margin: auto;
    border-radius: 25px;
  }

  .sheet-body {
    max-height: calc(88dvh - 73px);
  }
}

@media (max-width: 420px) {
  .brand-copy small {
    display: none;
  }

  .source-grid {
    gap: 7px;
  }

  .source-card {
    padding: 11px 10px;
  }

  .quick-card {
    grid-template-columns: 35px minmax(0, 1fr) 15px;
    gap: 8px;
    padding: 11px;
  }

  .quick-icon {
    width: 35px;
    height: 35px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
