:root {
  --paper: #f4f1ea;
  --surface: #faf7f1;
  --surface-strong: #fffdf8;
  --ink: #1d1916;
  --body: #4f453b;
  --muted: #8c7e6b;
  --soft: #a69785;
  --line: rgba(196, 184, 160, .72);
  --line-soft: rgba(217, 207, 191, .76);
  --accent: #a74538;
  --accent-dark: #8e3e33;
  --gold: #a88752;
  --shadow: 0 16px 36px rgba(58, 45, 31, .08);
  --shadow-lg: 0 18px 44px rgba(58, 45, 31, .09);
  --serif-cn: "Songti SC", STSong, "STKaiti", SimSun, "Noto Serif SC", serif;
  --serif-en: Baskerville, "Palatino Linotype", "Book Antiqua", "Times New Roman", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif-cn); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid rgba(167, 69, 56, .55); outline-offset: 3px; }
#app { min-height: 100vh; }
.fig-screen { min-height: 100svh; display: grid; place-items: center; padding: 32px 18px; background: var(--paper); color: var(--ink); }
.fig-card { width: min(430px, 100%); min-height: min(780px, calc(100svh - 64px)); display: grid; align-content: center; justify-items: center; padding: 34px 26px; background: rgba(250, 247, 241, .98); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); text-align: center; }
.fig-archive, .fig-subtitle, .eyebrow { color: #776958; font-family: var(--serif-en); letter-spacing: .22em; text-transform: uppercase; }
.fig-archive { margin: 0 0 14px; font-size: 12px; }
.fig-subtitle { margin: 0 0 26px; font-size: 11px; font-style: italic; letter-spacing: .12em; }
.fig-title { width: 100%; margin: 0; font-family: var(--serif-en); font-size: clamp(58px, 15vw, 70px); font-weight: 500; line-height: .95; letter-spacing: .055em; white-space: nowrap; }
.fig-title-cn { margin-top: 18px; color: var(--ink); font-size: 22px; font-weight: 500; letter-spacing: .28em; }
.fig-desc { max-width: 320px; min-height: 90px; margin: 118px auto 0; color: #211b16; font-size: 15.5px; line-height: 2; }
.fig-desc-line { display: block; }
.fig-dots { margin: 22px 0 20px; color: #9a8870; letter-spacing: .44em; }
.fig-btn, .primary { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border: 0; border-radius: 4px; background: var(--ink); color: #f7f3ec; font-family: var(--sans); font-size: 15px; font-weight: 500; letter-spacing: .3em; cursor: pointer; transition: background .2s, transform .2s, box-shadow .2s, opacity .2s; }
.fig-btn { width: 100%; padding: 0 6px; }
.primary { padding: 0 22px; letter-spacing: .12em; }
.fig-btn:hover, .primary:hover { background: #2a2520; }
.fig-btn:active, .primary:active, .action-btn:active, .nav-btn:active { transform: translateY(1px); }
.fig-btn:disabled, .primary:disabled { opacity: .45; cursor: not-allowed; }
.fig-footer { width: 100%; margin-top: 24px; }
.fig-method-note { width: 100%; padding: 18px 17px 16px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255, 253, 248, .72); text-align: left; }
.fig-method-kicker { margin: 0; color: #776958; font-family: var(--serif-en); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; line-height: 1.6; }
.fig-method-title { margin: 7px 0 0; color: #211b16; font-size: 16px; font-weight: 600; line-height: 1.55; letter-spacing: .03em; }
.fig-method-lead { margin: 8px 0 0; color: #3f362e; font-family: var(--sans); font-size: 12px; line-height: 1.8; }
.fig-method-points { display: grid; gap: 7px; margin-top: 13px; color: #4d4238; font-family: var(--sans); font-size: 11.5px; line-height: 1.65; }
.fig-method-points p { display: grid; grid-template-columns: 22px 1fr; gap: 7px; margin: 0; }
.fig-method-index { color: #aa967b; font-family: var(--serif-en); font-size: 11px; letter-spacing: .08em; }
.local-history-shell { width: 100%; margin-top: 12px; border: 1px solid #aa967b; border-radius: 4px; overflow: hidden; }
.local-history-button { width: 100%; min-height: 48px; border: 0; background: transparent; color: #4c4135; font-family: var(--sans); font-size: .86rem; letter-spacing: .12em; cursor: pointer; transition: background .2s; }
.local-history-button:hover { background: rgba(255, 252, 246, .44); }
.restore-button { width: 100%; margin-top: 12px; }

.flow-screen { align-items: safe center; padding: 48px 18px 58px; }
.flow-shell { width: min(560px, 100%); }
.preference-card, .quiz-card, .state-card { width: 100%; position: relative; padding: 30px 28px 28px; overflow: hidden; background: rgba(250, 247, 241, .98); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); }
.preference-card::before { position: absolute; top: 18px; bottom: 18px; left: 12px; width: 2px; background: linear-gradient(transparent, rgba(167, 69, 56, .45), transparent); content: ""; }
.preference-topline, .quiz-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #9b8b76; font-family: var(--serif-en); font-size: 11px; font-style: italic; letter-spacing: .2em; }
.preference-topline span, .quiz-header span { white-space: nowrap; }
.preference-title-block { margin-top: 28px; text-align: left; }
.preference-kicker { margin: 0 0 8px; color: var(--accent); font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .18em; }
.preference-title { margin: 0; color: var(--ink); font-size: 25px; font-weight: 600; line-height: 1.42; }
.preference-copy { margin: 12px 0 0; color: #746755; font-size: 14px; line-height: 1.9; }
.preference-options { display: grid; gap: 12px; margin-top: 28px; }
.preference-option { width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 14px; min-height: 78px; padding: 15px 18px 15px 15px; border: 1px solid rgba(190, 177, 156, .72); border-radius: 8px; background: rgba(255, 253, 248, .78); color: var(--body); text-align: left; cursor: pointer; transition: border-color .18s, background .18s, box-shadow .18s, transform .18s; }
.preference-option:hover { border-color: rgba(167, 69, 56, .48); background: var(--surface-strong); box-shadow: 0 10px 24px rgba(72, 51, 34, .07); transform: translateY(-1px); }
.preference-mark { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid rgba(167, 69, 56, .34); border-radius: 50%; color: var(--accent); font-size: 21px; font-weight: 600; line-height: 1; background: rgba(250, 247, 241, .88); }
.preference-option-main { display: grid; gap: 5px; min-width: 0; }
.preference-option-title { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.35; }
.preference-option-desc { color: #7b6d5b; font-family: var(--sans); font-size: 12px; line-height: 1.55; }
.flow-back { display: block; margin: 16px auto 0; }

.quiz-card { padding: 30px 28px 26px; }
.quiz-header { letter-spacing: .22em; }
.quiz-count { letter-spacing: .16em; }
.quiz-bar { height: 2px; margin: 16px 0 30px; overflow: hidden; background: #ddd4c7; border-radius: 999px; }
.quiz-bar-fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width .35s; }
.quiz-text { margin: 0 0 28px; color: var(--ink); font-size: 21.5px; font-weight: 600; line-height: 1.65; }
.quiz-options { display: grid; gap: 14px; }
.quiz-option { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; column-gap: 6px; min-height: 66px; padding: 17px 18px; border: 1px solid rgba(190, 177, 156, .74); border-radius: 8px; background: rgba(255, 253, 248, .86); color: #4f453b; text-align: left; font-family: inherit; font-size: 15.5px; line-height: 1.62; cursor: pointer; transition: border-color .18s, background .18s, color .18s, box-shadow .18s; }
.quiz-option:hover:not(:disabled), .quiz-option.selected { border-color: rgba(167, 69, 56, .72); background: #fffaf2; color: var(--ink); box-shadow: 0 8px 22px rgba(167, 69, 56, .08); }
.quiz-option:disabled { cursor: default; opacity: .7; }
.option-id { color: var(--accent); font-family: var(--serif-en); font-size: 19px; line-height: 1; }
.quiz-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; margin-top: 24px; padding: 0 2px; }
.nav-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 84px; min-height: 40px; padding: 9px 15px; border: 0; border-radius: 999px; background: transparent; color: #6f6255; font-family: inherit; font-size: 13px; line-height: 1; white-space: nowrap; cursor: pointer; transition: border-color .2s, background .2s, color .2s, opacity .2s, transform .2s; }
.nav-btn:hover:not(:disabled) { color: var(--ink); background: rgba(250, 247, 241, .82); }
.nav-btn:disabled { cursor: not-allowed; opacity: .34; }
.nav-prev { justify-self: start; }
.nav-home { justify-self: center; border: 1px solid rgba(124, 111, 96, .28); background: rgba(250, 247, 241, .86); box-shadow: 0 10px 26px rgba(73, 52, 35, .1); backdrop-filter: blur(12px); }
.nav-next { justify-self: end; border: 1px solid rgba(167, 69, 56, .36); color: var(--accent); font-weight: 600; }
.quiz-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: #8c7e6b; font-family: var(--sans); font-size: 12px; letter-spacing: .06em; }
.quiz-hint-dot { color: var(--accent); }

.result-screen { min-height: 100svh; padding: 24px 18px 56px; background: var(--paper); }
.result-inner { width: min(480px, 100%); margin: 0 auto; overflow: hidden; background: #faf7f0; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.capture-area { background: #faf7f0; overflow: hidden; }
.brand-bar { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px 0; }
.brand-bar .logo { color: #5f5143; font-family: var(--serif-en); font-size: 13px; letter-spacing: .3em; }
.brand-bar .meta { color: #756754; font-family: var(--sans); font-size: 11px; letter-spacing: .08em; }
.result-hero { padding: 50px 32px 22px; text-align: center; }
.result-hero-label { margin-bottom: 10px; color: #6d604f; font-family: var(--serif-en); font-size: 14px; font-style: italic; letter-spacing: .15em; }
.result-name { margin-bottom: 10px; color: #1a1a1a; font-size: 30px; font-weight: 500; letter-spacing: .08em; }
.result-era { margin-bottom: 28px; color: #6d604f; font-family: var(--serif-en); font-size: 13px; font-style: italic; letter-spacing: .06em; line-height: 1.6; }
.epigraph { max-width: 360px; margin: 0 auto; color: #4e4034; font-size: 20px; line-height: 1.8; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.tag { display: inline-flex; align-items: center; padding: 5px 10px; border: 1px solid rgba(196, 184, 160, .82); border-radius: 999px; color: #806e57; font-family: var(--sans); font-size: 12px; letter-spacing: .05em; }
.result-section, .meter-card { margin: 14px 32px 0; padding: 20px 0 0; border-top: 1px solid rgba(217, 207, 191, .88); }
.section-label, .section-kicker { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; color: #776957; font-family: var(--serif-en); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.section-label::before, .section-kicker::before { content: "✦"; color: var(--accent); font-size: 10px; }
.persona-text { margin: 0 0 13px; color: #453a30; font-size: 15px; line-height: 1.9; text-align: left; }
.persona-text--lead { color: #392f27; font-size: 15.5px; }
.radar-wrap { margin-top: 2px; }
.radar-chart { display: block; width: 100%; height: auto; }
.radar-grid { fill: none; stroke: rgba(211, 197, 169, .72); stroke-width: .9; }
.radar-axis { stroke: rgba(211, 197, 169, .66); stroke-width: .9; }
.radar-area { fill: rgba(156, 52, 46, .17); stroke: #9c342e; stroke-width: 2.2; stroke-linejoin: round; }
.radar-reference-area { fill: none; stroke: rgba(143, 104, 54, .86); stroke-width: 1.7; stroke-dasharray: 4 4; stroke-linecap: round; stroke-linejoin: round; }
.radar-point { fill: #9c342e; }
.radar-reference-point { fill: #9a784c; opacity: .94; }
.radar-label { fill: #706a61; font-family: var(--sans); font-size: 11px; font-weight: 500; }
.radar-key { display: flex; justify-content: center; gap: 18px; margin: -2px 0 8px; color: #907957; font-family: var(--sans); font-size: 10px; }
.radar-key-item { display: inline-flex; align-items: center; gap: 6px; }
.radar-key-swatch { width: 16px; height: 2px; border-radius: 999px; background: #9c342e; }
.radar-key-swatch.reference { height: 0; border-top: 2px dashed #a88752; background: none; }
.radar-note { max-width: 260px; margin: -2px auto 8px; color: #9a8060; font-family: var(--sans); font-size: 10.5px; line-height: 1.6; text-align: center; }
.radar-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.radar-legend-item { padding: 9px 10px; border: 1px solid rgba(196, 184, 160, .75); border-radius: 8px; background: rgba(241, 237, 229, .5); }
.radar-legend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.radar-legend-name { color: #211b16; font-size: 13px; font-weight: 500; }
.radar-legend-value { color: #6a5f4c; font-family: var(--serif-en); font-size: 14px; text-align: right; }
.radar-legend-value small { display: block; color: #9a8060; font-family: var(--sans); font-size: 10px; }
.radar-legend-desc { margin-top: 4px; color: #5c5145; font-size: 11px; line-height: 1.55; }
.disclaimer { margin: 18px 32px 0; color: #9a8060; font-family: var(--sans); font-size: 11px; line-height: 1.7; text-align: center; }
.compare { margin: 14px 32px 0; padding: 20px 0 0; border-top: 1px solid rgba(217, 207, 191, .88); }
.compare-title { margin: 0 0 10px; color: #776957; font-family: var(--serif-en); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.compare-summary { margin: 0 0 18px; color: #5a4c3d; font-size: 13.5px; line-height: 1.8; }
.path-entry, .scene-entry { display: block; padding: 17px 0 19px; border-top: 1px solid rgba(217, 207, 191, .58); }
.path-entry:first-of-type, .scene-entry:first-of-type { border-top: 0; padding-top: 0; }
.entry-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.entry-index { color: var(--gold); font-family: var(--serif-en); font-size: 10.5px; letter-spacing: .08em; }
.entry-label { display: inline-flex; padding: 3px 9px; border: 1px solid rgba(196, 184, 160, .82); border-radius: 999px; background: rgba(250, 247, 240, .48); color: #8a7d6a; font-family: var(--sans); font-size: 11.5px; letter-spacing: .06em; line-height: 1.35; }
.entry-title { margin: 0; color: #1a1a1a; font-size: 16.5px; font-weight: 600; line-height: 1.55; }
.entry-copy { margin: 5px 0 0; color: #453a30; font-size: 15px; line-height: 1.9; }
.entry-signal { margin: 8px 0 0; padding-left: 9px; border-left: 2px solid rgba(155, 125, 92, .32); color: #8a7862; font-size: 12px; line-height: 1.7; }
.closing-note { margin: 14px 32px 0; padding: 13px 15px; border: 1px solid rgba(196, 184, 160, .74); border-radius: 8px; background: rgba(250, 247, 240, .72); }
.closing-note p { margin: 0; color: #5a4c3d; font-size: 13.5px; line-height: 1.85; text-align: justify; }
.bottom-area { margin: 14px 32px 0; padding: 14px 0 max(26px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(217, 207, 191, .88); }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-btn { min-width: 0; height: 46px; padding: 0 14px; border-radius: 999px; cursor: pointer; transition: transform .25s, box-shadow .25s, background .25s, color .25s; display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans); font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.action-btn:hover { transform: translateY(-1px); }
.action-btn-outline { border: 1px solid rgba(165, 143, 111, .72); background: rgba(255, 252, 246, .98); color: #473729; box-shadow: 0 1px 0 rgba(255,255,255,.88) inset, 0 2px 8px rgba(102,84,62,.04); }
.action-btn-solid { border: 1px solid rgba(24,18,14,.9); background: linear-gradient(135deg, #17130f, #2b231d); color: #f7f2e8; box-shadow: 0 14px 28px rgba(26,20,14,.18); }
.secondary-action { width: 100%; margin-top: 12px; }

.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(29, 25, 22, .38); backdrop-filter: blur(6px); }
.modal { width: min(420px, 100%); padding: 26px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 24px 70px rgba(28, 20, 14, .22); }
.modal-close { float: right; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.modal h2 { margin: 18px 0 8px; font-size: 24px; font-weight: 600; }
.modal p { color: var(--body); font-family: var(--sans); font-size: 13px; line-height: 1.8; }
.code-label { display: block; margin-top: 20px; color: var(--muted); font-family: var(--sans); font-size: 11px; letter-spacing: .12em; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.code-row input { width: 100%; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf8; color: var(--ink); text-transform: uppercase; letter-spacing: .08em; }
.form-error { min-height: 22px; margin: 8px 0 0; color: var(--accent-dark); font-family: var(--sans); font-size: 12px; }
.spinner { width: 18px; height: 18px; display: inline-block; border: 2px solid rgba(167,69,56,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border: 1px solid rgba(196,184,160,.8); border-radius: 999px; background: rgba(29,25,22,.92); color: #fffaf3; font-family: var(--sans); font-size: 13px; box-shadow: 0 12px 28px rgba(28,20,14,.2); }
@media (max-height: 760px) { .fig-desc { margin-top: 52px; } .fig-footer { margin-top: 24px; } }
@media (max-width: 560px) {
  .fig-screen { align-items: safe center; padding: 24px 16px; }
  .fig-card { min-height: calc(100svh - 48px); padding: 26px 20px 24px; }
  .fig-method-note { padding-right: 15px; padding-left: 15px; }
  .fig-method-title { font-size: 15px; }
  .fig-method-lead, .fig-method-points { font-size: 11.5px; }
  .fig-method-points p { grid-template-columns: 20px 1fr; }
  .flow-screen { padding: 24px 16px; }
  .preference-card { padding: 26px 20px 24px; }
  .preference-card::before { left: 9px; }
  .preference-topline { gap: 10px; font-size: 10.5px; letter-spacing: .16em; }
  .preference-title-block { margin-top: 24px; }
  .preference-title { font-size: 22px; }
  .preference-copy { font-size: 13.5px; }
  .preference-options { margin-top: 22px; }
  .preference-option { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; min-height: 74px; padding: 14px; }
  .preference-mark { width: 38px; height: 38px; font-size: 19px; }
  .quiz-card { padding: 26px 20px 22px; }
  .quiz-header { gap: 12px; font-size: 11px; letter-spacing: .16em; }
  .quiz-text { font-size: 19px; line-height: 1.72; }
  .quiz-option { grid-template-columns: 19px minmax(0, 1fr); min-height: 62px; padding: 15px; font-size: 14px; }
  .option-id { width: 19px; font-size: 18px; }
  .quiz-nav { gap: 8px; margin-top: 18px; }
  .nav-btn { min-width: 68px; min-height: 36px; padding: 8px 10px; font-size: 12px; }
  .result-screen { padding: 0; }
  .result-inner { border-radius: 0; border-left: 0; border-right: 0; }
  .brand-bar { padding: 18px 24px 0; }
  .result-hero { padding: 40px 24px 20px; }
  .result-name { font-size: 26px; }
  .epigraph { max-width: 100%; margin-top: 16px; font-size: 15px; line-height: 1.8; }
  .result-section, .meter-card, .compare { margin-right: 24px; margin-left: 24px; }
  .disclaimer { margin-right: 24px; margin-left: 24px; }
  .radar-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bottom-area { margin-right: 24px; margin-left: 24px; padding-bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); }
  .action-btn { height: 42px; font-size: 13.5px; letter-spacing: .06em; }
  .share-actions { grid-template-columns: 1fr; }
}
@media (max-width: 380px) { .radar-legend { grid-template-columns: 1fr; } .actions { grid-template-columns: 1fr; } .fig-title { font-size: 56px; } }
.share-modal { max-height: calc(100svh - 40px); overflow: auto; }
.share-preview { margin: 18px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.share-preview svg { display: block; width: 100%; height: auto; }
.share-actions { margin-top: 10px; }
@media (max-width: 560px) { .share-actions { grid-template-columns: 1fr; } }
body.modal-open { overflow: hidden; }
.state-card { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 14px; text-align: center; }
.state-card .spinner { width: 30px; height: 30px; border-width: 2px; }
.state-card p { margin: 2px 0 0; color: var(--ink); font-size: 18px; line-height: 1.6; }
.state-card small { color: var(--muted); font-family: var(--sans); font-size: 12px; letter-spacing: .04em; }
.preference-option.selected { border-color: rgba(167, 69, 56, .72); background: #fffaf2; box-shadow: 0 8px 22px rgba(167, 69, 56, .08); }
.preference-option:disabled { cursor: wait; }
.modal-close { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; }
@media (max-width: 560px) {
  .nav-btn { min-height: 44px; }
  .action-btn { height: 46px; }
  .overlay { align-items: end; padding: 12px; }
  .modal { max-height: calc(100svh - 24px); overflow: auto; border-radius: 8px 8px 4px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Access code purchase dialog */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.access-overlay { background: rgba(37, 35, 31, .49); backdrop-filter: blur(8px); }
.access-modal { width: min(380px, calc(100vw - 32px)); padding: 20px; border: 0; border-radius: 20px; background: #fff; box-shadow: 0 20px 70px rgba(35, 27, 30, .26); }
.access-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.access-heading h2 { margin: 0; color: #202633; font-family: var(--sans); font-size: 20px; font-weight: 800; letter-spacing: .01em; }
.access-key-icon { display: inline-grid; place-items: center; width: 25px; height: 25px; color: #ff2f75; }
.access-key-svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.access-code-input { display: block; width: 100%; height: 46px; padding: 0 13px; border: 1.5px solid #ff3d82; border-radius: 12px; background: #fff; color: #242936; font-family: var(--sans); font-size: 13px; box-shadow: 0 0 0 3px rgba(255, 61, 130, .09); }
.access-code-input::placeholder { color: #9ca4b2; }
.access-code-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255, 61, 130, .16); }
.access-modal .form-error { min-height: 17px; margin: 6px 2px 0; color: #e42b5f; font-size: 12px; line-height: 1.45; }
.purchase-panel { margin-top: 3px; padding: 14px; border: 1px solid #f3dce7; border-radius: 12px; background: #fff5fa; }
.purchase-title { display: flex; align-items: center; gap: 7px; color: #232936; font-family: var(--sans); font-size: 14px; font-weight: 800; }
.purchase-title span { color: #202633; font-size: 19px; line-height: 1; }
.purchase-panel p { margin: 7px 0 9px; color: #778091; font-family: var(--sans); font-size: 12px; line-height: 1.6; }
.purchase-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 42px; border: 0; border-radius: 10px; background: linear-gradient(100deg, #ff2e52, #ff3d75); color: #fff; font-family: var(--sans); font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 16px rgba(255, 48, 94, .18); }
.purchase-button:hover { filter: brightness(1.03); transform: translateY(-1px); }
.purchase-button:disabled { opacity: .58; cursor: not-allowed; transform: none; }
.purchase-empty { margin-bottom: 0 !important; color: #b86d85 !important; }
.access-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.access-actions button { height: 46px; border-radius: 11px; font-family: var(--sans); font-size: 14px; font-weight: 700; cursor: pointer; }
.access-cancel { border: 1px solid #dfe3e9; background: #fff; color: #667080; }
.access-submit { border: 1px solid #ff8eb3; background: #fff; color: #ff9fbe; }
.access-submit:not(:disabled) { border-color: #ff3d82; background: linear-gradient(100deg, #ff2f70, #ff72a3); color: #fff; box-shadow: 0 8px 16px rgba(255, 55, 121, .16); }
.access-submit:disabled { cursor: not-allowed; }
/* Portrait PNG preview */
.portrait-share-block { margin: 16px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(180deg, #f2eee6, #e7e1d6); }
.portrait-preview { display: block; width: min(100%, 270px); max-height: 360px; margin: 0 auto; object-fit: contain; border: 1px solid #d4c8b7; border-radius: 6px; background: #faf7f0; box-shadow: 0 12px 28px rgba(55, 43, 31, .12); }
.portrait-preview-loading { min-height: 120px; display: grid; place-items: center; color: var(--muted); font-family: var(--sans); font-size: 12px; text-align: center; }
/* Share link and QR block */
.share-link-box { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; margin-top: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; }
.share-link-label { grid-column: 1 / -1; color: var(--muted); font-family: var(--sans); font-size: 11px; letter-spacing: .08em; }
.share-link-box code { min-width: 0; overflow: hidden; color: #5a4b3e; font-family: var(--sans); font-size: 11px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.share-link-box .text-button { white-space: nowrap; }
.qr-box { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center; margin-top: 10px; padding: 10px; border: 1px solid rgba(196, 184, 160, .72); border-radius: 8px; background: rgba(255, 252, 246, .82); }
.qr-box img { display: block; width: 92px; height: 92px; padding: 4px; border: 1px solid #e9e0d4; border-radius: 5px; background: #faf7f0; object-fit: contain; }
.qr-box strong { color: #3f342a; font-family: var(--sans); font-size: 13px; }
.qr-box p { margin: 5px 0 7px; color: #7a6c5b; font-size: 12px; line-height: 1.65; }
.share-safe-note { margin-bottom: 0; color: #8b7e70 !important; font-size: 11.5px !important; }
.state-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #d9cfc0; border-radius: 50%; color: #a74938; font-size: 24px; }
@media (max-width: 560px) {
  .access-modal { width: min(380px, calc(100vw - 24px)); padding: 18px; border-radius: 18px; }
  .share-link-box { grid-template-columns: 1fr; }
  .share-link-box .text-button { justify-self: start; }
  .qr-box { grid-template-columns: 84px 1fr; }
  .qr-box img { width: 84px; height: 84px; }
}

/* Result sharing: full-page long screenshot */
.share-export-footer { display: none; }
.capture-area.capture-exporting { overflow: visible; }
.capture-area.capture-exporting .bottom-area { display: none; }
.capture-area.capture-exporting .share-export-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 22px 32px 0;
  padding: 22px 0 28px;
  border-top: 1px solid rgba(217, 207, 191, .88);
  color: #4e4034;
  font-family: var(--sans);
}
.share-export-footer > div { min-width: 0; display: grid; gap: 6px; }
.share-export-brand { color: #776958; font-family: var(--serif-en); font-size: 12px; letter-spacing: .24em; }
.share-export-footer strong { color: #2d251f; font-size: 16px; }
.share-export-footer small { max-width: 300px; overflow: hidden; color: #8c7e6b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.share-export-qr { flex: 0 0 auto; width: 94px; height: 94px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: #fff; object-fit: contain; }
.result-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.action-btn-wide { grid-column: 1 / -1; }

.longshot-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: rgba(19, 16, 14, .94);
  color: #fff;
}
.longshot-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 18px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: var(--sans);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}
.longshot-stage { width: min(760px, 100%); height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.longshot-preview { min-height: 0; display: grid; place-items: center; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.longshot-loading { display: grid; justify-items: center; gap: 12px; color: rgba(255,255,255,.82); font-family: var(--sans); font-size: 13px; letter-spacing: .08em; }
.longshot-preview img { display: block; width: auto; max-width: min(78vw, 320px); max-height: calc(100svh - 164px); border-radius: 4px; background: #faf7f0; box-shadow: 0 18px 70px rgba(0,0,0,.45); cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.longshot-preview.is-zoomed { display: block; padding: 18px 0; }
.longshot-preview.is-zoomed img { width: min(92vw, 720px); max-width: none; max-height: none; margin: 0 auto; cursor: zoom-out; }
.longshot-hint { margin: 0; color: rgba(255,255,255,.96); font-family: var(--sans); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-align: center; }
.longshot-actions { display: flex; justify-content: center; gap: 8px; padding-bottom: 2px; }
.longshot-actions button { min-height: 38px; padding: 0 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); font-family: var(--sans); font-size: 12px; cursor: pointer; }
.longshot-actions button:first-child { border-color: #f1e8db; background: #f1e8db; color: #241d18; font-weight: 700; }

/* Gift-for-review dialog */
.gift-overlay { z-index: 35; background: rgba(38, 35, 31, .58); backdrop-filter: blur(10px); }
.gift-modal { width: min(360px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow: auto; padding: 24px; border: 1px solid rgba(228, 214, 192, .9); border-radius: 20px; background: #fffaf2; box-shadow: 0 24px 80px rgba(36, 29, 22, .32); color: #2b241f; font-family: var(--sans); }
.gift-heading { display: grid; grid-template-columns: 30px 1fr 34px; align-items: center; gap: 9px; padding-bottom: 14px; border-bottom: 1px solid #eadfce; }
.gift-heading h2 { margin: 0; font-size: 19px; font-weight: 700; }
.gift-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: #a74538; color: #fff; font-size: 15px; box-shadow: 0 8px 18px rgba(167,69,56,.22); }
.gift-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #f1ece4; color: #8e8174; font-size: 20px; cursor: pointer; }
.gift-steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.gift-steps li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid #eadfce; }
.gift-index { display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px; background: #f6e6df; color: #b45b4b; font-size: 12px; font-weight: 800; }
.gift-steps p { margin: 0; color: #3f3731; font-size: 13.5px; line-height: 1.9; }
.gift-steps strong { color: #e02f2f; font-weight: 800; }
.gift-service { display: grid; justify-items: center; gap: 7px; margin-top: 16px; padding: 15px 13px; border: 1px solid #e1d1ba; border-radius: 14px; background: linear-gradient(145deg, #fffaf2, #f6eee2); text-align: center; }
.gift-service strong { max-width: 270px; font-size: 14px; line-height: 1.55; }
.gift-service span, .gift-service small { color: #887a6e; font-size: 12px; line-height: 1.55; }

@media (max-width: 560px) {
  .capture-area.capture-exporting .share-export-footer { margin-right: 24px; margin-left: 24px; }
  .longshot-overlay { padding-right: 10px; padding-left: 10px; }
  .longshot-stage { gap: 8px; }
  .longshot-preview img { max-width: min(66vw, 240px); max-height: calc(100svh - 158px); }
  .longshot-actions { width: 100%; gap: 6px; }
  .longshot-actions button { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 11px; }
  .gift-modal { padding: 20px; }
}
@media (max-width: 380px) {
  .result-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-actions .action-btn-wide { grid-column: 1 / -1; }
}
