:root {
  --ink: #3f456d;
  --ink-deep: #30375e;
  --ink-mid: rgba(63, 69, 109, .74);
  --ink-soft: rgba(63, 69, 109, .55);
  --mist: #a5a9d0;
  --lilac: #bcb1d4;
  --peach: #ecc7c2;
  --paper: rgba(255, 250, 240, .68);
  --paper-strong: rgba(255, 251, 243, .86);
  --cream: #fff1d6;
  --gold: #efc77f;
  --rose: #bd7c79;
  --line: rgba(255, 242, 219, .62);
  --shadow: 0 22px 52px rgba(57, 61, 101, .15);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(76% 42% at 52% 2%, rgba(255, 244, 218, .42), transparent 72%),
    radial-gradient(82% 52% at 94% 44%, rgba(239, 199, 191, .72), transparent 66%),
    radial-gradient(84% 60% at 0% 78%, rgba(147, 155, 204, .72), transparent 68%),
    linear-gradient(165deg, #9da4cf 0%, #b8afd6 43%, #dfbec9 76%, #efd0c3 100%);
  background-attachment: fixed;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
.mist { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,249,238,.2)); }

.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
}
.brand { grid-column: 2; display: flex; align-items: baseline; gap: 7px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand strong { font-family: "Songti SC", "STSong", serif; font-size: 21px; font-weight: 300; letter-spacing: .16em; }
.brand span { color: var(--ink-soft); font-family: Georgia, serif; font-size: 8px; letter-spacing: .15em; }
.save-state { justify-self: end; color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.back-button { justify-self: start; }

main { position: relative; z-index: 2; }
main:focus { outline: none; }
.view-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 calc(50px + env(safe-area-inset-bottom)); }
.loading-view { display: grid; min-height: 70vh; place-content: center; justify-items: center; color: var(--ink-mid); }
.archive-spinner { width: 34px; height: 34px; border: 1px solid rgba(255,241,214,.5); border-top-color: var(--cream); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.eyebrow { margin: 0 0 10px; color: var(--ink-soft); font-family: Georgia, "Times New Roman", serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif; font-weight: 300; color: var(--ink-deep); }

.map-hero { max-width: 620px; margin: 20px auto 30px; text-align: center; }
.map-hero h1 { margin: 0; font-size: clamp(38px, 8vw, 64px); line-height: 1.16; letter-spacing: .02em; }
.map-lead { max-width: 490px; margin: 17px auto 0; color: var(--ink-mid); font-size: 15px; font-weight: 300; line-height: 1.82; }

.instructions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
.instructions li { display: grid; grid-template-columns: 36px 1fr; gap: 10px; min-width: 0; padding: 17px 15px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(135deg, rgba(255,250,240,.6), rgba(255,250,240,.27)); box-shadow: inset 0 1px rgba(255,255,255,.4); backdrop-filter: blur(16px); }
.instructions li > span { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,241,214,.76); border-radius: 50%; color: var(--rose); font-family: Georgia, serif; font-size: 11px; }
.instructions strong { color: var(--ink-deep); font-size: 14px; font-weight: 500; }
.instructions p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }

.curve-panel { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,250,240,.25); }
.curve-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.curve-head h2 { margin: 0; font-size: 20px; }
.curve-head p { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.curve-link { flex: 0 0 auto; color: var(--ink-mid); font-size: 12px; text-decoration: none; }
.curve-points { display: flex; gap: 8px; overflow-x: auto; padding: 15px 2px 2px; scrollbar-width: none; }
.curve-points::-webkit-scrollbar { display: none; }
.curve-point { position: relative; flex: 0 0 auto; min-width: 112px; padding: 11px 12px; border-radius: 16px; background: rgba(255,250,240,.36); }
.curve-point strong { display: block; max-width: 150px; overflow: hidden; color: var(--ink-deep); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.curve-point small { color: var(--ink-soft); font-size: 10px; }
.curve-point.told { opacity: .62; }
.curve-point.told::after { content: "短故事已讲过"; display: block; margin-top: 5px; color: var(--rose); font-size: 9px; }
.curve-empty { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.curve-empty p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }

.progress-panel { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 36px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(135deg, rgba(255,241,214,.56), rgba(255,250,240,.24)); box-shadow: var(--shadow); }
.progress-label { margin: 0 0 5px; color: var(--ink-soft); font-size: 11px; letter-spacing: .12em; }
.progress-copy { margin: 0; color: var(--ink-mid); font-size: 14px; }
.progress-copy strong { color: var(--ink-deep); font-family: Georgia, serif; font-size: 24px; font-weight: 400; }
.progress-ring { display: flex; align-items: baseline; justify-content: center; width: 64px; height: 64px; padding-top: 18px; border: 1px solid rgba(255,241,214,.9); border-radius: 50%; background: conic-gradient(var(--cream) var(--progress, 0%), rgba(255,250,240,.23) 0); box-shadow: inset 0 0 0 5px rgba(255,250,240,.28); }
.progress-ring span { color: var(--ink-deep); font-family: Georgia, serif; font-size: 20px; }.progress-ring small { color: var(--ink-soft); font-size: 9px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 26px; }.section-heading > p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.map-card { position: relative; display: flex; min-width: 0; min-height: 156px; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 17px; border: 1px solid var(--line); border-radius: 24px; color: inherit; background: linear-gradient(145deg, rgba(255,250,240,.56), rgba(255,250,240,.2)); box-shadow: 0 16px 36px rgba(64,65,103,.1); cursor: pointer; text-align: left; transition: transform .2s ease, background .2s ease; }
.map-card:hover { transform: translateY(-2px); }
.map-card::after { content: ""; position: absolute; right: -26px; bottom: -34px; width: 108px; height: 108px; border: 1px solid rgba(255,241,214,.46); border-radius: 50%; }
.map-card.lit { background: linear-gradient(145deg, rgba(255,241,214,.84), rgba(255,250,240,.38)); box-shadow: 0 18px 42px rgba(108,90,102,.14), inset 0 0 28px rgba(255,232,170,.26); }
.map-card.skipped { opacity: .7; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-number { color: var(--ink-soft); font-family: Georgia, serif; font-size: 12px; letter-spacing: .12em; }
.card-state { padding: 4px 7px; border: 1px solid rgba(255,241,214,.65); border-radius: 999px; color: var(--ink-soft); font-size: 9px; }
.lit .card-state { color: #936d49; background: rgba(255,241,214,.55); }
.map-card h3 { position: relative; z-index: 1; margin: 22px 0 0; font-family: "Songti SC", "STSong", serif; font-size: 21px; font-weight: 300; line-height: 1.24; color: var(--ink-deep); }
.map-card footer { position: relative; z-index: 1; display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: 18px; color: var(--ink-soft); font-size: 10px; }
.map-card footer b { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid rgba(255,241,214,.68); border-radius: 50%; color: var(--rose); font-size: 14px; font-weight: 400; }

.finish-panel { max-width: 640px; margin: 42px auto 0; padding: 30px 24px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,250,240,.35); text-align: center; }
.finish-panel h2 { margin: 0; font-size: 27px; }.finish-panel > p:not(.eyebrow) { margin: 12px auto 22px; color: var(--ink-mid); font-size: 13px; line-height: 1.7; }
.primary-button, .secondary-button, .quiet-button { min-height: 44px; padding: 0 18px; border-radius: 999px; cursor: pointer; }
.primary-button { border: 1px solid rgba(255,239,207,.92); color: var(--ink-deep); background: rgba(255,239,207,.74); box-shadow: 0 14px 32px rgba(75,65,96,.12); }
.secondary-button { border: 1px solid var(--line); color: var(--ink-mid); background: rgba(255,250,240,.3); }
.quiet-button { min-height: 36px; padding: 0 10px; border: 0; color: var(--ink-mid); background: transparent; }

.record-view { max-width: 820px; }
.record-hero { display: grid; grid-template-columns: 76px 1fr; gap: 18px; align-items: center; margin: 18px 0 22px; }
.record-number { display: grid; width: 72px; height: 72px; place-items: center; border: 1px solid rgba(255,241,214,.7); border-radius: 50%; color: var(--rose); background: rgba(255,250,240,.2); font-family: Georgia, serif; font-size: 18px; }
.record-hero h1 { margin: 0; font-size: clamp(33px, 7vw, 52px); line-height: 1.12; }
.seal { display: inline-flex; margin: 8px 0 0; padding: 4px 9px; border: 1px solid rgba(255,241,214,.7); border-radius: 999px; color: var(--ink-soft); font-size: 10px; letter-spacing: .16em; }
.already-told, .card-note { margin-bottom: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink-mid); background: rgba(255,250,240,.3); font-size: 12px; line-height: 1.6; }
.already-told { border-color: rgba(239,199,127,.58); background: rgba(255,241,214,.34); }
.question-sheet { padding: 22px 20px; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.question-section + .question-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(78,82,117,.1); }
.question-section h2 { margin: 0 0 12px; font-size: 18px; }.question-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.question-list li { color: var(--ink-mid); font-size: 14px; font-weight: 300; line-height: 1.72; }
.witness { margin: 22px 0 0; padding: 14px; border-left: 2px solid var(--gold); color: var(--ink-mid); background: rgba(255,241,214,.28); font-size: 13px; line-height: 1.65; }
.witness p { margin: 0; }.witness p + p { margin-top: 9px; }

.recorder-panel { margin-top: 16px; padding: 24px 20px; border: 1px solid var(--line); border-radius: 26px; background: linear-gradient(145deg, rgba(255,250,240,.56), rgba(255,250,240,.22)); text-align: center; }
.recorder-copy h2 { margin: 0; font-size: 25px; }.recorder-copy > p:last-child { margin: 8px auto 0; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 46px; margin-top: 15px; }
.wave i { width: 3px; height: 10px; border-radius: 99px; background: rgba(63,69,109,.26); }
.wave.active i { animation: wave .8s ease-in-out infinite alternate; background: var(--rose); }.wave.active i:nth-child(2n) { animation-delay: -.45s; }.wave.active i:nth-child(3n) { animation-delay: -.25s; }
@keyframes wave { to { height: 37px; } }
.record-time { margin: 0; color: var(--ink-deep); font-family: Georgia, serif; font-size: 24px; letter-spacing: .05em; }
.record-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.record-button { display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 22px; border: 1px solid rgba(255,241,214,.86); border-radius: 999px; color: var(--ink-deep); background: rgba(255,241,214,.62); cursor: pointer; }
.record-button span { width: 12px; height: 12px; border-radius: 50%; background: #b76f70; box-shadow: 0 0 0 5px rgba(183,111,112,.1); }.record-button b { font-weight: 500; }
.record-button.recording span { border-radius: 2px; }.record-button:disabled, .secondary-button:disabled, .primary-button:disabled { cursor: not-allowed; opacity: .45; }
.recorder-hint { margin: 13px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }

.upload-panel { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,250,240,.4); }
.upload-icon { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--rose); }
.upload-main strong { color: var(--ink-deep); font-size: 13px; }.upload-main p { margin: 4px 0 8px; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.upload-track { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(63,69,109,.12); }.upload-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d79ca0, var(--gold)); transition: width .25s ease; }
.upload-main small { color: var(--ink-soft); font-size: 9px; }
.card-navigation { display: flex; justify-content: space-between; margin-top: 14px; }

.submitted-view, .error-view { display: grid; min-height: calc(100vh - 80px); place-content: center; justify-items: center; max-width: 620px; text-align: center; }
.submitted-mark, .error-mark { display: grid; width: 88px; height: 88px; margin-bottom: 24px; place-items: center; border: 1px solid rgba(255,241,214,.78); border-radius: 50%; color: var(--rose); background: rgba(255,250,240,.24); font-family: "Songti SC", serif; font-size: 36px; box-shadow: 0 0 40px rgba(255,241,214,.3); }
.submitted-view h1, .error-view h1 { margin: 0; font-size: clamp(40px, 9vw, 65px); line-height: 1.15; }.submitted-view > p:not(.eyebrow), .error-view > p:not(.eyebrow) { max-width: 510px; margin: 20px 0 26px; color: var(--ink-mid); font-size: 14px; line-height: 1.85; }

@media (max-width: 720px) {
  .topbar { width: calc(100% - 24px); min-height: 60px; grid-template-columns: 1fr auto 1fr; }
  .brand span { display: none; }.save-state { max-width: 88px; overflow: hidden; text-overflow: ellipsis; }
  .view-shell { width: calc(100% - 24px); padding-top: 22px; }
  .map-hero { margin-top: 8px; }.map-hero h1 { font-size: 39px; }
  .instructions { grid-template-columns: 1fr; gap: 8px; }.instructions li { min-height: auto; padding: 13px; }
  .curve-head, .curve-empty { align-items: flex-start; }.curve-link { margin-top: 3px; }
  .progress-panel { margin-bottom: 30px; padding: 15px; }
  .section-heading { align-items: flex-start; }.section-heading > p { max-width: 110px; text-align: right; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .map-card { min-height: 142px; padding: 14px; border-radius: 21px; }.map-card h3 { font-size: 18px; }.map-card footer span { max-width: 90px; }
  .finish-panel { margin-top: 28px; padding: 25px 17px; }
  .record-hero { grid-template-columns: 57px 1fr; gap: 12px; }.record-number { width: 55px; height: 55px; }.record-hero h1 { font-size: 34px; }
  .question-sheet { padding: 18px 16px; border-radius: 22px; }.question-list li { font-size: 13px; }
  .recorder-panel { padding: 22px 14px; }
  .record-actions { flex-direction: column; }.record-button, .record-actions .secondary-button { width: min(260px, 100%); justify-content: center; }
  .upload-panel { grid-template-columns: 36px 1fr; }.upload-icon { width: 34px; height: 34px; }.retry-button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 360px) {
  .view-shell { width: calc(100% - 18px); }.topbar { width: calc(100% - 18px); }
  .map-card { min-height: 136px; padding: 12px; }.map-card h3 { font-size: 17px; }
  .record-hero h1 { font-size: 30px; }.question-sheet { padding: 16px 13px; }
}

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