:root {
  --bg: #f7f6f2;
  --ink: #111110;
  --mute: #6b6a66;
  --line: #e2e0d9;
  --card: #ffffff;
  --accent: #d23f24;
  --accent-soft: #fbe9e4;
  --good: #1f7a55;
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; }

.top { display: flex; align-items: center; gap: 12px; padding: 20px clamp(20px, 4vw, 56px); }
.brand { background: none; border: 0; padding: 0; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; cursor: pointer; }
.proto { font-size: 12px; color: var(--mute); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 56px) 48px; }
.foot { color: var(--mute); font-size: 12px; line-height: 1.6; text-align: center; padding: 24px clamp(20px, 4vw, 56px) 32px; max-width: 760px; margin: 0 auto; }

/* ---------- intro */
.intro { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: center; min-height: 70vh; }
.intro h1 .nw { white-space: nowrap; }
.intro h1 { font-size: clamp(48px, 7.2vw, 124px); line-height: 0.92; letter-spacing: -0.06em; margin: 0 0 28px; font-weight: 900; }
.intro h1 em { font-style: normal; color: var(--accent); }
.intro p.lede { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.6; color: #2b2a27; margin: 0 0 36px; max-width: 30em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn { appearance: none; border: 0; border-radius: 999px; padding: 16px 28px; font-size: 17px; font-weight: 700; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2c2b29; }
.btn.ghost { background: transparent; border: 1.5px solid var(--ink); }
.btn.small { padding: 10px 18px; font-size: 15px; }
.pickyear { display: flex; gap: 8px; align-items: center; margin-top: 22px; color: var(--mute); font-size: 15px; flex-wrap: wrap; }
.pickyear input { width: 110px; font: inherit; font-size: 17px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.pickyear input:focus { outline: 2px solid var(--ink); border-color: transparent; }
.resume { margin-top: 18px; font-size: 15px; }
.resume button { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--ink); }

.eras { display: flex; flex-direction: column; gap: 4px; }
.eras .row { display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); }
.eras .yr { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--mute); font-size: 14px; }
.eras .nm { font-weight: 700; font-size: 16px; }
.eras .nm small { display: block; font-weight: 400; color: var(--mute); font-size: 13px; margin-top: 3px; line-height: 1.45; }

.gift { background: var(--card); border-radius: 24px; padding: 28px; margin-bottom: 28px; box-shadow: 0 1px 0 var(--line); border: 1px solid var(--line); }
.gift b { color: var(--accent); }

/* ---------- roll */
.roll { min-height: 72vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.bigyear { font-size: clamp(120px, 24vw, 320px); font-weight: 900; letter-spacing: -0.07em; line-height: 0.85; font-variant-numeric: tabular-nums; }
.roll .era { font-size: clamp(20px, 2.4vw, 30px); font-weight: 700; margin-top: 18px; min-height: 1.4em; }
.roll .era span { color: var(--accent); }

/* ---------- play */
.play { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.side { position: sticky; top: 20px; }
.side .now { font-size: 96px; font-weight: 900; letter-spacing: -0.06em; line-height: 0.9; font-variant-numeric: tabular-nums; }
.side .age { font-size: 22px; font-weight: 800; margin-top: 6px; }
.side .who { color: var(--mute); margin-top: 6px; font-size: 15px; line-height: 1.5; }
.stats { margin: 26px 0 22px; display: grid; gap: 11px; }
.stat { display: grid; grid-template-columns: 38px 1fr 30px; gap: 10px; align-items: center; font-size: 14px; }
.stat .bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .5s ease; }
.stat.low .bar i { background: var(--accent); }
.stat .v { font-variant-numeric: tabular-nums; color: var(--mute); text-align: right; }
.facts { font-size: 14px; line-height: 1.7; color: #33322f; border-top: 1px solid var(--line); padding-top: 14px; }
.facts b { font-weight: 700; color: var(--ink); }

.track { margin-top: 22px; }
.track .rail { position: relative; height: 26px; }
.track .rail::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 2px; background: var(--line); }
.track .span { position: absolute; top: 9px; height: 8px; background: var(--ink); border-radius: 99px; }
.track .dot { position: absolute; top: 6px; width: 14px; height: 14px; margin-left: -7px; background: var(--accent); border-radius: 50%; border: 2px solid var(--bg); }
.track .labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); font-variant-numeric: tabular-nums; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: clamp(24px, 3.4vw, 44px); }
.card .meta { font-size: 14px; font-weight: 700; color: var(--mute); font-variant-numeric: tabular-nums; display: flex; gap: 10px; align-items: center; }
.card .meta .tag { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.card h2 { font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -0.04em; margin: 10px 0 14px; line-height: 1.12; }
.card .body { font-size: 18px; line-height: 1.7; color: #2b2a27; margin: 0 0 26px; }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; text-align: left; background: var(--bg); border: 1.5px solid transparent; border-radius: 16px; padding: 15px 18px; cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.opt:hover, .opt:focus-visible { border-color: var(--ink); background: #fff; outline: none; }
.opt .k { width: 26px; height: 26px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 700; display: grid; place-items: center; color: var(--mute); }
.opt .l { font-size: 17px; font-weight: 700; line-height: 1.4; }
.opt .h { display: block; font-size: 13px; color: var(--mute); font-weight: 400; margin-top: 3px; }
.optlist-many .opt { padding: 12px 16px; }

.outcome .chosen { font-size: 15px; color: var(--mute); margin: 0 0 10px; }
.outcome .result { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.5; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 28px; }
.outcome.dead .result { color: var(--accent); }

.between { margin: 0 0 16px; padding: 14px 18px; border-radius: 16px; background: #efede6; font-size: 15px; line-height: 1.6; color: #33322f; }
.between b { font-variant-numeric: tabular-nums; }

.log { margin-top: 36px; }
.log h3 { font-size: 14px; color: var(--mute); margin: 0 0 8px; font-weight: 700; }
.log ol { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 82px 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; }
.log li .t { color: var(--mute); font-variant-numeric: tabular-nums; }
.log li b { font-weight: 700; }

/* ---------- ending */
.ending { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); align-items: start; padding-top: 12px; }
.ending .years { font-size: clamp(56px, 8vw, 112px); font-weight: 900; letter-spacing: -0.06em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.ending .years span { color: var(--mute); font-weight: 300; }
.ending h2 { font-size: clamp(26px, 3vw, 40px); letter-spacing: -0.04em; line-height: 1.2; margin: 18px 0 10px; }
.ending .sub { color: var(--mute); font-size: 17px; line-height: 1.6; margin-bottom: 28px; }
.rows { border-top: 1px solid var(--line); }
.rows .r { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; line-height: 1.55; }
.rows .r .k { color: var(--mute); font-size: 14px; }
.picks { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.picks li { counter-increment: p; padding: 16px 0 16px 44px; position: relative; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 700; line-height: 1.45; }
.picks li::before { content: counter(p); position: absolute; left: 0; top: 15px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; display: grid; place-items: center; }
.picks li small { display: block; font-weight: 400; color: var(--mute); font-size: 14px; }
.vs { margin-top: 22px; padding: 22px; border-radius: 20px; background: var(--accent-soft); }
.vs h3 { margin: 0 0 8px; font-size: 17px; }
.vs p { margin: 0; line-height: 1.6; }
.share { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 15px; opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.toast.on { opacity: 1; }

@media (max-width: 900px) {
  .intro, .ending { grid-template-columns: 1fr; min-height: 0; }
  .intro { padding-top: 24px; }
  .play { grid-template-columns: 1fr; gap: 18px; }
  .side { position: static; display: grid; grid-template-columns: auto 1fr; gap: 4px 20px; align-items: end; }
  .side .now { font-size: 64px; grid-row: span 2; }
  .side .age { margin: 0; }
  .side .who { margin: 0; }
  .stats { grid-column: 1 / -1; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0 0; }
  .stat { grid-template-columns: 1fr; gap: 4px; font-size: 12px; }
  .stat .v { display: none; }
  .facts, .track { grid-column: 1 / -1; }
  .facts { font-size: 13px; }
}
.sheet { position: fixed; inset: 0; background: rgba(17,17,16,.72); display: grid; place-items: center; padding: 20px; z-index: 50; }
.sheet-in { background: var(--bg); border-radius: 24px; padding: 20px; max-width: 420px; width: 100%; text-align: center; }
.sheet-in img { width: 100%; border-radius: 12px; margin: 10px 0 16px; display: block; }
.sheet-in p { margin: 4px 0; font-size: 15px; }

/* ---------- birth card */
.birth { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; max-width: 760px; }
.birth .meta { font-size: 15px; font-weight: 700; color: var(--accent); }
.birth .bigyear { font-size: clamp(110px, 18vw, 220px); margin-top: 14px; }
.birth h2 { font-size: clamp(24px, 3vw, 36px); letter-spacing: -0.03em; margin: 18px 0 10px; }
.birth .body { font-size: 18px; line-height: 1.75; color: #2b2a27; margin: 0 0 28px; }
.birth .btn { align-self: flex-start; }
.hint { color: var(--mute); font-size: 14px; margin: 14px 0 0; }

/* ---------- time controls */
.ctrl { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0 14px; margin-bottom: 18px; background: linear-gradient(var(--bg) 82%, rgba(247,246,242,0)); }
.cbtn { appearance: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 15px; font-size: 14px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.cbtn:hover { border-color: var(--ink); }
.cbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#playBtn { min-width: 92px; }
.speeds { display: inline-flex; gap: 4px; }
.auto { font-size: 14px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; margin-left: 4px; cursor: pointer; }
.yprog { height: 3px; background: var(--line); border-radius: 99px; margin: 10px 0 0; overflow: hidden; max-width: 260px; }
.yprog i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- focus, job, map */
.focus { margin-top: 18px; }
.flabel { font-size: 13px; font-weight: 700; color: #33322f; margin-bottom: 8px; }
.flabel small { font-weight: 400; color: var(--mute); margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { appearance: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip:disabled { opacity: .45; cursor: default; }
#jobBtn { margin-top: 14px; }
#jobBtn:disabled { opacity: .4; cursor: default; }
.mapwrap { margin-top: 20px; }
.map { display: grid; grid-template-columns: repeat(10, 14px); gap: 3px; }
.map i { width: 14px; height: 14px; border-radius: 3px; background: var(--ink); display: block; }

/* ---------- feed */
.feedwrap { min-width: 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.fi { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.6; }
.fi .t { color: var(--mute); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.fi.ambient .x { color: #4a4945; }
.fi.hist .x b { color: var(--accent); }
.fi.dec { background: #fff; border-radius: 14px; border-top-color: transparent; padding: 14px 16px; margin: 6px 0; }
.fi.new { animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- decision modal */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(17,17,16,.42); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal[hidden] { display: none; }
.dcard { width: 100%; max-width: 640px; box-shadow: 0 30px 80px rgba(0,0,0,.18); animation: rise .3s ease both; }
.card .meta .tag.soft { background: #efede6; color: #33322f; }
.count { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 18px; }
.count i { display: block; height: 100%; width: 0; background: var(--ink); }

@media (max-width: 900px) {
  .ctrl { gap: 6px; }
  .cbtn { padding: 8px 12px; font-size: 13px; }
  .side { display: block; }
  .side .now { font-size: 64px; }
  .stats { grid-template-columns: repeat(5, 1fr); }
  .fi { grid-template-columns: 74px 1fr; font-size: 15px; }
  .map { grid-template-columns: repeat(20, 12px); }
  .map i { width: 12px; height: 12px; }
}

/* side panel above, choices below on desktop; on phones the record comes right after the numbers */
.play { grid-template-areas: "side feed" "side2 feed"; grid-template-rows: auto 1fr; }
.play > .side { grid-area: side; position: static; }
.play > .side2 { grid-area: side2; align-self: start; position: sticky; top: 76px; }
.play > .feedwrap { grid-area: feed; }
.side2 .focus { margin-top: 0; }
@media (max-width: 900px) {
  .play { grid-template-areas: "side" "feed" "side2"; grid-template-rows: auto; }
  .play > .side2 { position: static; }
  .feedwrap .feed { max-height: 46vh; overflow-y: auto; }
}

.rows .portrait { display: block; line-height: 1.7; }
.rows .nums { display: block; margin-top: 6px; font-size: 14px; color: var(--mute); font-variant-numeric: tabular-nums; }

.title-chip { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; font-size: clamp(22px, 2.6vw, 32px); font-weight: 900; letter-spacing: -0.03em; color: var(--accent); }
.title-chip span { font-size: 13px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 4px 10px; letter-spacing: 0; }
.eras .only { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); margin-left: 6px; }

.card .meta .tag.future { background: #e7ecff; color: #2f47c9; }
.fi.fut .t { color: #2f47c9; }
.fi.fut.hist .x b { color: #2f47c9; }
.futnote { color: #2f47c9; font-size: 14px; font-weight: 700; }
