:root {
  color-scheme: light;
  --black: #000;
  --white: #fff;
  --gray: #767676;
  --line: 3px;
  --shadow: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Apple SD Gothic Neo", "Noto Sans KR", monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--black); color: var(--white); }
button, a { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 4px solid currentColor; outline-offset: 4px; }
[hidden] { display: none !important; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 18px;
  border: var(--line) solid currentColor;
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  font-weight: 800;
  box-shadow: 5px 5px 0 currentColor;
}
.button:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 currentColor; }
.button--primary { background: var(--black); color: var(--white); }
.button--inverse { background: var(--white); color: var(--black); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; box-shadow: none; }
kbd { padding: 1px 5px; border: 1px solid currentColor; border-bottom-width: 3px; font-size: .75em; }
.eyebrow { margin: 0 0 10px; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.visually-hidden { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--black);
}
.screen--start {
  background-image: linear-gradient(90deg, transparent 49.8%, var(--black) 49.8% 50.2%, transparent 50.2%), url("special/D2_타이틀화면_분할.png");
  background-position: center;
  background-size: cover;
}
.start-card, .ending-card {
  width: min(620px, 92vw);
  padding: clamp(24px, 5vw, 54px);
  border: 5px solid var(--black);
  background: var(--white);
  color: var(--black);
  box-shadow: 14px 14px 0 var(--black);
}
.start-card h1, .ending-card h2 { margin: 0; font-size: clamp(48px, 9vw, 94px); line-height: .9; letter-spacing: -.08em; }
.start-card h1 {
  color: transparent;
  background: linear-gradient(110deg, var(--black) 0 44%, var(--white) 49% 51%, var(--black) 56% 100%);
  background-size: 260% 100%;
  background-position: 120% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: logo-light-sweep 900ms cubic-bezier(.3, .75, .25, 1) 250ms 1 both;
}
@keyframes logo-light-sweep {
  from { background-position: 120% 0; }
  to { background-position: -20% 0; }
}
.ending-card h2 { font-size: clamp(42px, 7vw, 78px); }
.start-copy, .ending-copy { margin: 28px 0; font-family: system-ui, sans-serif; font-size: 17px; line-height: 1.75; word-break: keep-all; }
.ending-card { width: min(780px, 94vw); max-height: 92vh; overflow-y: auto; }
.ending-copy { display: grid; gap: 14px; }
.ending-copy p { margin: 0; }
.ending-copy p + p { padding-top: 14px; border-top: 2px solid var(--black); }
.start-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.start-links { display: flex; gap: 18px; margin-top: 28px; padding-top: 18px; border-top: 2px solid var(--black); }
.start-links a { color: inherit; font-weight: 800; text-underline-offset: 4px; }
.native-app .start-links a[download] { display: none; }

.game-shell { min-height: 100vh; background: var(--black); }
.hud {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px clamp(14px, 3vw, 42px);
  background: var(--black);
  color: var(--white);
  border-bottom: 2px solid var(--white);
}
.hud__identity { display: grid; gap: 2px; }
.hud__identity strong { font-size: 17px; letter-spacing: -.04em; }
.hud__identity span { font-size: 11px; }
.hud__status { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 800; }
.world-badge { padding: 6px 8px; background: var(--white); color: var(--black); }
.hud__actions { display: flex; justify-content: flex-end; gap: 8px; }
.hud__actions button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--white);
  background: var(--black);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
}
.hud__actions button:hover { background: var(--white); color: var(--black); }

.play-area { position: relative; width: min(1600px, 100%); margin: 0 auto; padding-bottom: 170px; }
.scene {
  position: relative;
  width: 100%;
  height: min(67vw, calc(100vh - 225px));
  min-height: 470px;
  max-height: 900px;
  overflow: hidden;
  isolation: isolate;
  background: var(--white);
  color: var(--black);
  border-bottom: 3px solid currentColor;
}
.scene--black { background: var(--black); color: var(--white); }
.scene--gray { background: var(--white); color: var(--black); }
.scene > img {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: auto;
}
.scene--dialogue-image > img {
  bottom: auto;
  height: 72%;
  object-fit: contain;
  background: var(--white);
}
.scene--dialogue-image .scene__vignette,
.scene--dialogue-image .scene__caption { display: none; }
.scene__vignette {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 58%, var(--white) 100%);
  opacity: .72;
}
.scene--black .scene__vignette { background: linear-gradient(to bottom, transparent 58%, var(--black) 100%); }
.scene--gray .scene__vignette { background: linear-gradient(to bottom, transparent 58%, var(--white) 100%); opacity: .35; }
.scene__caption {
  position: absolute;
  left: clamp(16px, 4vw, 62px);
  bottom: clamp(18px, 4vw, 50px);
  z-index: 4;
  max-width: min(580px, 76vw);
  padding: 16px 20px;
  border: 3px solid currentColor;
  background: var(--white);
  color: var(--black);
  box-shadow: 8px 8px 0 var(--black);
}
.scene--black .scene__caption { background: var(--black); color: var(--white); box-shadow: 8px 8px 0 var(--white); }
.scene__caption span { font-size: 11px; font-weight: 900; }
.scene__caption h2 { margin: 3px 0 6px; font-size: clamp(26px, 4vw, 48px); line-height: 1; letter-spacing: -.06em; }
.scene__caption p { margin: 0; font-family: system-ui, sans-serif; font-size: 14px; font-weight: 650; line-height: 1.45; }

.hotspot-layer { position: absolute; inset: 0; z-index: 5; }
.hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w, 56px);
  height: var(--h, 56px);
  display: grid;
  place-items: center;
  border: 4px solid var(--gray);
  border-radius: 50%;
  background: rgba(118, 118, 118, .58);
  color: var(--white);
  mix-blend-mode: normal;
  filter: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 4px rgba(0, 0, 0, .9);
  animation: hotspot-pulse 1.2s steps(2, end) infinite;
}
.hotspot::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  width: max-content;
  max-width: 160px;
  padding: 5px 7px;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
}
.hotspot:hover::after, .hotspot:focus-visible::after { opacity: 1; }
.hotspot.is-found { animation: none; border-style: solid; opacity: .72; }
.hotspot.is-found::before { content: "✓"; font-size: 25px; font-weight: 900; }
@keyframes hotspot-pulse { 50% { transform: scale(1.1); } }

.dialogue {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: 18px;
  width: min(1180px, 94vw);
  min-height: 128px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  transform: translateX(-50%);
  padding: 16px 18px;
  border: 4px solid var(--black);
  background: var(--white);
  color: var(--black);
  box-shadow: 10px 10px 0 var(--black);
}
.game-shell.world-black .dialogue { border-color: var(--white); background: var(--black); color: var(--white); box-shadow: 10px 10px 0 var(--white); }
.portrait { width: 92px; height: 92px; overflow: hidden; flex: 0 0 auto; border: 3px solid currentColor; background: currentColor; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.dialogue__body { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.dialogue__speaker { width: fit-content; margin-bottom: 7px; padding: 3px 7px; background: var(--black); color: var(--white); font-size: 12px; font-weight: 900; }
.world-black .dialogue__speaker { background: var(--white); color: var(--black); }
.dialogue__body p { margin: 0; font-family: system-ui, sans-serif; font-size: clamp(15px, 1.6vw, 18px); font-weight: 650; line-height: 1.65; word-break: keep-all; }
.dialogue__next {
  min-width: 104px;
  width: 112px;
  max-width: 100%;
  justify-self: end;
  min-height: 54px;
  border: 3px solid var(--black);
  background: var(--black);
  color: var(--white);
  font-weight: 900;
}
.world-black .dialogue__next { border-color: var(--white); background: var(--white); color: var(--black); }

.advance-button {
  position: fixed;
  z-index: 27;
  right: max(3vw, calc((100vw - 1180px) / 2));
  bottom: 168px;
  min-height: 52px;
  padding: 12px 20px;
  border: 3px solid var(--black);
  background: var(--white);
  color: var(--black);
  font-weight: 900;
  box-shadow: 6px 6px 0 var(--black);
}
.world-black .advance-button { border-color: var(--white); background: var(--black); color: var(--white); box-shadow: 6px 6px 0 var(--white); }

.choice-panel {
  position: fixed;
  z-index: 28;
  inset: auto 50% 170px auto;
  width: min(760px, 92vw);
  display: grid;
  gap: 12px;
  transform: translateX(50%);
  padding: 18px;
  border: 4px solid var(--black);
  background: var(--white);
  box-shadow: 10px 10px 0 var(--black);
}
.world-black .choice-panel { border-color: var(--white); background: var(--black); box-shadow: 10px 10px 0 var(--white); }
.choice-panel button {
  min-height: 58px;
  padding: 14px 18px;
  border: 2px solid var(--black);
  background: var(--black);
  color: var(--white);
  text-align: left;
  font-size: clamp(16px, 1.8vw, 19px);
  font-weight: 900;
  line-height: 1.45;
}
.choice-panel button:hover, .choice-panel button:focus-visible { background: var(--white); color: var(--black); }
.world-black .choice-panel button { border-color: var(--white); background: var(--white); color: var(--black); }
.world-black .choice-panel button:hover, .world-black .choice-panel button:focus-visible { background: var(--black); color: var(--white); }

.minigame {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 50%;
  width: min(860px, 90vw);
  transform: translate(-50%, -50%);
  padding: 22px;
  border: 4px solid var(--white);
  background: var(--black);
  color: var(--white);
  box-shadow: 12px 12px 0 var(--white);
}
.minigame p { margin: 0 0 14px; font-family: system-ui, sans-serif; font-weight: 750; line-height: 1.5; }
.stealth-track { position: relative; height: 128px; overflow: hidden; margin-bottom: 16px; border: 2px solid var(--white); background: var(--black); }
.stealth-track::after { content: ""; position: absolute; left: 3%; right: 3%; bottom: 30px; height: 2px; background: var(--white); }
.stealth-light { position: absolute; z-index: 1; top: 0; bottom: 0; left: 0; width: 7%; background: var(--white); transition: left .08s linear; }
.stealth-player { position: absolute; z-index: 3; left: 7%; bottom: 21px; width: 19px; height: 38px; border: 2px solid var(--white); background: var(--black); transition: left .22s steps(3, end); }
.cover { position: absolute; z-index: 2; left: var(--x); bottom: 5px; transform: translateX(-50%); padding: 4px; background: var(--black); color: var(--white); font-size: 10px; }

.minigame--footprints { background: var(--black); }
.footprint-field { position: relative; height: 310px; border: 2px solid var(--white); background: var(--black); }
.footprint-guide {
  position: absolute;
  z-index: 3;
  padding: 4px 7px;
  background: var(--white);
  color: var(--black);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}
.footprint-guide--adult { top: 8px; left: 8px; }
.footprint-guide--child { right: 8px; bottom: 8px; }
.bootprint {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 38px;
  height: 66px;
  transform: rotate(var(--r));
  border: 3px dashed var(--white);
  border-radius: 46% 46% 18% 18%;
  background: var(--black);
  pointer-events: none;
}
.bootprint::before {
  content: "";
  position: absolute;
  inset: 10px 6px;
  border-top: 4px solid var(--white);
  border-bottom: 4px solid var(--white);
}
.footprint {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 34px;
  height: 62px;
  transform: rotate(var(--r));
  border: 3px solid var(--white);
  border-radius: 55% 48% 42% 45%;
  background: var(--black);
  color: transparent;
}
.footprint::before { content: ""; position: absolute; top: -10px; left: 2px; width: 7px; height: 7px; border: 2px solid var(--white); border-radius: 50%; box-shadow: 8px -5px 0 -1px var(--black), 8px -5px 0 1px var(--white), 16px -4px 0 -1px var(--black), 16px -4px 0 1px var(--white); }
.footprint.is-correct { background: var(--white); }

.modal {
  width: min(1100px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: 5px solid var(--black);
  background: var(--white);
  color: var(--black);
  box-shadow: 14px 14px 0 var(--black);
}
.modal::backdrop { background: rgba(0, 0, 0, .88); }
.modal__header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 4px solid var(--black); background: var(--white); }
.modal__header h2 { margin: 0; font-size: clamp(30px, 5vw, 54px); letter-spacing: -.07em; }
.modal-close { min-height: 42px; padding: 8px 12px; border: 2px solid var(--black); background: var(--black); color: var(--white); font-weight: 900; }
.hint-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 22px; border-bottom: 4px solid var(--black); background: var(--black); color: var(--white); }
.hint-panel h3 { margin: 0 0 6px; font-size: 20px; }
.hint-panel p { margin: 0; font-family: system-ui, sans-serif; font-size: 14px; line-height: 1.55; }
.hint-panel .button { flex: 0 0 auto; background: var(--white); color: var(--black); box-shadow: 5px 5px 0 var(--white); }
.evidence-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; padding: 22px; }
.evidence-card { min-height: 150px; display: grid; align-content: start; gap: 9px; padding: 14px; border: 3px solid var(--black); background: var(--white); color: var(--black); text-align: left; }
.evidence-card:hover, .evidence-card.is-selected { background: var(--black); color: var(--white); }
.evidence-card__image { width: 100%; aspect-ratio: 16 / 7; object-fit: contain; border: 2px solid currentColor; background: var(--black); }
.evidence-card strong { font-size: 15px; }
.evidence-card span { font-family: system-ui, sans-serif; font-size: 13px; line-height: 1.45; }
.evidence-card small { margin-top: auto; font-weight: 900; }
.evidence-empty { padding: 40px; font-family: system-ui, sans-serif; }
.deduction-board { padding: 22px; border-top: 5px solid var(--black); }
.deduction-board__heading h3 { margin: 0; font-size: 30px; }
.deduction-board__heading p { font-family: system-ui, sans-serif; }
.deduction-slots { min-height: 56px; display: flex; gap: 12px; align-items: center; margin: 18px 0; padding: 12px; border: 2px dashed var(--black); font-weight: 900; }
.deduction-list { display: grid; gap: 8px; margin: 18px 0; }
.deduction-result { padding: 12px; border-left: 8px solid var(--black); background: var(--black); color: var(--white); font-family: system-ui, sans-serif; }
.help-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.help-grid section { padding: 24px; border-right: 2px solid var(--black); border-bottom: 2px solid var(--black); }
.help-grid h3 { margin: 0 0 9px; font-size: 20px; }
.help-grid p { margin: 0; font-family: system-ui, sans-serif; line-height: 1.7; }

.toast { position: fixed; z-index: 120; left: 50%; top: 90px; transform: translate(-50%, -20px); padding: 10px 14px; border: 3px solid var(--white); background: var(--black); color: var(--white); font-weight: 900; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.transition { position: fixed; z-index: 90; inset: 0; pointer-events: none; background: var(--black); transform: translateX(-102%); }
.transition.is-active { animation: scene-wipe .7s steps(8, end); }
@keyframes scene-wipe { 0% { transform: translateX(-102%); } 48%, 52% { transform: translateX(0); } 100% { transform: translateX(102%); } }

.screen--ending { background-image: url("special/D1_최종장회색전환.png"); background-position: center; background-size: cover; }
.ending-stats { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 24px 0; padding: 16px 0; border-block: 3px solid var(--black); }
.ending-stats dt { font-weight: 900; }
.ending-stats dd { margin: 0; }

@media (max-width: 900px) {
  .hud { grid-template-columns: 1fr auto; }
  .hud__status { justify-self: end; }
  .hud__actions { grid-column: 1 / -1; justify-content: stretch; }
  .hud__actions button { flex: 1; }
  .scene { height: 65vh; min-height: 430px; }
  .dialogue { grid-template-columns: auto 1fr; bottom: 12px; }
  .dialogue__next { grid-column: 1 / -1; min-height: 40px; }
  .advance-button { bottom: 205px; }
  .choice-panel { bottom: 205px; }
}

@media (max-width: 600px) {
  .screen { padding: 14px; }
  .start-card, .ending-card { padding: 24px; box-shadow: 8px 8px 0 var(--black); }
  .hud { position: relative; min-height: auto; padding: 10px; }
  .hud__actions { overflow-x: auto; }
  .hud__actions button { min-width: max-content; }
  .play-area { padding-bottom: 210px; }
  .scene { height: 58vh; min-height: 420px; }
  .scene > img { object-position: center; }
  .scene__caption { left: 12px; bottom: 14px; max-width: calc(100vw - 30px); padding: 11px 13px; box-shadow: 5px 5px 0 var(--black); }
  .scene--black .scene__caption { box-shadow: 5px 5px 0 var(--white); }
  .dialogue { bottom: 8px; min-height: 190px; padding: 12px; gap: 10px; box-shadow: 6px 6px 0 var(--black); }
  .world-black .dialogue { box-shadow: 6px 6px 0 var(--white); }
  .portrait { width: 68px; height: 68px; }
  .dialogue__body p { font-size: 14px; }
  .advance-button { right: 16px; bottom: 215px; }
  .choice-panel { bottom: 214px; }
  .minigame { width: 94vw; padding: 14px; }
  .footprint-field { height: 250px; }
  .help-grid { grid-template-columns: 1fr; }
  .modal { max-height: 94vh; }
  .hint-panel { align-items: stretch; flex-direction: column; padding: 14px; }
  .hint-panel .button { width: 100%; box-shadow: none; }
  .evidence-list { grid-template-columns: 1fr; padding: 14px; }
}

@media (max-height: 650px) {
  .choice-panel {
    z-index: 40;
    top: 12px;
    bottom: 12px !important;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    align-content: start;
  }
  .minigame {
    position: fixed;
    z-index: 40;
    top: 130px;
    max-height: calc(100vh - 142px);
    transform: translateX(-50%);
    overflow-y: auto;
  }
  .stealth-track { height: 86px; margin-bottom: 8px; }
  .footprint-field { height: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
