:root {
  --paper: #F6F7F5;
  --sheet: #FFFFFF;
  --ink: #1D2120;
  --mourn: #6E7471;
  --rule: #D9DCD9;
  --dead: #B3261E;
  --dead-bg: #FBECEA;
  --alive: #1F7A4D;
  --alive-bg: #E7F3EC;
  --marker: #FFE066;
  --serif: "Gowun Batang", "Nanum Myeongjo", serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.7; word-break: keep-all; overflow-wrap: anywhere; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
h1[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap { max-width: 640px; margin: 0 auto; padding: 32px 16px 48px; }
h1 { font-size: 1.75rem; line-height: 1.35; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 800; }
h2 { font-size: 1.25rem; line-height: 1.4; margin: 40px 0 10px; font-weight: 750; }
h3 { font-size: 1.08rem; margin: 28px 0 8px; font-weight: 750; }
h4 { font-size: 1rem; margin: 22px 0 6px; font-weight: 750; }
p { margin: 0 0 14px; }
.small { font-size: 0.875rem; color: var(--mourn); }
.opt { font-weight: 400; color: var(--mourn); font-size: 0.875rem; }
.book { font-size: 0.875rem; color: var(--mourn); margin-bottom: 18px; }

/* 버튼 */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border-radius: 6px; font: 700 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer; border: 2px solid var(--ink); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--sheet); }
.btn.big { min-height: 64px; font-size: 1.125rem; padding: 0 32px; }
@media (max-width: 480px) { .actions .btn { flex: 1 1 100%; } }

/* 진행 */
.progress { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--rule); }
.progress ol { list-style: none; display: flex; gap: 4px; max-width: 640px; margin: 0 auto; padding: 10px 16px; counter-reset: s; }
.progress li { flex: 1; counter-increment: s; font-size: 0.75rem; color: var(--mourn); }
.progress li::before { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--rule); margin-bottom: 4px; }
.progress li.done::before { background: var(--mourn); }
.progress li.now::before { background: var(--ink); }
.progress li.now { color: var(--ink); font-weight: 700; }
@media (max-width: 380px) { .progress li span { display: none; } .progress li.now span { display: inline; } }

/* 시작: 부고장 */
.hero { padding-top: 8px; }
.hero-title { font-family: var(--serif); font-weight: 700; font-size: clamp(2rem, 8.4vw, 3.1rem); line-height: 1.28; letter-spacing: -0.03em; margin-bottom: 28px; }
.obit { margin: 0 0 28px; }
.obit-in { background: var(--sheet); border: 6px double var(--ink); padding: 28px 24px 22px; text-align: center; transform: rotate(-1.2deg); box-shadow: 0 1px 0 var(--rule); }
.obit-head { font-family: var(--serif); font-size: 2rem; letter-spacing: 0.4em; margin: 0 0 4px; padding-left: 0.4em; }
.obit-who { font-size: 0.9rem; color: var(--mourn); margin-bottom: 18px; }
.obit-text { font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; margin: 0 0 18px; color: var(--mourn); text-decoration: line-through; text-decoration-color: var(--dead); text-decoration-thickness: 2px; }
.obit-cause { font-size: 0.9rem; margin: 0; border-top: 1px solid var(--rule); padding-top: 12px; }
.obit figcaption { font-size: 0.875rem; color: var(--mourn); margin-top: 14px; }
.hero-sub { font-size: 1.05rem; }
.resume, .count { margin-top: 10px; }
.how-list { list-style: none; padding: 0; margin: 0; counter-reset: h; }
.how-list li { counter-increment: h; display: grid; grid-template-columns: 36px 1fr; column-gap: 8px; padding: 12px 0; border-top: 1px solid var(--rule); }
.how-list li::before { content: counter(h); grid-row: span 2; font-family: var(--serif); font-size: 1.4rem; line-height: 1.2; }
.how-list b { display: block; }
.how-list span { color: var(--mourn); font-size: 0.95rem; }

/* 문서 인용 */
.doc { font-family: var(--serif); font-size: 1.08rem; line-height: 1.85; margin: 0 0 16px; padding: 16px 18px; background: var(--sheet); border-left: 4px solid var(--rule); }
.doc.dead { border-left-color: var(--dead); }
.doc.alive { border-left-color: var(--alive); }
.tag { font-size: 0.8rem; font-weight: 700; margin: 18px 0 6px; }
.dead-tag { color: var(--dead); }
.alive-tag { color: var(--alive); }
.react { font-size: 0.95rem; color: var(--mourn); margin-top: -6px; }
.pull { font-family: var(--serif); font-size: 1.3rem; line-height: 1.6; margin: 22px 0; }

/* 폼 */
.form label, .form legend { display: block; font-weight: 700; margin: 20px 0 6px; }
input, textarea, select { font: inherit; color: var(--ink); width: 100%; background: var(--sheet); border: 1.5px solid #AEB3B0; border-radius: 6px; padding: 12px 14px; }
textarea { font-family: var(--serif); line-height: 1.8; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: 3px solid var(--marker); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--dead); }
.hint { font-size: 0.85rem; color: var(--mourn); margin: 6px 0 0; }
fieldset { border: 0; padding: 0; margin: 0; }
.cases-pick { margin-top: 8px; }
.chip { display: block; margin: 8px 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; }
.chip span { display: block; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 6px; background: var(--sheet); font-weight: 400; font-size: 0.95rem; }
.chip span b { display: block; }
.chip input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

/* 5초 무대 */
.stage { position: relative; min-height: 300px; margin: 20px 0; background: var(--sheet); border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.stage-text { padding: 36px 24px; font-family: var(--serif); line-height: 1.7; filter: blur(14px); opacity: 0.25; user-select: none; transition: filter .25s, opacity .25s; }
.stage-text.xl { font-size: 1.7rem; }
.stage-text.lg { font-size: 1.35rem; }
.stage-text.md { font-size: 1.08rem; }
.stage[data-state="show"] .stage-text { filter: none; opacity: 1; }
.stage[data-state="hidden"] .stage-text { filter: blur(18px); opacity: 0.18; transition-duration: .6s; }
.stage-cover { position: absolute; inset: 0; display: grid; place-items: center; }
.stage:not([data-state="ready"]) .stage-cover { display: none; }
.timer { position: absolute; top: 10px; right: 12px; font: 800 1.1rem/1 var(--sans); width: 48px; height: 48px; display: grid; place-items: center; }
.stage[data-state="count"] .timer { inset: 0; width: auto; height: auto; font-size: 5rem; font-family: var(--serif); }
.stage[data-state="hidden"] .timer { inset: 0; width: auto; height: auto; font-size: 2rem; color: var(--mourn); }
.ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--ink) var(--p, 100%), var(--rule) 0); -webkit-mask: radial-gradient(circle, transparent 17px, #000 18px); mask: radial-gradient(circle, transparent 17px, #000 18px); animation: drain var(--d) linear forwards; }
.sec { position: relative; }
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@keyframes drain { to { --p: 0%; } }
.qs { margin-top: 8px; }
.yn { margin: 14px 0; padding: 14px 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; }
.yn legend { font-weight: 700; padding: 0; float: left; width: 100%; margin-bottom: 8px; }
.yn label { display: inline-flex; align-items: center; gap: 6px; margin-right: 20px; font-weight: 400; min-height: 40px; cursor: pointer; }
.yn input { width: 20px; height: 20px; accent-color: var(--ink); }

/* 주어 세기 */
.tally { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.t { padding: 14px 16px; border-radius: 6px; }
.t b { display: block; font-family: var(--serif); font-size: 2.6rem; line-height: 1.1; }
.t span { font-size: 0.85rem; }
.t.company { background: var(--dead-bg); color: var(--dead); }
.t.customer { background: var(--alive-bg); color: var(--alive); }
.sents { list-style: none; padding: 0; margin: 0; }
.sents li { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--rule); }
.sents .s { font-family: var(--serif); line-height: 1.75; }
.sents .kind { flex: none; font: 700 0.78rem/1 var(--sans); padding: 8px 10px; border-radius: 99px; border: 1.5px solid currentColor; background: transparent; cursor: pointer; min-height: 36px; }
.k-company .s { background: linear-gradient(transparent 62%, var(--dead-bg) 62%); }
.k-company .kind { color: var(--dead); }
.k-customer .s { background: linear-gradient(transparent 62%, var(--alive-bg) 62%); }
.k-customer .kind { color: var(--alive); }
.k-neutral-customer .kind { color: var(--alive); border-style: dashed; }
.k-neutral .kind { color: var(--mourn); }
.warn { margin-top: 18px; font-size: 0.95rem; }
mark { background: var(--marker); padding: 0 3px; }

/* 감정 */
.emos legend { font-weight: 700; margin: 20px 0 10px; }
.emo-row { display: flex; gap: 8px; margin-bottom: 8px; }
.emo { flex: 1; cursor: pointer; }
.emo input { position: absolute; opacity: 0; width: 1px; }
.emo span { display: block; text-align: center; padding: 14px 6px; border: 1.5px solid var(--rule); border-radius: 6px; background: var(--sheet); font-weight: 700; }
.emo.alive input:checked + span { background: var(--alive); border-color: var(--alive); color: #fff; }
.emo.dead input:checked + span { background: var(--dead); border-color: var(--dead); color: #fff; }
.emo input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.friend-invite { margin-top: 32px; padding: 18px; border: 1.5px dashed var(--mourn); border-radius: 6px; }
.friend-invite h2 { margin-top: 0; font-size: 1.1rem; }
.copy { margin-top: 6px; font-size: 0.8rem; }

/* 결과 */
.verdict { font-family: var(--serif); font-size: 1.1rem; line-height: 1.8; padding: 16px 18px; border-radius: 6px; }
.verdict.dead { background: var(--dead-bg); }
.verdict.alive { background: var(--alive-bg); }
.yn-sum { list-style: none; padding: 0; margin: 16px 0; }
.yn-sum li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
.yn-sum .y b { color: var(--alive); }
.yn-sum .n b { color: var(--dead); }
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: var(--sheet); }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
thead th { font-size: 0.82rem; color: var(--mourn); font-weight: 700; }
tbody th { white-space: nowrap; }
.compare td:nth-child(2) { color: var(--dead); }
.compare td:nth-child(3) { color: var(--alive); }
.axes .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.axes .ok .dot { background: var(--alive); }
.axes .bad .dot { background: var(--dead); }
.axes td:nth-child(3) { color: var(--mourn); }
.friends input, .friends select { padding: 8px 10px; font-size: 0.9rem; min-width: 90px; }
.friends td { padding: 6px; }
.mistakes { list-style: none; padding: 0; }
.mistakes li { padding: 12px 0; border-top: 1px solid var(--rule); }
.mistakes b { display: block; color: var(--dead); }

/* 바꾸기 */
details.ex { margin: 12px 0 8px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 4px 16px; }
details.ex summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.live { min-height: 1.6em; font-size: 0.92rem; margin-top: 8px; }
.live.dead { color: var(--dead); }
.live.alive { color: var(--alive); }

/* 완료 */
.clinic { margin-top: 36px; padding: 22px 20px; background: var(--sheet); border: 2px solid var(--ink); border-radius: 6px; }
.clinic h2 { margin-top: 0; }
.clinic-steps { padding-left: 1.3em; }
.cta-block { margin-top: 18px; }
.cta-block .btn { width: 100%; }
.cta-block .small { margin-top: 10px; }
.next-book ul { padding-left: 1.2em; }

/* 1장 읽기 */
.chapter { font-size: 1.04rem; }
.chapter p, .chapter li { font-family: var(--serif); line-height: 1.9; }
.chapter .small, .chapter .small a { font-family: var(--sans); }
.kicker { font-family: var(--sans) !important; color: var(--mourn); font-size: 0.9rem; margin-top: 12px; }
.ch-title { font-family: var(--serif); font-size: 2rem; margin-bottom: 6px; }
.ch-lead { font-size: 1.15rem; color: var(--mourn); margin-bottom: 26px; }
.box { margin: 26px 0; padding: 18px 20px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 6px; }
.box h3, .box h2 { margin-top: 0; }
.box p, .box li { font-family: var(--sans) !important; line-height: 1.7 !important; }
.summary { border-color: var(--rule); }
.example { margin: 26px 0; }
.cases { padding-left: 1.2em; }
.next { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule); }
pre.reply { white-space: pre-wrap; font: 0.95rem/1.7 var(--sans); background: var(--paper); padding: 12px; border-radius: 6px; }
.friend-own { margin-top: 28px; }

.foot { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; border-top: 1px solid var(--rule); font-size: 0.8rem; color: var(--mourn); }
.foot p { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .obit-in { transform: none; }
}
@media (min-width: 900px) {
  .wrap { padding-top: 56px; }
  h1 { font-size: 2rem; }
}

/* ---------- 워크시트 ---------- */
.ws-head h1 { font-family: var(--serif); font-size: 2rem; margin-bottom: 4px; }
.ws-sub { font-size: 1.05rem; margin-bottom: 14px; }
.ws-prep { font-size: 0.92rem; padding: 12px 14px; background: var(--sheet); border-left: 4px solid var(--marker); }
.ws-sec { margin: 28px 0; padding: 22px 18px 18px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 6px; }
.ws-sec h2 { margin: 0 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ws-sec h2 small { font-size: 0.8rem; font-weight: 500; color: var(--mourn); }
.ws-sec .n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; font: 700 1rem/1 var(--serif); flex: none; }
.ws-steps { padding-left: 1.3em; margin: 0 0 12px; }
.ws-timer { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.ws-timer output { font: 800 1.6rem/1 var(--serif); }
.ws-timer output:not(:empty) { min-width: 2ch; }
.ws-yn { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--rule); }
.ws-yn legend { float: left; font-weight: 600; padding: 0; max-width: 100%; }
.ws-yn-opts { display: inline-flex; gap: 18px; margin-left: auto; }
.ws-yn label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; }
.ws-yn input { width: 20px; height: 20px; accent-color: var(--ink); }
.ws-label { display: block; font-weight: 700; margin: 18px 0 6px; }
.ws-count td input { width: 88px; text-align: right; padding: 8px 10px; }
.ws-count .company th { color: var(--dead); }
.ws-count .customer th { color: var(--alive); }
.ws-auto { margin-top: 12px; }
.ws-auto summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.ws-auto textarea { margin: 8px 0; }
.ws-emo { display: grid; gap: 4px; }
.alive-txt { color: var(--alive) !important; }
.dead-txt { color: var(--dead) !important; }
.ws-items { padding-left: 1.2em; font-size: 0.95rem; }
.ws-ex { margin: 8px 0 4px; padding: 12px 14px; background: var(--paper); border-radius: 6px; }
.ws-ex p { margin: 4px 0; font-family: var(--serif); }
.ws-ex .small { font-family: var(--sans); }
.ws-clinic { margin-top: 18px; padding: 14px; border: 1.5px dashed var(--mourn); border-radius: 6px; }
.ws-clinic h3 { margin: 0 0 6px; font-size: 1rem; }
.ws-clinic p { margin: 0; font-size: 0.92rem; }
.ws-save { margin: 28px 0 8px; padding: 20px 18px; border: 2px solid var(--ink); border-radius: 6px; background: var(--sheet); }
.ws-save h2 { margin-top: 0; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 0.92rem; cursor: pointer; }
.consent input { width: 20px; height: 20px; flex: none; margin-top: 3px; accent-color: var(--ink); }
.gbtn { gap: 10px; }
.gbtn svg { background: #fff; border-radius: 50%; padding: 2px; width: 22px; height: 22px; }
.gbtn[disabled] { opacity: .45; cursor: not-allowed; }
.userbar { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-top: 12px; }
.userbar img { border-radius: 50%; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--mourn); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ws-src { margin-top: 20px; }

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .progress, .foot, .skip, .no-print, .ws-save, .cta-block, .ws-timer, #wshare, #shareMsg, .ws-auto, #retestLink, .userbar, .ws-prep { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .ws-sec { break-inside: avoid; border-width: 1px; padding: 12px 14px; margin: 10px 0; }
  input, textarea, select { border: 0; border-bottom: 1px solid #999; border-radius: 0; padding: 4px 0; background: transparent; }
  textarea { resize: none; }
  .emo span { border: 1px solid #999; }
  .emo.alive input:checked + span, .emo.dead input:checked + span { color: #000; background: #ddd; border-color: #000; }
  a { text-decoration: none; }
}
.ws-q { margin: 6px 0 0; }
