:root {
  color-scheme: light;
  --reader-size: 19px;
  --paper: #f5f6f3;
  --ink: #202522;
  --muted: #59635e;
  --line: #c7cfca;
  --accent: #285c58;
  --action: #fdfefd;
}

:root.high-contrast {
  --paper: #fff;
  --ink: #000;
  --muted: #171717;
  --line: #333;
  --accent: #084d46;
  --action: #fff;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1160px; min-height: 62px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { color: var(--accent); font-weight: 800; font-size: 19px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-button { border: 0; color: var(--ink); background: none; padding: 10px 4px; font-size: 14px; }
.header-button:hover { text-decoration: underline; text-underline-offset: 4px; }

.reader { max-width: 760px; margin: 0 auto; padding: 0 24px 96px; }
.opening-art { margin: 28px 0 36px; width: 100%; aspect-ratio: 16 / 7; overflow: hidden; }
.opening-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 58%; }
.story-content { padding-top: 40px; }
.opening-art + .system-warning + .story-content { padding-top: 0; }
.prose { font-size: var(--reader-size); line-height: 1.85; overflow-wrap: anywhere; word-break: keep-all; }
.prose p { margin: 0 0 1.25em; }
.choices { border-top: 1px solid var(--line); margin-top: 46px; padding-top: 16px; display: grid; gap: 10px; }
.choice { display: block; width: 100%; min-height: 62px; text-align: left; color: var(--ink); background: var(--action); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 3px; padding: 14px 18px; font-size: 17px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.choice:hover { border-color: var(--accent); background: #edf4f1; }
.continue-action { margin-top: 30px; border: 0; border-bottom: 2px solid var(--accent); color: var(--accent); background: transparent; padding: 12px 2px; font-weight: 700; font-size: 16px; }
.continue-action:hover { color: var(--ink); }
.slice-ending { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); line-height: 1.7; font-size: 15px; }
.system-warning { padding: 12px 0; color: #8b3034; font-size: 15px; }

.reader-dialog { border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--paper); width: min(92vw, 420px); padding: 28px; box-shadow: 0 12px 48px #0004; }
.reader-dialog::backdrop { background: #1118; }
.reader-dialog h2 { margin: 0 0 20px; font-size: 21px; }
.reader-dialog p { line-height: 1.6; }
.reader-dialog label { display: block; margin: 18px 0 8px; }
.reader-dialog input[type="range"] { display: block; width: 100%; accent-color: var(--accent); }
.reader-dialog .check-row { display: flex; align-items: center; gap: 9px; margin: 24px 0; }
.reader-dialog input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
.reader-dialog button { border: 1px solid var(--line); border-radius: 3px; background: var(--action); color: var(--ink); padding: 10px 15px; }
.reader-dialog .primary-action, .primary-action { display: inline-block; border: 1px solid var(--accent); border-radius: 3px; color: #fff; background: var(--accent); padding: 11px 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@media (max-width: 600px) {
  .header-inner { min-height: 56px; padding: 0 16px; }
  .header-actions { gap: 7px; }
  .header-button { font-size: 13px; }
  .reader { padding: 0 18px 70px; }
  .opening-art { margin: 18px 0 28px; aspect-ratio: 16 / 8; }
  .story-content { padding-top: 28px; }
  .choices { margin-top: 32px; }
  .choice { font-size: 16px; }
}
