@charset "UTF-8";

:root {
  --ink: #211c1c;
  --ink-soft: #5d514a;
  --paper: #fff9eb;
  --paper-deep: #f2dfb9;
  --ivory: #fff2d6;
  --cream: #f7e7c3;
  --yellow: #ffd23f;
  --yellow-pale: #fff0a8;
  --coral: #ef6a56;
  --coral-dark: #b53e38;
  --mint: #98d8bd;
  --navy: #101b36;
  --navy-soft: #1c2b4e;
  --night-blue: #294c78;
  --line: 3px solid var(--ink);
  --shadow: 5px 6px 0 var(--ink);
  --soft-shadow: 0 18px 44px rgba(26, 23, 31, .2);
  --radius: 18px;
  color: var(--ink);
  background: var(--cream);
  font-family: "Arial Rounded MT Bold", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--cream); }
body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 14%, rgba(239, 106, 86, .14) 0 2px, transparent 2.5px) 0 0 / 31px 31px,
    radial-gradient(circle at 92% 26%, rgba(16, 27, 54, .1) 0 1.5px, transparent 2px) 0 0 / 25px 25px,
    linear-gradient(118deg, transparent 0 47%, rgba(255, 255, 255, .23) 48% 51%, transparent 52%),
    var(--cream);
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 4px solid #2176d2;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--navy);
  border-radius: 8px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

#game-root {
  width: min(1480px, 100%);
  min-height: 100dvh;
  margin-inline: auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.boot-card, .noscript-card {
  width: min(520px, calc(100% - 24px));
  margin: 20vh auto 0;
  padding: 30px;
  text-align: center;
  background: var(--paper);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.boot-card strong { display: block; margin: 14px 0 5px; font-size: 2rem; }
.boot-card span, .noscript-card { color: var(--ink-soft); font-weight: 750; line-height: 1.6; }
.mini-clapper {
  width: 70px;
  height: 46px;
  margin: auto;
  background: linear-gradient(var(--yellow) 0 14px, var(--navy) 14px);
  border: var(--line);
  border-radius: 5px;
  transform: rotate(-4deg);
}

/* Shared controls */
.ink-button, .paper-button, .coral-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  cursor: pointer;
  color: var(--paper);
  background: var(--navy);
  border: var(--line);
  border-radius: 11px;
  box-shadow: 3px 4px 0 rgba(33, 28, 28, .35);
  font-weight: 900;
  line-height: 1.25;
  transition: transform .13s ease, box-shadow .13s ease, background-color .13s ease;
}
.paper-button { color: var(--ink); background: var(--paper); }
.coral-button { color: var(--ink); background: var(--yellow); }
.danger-button { color: #fff; background: var(--coral-dark); }
.ink-button:hover, .paper-button:hover, .coral-button:hover { transform: translateY(-2px); box-shadow: 4px 6px 0 rgba(33, 28, 28, .35); }
.ink-button:active, .paper-button:active, .coral-button:active { transform: translateY(2px); box-shadow: 1px 1px 0 rgba(33, 28, 28, .35); }
.ink-button:disabled, .paper-button:disabled, .coral-button:disabled { cursor: wait; opacity: .58; transform: none; }

/* Episode selection */
.select-screen { animation: paper-in .28s ease-out both; }
.title-lockup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}
.clapper-title {
  position: relative;
  width: min(760px, 100%);
  padding: 34px clamp(21px, 4vw, 42px) 24px;
  overflow: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 86% 20%, rgba(255, 210, 63, .18), transparent 25%),
    linear-gradient(145deg, var(--navy-soft), var(--navy));
  border: var(--line);
  border-radius: 12px;
  box-shadow: 7px 8px 0 var(--coral);
}
.clapper-title::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 17px;
  content: "";
  background: repeating-linear-gradient(125deg, var(--yellow) 0 14px, var(--ink) 14px 28px);
  border-bottom: 3px solid var(--ink);
}
.eyebrow { margin: 0 0 5px; color: var(--yellow); font-size: .7rem; font-weight: 1000; letter-spacing: .18em; }
.clapper-title h1 { margin: 0; font-size: clamp(2.45rem, 7vw, 5.2rem); font-weight: 1000; letter-spacing: -.075em; line-height: .98; }
.clapper-title h1 em { display: inline-grid; width: .83em; aspect-ratio: 1; place-items: center; margin-left: .08em; color: var(--ink); background: var(--yellow); border: 3px solid var(--paper); border-radius: 50%; font-style: normal; font-size: .7em; transform: rotate(7deg); }
.clapper-title .tagline { margin: 12px 0 0; color: #f6dfb5; font-family: "AppleMyungjo", "Nanum Myeongjo", serif; font-size: clamp(.9rem, 2vw, 1.08rem); font-weight: 700; line-height: 1.55; }
.score-ticket {
  position: relative;
  min-width: 185px;
  padding: 17px 20px;
  text-align: center;
  background: var(--paper);
  border: var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transform: rotate(1deg);
}
.score-ticket::before, .score-ticket::after { position: absolute; top: 50%; width: 17px; aspect-ratio: 1; content: ""; background: var(--cream); border: 3px solid var(--ink); border-radius: 50%; transform: translateY(-50%); }
.score-ticket::before { left: -11px; }
.score-ticket::after { right: -11px; }
.ticket-label { display: block; color: var(--coral-dark); font-size: .67rem; font-weight: 1000; letter-spacing: .14em; }
.ticket-score { display: block; margin: 3px 0; font-size: 1.8rem; font-weight: 1000; font-variant-numeric: tabular-nums; }
.ticket-score small { color: var(--ink-soft); font-size: .86rem; }
.ticket-scenes { color: var(--ink-soft); font-size: .76rem; font-weight: 850; }
.call-sheet {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 22px;
  padding: 11px 13px;
  background: rgba(255, 249, 235, .86);
  border: 2px dashed var(--ink);
  border-radius: 10px;
}
.call-sheet strong { padding: 5px 9px; color: var(--paper); background: var(--coral-dark); border-radius: 5px; font-size: .73rem; letter-spacing: .06em; }
.call-sheet p { margin: 0; font-size: .82rem; font-weight: 750; line-height: 1.5; }
.text-action { padding: 6px; cursor: pointer; color: var(--ink-soft); background: transparent; border: 0; font-size: .73rem; font-weight: 900; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.text-action:hover { color: var(--coral-dark); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 3px 11px; }
.section-heading h2 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.7rem); font-weight: 1000; }
.section-heading p { margin: 0; color: var(--ink-soft); font-size: .8rem; font-weight: 800; }
.scene-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.5vw, 19px); align-items: stretch; }
.scene-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 390px;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: var(--line);
  border-radius: 12px;
  box-shadow: 4px 6px 0 var(--ink);
  transition: transform .16s ease, box-shadow .16s ease;
}
.scene-card:nth-child(2n) { transform: rotate(.35deg); }
.scene-card:nth-child(3n) { transform: rotate(-.35deg); }
.scene-card:not(.is-locked):hover { z-index: 2; transform: translateY(-6px) rotate(0); box-shadow: 7px 10px 0 var(--ink); }
.scene-card:not(.is-locked):active { transform: translateY(1px); box-shadow: 2px 2px 0 var(--ink); }
.scene-card-art { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; background: var(--navy); border-bottom: var(--line); }
.scene-card-art img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.scene-card-copy { display: flex; min-height: 196px; flex: 1; flex-direction: column; padding: 14px 13px 12px; }
.scene-number { color: var(--coral-dark); font-size: .67rem; font-weight: 1000; letter-spacing: .14em; }
.scene-card h3 { margin: 4px 0 2px; font-size: 1.08rem; font-weight: 1000; line-height: 1.25; word-break: keep-all; }
.scene-subtitle { margin: 0 0 9px; color: var(--night-blue); font-size: .73rem; font-weight: 900; line-height: 1.4; }
.scene-teaser { margin: 0; color: var(--ink-soft); font-size: .77rem; font-weight: 700; line-height: 1.55; word-break: keep-all; }
.card-status { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: auto; padding-top: 12px; font-size: .68rem; font-weight: 1000; }
.take-pill { padding: 4px 7px; color: var(--paper); background: var(--navy); border-radius: 999px; }
.card-score { color: var(--coral-dark); font-variant-numeric: tabular-nums; }
.scene-card.is-complete::after { position: absolute; top: 11px; right: 9px; padding: 5px 7px; content: "다시 보기"; color: var(--ink); background: var(--yellow); border: 2px solid var(--ink); border-radius: 6px; font-size: .64rem; font-weight: 1000; transform: rotate(3deg); }
.scene-card.has-progress, .scene-card.is-current { box-shadow: 4px 6px 0 var(--coral); }
.scene-card.is-current { outline: 4px solid var(--yellow); outline-offset: 3px; }
.scene-card.is-locked { cursor: not-allowed; filter: saturate(.58); }
.scene-card.is-locked .scene-card-art img { opacity: .45; }
.scene-card.is-locked .scene-card-art::after { position: absolute; inset: 0; display: grid; place-items: center; content: "아직 열리지 않은 장면"; color: var(--paper); background: rgba(16, 27, 54, .68); font-size: .7rem; font-weight: 1000; letter-spacing: .03em; }
.scene-card.is-locked .take-pill { color: #dbd5c9; background: #5e5a60; }

/* Compact film navigation */
.film-nav {
  display: grid;
  grid-template-columns: 9px repeat(5, minmax(0, 1fr)) 9px;
  gap: 6px;
  margin-bottom: 10px;
  padding: 7px;
  color: var(--paper);
  background: var(--navy);
  border: 3px solid var(--ink);
  border-radius: 8px;
}
.film-nav::before, .film-nav::after { content: ""; background: repeating-linear-gradient(to bottom, var(--paper) 0 7px, transparent 7px 14px); opacity: .85; }
.film-frame { min-width: 0; min-height: 34px; padding: 5px 7px; overflow: hidden; cursor: pointer; color: #d7d8df; background: #23304a; border: 2px solid #66708a; border-radius: 4px; font-size: .69rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.film-frame:not(:disabled):hover { color: var(--ink); background: var(--yellow); }
.film-frame.is-current { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.film-frame.is-complete:not(.is-current) { color: var(--paper); background: var(--coral-dark); border-color: #f58b77; }
.film-frame.is-locked, .film-frame:disabled { cursor: not-allowed; color: #868b98; background: #192238; border-color: #39445d; }
.film-number { display: none; }

/* Story play layout */
.play-screen { animation: paper-in .24s ease-out both; }
.play-topbar { display: flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.small-brand { display: flex; align-items: center; gap: 8px; color: var(--navy); font-size: .88rem; font-weight: 1000; letter-spacing: -.03em; }
.small-brand::before { width: 27px; height: 20px; content: ""; background: repeating-linear-gradient(125deg, var(--yellow) 0 6px, var(--ink) 6px 12px); border: 2px solid var(--ink); border-radius: 4px; transform: rotate(-4deg); }
.top-score { padding: 6px 10px; color: var(--paper); background: var(--navy); border-radius: 7px; font-size: .71rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.back-button { padding: 7px 6px; cursor: pointer; color: var(--ink); background: transparent; border: 0; font-size: .73rem; font-weight: 900; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.game-layout { display: grid; grid-template-columns: minmax(420px, 1.18fr) minmax(370px, .82fr); gap: clamp(15px, 2.2vw, 30px); align-items: start; }
.stage-column { position: sticky; top: 12px; min-width: 0; }
.scene-slate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
  min-height: 48px;
  padding: 7px 12px;
  color: var(--paper);
  background: var(--navy);
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.slate-take, .shot-counter { grid-row: 1 / span 2; color: var(--yellow); font-size: clamp(1.1rem, 2.1vw, 1.7rem); font-weight: 1000; line-height: 1; }
.slate-title { min-width: 0; overflow: hidden; font-size: clamp(.85rem, 1.5vw, 1.05rem); font-weight: 1000; text-overflow: ellipsis; white-space: nowrap; }
.slate-meta { color: #d3d1cb; font-size: .61rem; font-weight: 750; letter-spacing: .07em; }

/* Establishing image and reaction closeups */
.scene-visual {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 3 / 2;
  place-items: center;
  margin: 0;
  overflow: hidden;
  background: var(--navy);
  border: 3px solid var(--ink);
  border-radius: 0 0 12px 12px;
  box-shadow: 6px 7px 0 var(--ink);
  isolation: isolate;
}
.scene-visual > img:not(.scene-backdrop):not(.portrait-image), .scene-visual > .wide-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.scene-visual.is-closeup { display: block; background: #15213b; }
.scene-backdrop {
  position: absolute;
  z-index: 0;
  inset: -7px;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  object-fit: cover;
  object-position: center;
  filter: blur(3px) brightness(.4) saturate(.82);
}
.scene-visual.is-closeup::after { position: absolute; z-index: 1; inset: 0; content: ""; background: linear-gradient(90deg, rgba(8, 15, 32, .08) 0 57%, rgba(8, 15, 32, .78) 78% 100%); }
.portrait-frame {
  position: absolute;
  z-index: 2;
  top: 10px;
  bottom: 10px;
  left: clamp(9px, 3vw, 30px);
  max-width: 68%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--ivory);
  border: 3px solid var(--ink);
  border-radius: 46% 46% 12px 12px;
  box-shadow: 5px 5px 0 rgba(5, 11, 26, .68), 0 0 0 3px var(--yellow);
}
.portrait-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--ivory);
}
.shot-caption {
  position: absolute;
  z-index: 3;
  right: clamp(9px, 2vw, 20px);
  bottom: clamp(10px, 2vw, 18px);
  width: min(29%, 220px);
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 9px 9px 9px 2px;
  box-shadow: 4px 4px 0 var(--coral);
  font-size: clamp(.67rem, 1.15vw, .86rem);
  font-weight: 900;
  line-height: 1.4;
  word-break: keep-all;
}
.shot-caption strong, .shot-caption .shot-speaker { display: block; margin-bottom: 2px; color: var(--coral-dark); font-size: .77em; letter-spacing: .08em; }
.scene-visual.is-camera-cut .portrait-frame, .scene-visual.is-cut .portrait-frame { animation: camera-cut .2s ease-out both; }
.scene-visual.is-camera-cut .shot-caption, .scene-visual.is-cut .shot-caption { animation: caption-cut .2s .04s ease-out both; }
.cast-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 9px 0 0; padding: 0; list-style: none; }
.cast-strip li { padding: 5px 8px; color: var(--paper); background: var(--navy); border: 2px solid var(--ink); border-radius: 6px; font-size: .67rem; font-weight: 900; }
.cast-strip span { margin-left: 4px; color: #ddcbad; font-weight: 700; }

/* Cream script page */
.notebook {
  position: relative;
  min-width: 0;
  min-height: 540px;
  padding: clamp(23px, 3.2vw, 40px) clamp(20px, 3vw, 36px) clamp(25px, 3.2vw, 42px) clamp(31px, 4vw, 52px);
  overflow: hidden;
  background:
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(41, 76, 120, .11) 31px 32px),
    var(--paper);
  border: var(--line);
  border-radius: 14px;
  box-shadow: 7px 9px 0 var(--coral), var(--soft-shadow);
}
.notebook::before { position: absolute; top: 0; bottom: 0; left: 23px; width: 2px; content: ""; background: rgba(239, 106, 86, .45); }
.notebook > * { position: relative; z-index: 1; }
.page-label { display: inline-block; margin-bottom: 13px; padding: 4px 8px; color: var(--paper); background: var(--coral-dark); border-radius: 5px; font-size: .64rem; font-weight: 1000; letter-spacing: .13em; transform: rotate(-1deg); }
.notebook h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.25rem); font-weight: 1000; letter-spacing: -.04em; line-height: 1.18; word-break: keep-all; }
.notebook .subtitle { margin: 4px 0 17px; color: var(--night-blue); font-size: .82rem; font-weight: 900; }
.mission-card { margin: 16px 0; padding: 12px 14px; background: var(--yellow-pale); border: 2px solid var(--ink); border-radius: 8px; box-shadow: 3px 3px 0 var(--ink); }
.mission-card b { display: block; margin-bottom: 3px; color: var(--coral-dark); font-size: .65rem; letter-spacing: .11em; }
.mission-card p { margin: 0; font-size: .86rem; font-weight: 800; line-height: 1.55; word-break: keep-all; }
.intro-copy { margin: 17px 0; font-family: "AppleMyungjo", "Nanum Myeongjo", serif; font-size: .98rem; font-weight: 700; line-height: 1.8; word-break: keep-all; }
.intro-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.resume-note { color: var(--ink-soft); font-size: .7rem; font-weight: 850; line-height: 1.45; }
.beat-head { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 13px; }
.take-counter { display: inline-flex; align-items: center; gap: 7px; font-size: .68rem; font-weight: 1000; letter-spacing: .07em; }
.take-counter strong { display: grid; width: 31px; height: 31px; place-items: center; color: var(--paper); background: var(--navy); border-radius: 50%; font-size: .9rem; }
.progress-dots { display: flex; gap: 6px; }
.progress-dot { width: 13px; height: 13px; background: var(--paper); border: 2px solid var(--ink); border-radius: 50%; }
.progress-dot.is-done { background: var(--mint); }
.progress-dot.is-current { background: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 210, 63, .35); }
.dialogue-block { margin: 4px 0 14px; padding: 15px 16px; background: rgba(255, 255, 255, .9); border: 2px solid var(--ink); border-radius: 8px 17px 17px; }
.dialogue-block.is-active { border-color: var(--coral-dark); box-shadow: 3px 3px 0 var(--coral); }
.speaker { display: inline-block; margin: -27px 0 7px -7px; padding: 4px 9px; color: var(--paper); background: var(--navy); border-radius: 5px; font-size: .68rem; font-weight: 1000; }
.dialogue-line { margin: 0; font-size: clamp(.98rem, 1.7vw, 1.1rem); font-weight: 850; line-height: 1.62; word-break: keep-all; }
.dialogue-advance { width: 100%; margin-top: 12px; }
.direction { margin: 0 0 11px; color: var(--coral-dark); font-size: .68rem; font-weight: 1000; letter-spacing: .1em; }
.choice-list { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.choice-button {
  display: grid;
  grid-template-columns: 29px 1fr;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 8px 11px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: 2px 3px 0 var(--ink);
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.45;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.choice-button:hover { z-index: 1; background: var(--yellow-pale); transform: translateX(3px); box-shadow: 3px 4px 0 var(--ink); }
.choice-button:active { transform: translate(2px, 2px); box-shadow: none; }
.choice-button:disabled { cursor: not-allowed; opacity: .52; transform: none; box-shadow: 1px 1px 0 var(--ink); }
.choice-number { display: grid; width: 29px; height: 29px; place-items: center; background: var(--yellow); border: 2px solid var(--ink); border-radius: 7px; font-size: .75rem; font-weight: 1000; transform: rotate(-2deg); }
.choice-button:nth-child(even) .choice-number { background: var(--mint); transform: rotate(2deg); }
.choice-button.is-tried { background: #e3ddd1; text-decoration: line-through; text-decoration-color: var(--coral-dark); text-decoration-thickness: 2px; }
.hint-wrap { margin-top: 11px; }
.hint-toggle { padding: 6px 8px; cursor: pointer; color: var(--ink-soft); background: transparent; border: 2px dashed var(--ink-soft); border-radius: 7px; font-size: .69rem; font-weight: 900; }
.hint-toggle:hover { color: var(--coral-dark); border-color: var(--coral-dark); }
.hint-note { margin: 8px 0 0; padding: 9px 11px; background: #fff7bd; border-left: 5px solid var(--yellow); font-size: .75rem; font-weight: 750; line-height: 1.55; animation: note-open .16s ease-out both; }
.keyboard-note { margin: 11px 0 0; color: #746c61; font-size: .63rem; font-weight: 750; text-align: right; }
.context-note { margin-top: 13px; color: var(--ink-soft); font-size: .75rem; line-height: 1.6; }
.context-note summary { width: fit-content; cursor: pointer; font-weight: 850; }
.context-note p { padding: 10px; background: #fff8de; border-left: 3px solid var(--yellow); }

/* Choice reply, reaction and ending */
.feedback-card { position: relative; padding: 17px 15px 15px; background: #ffe1da; border: 3px solid var(--ink); border-radius: 9px; box-shadow: 4px 5px 0 var(--ink); animation: feedback-in .2s ease-out both; }
.feedback-card.is-ok { background: #e1f5e8; }
.feedback-card.is-ng { background: #ffe1da; }
.take-stamp { position: absolute; top: 10px; right: 10px; padding: 5px 8px; color: var(--coral-dark); background: rgba(255, 255, 255, .72); border: 3px solid currentColor; border-radius: 5px; font-size: 1.12rem; font-weight: 1000; transform: rotate(6deg); }
.is-ok .take-stamp { color: #257454; transform: rotate(-6deg); }
.player-reply, .reply-note { margin: 0 0 13px; padding: 10px 12px; background: var(--yellow-pale); border: 2px solid var(--coral-dark); border-radius: 8px; box-shadow: 3px 3px 0 var(--coral); font-size: .79rem; font-weight: 850; line-height: 1.5; word-break: keep-all; }
.feedback-response { margin: 0 0 9px; font-size: .92rem; font-weight: 850; line-height: 1.55; word-break: keep-all; }
.director-note, .story-note { margin: 0 0 13px; padding: 8px 10px; background: rgba(255, 255, 255, .68); border-left: 4px solid currentColor; font-size: .73rem; font-weight: 750; line-height: 1.5; }
.feedback-action { width: 100%; }
.ending-page { text-align: center; }
.ending-page .take-stamp { position: static; display: inline-block; margin: 4px 0 15px; padding: 9px 17px; font-size: 1.7rem; transform: rotate(-4deg); }
.ending-page h2 { font-size: clamp(1.65rem, 4vw, 2.7rem); }
.ending-copy { max-width: 42ch; margin: 14px auto; font-size: .94rem; font-weight: 750; line-height: 1.72; word-break: keep-all; }
.scene-result { display: inline-flex; gap: 8px; align-items: center; margin: 7px 0 19px; padding: 8px 12px; background: var(--yellow-pale); border: 2px solid var(--ink); border-radius: 8px; font-size: .76rem; font-weight: 900; }
.ending-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }

/* Final record */
.wrap-screen { display: grid; min-height: calc(100dvh - 42px); place-items: center; animation: paper-in .28s ease-out both; }
.wrap-board { width: min(760px, 100%); padding: clamp(27px, 5vw, 55px); text-align: center; background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 8px 9px 0 var(--ink), 13px 15px 0 var(--coral); }
.wrap-kicker { margin: 0; color: var(--coral-dark); font-size: .72rem; font-weight: 1000; letter-spacing: .18em; }
.wrap-board h1 { margin: 7px 0 4px; font-size: clamp(2rem, 6vw, 4.2rem); font-weight: 1000; letter-spacing: -.06em; }
.wrap-subtitle { margin: 0 0 19px; color: var(--night-blue); font-weight: 850; }
.final-score { display: inline-grid; min-width: 180px; aspect-ratio: 1.8; place-content: center; background: var(--yellow); border: 4px solid var(--ink); border-radius: 50%; box-shadow: 5px 6px 0 var(--ink); transform: rotate(-2deg); }
.final-score strong { display: block; font-size: clamp(2.2rem, 7vw, 4.4rem); font-weight: 1000; line-height: .95; font-variant-numeric: tabular-nums; }
.final-score span { margin-top: 4px; font-size: .67rem; font-weight: 1000; letter-spacing: .11em; }
.rating-copy { max-width: 48ch; margin: 20px auto; font-size: .95rem; font-weight: 800; line-height: 1.7; word-break: keep-all; }
.score-reel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 20px 0; padding: 9px; color: var(--paper); background: var(--navy); border-radius: 9px; }
.reel-cell { min-width: 0; padding: 8px 4px; background: #26334d; border: 1px solid #6f7890; border-radius: 5px; }
.reel-cell b { display: block; overflow: hidden; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.reel-cell span { color: var(--yellow); font-size: .72rem; font-weight: 1000; }
.wrap-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }

/* Reset confirmation */
.confirm-dialog { width: min(440px, calc(100% - 28px)); padding: 0; color: var(--ink); background: var(--paper); border: var(--line); border-radius: 14px; box-shadow: 7px 8px 0 var(--coral); }
.confirm-dialog::backdrop { background: rgba(10, 17, 34, .78); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 24px; }
.confirm-slate { display: inline-block; padding: 5px 8px; color: var(--paper); background: var(--coral-dark); border-radius: 5px; font-size: .67rem; font-weight: 1000; letter-spacing: .09em; }
.confirm-dialog h2 { margin: 11px 0 6px; font-size: 1.35rem; }
.confirm-dialog p { margin: 0; color: var(--ink-soft); font-size: .84rem; font-weight: 700; line-height: 1.58; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; flex-wrap: wrap; }
.confirm-actions button { min-height: 42px; padding: 8px 12px; font-size: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes paper-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes camera-cut { from { opacity: .82; transform: scale(1.012) translateX(-3px); } to { opacity: 1; transform: none; } }
@keyframes caption-cut { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes feedback-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes note-open { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Tablet */
@media (max-width: 1180px) {
  .scene-grid { grid-template-columns: repeat(3, minmax(190px, 1fr)); }
  .game-layout { grid-template-columns: minmax(380px, 1fr) minmax(350px, .92fr); }
}

@media (max-width: 820px) {
  #game-root { padding-inline: max(12px, env(safe-area-inset-left)); }
  .title-lockup { grid-template-columns: 1fr; }
  .score-ticket { justify-self: end; margin-top: -6px; }
  .scene-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-layout { grid-template-columns: 1fr; gap: 12px; }
  .stage-column { position: static; }
  .scene-visual { aspect-ratio: 16 / 9; }
  .notebook { min-height: 0; }
  .cast-strip { display: none; }
}

/* Phones: keep the current face and dialogue action together */
@media (max-width: 560px) {
  #game-root { padding-top: max(8px, env(safe-area-inset-top)); padding-right: max(9px, env(safe-area-inset-right)); padding-left: max(9px, env(safe-area-inset-left)); }
  .title-lockup { margin-top: 7px; }
  .clapper-title { padding: 28px 17px 16px; box-shadow: 5px 6px 0 var(--coral); }
  .clapper-title h1 { font-size: clamp(2.4rem, 14vw, 4rem); }
  .score-ticket { width: calc(100% - 10px); justify-self: center; }
  .call-sheet { grid-template-columns: auto 1fr; }
  .call-sheet .text-action { grid-column: 1 / -1; justify-self: end; padding: 0 4px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 3px; }
  .scene-grid { grid-template-columns: 1fr; }
  .scene-card { display: grid; min-height: 0; grid-template-columns: 42% 58%; }
  .scene-card-art { height: 100%; min-height: 180px; aspect-ratio: auto; border-right: var(--line); border-bottom: 0; }
  .scene-card-copy { min-height: 190px; padding: 12px 11px; }
  .scene-card h3 { font-size: 1rem; }
  .scene-teaser { font-size: .72rem; }
  .film-nav { grid-template-columns: 6px repeat(5, 1fr) 6px; gap: 3px; margin-bottom: 6px; padding: 5px; }
  .film-frame { min-height: 34px; padding: 3px 1px; font-size: .68rem; }
  .film-label { display: none; }
  .film-number { display: inline; }
  .play-topbar { min-height: 30px; gap: 4px; margin-bottom: 4px; }
  .small-brand { gap: 4px; font-size: .73rem; }
  .small-brand::before { width: 19px; height: 16px; }
  .top-score { padding: 5px 6px; font-size: .61rem; }
  .back-button { padding: 5px 0; font-size: .63rem; white-space: nowrap; }
  .game-layout { gap: 9px; }
  .scene-slate { min-height: 36px; padding: 4px 8px; border-width: 2px; }
  .slate-take, .shot-counter { font-size: 1rem; }
  .slate-title { font-size: .77rem; }
  .slate-meta { font-size: .54rem; }
  .scene-visual { height: min(224px, 57vw); aspect-ratio: auto; border-width: 2px; border-radius: 0 0 9px 9px; box-shadow: 3px 4px 0 var(--ink); }
  .portrait-frame { top: 7px; bottom: 7px; left: 8px; max-width: 67%; border-width: 2px; box-shadow: 3px 3px 0 rgba(5, 11, 26, .7), 0 0 0 2px var(--yellow); }
  .shot-caption { right: 7px; bottom: 8px; width: 29%; padding: 6px; border-width: 2px; box-shadow: 3px 3px 0 var(--coral); font-size: clamp(.59rem, 2.5vw, .7rem); line-height: 1.3; }
  .notebook { padding: 20px 14px 22px 27px; border-radius: 11px; box-shadow: 4px 5px 0 var(--coral); }
  .notebook::before { left: 17px; }
  .notebook h2 { font-size: 1.5rem; }
  .intro-copy { margin: 14px 0; font-size: .9rem; }
  .mission-card { margin: 13px 0; }
  .dialogue-block { margin-bottom: 11px; padding: 13px 12px; }
  .dialogue-line { font-size: .94rem; line-height: 1.5; }
  .dialogue-advance { min-height: 43px; margin-top: 9px; }
  .choice-button { min-height: 46px; padding: 7px 9px; font-size: .76rem; }
  .keyboard-note { display: none; }
  .ending-actions > *, .wrap-actions > * { width: 100%; }
  .score-reel { grid-template-columns: 1fr; }
  .reel-cell { display: flex; justify-content: space-between; padding-inline: 11px; }
  .confirm-actions { flex-direction: column; }
  .confirm-actions button { width: 100%; }
}

@media (max-width: 370px) {
  .scene-card { grid-template-columns: 39% 61%; }
  .scene-card-copy { padding: 10px 8px; }
  .scene-teaser { font-size: .68rem; }
  .card-status { align-items: flex-start; flex-direction: column; }
  .small-brand { font-size: .67rem; }
  .top-score { font-size: .57rem; }
  .scene-visual { height: 205px; }
  .portrait-frame { max-width: 65%; }
  .shot-caption { width: 31%; font-size: .57rem; }
  .notebook { padding-right: 10px; }
  .choice-button { grid-template-columns: 27px 1fr; gap: 7px; padding-right: 7px; }
  .choice-number { width: 27px; height: 27px; }
}

@media (min-width: 1400px) {
  #game-root { padding: 24px 30px 48px; }
  .game-layout { grid-template-columns: minmax(0, 1.23fr) minmax(410px, .77fr); }
  .scene-visual { max-height: 660px; }
  .notebook { min-height: 620px; }
}

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

@media (prefers-contrast: more) {
  :root { --ink: #080706; --ink-soft: #28231f; --navy: #071126; }
  .scene-subtitle, .scene-teaser, .keyboard-note { color: var(--ink); }
}
