/* 나때는 말야
   The look comes from Korean paper forms: a birth registration form to pick a year, a newspaper
   breaking-news strip, a ruled event card, and a death certificate with a red stamp at the end.
   Paper stays paper in both themes; the counter around it follows the theme. */
:root {
  --bg: #e9e1cf; --muted: #5d5a52; --line: rgba(27, 27, 27, 0.18);
  --ink: #1b1b1b; --paper: #fbfaf4; --red: #c0271d; --yellow: #ffd84d; --green: #2f7d4a; --amber: #d99a00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1d1c19; --muted: #a8a294; }
}
:root[data-theme="dark"] { --bg: #1d1c19; --muted: #a8a294; }

.k-btn.is-red { background: var(--red); color: #fff; }
.actions { display: grid; gap: 10px; margin-top: 18px; }

/* ---------- intro ---------- */
.intro-title { margin-top: 14px; }
.intro-title span { display: block; margin-top: 6px; font-size: clamp(20px, 6vw, 26px); color: var(--muted); }
.form { margin-top: 18px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); }
.form-head { display: flex; justify-content: space-between; padding: 6px 10px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; }
.gens { display: grid; grid-template-columns: 1fr 1fr; }
.gen {
  display: grid; gap: 2px; text-align: left; padding: 10px 10px 9px; cursor: pointer;
  background: transparent; color: var(--ink); border: 0; border-right: 1px solid #a49e90; border-bottom: 1px solid #a49e90;
  font-size: 13px; line-height: 1.35;
}
.gen:nth-child(2n) { border-right: 0; }
.gen:nth-last-child(-n+2) { border-bottom: 0; }
.gen b { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.1; }
.gen small { color: #5d5a52; font-size: 12px; }
.gen.is-on { background: var(--yellow); }
.gen.is-on b::after { content: " ✓"; color: var(--red); font-family: var(--body); font-size: 16px; }
.gen:focus-visible { outline: 3px solid var(--red); outline-offset: -3px; }
.quote { margin: 22px 0 0; padding: 2px 0 2px 12px; border-left: 4px solid var(--red); font-size: 15px; }
.quote span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.quote span::before { content: "— "; }

/* ---------- play ---------- */
.play-top { display: flex; justify-content: space-between; margin-top: 4px; padding: 9px 12px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; }
:root[data-theme="dark"] .play-top { box-shadow: inset 0 0 0 1px #3a3833; }
.news { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--yellow); color: var(--ink); font-size: 13.5px; font-weight: 600; line-height: 1.35; border-bottom: 2px solid var(--ink); }
.news i { flex: none; font-style: normal; background: var(--red); color: #fff; padding: 1px 6px; font-size: 12px; }
.news.is-future { background: #d7e4f0; }
.news.is-future i { background: #2b5c8a; }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.m { background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); padding: 4px 7px 6px; font-size: 12px; font-weight: 600; }
.m i { display: block; height: 8px; margin-top: 3px; background: var(--green); transition: width 0.5s ease-out; }
.m[data-meter="m"] i { background: #2b5c8a; }
.m[data-meter="s"] i { background: var(--amber); }
.m.is-low { border-color: var(--red); color: var(--red); }
.m.is-low i { background: var(--red); }
.age { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
.age b { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1; color: var(--fg); }
.event { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); padding: 12px 14px; }
.event h2 { margin: 0 0 4px; color: var(--red); font-size: 16px; }
.event p { margin: 0; font-size: 16px; line-height: 1.6; }
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice {
  display: flex; gap: 8px; align-items: flex-start; width: 100%; min-height: 52px; padding: 12px 14px; cursor: pointer; text-align: left;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); font-size: 15.5px; font-weight: 600; line-height: 1.4;
  transition: transform 0.06s;
}
.choice:active { transform: translateY(2px); }
.choice:hover { background: #fff6cf; }
.choice:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.choice b { flex: none; font-weight: 600; }
.after { margin-top: 12px; }
.after-pick { margin: 0; color: var(--muted); font-size: 13px; }
.after-pick::before { content: "고른 길: "; }
.after-roast { margin: 6px 0 0; padding: 12px 14px; background: var(--ink); color: var(--yellow); font-size: 15.5px; font-weight: 600; line-height: 1.55; }
:root[data-theme="dark"] .after-roast, :root:not([data-theme="light"]) .after-roast { box-shadow: inset 0 0 0 1px #3a3833; }
.after-delta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.d { padding: 3px 8px; font-size: 13px; font-weight: 600; border: 1.5px solid currentColor; background: var(--paper); }
.d.up { color: var(--green); }
.d.down { color: var(--red); }
#a-next.is-dead { background: var(--red); color: #fff; }

/* ---------- death ---------- */
.dead { display: grid; place-items: center; text-align: center; min-height: 60dvh; gap: 6px; }
.dead-line { margin: 0; font-weight: 600; font-size: 17px; }
.dead-stamp {
  margin: 10px 0; padding: 6px 22px; border: 8px solid var(--red); color: var(--red); background: var(--paper);
  font-family: var(--display); font-size: clamp(56px, 18vw, 84px); line-height: 1.1; transform: rotate(-9deg);
  animation: stamp 0.45s cubic-bezier(.2, 1.6, .4, 1) both 0.2s;
}
@keyframes stamp { from { transform: rotate(-9deg) scale(2.2); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
.dead-will { margin: 6px 0 2px; font-size: 16px; font-weight: 600; }
.dead-will::before { content: "유언: “"; color: var(--muted); }
.dead-will::after { content: "”"; color: var(--muted); }
.dead-sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- result ---------- */
.friend-bar { margin: 6px 0 10px; padding: 10px 12px; background: var(--yellow); color: var(--ink); font-weight: 600; font-size: 14px; }
.friend-bar p { margin: 0; }
.cert { margin-top: 6px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14); }
.dex, .life-log { margin-top: 30px; }
.dex h2, .life-log h2 { font-size: 16px; margin: 0 0 8px; }
.dex table { width: 100%; border-collapse: collapse; background: var(--paper); color: var(--ink); font-size: 13px; }
.dex th, .dex td { border: 1px solid #a49e90; padding: 6px 4px; text-align: center; }
.dex th { background: #efe8d6; font-weight: 600; }
.dex td { color: #9c968a; }
.dex td.on { color: var(--red); font-weight: 600; }
.dex td.lock { background: #ddd8cc; color: #8a857a; }
.dex p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.life-log ol { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.life-log li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.life-log li b { flex: none; width: 44px; color: var(--muted); }
.life-log li.end { color: var(--red); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .dead-stamp { animation: none; }
  .m i { transition: none; }
}

/* v3: good years, the obituary, and the same choice in every era */
.news.is-good { background: #d8ecd0; }
.news.is-good i { background: #2f7a3a; }
.life-log li.good span::after { content: " 🎉"; }
.obit, .eras { margin-top: 26px; }
.obit h2, .eras h2 { font-size: 16px; margin: 0 0 8px; }
#obit-body { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-top-width: 6px; padding: 12px 14px; font-size: 14.5px; line-height: 1.55; }
#obit-body p { margin: 0 0 8px; }
#obit-body p:last-child { margin: 0; }
#obit-body p:first-child { font-weight: 600; }
#obit-body b { display: block; font-size: 12px; color: #6d685d; font-weight: 600; }
.eras-sub { margin: -4px 0 8px; color: var(--muted); font-size: 13px; }
.eras table { width: 100%; border-collapse: collapse; background: var(--paper); color: var(--ink); font-size: 13.5px; line-height: 1.45; margin-bottom: 12px; }
.eras caption { text-align: left; font-weight: 600; padding: 0 0 6px; color: var(--fg, inherit); }
.eras th, .eras td { border: 1px solid #a49e90; padding: 7px 8px; text-align: left; vertical-align: top; }
.eras th { width: 58px; background: #efe8d6; font-weight: 600; white-space: nowrap; }
.eras tr.is-me th, .eras tr.is-me td { background: #fff3c4; font-weight: 600; }

.nudge { margin: 6px 0 0; text-align: center; font-weight: 600; color: var(--red); }
.choice.is-locked { opacity: 0.45; cursor: not-allowed; }
