:root {
  --ink: #2b2018;
  --muted: #8a7a6a;
  --line: #f0e6da;
  --surface: #ffffff;
  --surface-soft: #faf6f0;
  --blue: #ef7a3d;
  --blue-dark: #e05f1f;
  --blue-soft: #ffe9d8;
  --green: #16a34a;
  --green-soft: #e9f8ef;
  --amber: #d97706;
  --amber-soft: #fff5df;
  --red: #e5484d;
  --red-soft: #fdeeee;
  --shadow: 0 12px 32px rgba(120, 74, 30, 0.10);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7f1e8;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background: #f7f1e8;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  overscroll-behavior-y: contain;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 16px 18px;
  background: #ffffff;
  border-right: 1px solid #f0e6da;
}

.brand,
.mini-profile,
.row,
.topbar,
.topbar-actions,
.status-dot,
.stat-label,
.card-header,
.option-row,
.settings-row,
.paper-row,
.action-row,
.quiz-head,
.quiz-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  padding: 0 10px 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), #ffb066);
  border-radius: 14px;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(239, 122, 61, 0.35);
}

.brand strong,
.brand span,
.mini-profile strong,
.mini-profile span {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0;
}

.brand span,
.mini-profile span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  color: #5a6572;
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.nav-item.active {
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 700;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  color: currentColor;
  font-size: 17px;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  display: block;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 10px 0;
  border-top: 1px solid var(--line);
}

.mini-profile {
  gap: 10px;
  min-width: 0;
}

.mini-profile strong {
  overflow: hidden;
  max-width: 140px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #ffffff;
  background: linear-gradient(135deg, #ef7a3d, #ffb066);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(239, 122, 61, 0.25);
}

.text-button {
  margin-top: 15px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 12px;
}

.text-button:hover {
  color: var(--red);
}

.main {
  min-width: 0;
  min-height: 100svh;
}

.hide-topbar .topbar {
  display: none;
}

.topbar {
  justify-content: space-between;
  min-height: 92px;
  padding: 20px clamp(20px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 6px;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 16px;
  font-weight: 700;
}

.topbar-actions {
  gap: 12px;
}

.status-dot {
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #5a6572;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.icon-button:hover {
  color: var(--blue-dark);
  border-color: #a9c4f5;
}

.screen {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 50px);
}

.section {
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading p,
.muted {
  color: var(--muted);
}

.section-heading p {
  margin-top: 7px;
  font-size: 13px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 26px;
  padding: clamp(24px, 4vw, 42px);
  background: linear-gradient(135deg, #1e4bb8 0%, #2f6fe4 58%, #4a8cf5 100%);
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(38, 84, 190, 0.28);
}

.hero-copy {
  max-width: 660px;
}

.hero-kicker {
  color: #bcd3fb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h2 {
  max-width: 630px;
  margin-top: 14px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.13;
}

.hero p {
  max-width: 550px;
  margin-top: 16px;
  color: #d6e4fd;
  font-size: 15px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-actions .button {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--blue-dark);
}

.hero-actions .button:hover {
  background: #eaf1ff;
  border-color: #eaf1ff;
}

.hero-actions .button.secondary {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}

.hero-actions .button.secondary:hover {
  background: rgba(255, 255, 255, 0.26);
}

.hero-aside {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 190px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
}

.hero-aside .label {
  color: #bcd3fb;
  font-size: 12px;
}

.hero-aside strong {
  display: block;
  margin-top: 9px;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
}

.hero-aside small {
  color: #d6e4fd;
  line-height: 1.6;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(28, 48, 84, 0.04);
}

.card-header {
  justify-content: space-between;
  gap: 18px;
}

.card-header h3 {
  line-height: 1.4;
}

.stat-card {
  min-height: 124px;
}

.stat-label {
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  margin-top: 13px;
  color: var(--blue-dark);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.tag.amber {
  color: #9a5b00;
  background: var(--amber-soft);
}

.tag.red {
  color: #c22b30;
  background: var(--red-soft);
}

.tag.green {
  color: #14753a;
  background: var(--green-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 10px;
  font-weight: 700;
  text-align: center;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

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

.button.secondary {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #c9dbfa;
}

.button.secondary:hover {
  background: #ddebfe;
  border-color: #a9c4f5;
}

.button.ghost {
  color: #5a6572;
  background: #ffffff;
  border-color: var(--line);
}

.button.ghost:hover {
  color: var(--blue-dark);
  border-color: #a9c4f5;
}

.button.danger {
  color: #c22b30;
  background: var(--red-soft);
  border-color: #f4c1c2;
}

.button.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.button.full {
  width: 100%;
}

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

.shortcut-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 132px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button.shortcut-card:hover {
  border-color: #a9c4f5;
  box-shadow: 0 10px 26px rgba(38, 84, 190, 0.12);
  transform: translateY(-1px);
}

.shortcut-card .shortcut-title {
  font-size: 16px;
  font-weight: 800;
}

.shortcut-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.shortcut-arrow {
  align-self: end;
  color: var(--blue);
  font-size: 22px;
}

.app-strategy-card p {
  margin-top: 10px;
  line-height: 1.7;
}

.exam-card {
  position: relative;
  min-height: 156px;
  text-align: left;
}

.exam-card.selected-card {
  border-color: var(--blue);
  box-shadow: 0 14px 34px rgba(38, 84, 190, 0.16);
}

.exam-card.planned-card {
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

.exam-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.onboarding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  background: var(--amber-soft);
  border: 1px solid #f2d38f;
  border-radius: var(--radius);
}

.onboarding h3 {
  color: #7c4a03;
}

.onboarding p {
  margin-top: 6px;
  color: #94651b;
  font-size: 13px;
}

.action-row {
  flex-wrap: wrap;
  gap: 9px;
}

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

.list-row,
.paper-row,
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

button.list-row,
button.paper-row {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.list-row:last-child,
.paper-row:last-child,
.settings-row:last-child {
  border-bottom: 0;
}

.list-row-main,
.paper-row-main {
  min-width: 0;
}

.list-row-title,
.paper-row-title {
  overflow: hidden;
  font-weight: 700;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-meta,
.paper-row-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.boot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 96px 20px;
  color: var(--muted);
  font-size: 13px;
}

.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d8e2f3;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: boot-spin 0.8s linear infinite;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
}

.setup-grid {
  display: grid;
  gap: 14px;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.choice {
  min-height: 42px;
  padding: 6px 13px;
  color: #5a6572;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.choice:hover {
  border-color: #a9c4f5;
}

.choice.active {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: var(--blue);
  font-weight: 700;
}

.choice-title {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.choice-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.setup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.setup-footer p {
  color: var(--muted);
  font-size: 12px;
}

.quiz-shell {
  max-width: 900px;
  margin: 0 auto;
}

.quiz-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.quiz-head h2 {
  margin-top: 7px;
}

.timer {
  min-width: 72px;
  height: 52px;
  padding: 0 14px;
  display: grid;
  place-items: center;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border: 1px solid #c9dbfa;
  border-radius: 999px;
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.timer.urgent {
  color: #c22b30;
  background: var(--red-soft);
  border-color: #f4c1c2;
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.progress-track {
  height: 6px;
  margin-top: 15px;
  overflow: hidden;
  background: #e3e9f2;
  border-radius: 99px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #5b93f2);
  border-radius: inherit;
  transition: width 180ms ease;
}

.question-card {
  margin-top: 16px;
}

.material {
  margin-bottom: 20px;
  padding: 14px 16px;
  color: #4a5563;
  background: var(--surface-soft);
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

.stem {
  margin-top: 16px;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.7;
  white-space: pre-wrap;
}

.question-source {
  margin-top: 14px;
  font-size: 12px;
  color: #94a3b8;
  text-align: right;
}

.options {
  display: grid;
  gap: 11px;
  margin-top: 22px;
}

.answer-option {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  align-items: start;
  width: 100%;
  padding: 15px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.answer-option:hover {
  border-color: #a9c4f5;
  box-shadow: 0 4px 14px rgba(38, 84, 190, 0.07);
}

.answer-option.selected {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.option-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #5a6572;
  background: #eef1f6;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease;
}

.answer-option.selected .option-key {
  color: #ffffff;
  background: var(--blue);
}

.option-content {
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.question-assets {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.question-assets img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.quiz-footer {
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.quiz-footer-left,
.quiz-footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.analysis-status {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 800;
}

.analysis-status.right {
  color: var(--green);
}

.analysis-status.wrong {
  color: var(--red);
}

.analysis-box {
  margin-top: 16px;
  padding: 18px;
  background: #f6f9fd;
  border: 1px solid #d9e5f7;
  border-radius: 11px;
}

.analysis-box h3 {
  margin-bottom: 10px;
}

.analysis-text {
  color: #435060;
  line-height: 1.8;
  white-space: pre-wrap;
}

.bar-list {
  display: grid;
  gap: 15px;
  margin-top: 18px;
}

.bar-line {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 10px;
}

.bar-label,
.bar-value {
  color: #5a6572;
  font-size: 12px;
}

.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  background: #e7ecf3;
  border-radius: 99px;
}

.bar-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #5b93f2);
  border-radius: inherit;
}

.settings-row {
  min-height: 66px;
}

.settings-row strong {
  display: block;
}

.settings-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #cdd5df;
  border-radius: 99px;
  transition: background 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--blue);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 15px;
}

.field label {
  color: #5a6572;
  font-size: 12px;
  font-weight: 700;
}

.text-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.text-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 228, 0.14);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

.checkbox-row input {
  accent-color: var(--blue);
}

.toast-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: min(320px, calc(100vw - 48px));
  padding: 12px 15px;
  color: #ffffff;
  background: #232e3d;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.mobile-nav {
  display: none;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1050px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-aside {
    min-height: 0;
  }
}

/* Force the mobile app layout on every viewport. */
  html {
    background: #dfe4ec;
  }

  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    font-size: 14px;
  }

  .app-shell {
    display: block;
    width: min(100%, 430px);
    min-height: 100svh;
    margin: 0 auto;
    overflow: hidden;
    background: #f3f5f9;
    box-shadow: 0 0 0 1px rgba(28, 48, 84, 0.05), 0 24px 70px rgba(28, 48, 84, 0.16);
  }

  .sidebar {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 58px;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    backdrop-filter: blur(14px);
  }

  .topbar .eyebrow,
  .topbar-actions .status-dot {
    display: none;
  }

  h1 {
    margin-top: 0;
    font-size: 20px;
  }

  h2 {
    font-size: 18px;
  }

  h3 {
    font-size: 15px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .screen {
    max-width: none;
    padding: 14px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
  }

  .section {
    margin-bottom: 12px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  .section-heading p {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.55;
  }

  .mobile-nav {
    position: fixed;
    right: auto;
    bottom: 0;
    left: 50%;
    z-index: 10;
    display: grid;
    width: min(100%, 430px);
    transform: translateX(-50%);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(28, 48, 84, 0.08);
    backdrop-filter: blur(14px);
  }

  .mobile-nav .nav-item {
    min-height: 48px;
    padding: 4px;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    color: #8b95a3;
  }

  .mobile-nav .nav-item.active {
    color: var(--blue);
    background: transparent;
  }

  .mobile-nav .nav-item.active .nav-icon {
    color: var(--blue);
  }

  .mobile-nav .nav-icon {
    height: 20px;
    font-size: 16px;
  }

  .mobile-nav .nav-icon svg {
    width: 21px;
    height: 21px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

  .topbar-actions {
    flex: 0 0 auto;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px;
    border-radius: 16px;
  }

  .hero-kicker {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .hero h2 {
    margin-top: 8px;
    font-size: 24px;
    line-height: 1.18;
  }

  .hero p {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.58;
  }

  .hero-actions {
    gap: 8px;
    margin-top: 16px;
  }

  .hero-aside {
    min-height: 0;
    padding: 14px;
  }

  .hero-aside strong {
    margin-top: 4px;
    font-size: 28px;
  }

  .card {
    padding: 15px;
    border-radius: 14px;
  }

  .stat-card {
    min-height: 92px;
  }

  .stat-value {
    margin-top: 8px;
    font-size: 26px;
  }

  .shortcut-card {
    min-height: 100px;
  }

  .app-strategy-card p,
  .shortcut-card p {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.48;
  }

  .button {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 10px;
  }

  .choice-grid {
    gap: 7px;
  }

  .choice {
    min-height: 40px;
    padding: 5px 11px;
  }

  .choice-title {
    font-size: 13px;
  }

  .choice-subtitle {
    font-size: 10px;
  }

  .quiz-shell {
    max-width: none;
  }

  .quiz-head {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }

  .quiz-head h2 {
    margin-top: 4px;
  }

  .timer {
    min-width: 58px;
    height: 44px;
    padding: 0 12px;
    font-size: 16px;
  }

  .question-card {
    padding: 15px;
  }

  .stem,
  .material,
  .analysis-text {
    font-size: 14px;
    line-height: 1.7;
  }

  .answer-option {
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 48px;
    padding: 11px;
    border-radius: 12px;
  }

  .option-key {
    width: 28px;
    height: 28px;
  }

  .options {
    gap: 8px;
    margin-top: 14px;
  }

  .analysis-box {
    padding: 13px;
  }

  .onboarding,
  .setup-footer,
  .quiz-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .onboarding .action-row,
  .setup-footer .action-row,
  .quiz-footer-left,
  .quiz-footer-right {
    width: 100%;
  }

  .onboarding .button,
  .setup-footer .button,
  .quiz-footer-right .button {
    flex: 1;
  }

  .quiz-footer-left,
  .quiz-footer-right {
    justify-content: space-between;
  }

  .quiz-footer-left .button {
    flex: 1;
  }

  .settings-row {
    gap: 12px;
  }

  .text-input {
    min-height: 44px;
    font-size: 16px;
  }

  .toast-root {
    right: auto;
    bottom: calc(86px + env(safe-area-inset-bottom));
    left: 50%;
    width: min(calc(100% - 24px), 406px);
    transform: translateX(-50%);
  }

  .toast {
    max-width: none;
    width: 100%;
  }


/* Use compact phone card/list rules even on desktop browsers. */
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strategy-section {
    display: none;
  }

  .hero {
    padding: 16px;
  }

  .hero h2 {
    font-size: 22px;
  }

  .hero-actions .button {
    flex: 1 1 100%;
  }

  .hero-aside {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .hero-aside small {
    font-size: 12px;
  }

  .card {
    padding: 13px;
  }

  .stat-card {
    min-height: 82px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label,
  .stat-note,
  .pill,
  .tag {
    font-size: 10px;
  }

  .list-row,
  .paper-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 10px 0;
  }

  .list-row-title,
  .paper-row-title {
    white-space: normal;
  }

  .list-row .action-row,
  .paper-row .action-row {
    width: 100%;
  }

  .list-row .action-row .button,
  .paper-row .action-row .button {
    flex: 1;
  }

  .bar-line {
    grid-template-columns: 78px minmax(0, 1fr) 42px;
  }


@media (max-width: 380px) {
  h1 {
    font-size: 18px;
  }

  .screen {
    padding-top: 10px;
  }

  .hero h2 {
    font-size: 20px;
  }

  .hero p {
    font-size: 12px;
  }

  .stat-card {
    min-height: 78px;
  }

  .stat-value {
    font-size: 22px;
  }

  .mobile-nav .nav-item {
    min-height: 44px;
    font-size: 9px;
  }

  .button {
    min-height: 38px;
    padding: 0 11px;
    font-size: 13px;
  }
}


/* ---- 练习结果页：猫爪序号格，对绿错红 ---- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  padding: 12px 0;
  justify-items: center;
}

.result-cell {
  width: 56px;
  height: 56px;
  border-radius: 50% 50% 50% 40%;
  border: 0;
  font-size: 17px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: #ffffff;
  position: relative;
}

/* 猫爪肉垫形状 — 每个序号像一个小爪垫 */
.result-cell::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 10px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.35;
  filter: blur(1px);
}

.result-cell::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.25;
  filter: blur(1px);
}

.result-cell:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.result-cell:active {
  transform: scale(0.93);
}

.result-cell.cell-correct {
  background: linear-gradient(135deg, var(--green), #22c55e);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

.result-cell.cell-wrong {
  background: linear-gradient(135deg, var(--red), #f87171);
  box-shadow: 0 4px 12px rgba(229, 72, 77, 0.35);
}

.result-cell.cell-active {
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 6px currentColor, 0 6px 20px rgba(0, 0, 0, 0.15);
  transform: scale(1.12);
  z-index: 2;
}

.result-cell.cell-correct.cell-active {
  color: var(--green);
}

.result-cell.cell-wrong.cell-active {
  color: var(--red);
}

.result-detail {
  scroll-margin-top: 12px;
  border-color: #f0e6da !important;
}

.result-detail .answer-option {
  pointer-events: none;
}

.result-opt-correct {
  border-color: var(--green) !important;
  background: var(--green-soft) !important;
}

.result-opt-correct .option-key {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.result-opt-wrong {
  border-color: var(--red) !important;
  background: var(--red-soft) !important;
}

.result-opt-wrong .option-key {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}
