:root {
  --bg: #0d1117;
  --panel: rgba(23, 29, 38, 0.88);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --text: #e7e9e7;
  --muted: #939ba5;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #b9d7cc;
  --accent-dark: #17251f;
  --danger: #c59494;
  --radius: 18px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 8%, rgba(108, 143, 137, .14), transparent 32rem),
    radial-gradient(circle at 90% 100%, rgba(72, 85, 119, .12), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
}

.app-shell { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; padding: 22px; }
.screen { display: none; }
.screen.active { display: block; animation: appear .35s ease; }
.screen.centered.active { min-height: calc(100vh - 44px); display: flex; flex-direction: column; justify-content: center; align-items: stretch; text-align: center; }

@keyframes appear { from { opacity: 0; transform: translateY(5px); } }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-family: Georgia, "Songti SC", serif; font-size: clamp(2.2rem, 9vw, 4.6rem); font-weight: 400; line-height: 1.1; letter-spacing: -.04em; }
h2 { margin-bottom: 12px; font-family: Georgia, "Songti SC", serif; font-size: 1.8rem; font-weight: 400; }
.eyebrow, .section-label { margin-bottom: 10px; color: var(--muted); font-size: .72rem; letter-spacing: .17em; text-transform: uppercase; }
.lead { max-width: 32rem; margin: 0 auto 32px; color: #b9bec5; }
.signature { margin-top: 34px; color: #6f7780; font-size: .8rem; }

.button-stack { width: min(100%, 340px); margin: 0 auto; display: grid; gap: 11px; }
.button-stack.horizontal { width: 100%; grid-template-columns: 1fr 1fr; margin-top: 24px; }
.primary, .ghost, .option-button, .icon-button {
  min-height: 52px; border-radius: 12px; border: 1px solid transparent; padding: 12px 18px; color: var(--text); background: transparent;
}
.primary { color: var(--accent-dark); background: var(--accent); font-weight: 700; }
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: .42; cursor: default; }
.ghost, .icon-button { border-color: var(--line); background: rgba(255,255,255,.025); }
.ghost:hover, .icon-button:hover { background: rgba(255,255,255,.065); }

.profile-form { display: grid; gap: 12px; width: min(100%, 370px); margin: 0 auto; text-align: left; }
.profile-form label { color: var(--muted); font-size: .82rem; }
.profile-form input { width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; color: var(--text); background: rgba(255,255,255,.045); }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-top: 10px; }
.topbar h1 { font-size: clamp(2.7rem, 13vw, 5rem); }
.icon-button { min-height: 38px; padding: 7px 11px; color: var(--muted); font-size: .75rem; }
.last-login { margin-top: -6px; margin-bottom: 20px; color: var(--muted); font-size: .78rem; }

.status-card, .task-card, .scene { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.15); }
.status-card { margin-bottom: 18px; padding: 18px; }
.stage-row { display: flex; justify-content: space-between; margin-bottom: 18px; color: var(--muted); font-size: .84rem; }
.stage-row strong { color: var(--accent); font-weight: 500; }
.meters { display: grid; gap: 12px; }
.meter-row { display: grid; grid-template-columns: 55px 1fr 28px; align-items: center; gap: 10px; color: var(--muted); font-size: .78rem; }
.meter-row b { color: var(--text); text-align: right; font-weight: 500; }
.meter { height: 5px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.08); }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
#abnormality-bar { background: #c3a9ba; }
#weightlessness-bar { background: #aab6d4; }

.task-card { padding: 24px; }
.task-card h2 { font-size: 2rem; }
.task-card > .primary { width: 100%; margin-top: 8px; }
.feedback { min-height: 0; margin: 16px 0 0; color: #bdc4c9; font-family: Georgia, "Songti SC", serif; }
.optional-section { padding-top: 24px; }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.option-button { min-height: 88px; border-color: var(--line); background: var(--panel-soft); text-align: left; }
.option-button strong { display: block; margin-bottom: 3px; font-weight: 500; }
.option-button span { color: var(--muted); font-size: .72rem; }
.option-button:hover { border-color: rgba(185,215,204,.45); background: rgba(185,215,204,.055); }

.scene { padding: 28px 24px; }
.scene-copy { min-height: 80px; margin: 28px 0; font-family: Georgia, "Songti SC", serif; font-size: 1.15rem; line-height: 2; }
.scene > .primary, .scene > .ghost { width: 100%; }
.time-row { display: grid; gap: 10px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.timeline { height: 3px; background: rgba(255,255,255,.1); }
.timeline i { display: block; width: 0; height: 100%; background: var(--accent); }
.audio-notice { min-height: 24px; margin: 12px 0 0; color: var(--muted); font-size: .76rem; text-align: center; }
.summary-text { color: #c4c8cc; white-space: pre-line; }
.records-list { display: grid; gap: 10px; max-height: 55vh; margin: 22px 0; overflow: auto; }
.record { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.record strong { display: block; margin-bottom: 7px; color: var(--accent); }
.record p { margin: 0; color: var(--muted); font-size: .85rem; white-space: pre-line; }

.footer-actions { display: flex; justify-content: space-between; padding: 24px 4px 10px; }
.text-button { border: 0; padding: 8px 0; color: var(--muted); background: transparent; font-size: .78rem; }
.text-button:hover { color: var(--text); }
.text-button.danger:hover { color: var(--danger); }
.pwa-install { color: var(--accent); font-weight: 500; }
.hidden { display: none !important; }

body.dream { --accent: #c3bad8; --accent-dark: #201b2b; background: radial-gradient(circle at 50% -15%, rgba(118,89,140,.25), transparent 45rem), #0b0a11; }
body.dream .app-shell { filter: saturate(.82); }

@media (max-width: 520px) {
  .app-shell { padding: 16px; }
  .screen.centered.active { min-height: calc(100vh - 32px); }
  .option-grid, .button-stack.horizontal { grid-template-columns: 1fr; }
  .status-card, .task-card, .scene { border-radius: 15px; }
}

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