/* The brief's archive aesthetic: variance 4, motion 3, density 4.
   Native CSS, paper records, restrained gold; no external UI dependencies. */
:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --surface: #171a21;
  --surface-hover: #22262e;
  --ink: #eeeae2;
  --muted: #a4a6ad;
  --line: #33363e;
  --accent: #dac290;
  --accent-ink: #252016;
  --good: #9bc3a5;
  --bad: #e69b95;
  --paper: #f3ede1;
  --paper-ink: #2b2925;
  --paper-muted: #635e54;
  --paper-line: #afa594;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --rarity-legend: #dac290;
  --rarity-epic: #cbb6ea;
  --rarity-rare: #a6c7ea;
  --rarity-common: #a4a6ad;
  font-family: "Twemoji Country Flags", 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
  scrollbar-color: var(--line) var(--bg);
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
body, input, button { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent); color: var(--accent-ink); }
button, input { font: inherit; }
button, a, input { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-underline-offset: 4px; }
button, input, a { -webkit-tap-highlight-color: rgb(218 194 144 / 18%); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p, blockquote, dl { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
ul { list-style: none; margin: 0; padding: 0; }
strong { font-weight: 650; }
.site-header, #app, .site-footer { width: min(100%, 480px); margin-inline: auto; padding-inline: 16px; }
.site-header { height: 72px; display: flex; justify-content: space-between; align-items: center; padding-top: env(safe-area-inset-top, 0px); }
.wordmark { font-size: 16px; font-weight: 700; letter-spacing: -.035em; text-decoration: none; display: inline-flex; align-items: center; gap: 9px; min-height: 44px; }
.wordmark-symbol { color: var(--accent); font-size: 24px; font-weight: 400; }
.header-link { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
#app { min-height: calc(100dvh - 200px); outline: none; }
.skip-link { position: fixed; left: 16px; top: -70px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 12px 20px; }
.skip-link:focus { top: 8px; }
.button { width: 100%; display: flex; gap: 12px; justify-content: center; align-items: center; min-height: 52px; padding: 14px 16px; border-radius: 8px; border: 1px solid transparent; text-decoration: none; font-size: 15px; font-weight: 650; line-height: 1.4; transition: background-color 160ms var(--ease), transform 160ms var(--ease), border-color 160ms var(--ease); }
.button:active:not(:disabled) { transform: scale(.985); }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary > span { margin-left: auto; font-size: 20px; }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.text-button, .button-link { min-height: 44px; background: transparent; color: var(--muted); border: 0; padding: 10px 0; font-size: 13px; text-decoration: none; }
.button-link { display: block; text-align: center; }
.icon-button { border: 0; background: transparent; color: var(--muted); min-width: 44px; min-height: 44px; font-size: 26px; line-height: 1; }
.muted { color: var(--muted); }
.site-footer { padding-top: 28px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 11px; text-align: center; }
.site-footer nav { display: flex; justify-content: center; gap: 24px; margin-top: 8px; }
.site-footer a { display: flex; align-items: center; min-height: 44px; text-decoration: none; }
.boot-message, .error-screen { padding: 64px 16px; text-align: center; }
.error-screen h1 { font-size: 28px; line-height: 1.35; margin-bottom: 20px; }
.error-screen p { color: var(--muted); margin-bottom: 28px; }
.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 1000; padding: 13px 20px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: 0 8px 28px rgb(0 0 0 / 20%); max-width: min(92vw, 440px); width: max-content; font-size: 14px; }

/* Landing: the unfinished record is the promise of the game. */
.landing { padding-top: 22px; }
.landing-title h1 { font-size: clamp(38px, 10vw, 48px); line-height: 1.19; letter-spacing: -.04em; font-weight: 650; }
.question-mark { color: var(--accent); }
.landing-title > p { margin-top: 18px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.archive-art { height: 235px; position: relative; width: 100%; display: grid; place-items: center; margin-block: 24px 30px; }
.archive-leaf { width: 174px; height: 215px; position: absolute; background: var(--paper); color: var(--paper-ink); border: 1px solid var(--paper-line); }
.leaf-back { transform: translate(15px, 8px) rotate(8deg); background: #d8d0c1; }
.leaf-front { transform: rotate(-5deg); padding: 18px; text-align: center; outline: 1px solid var(--paper-line); outline-offset: -6px; box-shadow: 0 14px 28px rgb(0 0 0 / 22%); }
.art-record { display: block; font-size: 8px; letter-spacing: .19em; }
.art-rule { height: 1px; background: var(--paper-line); margin-block: 11px; }
.art-question { display: block; font: 64px/1.2 'Gowun Batang', serif; }
.art-caption { display: block; font: 10px/1.8 'Gowun Batang', serif; margin-top: 2px; }
.art-end { font-size: 9px; letter-spacing: .12em; }
.landing-actions { display: grid; gap: 10px; }
.landing-actions .primary { justify-content: space-between; padding-inline: 20px; min-height: 58px; }
.daily-button { display: flex; width: 100%; justify-content: space-between; gap: 8px; align-items: center; min-height: 56px; padding: 12px 1px; background: transparent; border: 0; color: var(--ink); font-size: 13px; text-align: left; }
.daily-button time { color: var(--accent); margin-left: 5px; font-variant-numeric: tabular-nums; }
.daily-button > span:last-child { color: var(--muted); font-size: 12px; }
.daily-button { gap: 12px; }
.daily-streak { display: block; color: var(--accent); font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.result-streak { color: var(--muted); font-size: 13px; margin: -8px 0 24px; }
.result-streak > span { color: var(--accent); font-variant-numeric: tabular-nums; }
.karma-preview { color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.next-goals { margin-top: 30px; }
.next-goals h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.next-goals > .muted { font-size: 13px; }
.dex-summary { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 18px; }
.dex-summary a { display: flex; align-items: center; min-height: 44px; text-decoration: none; overflow-wrap: anywhere; }
.chronicle-list { display: grid; gap: 12px; }
.chronicle-card { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.chronicle-person { display: flex; gap: 12px; align-items: center; }
.chronicle-person > div { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.chronicle-person strong { font-size: 14px; }
.chronicle-person p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.chronicle-flag { font-size: 24px; flex-shrink: 0; }
.chronicle-grade { font-size: 12px; color: var(--accent); flex-shrink: 0; }
.chronicle-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chronicle-meta > span:last-child { margin-left: auto; color: var(--accent); }
.chronicle-card:hover { background: var(--surface-hover); border-color: var(--accent); }
.past-life { color: var(--ink); font-size: 12px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 12px; overflow-wrap: anywhere; }
.past-life > span { color: var(--muted); display: block; }
.archive-summary { padding-block: 26px 8px; margin-top: 12px; border-top: 1px solid var(--line); }
.archive-summary p { font-size: 14px; color: var(--muted); }
.archive-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.archive-summary a { display: inline-flex; align-items: center; gap: 18px; text-decoration: none; color: var(--accent); min-height: 44px; margin-top: 8px; font-size: 13px; }

/* Birth and the closing page. */
.birth-screen { min-height: 70dvh; padding-block: 56px 32px; }
.screen-context { color: var(--muted); font-size: 13px; margin-bottom: 16px; overflow-wrap: anywhere; }
.birth-screen h1 { font: 32px/1.4 'Gowun Batang', serif; overflow-wrap: anywhere; }
.roulette { margin-block: 42px 30px; border-block: 1px solid var(--line); }
.roulette-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; }
.roulette-row + .roulette-row { border-top: 1px solid var(--line); }
.roulette-row > span { font-size: 12px; color: var(--muted); }
.roulette-row strong { font-size: 19px; font-weight: 500; }
.spoon { font-size: 14px; border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; }
.spoon-3, .spoon-4 { color: var(--accent); border-color: var(--accent); }
.birth-story { min-height: 64px; color: var(--muted); font-size: 15px; margin-bottom: 32px; }
.death-screen { min-height: 75dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; animation: close-page 650ms ease-out both; }
.death-screen > p { color: var(--muted); font-size: 13px; }
.death-mark { color: var(--accent); margin-bottom: 30px; font-size: 32px; }
.death-screen h1 { font: 36px/1.5 'Gowun Batang', serif; margin-block: 18px 24px; }
.death-name { max-width: 100%; overflow-wrap: anywhere; }
@keyframes close-page { from { opacity: .25; } to { opacity: 1; } }

/* Timeline lives in its own viewport, so manual scroll never fights the page. */
body[data-screen="life"] .site-header { height: 54px; }
body[data-screen="life"] .site-footer { display: none; }
body[data-screen="life"] #app { min-height: 0; }
.life-screen { display: flex; flex-direction: column; height: calc(100dvh - 54px - env(safe-area-inset-top, 0px)); min-height: 400px; position: relative; }
.life-dashboard { flex-shrink: 0; background: var(--bg); padding: 6px 0 14px; border-bottom: 1px solid var(--line); }
.life-identity { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.life-identity > span { min-width: 0; overflow-wrap: anywhere; }
.life-identity > span:last-child { flex-shrink: 0; }
.age-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block: 12px; font-variant-numeric: tabular-nums; }
.age-row h1 { display: flex; align-items: baseline; gap: 5px; line-height: 1; }
.age-row h1 strong { font-size: 42px; font-weight: 450; letter-spacing: -.035em; }
.age-row h1 > span { color: var(--muted); font-size: 14px; font-weight: 400; }
.age-row > div { text-align: right; }
.age-row time { font-size: 12px; color: var(--muted); }
.age-row p { font-size: 14px; margin-top: 2px; }
.debt { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { min-width: 0; }
.stat span { display: block; font-size: 10px; color: var(--muted); }
.stat meter { display: block; width: 100%; height: 5px; margin-block: 5px; background: var(--line); border: 0; border-radius: 0; }
meter::-webkit-meter-bar { background: var(--line); border: 0; height: 4px; border-radius: 0; }
meter::-webkit-meter-optimum-value { background: var(--accent); border-radius: 0; }
meter::-moz-meter-bar { background: var(--accent); }
.stat small { display: block; font-size: 10px; color: var(--ink); font-variant-numeric: tabular-nums; }
.karma-note { font-size: 10px; color: var(--muted); margin-top: 9px; }
.replay-result { min-height: 44px; margin-top: 12px; font-size: 14px; }
.life-dashboard.is-compact { padding-block: 6px 8px; }
.is-compact .life-identity, .is-compact .karma-note, .is-compact .age-row time { display: none; }
.is-compact .age-row { margin-block: 0 6px; }
.is-compact .age-row h1 strong { font-size: 22px; }
.is-compact .age-row p { margin: 0; font-size: 13px; }
.is-compact .stat > span, .is-compact .stat small { font-size: 10px; line-height: 1.3; }
.is-compact .stat { display: grid; grid-template-columns: auto 1fr; column-gap: 4px; align-items: center; }
.is-compact .stat meter { grid-column: 1 / -1; }
.is-compact .stat meter { height: 3px; margin: 0; }
.is-compact .replay-result { margin-top: 8px; }
.life-log { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; padding: 20px 5px 28px 0; font-variant-numeric: tabular-nums; }
.log-origin { color: var(--muted); font: 14px/1.6 'Gowun Batang', serif; margin-bottom: 24px; }
.log-year { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; font-weight: 450; margin-block: 24px 10px; }
.log-year::after { content: ''; flex: 1; height: 1px; background: var(--line); opacity: .6; }
.log-entry { display: flex; gap: 11px; align-items: baseline; font-size: 14px; line-height: 1.85; margin-block: 8px; }
.log-icon { width: 18px; flex-shrink: 0; font-size: 12px; text-align: center; }
.tone-good { color: var(--good); }
.tone-bad { color: var(--bad); }
.tone-epic { color: var(--accent); font-weight: 650; }
.playback-controls { flex-shrink: 0; display: grid; grid-template-columns: 1fr 1fr 1.25fr 44px; gap: 6px; padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--bg); }
.playback-controls button { background: var(--surface); color: var(--muted); border: 1px solid transparent; min-height: 44px; border-radius: 6px; font-size: 12px; }
.playback-controls button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.resume-scroll { position: absolute; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); min-height: 44px; padding: 10px 16px; white-space: nowrap; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 6px; font-size: 12px; box-shadow: 0 5px 20px rgb(0 0 0 / 20%); }

/* Native dialog supplies focus trapping and background inertness. */
.sheet { position: fixed; inset: auto 0 0; width: min(100%, 480px); max-width: 100%; max-height: 88dvh; margin: auto auto 0; padding: 12px 24px calc(28px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -16px 48px rgb(0 0 0 / 22%); }
.sheet[open] { animation: sheet-enter 220ms var(--ease); }
.sheet::backdrop { background: rgb(0 0 0 / 65%); }
.sheet-grip { width: 32px; height: 3px; border-radius: 2px; background: var(--line); margin: 0 auto 20px; }
.sheet h2 { font-size: 22px; line-height: 1.5; }
.sheet-heading { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-heading h2 { flex: 1; }
.sheet > .muted { font-size: 13px; margin-block: 10px 20px; }
.sheet label { display: block; margin-top: 26px; margin-bottom: 10px; font-size: 13px; }
.sheet input { width: 100%; min-height: 54px; background: var(--bg); color: var(--ink); caret-color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 16px; }
.sheet input::placeholder { color: var(--muted); opacity: 1; }
.field-error { color: var(--bad); min-height: 28px; font-size: 12px; padding-block: 4px; }
.choice-age { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.choice-options { display: grid; gap: 10px; margin-top: 24px; }
.choice-option { display: flex; align-items: center; gap: 14px; padding: 15px; min-height: 76px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.choice-option strong { display: block; font-size: 15px; }
.choice-option small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.choice-number { font-size: 12px; color: var(--muted); }
.choice-option.chosen { border-color: var(--accent); opacity: 1; color: var(--accent); cursor: default; }
.choice-option .choice-mark { margin-left: auto; }
@keyframes sheet-enter { from { opacity: .7; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* The record stays ivory in either UI theme: it is a paper artifact. */
.result-screen { padding-top: 20px; }
.result-intro { padding-bottom: 30px; }
.result-intro > p { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.result-intro h1 { font-size: 28px; line-height: 1.4; letter-spacing: -.025em; }
.death-record { --record-border: #8e8370; position: relative; padding: 8px; background: var(--paper); color: var(--paper-ink); border: 1px solid var(--record-border); box-shadow: 0 12px 32px rgb(0 0 0 / 20%); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7'%3E%3Ccircle cx='1' cy='1' r='.45' fill='%23635e54' opacity='.11'/%3E%3C/svg%3E"); }
.death-record.grade-S { --record-border: #a17a28; border-width: 2px; }
.death-record.grade-S::after { content: '✦'; position: absolute; top: 17px; right: 20px; color: #a17a28; font-size: 24px; opacity: .35; pointer-events: none; animation: record-sparkle 2.4s ease-in-out 2; }
@keyframes record-sparkle { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: .85; transform: scale(1.08); } }
.death-record.grade-A { --record-border: #7a8086; }
.death-record.grade-B { --record-border: #9a6745; }
.record-inner { border: 1px solid var(--record-border); padding: 28px 24px 16px; }
.record-heading { text-align: center; }
.record-english { font-size: 9px; letter-spacing: .24em; color: var(--paper-muted); }
.record-heading h2 { font: 26px/1.65 'Gowun Batang', serif; letter-spacing: .16em; margin-top: 8px; }
.record-ornament { display: block; font-size: 14px; margin-block: 6px 20px; color: var(--record-border); }
.record-label { color: var(--paper-muted); font: 13px/1.6 'Gowun Batang', serif; text-align: center; margin-bottom: 18px; overflow-wrap: anywhere; }
.record-person { text-align: center; padding-bottom: 24px; border-bottom: 1px solid var(--paper-line); }
.record-person h3 { font: 700 30px/1.4 'Gowun Batang', serif; letter-spacing: -.025em; overflow-wrap: anywhere; }
.record-local { color: var(--paper-muted); font-size: 11px; margin-top: 4px; overflow-wrap: anywhere; }
.record-origin { font-size: 12px; margin-top: 18px; }
.record-years { font-size: 12px; letter-spacing: .09em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.record-age { font: 15px/1.5 'Gowun Batang', serif; margin-top: 7px; }
.record-age strong { font-size: 24px; font-weight: 700; margin-inline: 4px 1px; }
.record-details { display: grid; gap: 10px; padding-block: 24px; border-bottom: 1px solid var(--paper-line); }
.record-details > div { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; font-size: 12px; line-height: 1.6; }
.record-details dt { color: var(--paper-muted); }
.record-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.record-details dd small { display: block; color: var(--paper-muted); font-size: 10px; }
.record-debt { color: #923e35; }
.epitaph { font: 17px/1.9 'Gowun Batang', serif; text-align: center; padding-block: 24px; text-wrap: balance; overflow-wrap: anywhere; }
.record-highlights { border-top: 1px solid var(--paper-line); padding-block: 19px 22px; }
.record-highlights h4 { font-size: 10px; font-weight: 500; color: var(--paper-muted); margin-bottom: 10px; }
.record-highlights li { font-size: 11px; line-height: 1.85; margin-top: 6px; padding-left: 9px; position: relative; overflow-wrap: anywhere; }
.record-highlights li::before { content: '·'; position: absolute; left: 0; }
.record-seal { display: flex; justify-content: space-between; gap: 8px; font-size: 9px; color: var(--paper-muted); border-top: 1px solid var(--paper-line); padding-top: 13px; }
.life-verdict { display: flex; gap: 18px; align-items: flex-start; margin-block: 30px 26px; }
.grade-badge { display: grid; place-items: center; flex-shrink: 0; width: 56px; height: 66px; border: 1px solid var(--line); font: 32px/1 'Gowun Batang', serif; color: var(--muted); }
.grade-badge.grade-S { color: var(--accent); border-color: var(--accent); }
.grade-badge.grade-A { color: #c9ced8; border-color: #a0a6b1; }
.grade-badge.grade-B { color: #d3a282; border-color: #b48363; }
.life-verdict > div:last-child { min-width: 0; }
.grade-caption { display: flex; gap: 12px; align-items: baseline; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.grade-caption strong { color: var(--ink); font-weight: 500; }
.life-verdict h2 { font-size: 18px; margin-bottom: 7px; }
.life-verdict p { font-size: 12px; color: var(--muted); line-height: 1.8; }
.life-verdict .grade-one-liner { color: var(--accent); font-size: 13px; margin-bottom: 10px; }
.happiness-panel { padding-block: 20px 16px; border-block: 1px solid var(--line); }
.curve-heading, .curve-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.happy-curve { display: block; width: 100%; height: 100px; margin-top: 14px; }
.curve-grid { stroke: var(--line); stroke-width: .5; fill: none; }
.curve-line { stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.curve-point { fill: var(--accent); }
.curve-axis { font-size: 10px; font-variant-numeric: tabular-nums; }
.achievement-section, .share-section { margin-top: 30px; }
.achievement-section h2, .share-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.achievement-section h2 > span { font-size: 12px; color: var(--muted); margin-left: 4px; }
.achievement-section > .muted { font-size: 13px; }
.achievement-list { display: grid; gap: 15px; }
.achievement-list li { --rarity-color: var(--rarity-common); display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--rarity-color); border-radius: 8px; }
.achievement-list li > div { min-width: 0; overflow-wrap: anywhere; }
.achievement-list .rarity-legend { --rarity-color: var(--rarity-legend); }
.achievement-list .rarity-epic { --rarity-color: var(--rarity-epic); }
.achievement-list .rarity-rare { --rarity-color: var(--rarity-rare); }
.rarity-label { display: block; color: var(--rarity-color); font-size: 10px; margin-bottom: 2px; }
.achievement-toggle { margin-top: 12px; font-size: 13px; min-height: 44px; }
.achievement-list li > span { font-size: 22px; width: 30px; flex-shrink: 0; text-align: center; }
.achievement-list strong { font-size: 13px; font-weight: 550; }
.achievement-list p { color: var(--muted); font-size: 11px; margin-top: 2px; }
.rarity-legend strong { color: var(--rarity-legend); }
.rarity-epic strong { color: var(--rarity-epic); }
.rarity-rare strong { color: var(--rarity-rare); }
.new-badge { display: inline-block; font-size: 10px; font-weight: 650; color: var(--accent); margin-left: 8px; letter-spacing: .03em; }
.share-section { padding-top: 24px; border-top: 1px solid var(--line); }
.share-preview { color: var(--muted); font-size: 12px; margin: -4px 0 16px; overflow-wrap: anywhere; }
.share-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share-actions .button { font-size: 13px; min-height: 48px; }
.share-primary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.share-primary .button { min-height: 48px; padding-inline: 6px; font-size: 13px; }
.result-actions.result-replay { margin-top: 10px; }
.kakao { background: #fee500; color: #211b00; }
.share-section > .text-button { width: 100%; margin-top: 6px; }
.result-actions { display: grid; gap: 10px; margin-top: 24px; }
.result-actions .primary { font-size: 14px; min-height: 58px; }
.toss-block:not(:empty), .result-ad:not(:empty) { margin-top: 32px; }
.compare-names { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-block: 24px; font-size: 12px; color: var(--muted); }
.compare-names strong { display: inline-block; font-size: 16px; color: var(--ink); padding-top: 5px; overflow-wrap: anywhere; }
.comparison { margin-bottom: 24px; }
.comparison > div { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; border-top: 1px solid var(--line); padding-block: 12px; text-align: center; }
.comparison dt { grid-column: 1 / -1; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.comparison dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }

/* Collection: flags and a readable inventory, with honest unknown states. */
.dex-screen { padding-top: 10px; }
.dex-heading h1 { font-size: 32px; letter-spacing: -.035em; margin-top: 14px; }
.dex-heading p { color: var(--muted); font-size: 13px; margin-top: 10px; }
.dex-statistics { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 20px; padding-block: 32px; }
.dex-statistics dt { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.dex-statistics dd { margin: 0; font-size: 22px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.dex-statistics dd small { margin-left: 4px; color: var(--muted); font-size: 12px; }
.stat-wide { grid-column: 1 / -1; }
.dex-tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.dex-tabs::-webkit-scrollbar { display: none; }
.dex-tabs button { flex: 1 0 auto; padding: 0 12px; white-space: nowrap; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); min-height: 48px; font-size: 13px; }
.dex-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.dex-progress { display: flex; align-items: center; justify-content: space-between; margin-block: 24px; font-size: 13px; }
.dex-progress strong { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 500; }
.dex-progress strong > span { color: var(--muted); }
.country-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 8px; }
.country-grid li { min-height: 66px; text-align: center; }
.country-grid li > span { display: block; font-size: 28px; line-height: 1.5; }
.country-grid strong { display: block; font-size: 10px; font-weight: 450; overflow-wrap: anywhere; }
.undiscovered { color: var(--muted); }
.country-grid .undiscovered > span { color: #7b7e86; font-family: 'Gowun Batang', serif; }
.dex-list { display: grid; gap: 0; }
.dex-list li { display: flex; align-items: center; gap: 16px; padding-block: 14px; min-height: 62px; content-visibility: auto; contain-intrinsic-size: auto 66px; }
.dex-item-symbol { width: 30px; text-align: center; font-size: 20px; flex-shrink: 0; }
.dex-list strong { font-size: 13px; font-weight: 500; }
.dex-list p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.dex-empty { font-size: 12px; color: var(--muted); text-align: center; margin-top: 28px; }

@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) { background: #e9d6ae; }
  .secondary:hover:not(:disabled), .choice-option:hover:not(:disabled), .playback-controls button:hover { background: var(--surface-hover); }
  .header-link:hover, .text-button:hover, .button-link:hover, .site-footer a:hover { color: var(--ink); }
  .daily-button:hover { color: var(--accent); }
}
@media (prefers-color-scheme: light) {
  :root { color-scheme: light; --bg: #f6f5f1; --surface: #eeede8; --surface-hover: #e4e2db; --ink: #252a31; --muted: #63656c; --line: #cdcac1; --accent: #776031; --accent-ink: #ffffff; --good: #356d46; --bad: #a3453c; }
  .primary { background: #776031; }
  .grade-badge.grade-A { color: #616875; border-color: #7a808a; }
  .grade-badge.grade-B { color: #855235; border-color: #9c7256; }
  .rarity-epic strong { color: #675784; }
  .rarity-rare strong { color: #3f637f; }
  :root { --rarity-legend: #776031; --rarity-epic: #675784; --rarity-rare: #3f637f; --rarity-common: #63656c; }
  .toast { box-shadow: 0 8px 28px rgb(40 35 26 / 12%); }
  @media (hover: hover) and (pointer: fine) { .primary:hover:not(:disabled) { background: #655026; } }
}
@media (min-width: 600px) {
  .site-header { height: 88px; }
  .landing { padding-top: 30px; }
  .archive-art { margin-block: 28px 36px; }
}
@media (max-width: 359px) {
  .record-inner { padding-inline: 16px; }
  .record-person h3 { font-size: 26px; }
  .stats { gap: 8px; }
  .daily-button { font-size: 12px; }
  .result-actions .primary { font-size: 12px; }
  .sheet { padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .button:active:not(:disabled) { transform: none; }
}
@media print {
  :root { color-scheme: light; }
  body { background: white; }
  .site-header, .site-footer, .result-intro, .result-streak, .next-goals, .life-verdict, .happiness-panel, .achievement-section, .share-section, .share-primary, .result-actions, .toss-block, .result-ad, .toast { display: none; }
  #app { width: 480px; padding: 0; }
  .result-screen { padding-top: 0; }
  .death-record { box-shadow: none; break-inside: avoid; print-color-adjust: exact; }
}

/* 인생 진행 중에는 '당겨서 새로고침'을 막는다: 로그를 위로 올려 보다가 새로고침되는 문제 */
html:has(body[data-screen="life"]), body[data-screen="life"] { overscroll-behavior-y: none; }
.life-log { overscroll-behavior-y: contain; }

/* 로그 안 선택 카드 (팝업 대신) */
.choice-card { margin: 18px 0 8px; padding: 18px 16px; border: 1px solid var(--accent); border-radius: 14px; background: var(--surface); }
.choice-card h2 { font-size: 18px; line-height: 1.5; margin: 4px 0 14px; }
.choice-card .muted { font-size: 12px; margin: -6px 0 12px; }
.choice-card.is-done { border-color: var(--line); opacity: .85; }
.choice-card.is-done .choice-option:not(.chosen) { opacity: .45; }

/* 한국어는 어절 단위로 줄바꿈 */
body { word-break: keep-all; overflow-wrap: anywhere; }

/* 이름으로 태어나기 시트 */
.sheet select { width: 100%; min-height: 54px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 16px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button, .local-name { min-height: 48px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 15px; }
.segmented button[aria-checked="true"], .local-name[aria-checked="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
.local-name-list { display: grid; gap: 8px; }
.local-name { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; text-align: left; }
.local-name small { color: var(--muted); font-size: 12px; font-weight: 400; }
.link-button { border: 0; background: none; color: var(--accent); font-size: 12px; margin-left: 8px; text-decoration: underline; padding: 0; }
.sheet form .button.primary { margin-top: 24px; width: 100%; }

.record-summary ul { list-style: none; padding: 0; }

/* 상단 한 줄 상태 */
.life-facts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0 2px; font-size: 12px; color: var(--ink); }
.life-facts span { white-space: nowrap; }
.life-dashboard.is-compact .life-facts { margin-top: 4px; }
details.karma-note summary { cursor: pointer; list-style: none; }
details.karma-note summary::-webkit-details-marker { display: none; }
details.karma-note p { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
