:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --primary-soft: rgba(15, 118, 110, 0.1);
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  --radius: 16px;
  --radius-sm: 12px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --max: 1080px;
  --topbar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
}

body.is-locked {
  background: #f5f7fb;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(18px, 4vw, 48px);
}

.auth-hero {
  width: min(1080px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: clamp(18px, 4vw, 46px);
  align-items: center;
}

.auth-copy {
  min-width: 0;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(24px, 5vw, 58px);
  color: var(--ink);
  text-decoration: none;
}

.auth-brand span:last-child {
  display: grid;
  gap: 2px;
}

.auth-brand strong {
  font-size: 1.05rem;
  line-height: 1.1;
}

.auth-brand em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.auth-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(2.35rem, 7vw, 5.2rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.auth-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.auth-metrics span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-metrics b {
  color: var(--primary);
  font-size: 1rem;
}

.auth-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.auth-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-preview img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
}

.auth-preview span,
.miniapp-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.auth-preview strong,
.miniapp-strip strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 1rem;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--ink);
  background: #f8fafc;
  font: inherit;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.auth-submit {
  width: 100%;
  margin-top: 2px;
}

.auth-message {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-message.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b42318;
}

.auth-message.ok {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #067647;
}

.auth-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.auth-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.miniapp-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.miniapp-strip img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
}

.miniapp-strip p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-footer {
  width: min(1080px, 100%);
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ========== App shell ========== */
.app {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 calc(28px + var(--safe-b));
}

/* ========== Top bar ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 10px;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  background: conic-gradient(from 210deg, #0f766e, #0ea5e9, #99f6e4, #0f766e);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.brand-text span {
  color: var(--muted);
  font-size: 0.72rem;
}

.account-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.remain-badge,
.logout-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.remain-badge {
  background: #ecfdf5;
  color: #067647;
  border: 1px solid #bbf7d0;
}

.logout-link {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.steps {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
}

.step i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--line);
  color: var(--muted);
}

.step.active {
  background: var(--ink);
  color: #fff;
}

.step.active i {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ========== Panels ========== */
.panel[hidden] {
  display: none !important;
}

.panel {
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ========== Cards / common ========== */
.hero-copy,
.hero-aside,
.test-shell,
.result-summary-card,
.result-table-card,
.share-shell,
.history-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.22);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.ghost {
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.label {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.pill.ok { background: #ecfdf5; color: var(--ok); }
.pill.bad { background: #fef2f2; color: var(--danger); }
.pill.skip { background: #fffbeb; color: var(--warn); }

/* ========== Intro ========== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: stretch;
}

.hero-copy {
  padding: clamp(22px, 3.5vw, 36px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.hero-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.hero-mobile-preview {
  display: none;
}

.hero-cta {
  margin: 4px 0 18px;
}

.hero-cta .btn {
  min-width: 160px;
}

.billing-status {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.billing-status.error {
  color: var(--danger);
}

.tips {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tips li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
}

.tip-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
}

.tips strong {
  display: block;
  font-size: 0.9rem;
}

.tips p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.88rem;
}

.hero-aside {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.plate-frame {
  width: min(100%, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.plate-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plate-frame.large {
  width: min(100%, 400px);
}

.plate-frame.large img {
  object-fit: contain;
}

.aside-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.aside-caption b {
  color: var(--ink);
}

.stat-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  text-align: center;
  padding: 10px 6px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-size: 1.1rem;
  line-height: 1.2;
}

.stat span {
  color: var(--muted);
  font-size: 0.72rem;
}

/* ========== TEST PAGE (core) ========== */
.test-shell {
  padding: 20px;
}

.test-scroll {
  width: 100%;
}

.test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.test-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.test-head-row h2 {
  margin: 0;
  font-size: 1.15rem;
}

.progress-wrap {
  flex: 1;
  min-width: 140px;
  max-width: 260px;
}

.progress-bar {
  height: 7px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #2dd4bf);
  transition: width 0.25s ease;
  border-radius: 999px;
}

/* Desktop: two columns, both full height of cell */
.test-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  width: 100%;
}

.plate-stage {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 360px;
}

.answer-panel {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.answer-intro {
  margin-bottom: 12px;
}

.answer-intro h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.answer-dock {
  width: 100%;
}

.answer-chip {
  width: 100%;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.answer-chip span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.answer-chip strong {
  font-size: 1.45rem;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

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

.numpad button,
.line-choices button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.numpad button {
  font-size: 1.15rem;
}

.numpad button:active,
.line-choices button:active {
  transform: scale(0.97);
}

.numpad button.muted {
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
}

.line-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.line-choices button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 6px;
}

.line-choices button b {
  font-size: 1.3rem;
  line-height: 1;
}

.line-choices button span {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.line-choices button.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.line-choices button.selected span {
  color: rgba(255, 255, 255, 0.85);
}

.answered-chip {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.sticky-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}

.sticky-actions .btn {
  flex: 1;
  min-width: 0;
}

/* ========== Result ========== */
.result-shell {
  display: grid;
  gap: 14px;
}

.result-summary-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  padding: clamp(18px, 3vw, 28px);
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg);
  stroke-width: 9;
}

.ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}

.score-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.score-text strong {
  font-size: 1.7rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-text span {
  color: var(--muted);
  font-size: 0.82rem;
}

.result-copy h2 {
  margin: 8px 0 6px;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.25;
}

.result-copy > p {
  margin: 0;
  color: var(--ink-soft);
}

.severity-block {
  margin-top: 14px;
  max-width: 340px;
}

.severity-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.severity-bar {
  height: 9px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.severity-fill {
  height: 100%;
  width: 0%;
  background: #f59e0b;
  transition: width 0.5s ease;
  border-radius: 999px;
}

.result-table-card {
  padding: clamp(14px, 2.5vw, 22px);
}

.section-head {
  margin-bottom: 12px;
}

.section-head h2,
.section-head h3 {
  margin: 0 0 3px;
  font-size: 1.1rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 540px;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.detail-table th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ========== Share ========== */
.share-shell {
  padding: clamp(18px, 3vw, 26px);
}

.share-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.share-card-visual {
  border-radius: 14px;
  padding: 24px;
  min-height: 200px;
  background: linear-gradient(145deg, #0f172a 0%, #134e4a 55%, #0f766e 100%);
  color: #fff;
}

.share-brand {
  opacity: 0.78;
  font-size: 0.86rem;
}

.share-score {
  margin-top: 16px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.share-level {
  margin-top: 6px;
  font-size: 1rem;
}

.share-date {
  margin-top: 22px;
  opacity: 0.72;
  font-size: 0.84rem;
}

/* ========== History ========== */
.history-shell {
  padding: clamp(18px, 3vw, 26px);
}

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

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

.history-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  background: var(--bg);
}

.history-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.history-card-main {
  display: grid;
  gap: 6px;
}

.history-meta,
.history-stats,
.history-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.history-meta {
  justify-content: space-between;
}

.history-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.04rem;
}

.history-stats strong {
  color: var(--primary);
  font-size: 1.2rem;
}

.history-meter {
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.history-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f79009, #f04438);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 600;
  font-size: 0.88rem;
}

.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 130px;
}

.toast {
  margin: 8px 0 0;
  color: var(--ok);
  font-weight: 600;
  font-size: 0.88rem;
}

.site-footer {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

/* =========================================================
   TABLET  ≤ 900px  — 单列，全宽
   ========================================================= */
@media (max-width: 900px) {
  .auth-page {
    align-content: start;
    padding: 18px 14px;
  }

  .auth-hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .auth-brand {
    margin-bottom: 28px;
  }

  .auth-copy h1 {
    font-size: clamp(2.1rem, 13vw, 3.3rem);
  }

  .auth-panel {
    border-radius: 16px;
    padding: 16px;
  }

  .auth-links {
    grid-template-columns: 1fr;
  }

  .hero,
  .test-body,
  .share-grid {
    grid-template-columns: 1fr;
  }

  .hero-aside {
    display: none;
  }

  .hero-mobile-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .mobile-preview-plate {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--line);
    background: #fff;
  }

  .mobile-preview-plate img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mobile-preview-meta {
    flex: 1;
    min-width: 0;
  }

  .stat-row.compact {
    gap: 6px;
  }

  .stat-row.compact .stat {
    padding: 6px 4px;
  }

  .stat-row.compact .stat strong {
    font-size: 0.95rem;
  }

  .stat-row.compact .stat span {
    font-size: 0.66rem;
  }

  .mobile-preview-meta .aside-caption {
    margin-top: 6px;
    font-size: 0.78rem;
    text-align: left;
  }

  .hero-cta .btn {
    width: 100%;
  }

  .progress-wrap {
    max-width: none;
    width: 100%;
  }

  .test-head {
    flex-direction: column;
    align-items: stretch;
  }

  .plate-stage {
    min-height: 0;
    padding: 16px;
  }

  .plate-frame.large {
    width: min(70vw, 280px);
  }

  .result-summary-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .severity-block {
    margin-left: auto;
    margin-right: auto;
  }
}

/* =========================================================
   PHONE / NARROW  ≤ 900px — 测试页强制单列全宽贴底
   （避免「半屏空白」的双栏错位）
   ========================================================= */
@media (max-width: 900px) {
  .app {
    width: 100%;
    padding: 0 0 calc(12px + var(--safe-b));
  }

  .topbar {
    flex-wrap: wrap;
    margin: 0;
    top: 0;
    padding: 10px 12px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
  }

  .topbar .brand {
    flex: 1 1 auto;
  }

  .account-status {
    order: 2;
    margin-left: 0;
  }

  .steps {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .step span {
    display: none;
  }

  .step.active span {
    display: inline;
  }

  .step {
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  .step i {
    width: 22px;
    height: 22px;
  }

  .panel:not(.panel-test) {
    padding: 10px 12px 16px;
  }

  .hero-copy {
    padding: 16px;
  }

  .hero-copy h1 {
    font-size: 1.4rem;
  }

  .lead {
    font-size: 0.9rem;
    margin-bottom: 12px;
  }

  .result-copy .actions,
  .share-form .actions {
    width: 100%;
  }

  .result-copy .actions .btn,
  .share-form .actions .btn {
    flex: 1 1 calc(50% - 5px);
  }

  .share-form .actions .btn:last-child {
    flex: 1 1 100%;
  }

  /* —— 测试页：移动端单列，图板完整显示，页面自然滚动 —— */
  html.mode-test,
  body.mode-test {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.mode-test {
    width: 100%;
    background: var(--surface);
  }

  .app.mode-test {
    width: 100%;
    min-height: 100dvh;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .app.mode-test > main {
    flex: 1 1 auto;
    min-height: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .app.mode-test .site-footer {
    display: none;
  }

  .app.mode-test .topbar {
    flex-shrink: 0;
    position: relative;
    top: auto;
  }

  .panel-test {
    flex: 1 1 auto;
    min-height: auto;
    width: 100%;
    display: flex !important;
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  .panel-test[hidden] {
    display: none !important;
  }

  .panel-test .test-shell {
    flex: 1 1 auto;
    min-height: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--surface);
  }

  .panel-test .test-scroll {
    flex: 1 1 auto;
    min-height: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .panel-test .test-head {
    flex: 0 0 auto;
    width: 100%;
    margin: 0;
    padding: 10px 14px 8px;
    gap: 8px;
  }

  .panel-test .test-head-row {
    width: 100%;
    justify-content: space-between;
  }

  .panel-test .test-head-row h2 {
    font-size: 1rem;
  }

  .panel-test .progress-wrap {
    width: 100%;
    max-width: none;
  }

  /* 强制单列全宽，覆盖任何桌面 grid */
  .panel-test .test-body {
    flex: 1 1 auto;
    min-height: auto;
    width: 100%;
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    overflow: visible;
  }

  .panel-test .plate-stage,
  .panel-test .answer-panel,
  .panel-test .answer-dock,
  .panel-test .numpad,
  .panel-test #number-input-block,
  .panel-test #line-input-block {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .panel-test .plate-stage {
    flex: 0 0 auto;
    min-height: auto;
    padding: 10px 12px 12px;
    border: 0;
    border-radius: 0;
    background: #f1f5f9;
    overflow: visible;
  }

  .panel-test .plate-frame.large {
    width: min(calc(100vw - 32px), 420px) !important;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
  }

  .panel-test .answer-panel {
    flex: 0 0 auto;
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .panel-test .answer-intro {
    display: none;
  }

  .panel-test .answer-dock {
    padding: 8px 12px calc(10px + var(--safe-b));
  }

  .panel-test .answer-chip {
    margin-bottom: 6px;
    padding: 7px 12px;
    border-radius: 10px;
  }

  .panel-test .answer-chip strong {
    font-size: 1.25rem;
  }

  .panel-test .numpad {
    gap: 6px;
  }

  .panel-test .numpad button {
    min-height: 40px;
    border-radius: 10px;
    width: 100%;
  }

  .panel-test .line-choices {
    width: 100%;
  }

  .panel-test .line-choices button {
    min-height: 44px;
    border-radius: 10px;
    width: 100%;
  }

  .panel-test .sticky-actions {
    width: 100%;
    margin-top: 10px;
    gap: 8px;
  }

  .panel-test .sticky-actions .btn {
    min-height: 44px;
  }
}

/* 窄屏：给答题区留出可扫描的节奏，图板仍按宽度完整显示 */
@media (max-width: 900px) and (max-height: 700px) {
  .panel-test .plate-frame.large {
    width: min(calc(100vw - 40px), 360px) !important;
  }

  .panel-test .numpad button {
    min-height: 38px;
  }
}

@media (max-width: 900px) and (max-height: 600px) {
  .panel-test .plate-frame.large {
    width: min(calc(100vw - 48px), 320px) !important;
  }

  .panel-test .test-head {
    padding: 6px 12px 3px;
  }

  .panel-test .numpad button {
    min-height: 34px;
    font-size: 1.05rem;
  }

  .panel-test .sticky-actions .btn {
    min-height: 38px;
  }
}

/* 高屏 */
@media (max-width: 900px) and (min-height: 780px) {
  .panel-test .plate-frame.large {
    width: min(calc(100vw - 32px), 440px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
