@font-face {
  font-family: "DotGothic16";
  src: url("./assets/fonts/DotGothic16-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #e9dfc7;
  --muted: #a99c86;
  --red: #c85b4b;
  --gold: #d5a64a;
  --green: #6e9b78;
  --danger-caution: #d08a3e;
  --danger-critical: var(--red);
  --panel: #171418;
  --line: #4a3c37;
  --paper: #d8cfb7;
  --paper-ink: #332f2a;
  --font-game: "DotGothic16", "MS Gothic", ui-monospace, monospace;
  --font-story: Georgia, "Yu Mincho", serif;
  --text-xs: 12px;
  --text-base: 16px;
  --text-lg: 24px;
  --text-xl: 32px;
}

.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;
}


* { box-sizing: border-box; }

html { min-width: 320px; background: #0b090c; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(8, 6, 9, .9), rgba(8, 6, 9, .96)),
    repeating-linear-gradient(0deg, #161119 0 2px, #0f0c12 2px 4px);
  font-family: var(--font-game);
  letter-spacing: .03em;
}

button, input { font: inherit; }
button { color: inherit; }

.game-shell {
  width: min(1320px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 38px) 34px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font: 700 10px/1.2 ui-monospace, monospace;
  letter-spacing: .22em;
}

.brand-lockup { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5em; margin: 0; font-size: clamp(20px, 3vw, 34px); letter-spacing: .08em; }
.brand-title { white-space: nowrap; }
.brand-roman { color: var(--gold); font: 700 .3em/1 ui-monospace, monospace; letter-spacing: .22em; white-space: nowrap; }
.brand-enemy { color: var(--muted); font-size: .5em; font-weight: 500; white-space: nowrap; }
.brand-tagline { margin: 4px 0 0; color: #b3a694; font-size: 10px; letter-spacing: .12em; }
.version-badge { display: inline-block; margin: 6px 0 0; padding: 2px 6px; border: 1px solid #7d5d38; color: #d8ad63; background: #201711; font: 700 8px/1.4 ui-monospace, monospace; letter-spacing: .16em; }

.settings { display: flex; align-items: center; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { width: 34px; height: 18px; border: 2px solid #64564d; background: #282126; position: relative; }
.toggle span::after { content: ""; position: absolute; width: 10px; height: 10px; left: 2px; top: 2px; background: #817469; transition: transform .16s; }
.toggle input:checked + span { border-color: var(--gold); }
.toggle input:checked + span::after { background: var(--gold); transform: translateX(16px); }
.toggle input:focus-visible + span, button:focus-visible { outline: 3px solid #f4d487; outline-offset: 3px; }

.icon-button {
  min-height: 34px;
  border: 1px solid #5b4c45;
  background: #211b20;
  padding: 5px 10px;
  cursor: pointer;
}
.icon-button:hover { border-color: var(--gold); }
.icon-button span { color: var(--gold); }

.hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr 1.15fr .9fr;
  gap: 8px;
  margin-bottom: 10px;
}

.meter-card, .number-card {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #3c3134;
  border-top-color: #5e4c43;
  background: #171318;
  box-shadow: inset 0 -3px #0b090c;
  opacity: .68;
  filter: saturate(.72);
  transition: opacity .22s ease, filter .22s ease, transform .22s ease, box-shadow .22s ease;
}
.meter-card.is-changing, .number-card.is-changing {
  opacity: 1;
  filter: none;
  transform: translateY(-3px);
  animation: hud-impact .65s ease both;
}
.meter-card.is-changing[data-change="down"], .number-card.is-changing[data-change="down"] { box-shadow: inset 0 -3px #0b090c, 0 0 20px #d65d5055; }
.meter-card.is-changing[data-change="up"], .number-card.is-changing[data-change="up"] { box-shadow: inset 0 -3px #0b090c, 0 0 20px #77bd8755; }

.hud-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.hud-label span, .number-card span { color: #a99b8d; font-size: 12px; }
.hud-label span small { color: #8b7d70; font-size: 9px; }
.hud-label strong { font-size: 14px; }
.meter { height: 8px; padding: 2px; position: relative; background: #08070a; border: 1px solid #3d3030; }
.drunk-warning { display: block; margin-top: 5px; color: #e4b45f; font-size: 10px; animation: softPulse 1.4s ease-in-out infinite; }
.drunk-warning[hidden] { display: none; }
.mood-zone { display: block; margin-top: 5px; color: #8fc999; font-size: 10px; white-space: nowrap; }
.enemy-drunk { float: right; margin-top: -11px; color: #9b8d81; font-size: 10px; white-space: nowrap; }
.enemy-drunk[data-stage="1"] { color: #d0a75e; }
.enemy-drunk[data-stage="2"] { color: #82bd8e; }
.enemy-drunk[data-stage="3"] { color: #f0c56f; text-shadow: 0 0 8px #f0c56f55; }
.mood-card[data-zone="low"] .mood-zone { color: #e87968; }
.mood-card[data-zone="high"] .mood-zone { color: #e7b35c; }
.zone-pressure-badge {
  display: inline-block;
  clear: both;
  margin-top: 6px;
  padding: 2px 7px;
  border: 1px solid #9b8d81;
  color: #d8cfb7;
  background: #201a1d;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
  white-space: nowrap;
  animation: softPulse 1.6s ease-in-out infinite;
}
.zone-pressure-badge[hidden] { display: none; }
.zone-pressure-badge[data-zone="low"] { color: #ffb2a3; border-color: #e87968; background: #2b1614; }
.zone-pressure-badge[data-zone="high"] { color: #ffdca0; border-color: #e7b35c; background: #2b2312; }
.hud-label .urgent { color: #ff7664; }
.number-card { display: flex; flex-direction: column; justify-content: center; }
.number-card strong { margin-top: 5px; color: #f1e6cd; font-size: clamp(17px, 2.2vw, 23px); }
.number-card .urgent { color: #ff7664; animation: softPulse 1.5s ease-in-out infinite; }

.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 244px; gap: 12px; align-items: stretch; }

.bar-stage {
  min-height: 630px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: 315px auto 1fr;
  border: 2px solid #4b3b36;
  box-shadow: 0 16px 45px #000a, inset 0 0 0 3px #0c090c;
  background: #120f13;
  isolation: isolate;
}

.bar-backdrop {
  position: absolute;
  inset: 0 0 auto;
  height: 380px;
  z-index: -1;
  overflow: hidden;
  background: #100d11 url("./assets/backgrounds/bar-interior-pixel.png") center / cover no-repeat;
  image-rendering: pixelated;
}

.bar-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #07060a1f;
}

.bar-backdrop > .window,
.bar-backdrop > .bottle-shelf,
.bar-backdrop > .lamp { display: none; }

.window {
  position: absolute;
  left: 5%; top: 34px;
  width: 180px; height: 130px;
  border: 8px solid #30282a;
  box-shadow: 0 0 0 3px #09080a, inset 0 0 30px #080d13;
  background: linear-gradient(145deg, #14222d, #091017 70%);
}
.window::before, .window::after { content: ""; position: absolute; background: #30282a; }
.window::before { width: 6px; top: 0; bottom: 0; left: 48%; }
.window::after { height: 6px; left: 0; right: 0; top: 48%; }
.window i { position: absolute; width: 2px; height: 31px; background: #75899a80; transform: rotate(12deg); animation: rain 2.4s linear infinite; }
.window i:nth-child(1) { left: 15%; top: 5px; }
.window i:nth-child(2) { left: 35%; top: 52px; animation-delay: -.8s; }
.window i:nth-child(3) { left: 58%; top: 15px; animation-delay: -1.4s; }
.window i:nth-child(4) { left: 75%; top: 67px; animation-delay: -.3s; }
.window i:nth-child(5) { left: 88%; top: 25px; animation-delay: -1.8s; }

.bottle-shelf {
  position: absolute;
  right: 4%; top: 55px;
  width: 215px; height: 128px;
  display: flex; align-items: end; justify-content: space-around;
  padding: 0 12px 13px;
  border-bottom: 8px solid #4b3025;
  filter: drop-shadow(0 5px 3px #0008);
}
.bottle { display: block; width: 22px; height: 64px; background: #754520; border: 3px solid #1a1010; box-shadow: inset 4px 0 #d9a95b22; position: relative; }
.bottle::before { content: ""; position: absolute; width: 10px; height: 20px; left: 3px; top: -22px; background: inherit; border: 3px solid #1a1010; border-bottom: 0; }
.bottle::after { content: ""; position: absolute; left: 3px; right: 3px; top: 25px; height: 15px; background: #c6aa7299; }
.bottle.green { background: #294c3c; }.bottle.clear { background: #72858a88; }.bottle.red { background: #63322f; }
.bottle.tall { height: 84px; }.bottle.short { height: 48px; }

.lamp { position: absolute; left: 50%; top: -6px; width: 4px; height: 68px; background: #453a34; }
.lamp i { position: absolute; width: 84px; height: 34px; left: -40px; bottom: -20px; background: #8f632e; clip-path: polygon(25% 0,75% 0,100% 100%,0 100%); box-shadow: 0 16px 30px #e0a54a33; }

.senpai { position: absolute; width: 132px; height: 212px; left: calc(50% - 66px); top: 94px; filter: drop-shadow(8px 10px 0 #08060988); }
.senpai[data-visual-mode="image"] { width: 220px; height: 274px; left: calc(50% - 110px); filter: drop-shadow(8px 10px 0 #08060988); }
.senpai[data-visual-mode="image"] .legacy-character-sprite { display: none; }
.character-sprite-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  transform: translate(var(--character-offset-x, 0), var(--character-offset-y, 0)) scale(var(--character-scale, 1));
  transform-origin: center bottom;
}
.senpai[data-visual-mode="image"][data-reaction="speaking"] .character-sprite-image { animation: character-boast 1.6s steps(2, end) infinite; }
.senpai[data-visual-mode="image"][data-reaction="pressured"] .character-sprite-image { animation: character-pressure .28s steps(2, end) 2; }
.senpai[data-visual-mode="image"][data-reaction="defeated"] .character-sprite-image { filter: saturate(.76) brightness(.88); }
.senpai .face { position: absolute; left: 30px; top: 24px; width: 72px; height: 77px; background: #c08b69; border: 6px solid #24191a; box-shadow: inset 9px -9px #8c5c4e; }
.senpai .hair { position: absolute; z-index: 2; left: 25px; top: 13px; width: 83px; height: 33px; background: #211a1d; box-shadow: -6px 15px #211a1d, 8px 8px #211a1d; clip-path: polygon(0 20%,20% 0,100% 10%,95% 100%,78% 62%,63% 85%,45% 55%,25% 80%,0 65%); }
.eye { position: absolute; top: 36px; width: 8px; height: 5px; background: #211619; }
.eye.left { left: 13px; }.eye.right { right: 13px; }
.mouth { position: absolute; left: 27px; top: 58px; width: 18px; height: 5px; border-bottom: 4px solid #4d2928; transform: skewX(-12deg); }
.senpai .body { position: absolute; left: 9px; top: 98px; width: 114px; height: 112px; background: #393a42; border: 6px solid #171317; clip-path: polygon(17% 0,83% 0,100% 22%,95% 100%,5% 100%,0 22%); box-shadow: inset 17px 0 #303139, inset -17px 0 #27272e; }
.senpai .tie { position: absolute; left: 48px; top: 0; width: 13px; height: 69px; background: repeating-linear-gradient(45deg, #9b4a40 0 6px, #d09b4b 6px 10px); clip-path: polygon(0 0,100% 0,80% 80%,50% 100%,20% 80%); }
.senpai .glass { position: absolute; right: -5px; bottom: 2px; width: 35px; height: 48px; border: 5px solid #8aa2a499; border-top: 2px solid #8aa2a499; background: linear-gradient(transparent 38%, #a96128aa 39%); transform: rotate(5deg); }

@keyframes character-boast {
  0%, 100% { transform: translate(var(--character-offset-x, 0), var(--character-offset-y, 0)) scale(var(--character-scale, 1)); }
  50% { transform: translate(var(--character-offset-x, 0), calc(var(--character-offset-y, 0) - 2px)) scale(var(--character-scale, 1)); }
}

@keyframes character-pressure {
  0%, 100% { transform: translate(var(--character-offset-x, 0), var(--character-offset-y, 0)) scale(var(--character-scale, 1)); }
  50% { transform: translate(calc(var(--character-offset-x, 0) + 3px), var(--character-offset-y, 0)) scale(var(--character-scale, 1)); }
}

.enemy-speech {
  position: absolute;
  z-index: 6;
  left: 4%;
  top: 190px;
  width: min(34%, 290px);
  min-height: 92px;
  padding: 12px 15px 13px;
  color: #241b1c;
  border: 3px solid #332729;
  border-radius: 7px;
  background: #f0dfb8;
  box-shadow: 6px 7px #09070a99, inset 0 0 0 2px #fff6d4;
  transform-origin: 100% 75%;
}
.enemy-speech::after {
  content: "";
  position: absolute;
  right: -25px;
  bottom: 18px;
  width: 28px;
  height: 22px;
  background: #f0dfb8;
  border-bottom: 3px solid #332729;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.enemy-speech.is-speaking { animation: speech-arrive .28s ease both; }
.speech-speaker { display: flex; align-items: center; gap: 7px; color: #6d3b35; font-size: 10px; font-weight: 900; }
.speech-speaker span { padding: 2px 5px; color: #f7e8c4; background: #8f4039; font-size: 8px; letter-spacing: .08em; }
.enemy-speech .dialog-text { margin: 7px 0 0; padding-right: 17px; font-size: clamp(var(--text-xs), 1.45vw, var(--text-base)); line-height: 1.55; font-weight: 800; }
.enemy-speech .dialog-text::after { color: #45869a; }
.dialog-advance { position: absolute; right: 10px; bottom: 7px; color: #6d3b35; font-size: 10px; line-height: 1; animation: dialog-advance-blink .9s steps(1, end) infinite; }

/* 泣き上戸の同期：先輩とは髪型・服・表情・持ち物の輪郭から変える。 */
.game-shell[data-enemy-id="nakijozu-doki"] .senpai {
  width: 142px;
  left: calc(50% - 71px);
  filter: drop-shadow(8px 10px 0 #08060988) drop-shadow(0 0 12px #6b334033);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .face {
  left: 35px;
  top: 29px;
  width: 68px;
  height: 73px;
  background: #c99478;
  border-color: #2b1d25;
  box-shadow: inset 7px -7px #9e685f;
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .hair {
  left: 25px;
  top: 10px;
  width: 92px;
  height: 104px;
  background: #30212b;
  box-shadow: none;
  clip-path: polygon(12% 7%,30% 0,72% 2%,91% 15%,100% 41%,91% 96%,75% 83%,77% 36%,65% 22%,49% 31%,31% 19%,21% 37%,23% 84%,6% 98%,0 43%);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .hair::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 10px;
  width: 40px;
  height: 25px;
  background: #4b3040;
  clip-path: polygon(0 0,100% 15%,76% 42%,51% 29%,24% 73%);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .eye {
  top: 35px;
  width: 10px;
  height: 6px;
  background: transparent;
  border-bottom: 4px solid #2b1821;
  transform: rotate(8deg);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .eye.right { transform: rotate(-8deg); }
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .mouth {
  left: 25px;
  top: 57px;
  width: 18px;
  height: 8px;
  border: 0;
  border-top: 4px solid #6b343b;
  transform: rotate(-4deg);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .face::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 45px;
  width: 5px;
  height: 13px;
  background: #79b9c5;
  clip-path: polygon(50% 0,100% 65%,78% 100%,22% 100%,0 65%);
  filter: drop-shadow(0 0 3px #77b8c9aa);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .body {
  left: 6px;
  top: 100px;
  width: 130px;
  height: 110px;
  background: #653443;
  border-color: #21141b;
  clip-path: polygon(22% 0,78% 0,96% 18%,100% 100%,0 100%,4% 18%);
  box-shadow: inset 23px 0 #4f2937, inset -23px 0 #4f2937;
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .body::before {
  content: "";
  position: absolute;
  left: 39px;
  top: 0;
  width: 40px;
  height: 76px;
  background: #d2b9a1;
  clip-path: polygon(0 0,35% 0,50% 15%,65% 0,100% 0,86% 100%,14% 100%);
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .body::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 51px;
  width: 28px;
  height: 23px;
  background: #ded5c5;
  border: 3px solid #8b7f78;
  transform: rotate(10deg);
  box-shadow: inset 5px -5px #bbb0a4;
}
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .tie { display: none; }
.game-shell[data-enemy-id="nakijozu-doki"] .senpai .glass {
  right: -1px;
  bottom: 5px;
  width: 31px;
  height: 50px;
  border: 5px solid #17151d;
  border-top-width: 5px;
  border-radius: 3px;
  background: linear-gradient(#446777 0 72%, #222633 73%);
  box-shadow: inset 0 0 0 2px #7399a455;
  transform: rotate(-7deg);
}

/* 潰れかけの後輩：短い髪、パーカ、赤い頬、ショットグラスで介抱型を判別できる。 */
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai {
  width: 148px;
  left: calc(50% - 74px);
  transform: rotate(3deg) translateY(7px);
  filter: drop-shadow(9px 11px 0 #08060988) drop-shadow(0 0 12px #d6673933);
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .face {
  left: 37px; top: 31px; width: 73px; height: 70px;
  background: #c98a68; border-color: #25191a;
  box-shadow: inset 8px -7px #a65d54, inset -12px 0 #d56a5b55;
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .hair {
  left: 28px; top: 10px; width: 96px; height: 48px;
  background: #382a23; box-shadow: none;
  clip-path: polygon(0 50%,10% 18%,24% 31%,34% 0,47% 27%,63% 3%,70% 31%,88% 14%,100% 48%,91% 91%,76% 66%,61% 91%,45% 60%,27% 86%,10% 67%);
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .eye {
  top: 37px; width: 13px; height: 4px; background: transparent;
  border-bottom: 4px solid #29191a;
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .eye.left { transform: rotate(11deg); }
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .eye.right { transform: rotate(-11deg); }
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .mouth {
  left: 27px; top: 57px; width: 21px; height: 8px;
  border: 0; border-bottom: 5px solid #712f2f; transform: rotate(5deg);
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .face::after {
  content: ""; position: absolute; left: 7px; top: 46px; width: 14px; height: 7px;
  background: #d96d62; box-shadow: 47px 1px #d96d62; opacity: .8;
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .body {
  left: 3px; top: 96px; width: 138px; height: 118px;
  background: #36515a; border-color: #172126;
  clip-path: polygon(17% 0,83% 0,100% 25%,94% 100%,6% 100%,0 25%);
  box-shadow: inset 22px 0 #29414a, inset -22px 0 #29414a;
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .body::before {
  content: ""; position: absolute; left: 38px; top: -4px; width: 53px; height: 40px;
  border: 7px solid #1f343b; border-top: 0; border-radius: 0 0 50% 50%;
}
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .tie { display: none; }
.game-shell[data-enemy-id="tsuburekake-kohai"] .senpai .glass {
  right: 4px; bottom: 4px; width: 25px; height: 31px;
  border: 5px solid #9bb4b599; border-top-width: 3px;
  background: linear-gradient(transparent 25%, #d7d2c988 26%);
  transform: rotate(16deg);
}

.dialog-box {
  grid-row: 2;
  margin: 0 18px 12px;
  min-height: 144px;
  padding: 16px 20px 14px;
  position: relative;
  z-index: 2;
  border: 2px solid #526d73;
  border-left: 5px solid #69a7b4;
  background: #0c1418f2;
  box-shadow: inset 0 0 0 3px #1d2b30, 6px 6px #070609aa;
}
.message-heading { display: flex; align-items: center; gap: 9px; color: #b9d8de; font-weight: 700; font-size: 13px; }
.message-heading span { padding: 2px 6px; color: #071115; background: #69a7b4; font-size: 9px; letter-spacing: .08em; }
.dialog-text { position: relative; }
.dialog-text::after { content: attr(data-text); display: none; position: absolute; inset: 0; color: #65a9b8; pointer-events: none; }
.reaction { margin: 9px 0 0; color: #b8c8c8; font-size: 12px; line-height: 1.7; }
.reaction::before { content: "▸"; margin-right: 7px; color: #69a7b4; font-weight: 900; }
.battle-messages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 10px 0 0; padding: 0; list-style: none; }
.battle-messages:empty { display: none; }
.battle-messages li { position: relative; padding-left: 17px; color: #f0e5cf; font-size: clamp(12px, 1.45vw, 15px); font-weight: 800; line-height: 1.55; animation: battle-message-arrive .22s ease both; }
.battle-messages li::before { content: "▶"; position: absolute; left: 0; top: .08em; color: #d3a251; font-size: .72em; }
.battle-messages li[data-tone="loss"], .battle-messages li[data-tone="critical"] { color: #f09a82; }
.battle-messages li[data-tone="gain"] { color: #9bd1a5; }
.battle-messages li[data-tone="cost"] { color: #e7c47e; }
.battle-messages li[data-tone="critical"] { text-shadow: 0 0 10px #d9584d77; }
/* じぶん／あいての集約行: 全幅で縦に積み、行頭ラベルは基底色・トークンは span 単位で色分け */
.battle-messages li.battle-line { grid-column: 1 / -1; }
.battle-messages li.battle-line .battle-line-label,
.battle-messages li.battle-line .battle-line-sep { color: #f0e5cf; }
.battle-messages li.battle-line span[data-tone="loss"] { color: #f09a82; }
.battle-messages li.battle-line span[data-tone="gain"] { color: #9bd1a5; }
.battle-messages li.battle-line span[data-tone="cost"] { color: #e7c47e; }
.game-shell[data-resolving="true"] .dialog-box { border-color: #75aeb8; box-shadow: inset 0 0 0 3px #21363b, 6px 6px #070609aa, 0 0 22px #65a9b833; }
.payoff-notes { display: grid; gap: 4px; list-style: none; margin: 8px 0 0; padding: 0; color: #bde8c3; font-size: 12px; font-weight: 800; line-height: 1.6; }
.payoff-notes:empty { display: none; }
.payoff-notes li { animation: payoff-arrive .45s ease both; text-shadow: 0 0 10px #82bd8e55; }

.counter {
  grid-row: 3;
  position: relative;
  z-index: 3;
  min-height: 210px;
  padding: 18px;
  border-top: 7px solid #6c422e;
  background: linear-gradient(#392318, #271711 78%, #170e0d);
  box-shadow: inset 0 5px #1d100d, inset 0 9px #8a5532;
}
.counter-grain { position: absolute; inset: 0; opacity: .22; background: repeating-linear-gradient(174deg, transparent 0 17px, #bc7944 18px 20px, transparent 21px 42px); pointer-events: none; }
.choices-heading { position: relative; display: flex; justify-content: space-between; margin-bottom: 12px; color: #d6bb8d; font-weight: 700; }
.choices-heading small { color: #aa9380; font-size: 12px; font-weight: 400; }
.preparations { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; margin: -3px 0 12px; }
.preparations-label { color: #b09a7f; font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.preparation-list { display: flex; gap: 5px; min-width: 0; overflow-x: auto; padding: 2px 1px 4px; scrollbar-width: thin; }
.preparation-chip, .preparation-empty { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #71866c; color: #c9e4c5; background: #182018; font-size: 10px; line-height: 1.35; white-space: nowrap; }
.preparation-chip[data-consumable="true"] { border-style: dashed; color: #efd49a; border-color: #a9834e; background: #2a2013; }
.preparation-chip.is-boon { color: #7fc8a9; border-color: #7fc8a9; background: #16241d; }
.preparation-chip.is-trouble { color: #e26d5c; border-color: #e26d5c; background: #241614; animation: trouble-pulse 2.4s ease-in-out infinite; }
.preparation-empty { color: #766b5e; border-color: #493e36; background: #191310; }

@keyframes trouble-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.focus-tools { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin: -2px 0 12px; padding: 8px; border: 1px solid #66523a; background: #170f0de8; }
.focus-tools[hidden] { display: none; }
.focus-tools p { margin: 0; color: #c7b69e; font-size: 11px; line-height: 1.65; }
.brace-button { min-width: 180px; min-height: 48px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px 10px; text-align: left; color: #ead7ae; border: 1px solid #c79d54; border-bottom-width: 3px; background: #302113; cursor: pointer; box-shadow: 3px 3px #090606; }
.brace-button > span { grid-row: span 2; padding: 4px; color: #182319; background: #88bd8c; font-size: 8px; font-weight: 900; }
.brace-button strong { font-size: 14px; }
.brace-button small { color: #cdbfa8; font-size: 10px; }
.brace-button:hover:not(:disabled) { border-color: #f0c56f; background: #402c17; }
.brace-button:disabled { opacity: .48; cursor: not-allowed; }
.brace-button.is-active { opacity: 1; color: #c7edcc; border-color: #82bd8e; background: #17251a; box-shadow: 0 0 18px #82bd8e33; }
.choices { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.choice-card {
  min-width: 0;
  min-height: 150px;
  padding: 15px 14px 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  border: 2px solid #655348;
  border-bottom-width: 5px;
  background: #1d191b;
  box-shadow: 4px 5px #120b0a99;
  transition: translate .12s ease, border-color .12s, background .12s, box-shadow .12s;
}
.choice-card:hover { translate: 0 -3px; border-color: #d0a35e; background: #292123; }
.choice-card:active { translate: 0 1px; border-bottom-width: 2px; margin-bottom: 3px; }
.choice-number { color: #ad8e70; font-size: 11px; }
.choice-card[data-focus-required="true"] .choice-number::after { content: " HOLD"; margin-left: 5px; color: #f0c56f; font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.choice-card strong { margin: auto 0 8px; font-size: clamp(14px, 1.65vw, 18px); line-height: 1.42; }
.choice-card small { color: #b9aa98; font-size: 12px; line-height: 1.55; }
.choice-card::after { content: ""; position: absolute; width: 7px; height: 7px; right: 10px; top: 10px; background: #8d7b68; }
.choice-card[data-anchored="true"] { border-color: #75ad7f; box-shadow: 4px 5px #120b0a99, 0 0 16px #82bd8e44; }
.choice-card[data-anchored="true"]::before { content: "命綱"; position: absolute; right: 8px; bottom: 7px; padding: 2px 5px; color: #142019; background: #82bd8e; font-size: 10px; font-weight: 900; }
.choice-card[data-payoff-ready="true"] { border-color: #8fc998; background: linear-gradient(145deg, #1d251e, #1d191b 58%); box-shadow: 4px 5px #120b0a99, 0 0 22px #82bd8e55; }
.choice-payoff-badge { position: absolute; left: 8px; bottom: 7px; padding: 2px 5px; color: #d6f3d9; border: 1px solid #82bd8e; background: #1a2b1d; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.choice-card.is-focusing { z-index: 6; animation: none !important; translate: 0 -5px; border-color: #f0c56f !important; background: #32271f; box-shadow: 0 0 0 2px #f0c56f55, 0 0 30px #f0c56f66 !important; }
.focus-track { display: none; position: absolute; left: 10px; right: 10px; bottom: 8px; height: 8px; overflow: visible; border: 1px solid #6e5c49; background: #090809; box-shadow: inset 0 0 0 1px #1b1513; pointer-events: none; }
.choice-card.is-focusing .focus-track { display: block; }
.focus-track i { position: absolute; top: 0; bottom: 0; left: 50%; width: var(--focus-window, 34%); translate: -50% 0; background: #82bd8e; box-shadow: 0 0 9px #82bd8eaa; }
.focus-track b { position: absolute; z-index: 2; top: -3px; bottom: -3px; left: 0; width: 3px; translate: -1px 0; background: #f5e4af; box-shadow: 0 0 7px #fff1bddd; animation: focus-sweep var(--focus-duration, 1200ms) linear infinite; }
.choice-card[data-tone-visible="true"].tone-danger::after,
.choice-card[data-tone-visible="true"].tone-drink::after { background: var(--red); }
.choice-card[data-tone-visible="true"].tone-safe::after,
.choice-card[data-tone-visible="true"].tone-leave::after { background: var(--green); }
.choice-card[data-tone-visible="true"].tone-food::after { background: var(--gold); }
.choice-card[data-anchored="true"]::after,
.choice-card[data-payoff-ready="true"]::after { background: var(--green); }
.choices[data-resolving="true"] .choice-card:not(.is-answer-reveal) { opacity: .5; }
.choice-card.is-answer-reveal { z-index: 7; animation: none !important; translate: 0 -5px; pointer-events: none; }
.choice-card.is-answer-reveal.tone-danger,
.choice-card.is-answer-reveal.tone-drink { border-color: var(--red); background: #32191b; box-shadow: 0 0 0 2px #c85b4b55, 0 0 28px #c85b4b55; }
.choice-card.is-answer-reveal.tone-safe,
.choice-card.is-answer-reveal.tone-leave { border-color: var(--green); background: #17251a; box-shadow: 0 0 0 2px #82bd8e44, 0 0 28px #82bd8e55; }
.choice-card.is-answer-reveal.tone-food { border-color: var(--gold); background: #2e2415; box-shadow: 0 0 0 2px #d5a64a44, 0 0 28px #d5a64a44; }
.choice-card.is-answer-reveal[data-anchored="true"]::before { display: none; }
.choice-result-badge { position: absolute; right: 8px; bottom: 7px; padding: 2px 5px; color: #171116; background: #b8aa98; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.choice-card.is-answer-reveal.tone-danger .choice-result-badge,
.choice-card.is-answer-reveal.tone-drink .choice-result-badge { color: #fff2e7; background: var(--red); }
.choice-card.is-answer-reveal.tone-safe .choice-result-badge,
.choice-card.is-answer-reveal.tone-leave .choice-result-badge { background: var(--green); }
.choice-card.is-answer-reveal.tone-food .choice-result-badge { background: var(--gold); }
.misclick-alert {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  background: #16090ca8;
  backdrop-filter: blur(2px);
}
.misclick-alert.is-visible {
  visibility: visible;
  opacity: 1;
  animation: misclick-screen 1.4s ease both;
}
.misclick-alert-card {
  width: min(520px, 92vw);
  padding: clamp(24px, 5vw, 42px);
  text-align: center;
  border: 3px solid #ef6656;
  background: #1b1015f5;
  box-shadow: 9px 10px #080407, 0 0 42px #ef665677, inset 0 0 0 4px #3d1d25;
}
.misclick-alert.is-visible .misclick-alert-card { animation: misclick-card 1.4s cubic-bezier(.2,.75,.2,1) both; }
.misclick-alert-card span { display: block; margin-bottom: 11px; color: #ef6656; font-size: 10px; font-weight: 900; letter-spacing: .2em; }
.misclick-alert-card strong { display: block; color: #f1d7a6; font-size: clamp(25px, 6vw, 46px); line-height: 1.2; text-shadow: 3px 3px #8a2c31; }
.misclick-alert-card p { margin: 17px 0 0; color: #e3d9cb; font-size: clamp(12px, 2.4vw, 17px); font-weight: 700; line-height: 1.7; }

.focus-tutorial { position: absolute; z-index: 80; inset: 0; display: none; place-items: center; padding: 18px; background: #0c080cdd; backdrop-filter: blur(5px); }
.focus-tutorial.is-visible { display: grid; }
.focus-tutorial-card { width: min(560px, 100%); padding: clamp(22px, 4vw, 36px); text-align: center; border: 2px solid #d0a35e; background: #171318f7; box-shadow: 9px 10px #070507, inset 0 0 0 4px #2c2220, 0 0 42px #d0a35e33; }
.focus-tutorial-kicker { color: #e66f5e; font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.focus-tutorial-card h2 { margin: 10px 0 12px; color: #f1d7a6; font-size: clamp(25px, 5vw, 39px); }
.focus-tutorial-card > p:not(.tutorial-feedback) { margin: 0 auto 18px; max-width: 450px; color: #c8baa4; font-size: 12px; line-height: 1.8; }
.tutorial-practice { width: min(390px, 100%); min-height: 104px; position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; margin: 0 auto; padding: 15px 18px 28px; color: #eadbbd; border: 2px solid #79634e; border-bottom-width: 5px; background: #251d1b; cursor: pointer; box-shadow: 5px 6px #080608; }
.tutorial-practice strong { font-size: 17px; }
.tutorial-practice small { color: #9e8e7e; font-size: 10px; }
.tutorial-practice .focus-track { display: block; left: 16px; right: 16px; bottom: 10px; }
.tutorial-practice .focus-track b { animation-play-state: paused; }
.tutorial-practice.is-focusing { border-color: #f0c56f; box-shadow: 0 0 0 2px #f0c56f55, 0 0 28px #f0c56f55; }
.tutorial-practice.is-focusing .focus-track b { animation-play-state: running; }
.tutorial-practice.is-success { color: #d5f0d9; border-color: #82bd8e; background: #17251a; box-shadow: 0 0 32px #82bd8e55; }
.tutorial-feedback { min-height: 24px; margin: 15px 0 8px; color: #e8c478; font-size: 11px; font-weight: 800; }
.tutorial-note { display: block; color: #867a6f; font-size: 9px; line-height: 1.6; }
.tutorial-skip { margin-top: 14px; padding: 7px 10px; color: #8f8276; border: 1px solid #4a3d3e; background: transparent; font-size: 9px; cursor: pointer; }
.tutorial-skip:hover { color: #c7b9a7; border-color: #796756; }

.receipt {
  min-height: 630px;
  padding: 27px 18px 18px;
  position: relative;
  color: var(--paper-ink);
  background: var(--paper);
  box-shadow: 8px 12px 0 #05040588;
  clip-path: polygon(0 0,100% 0,100% 98%,96% 100%,91% 98%,86% 100%,81% 98%,76% 100%,71% 98%,66% 100%,61% 98%,56% 100%,51% 98%,46% 100%,41% 98%,36% 100%,31% 98%,26% 100%,21% 98%,16% 100%,11% 98%,6% 100%,0 98%);
}
.receipt::before { content: ""; position: absolute; inset: 0; opacity: .2; background: repeating-linear-gradient(5deg, transparent 0 12px, #6e5e48 13px); pointer-events: none; }
.receipt-pin { position: absolute; width: 12px; height: 12px; border-radius: 50%; top: 10px; left: 50%; background: #574c42; box-shadow: inset 2px 2px #9a8b78; }
.receipt-kicker { margin: 5px 0 2px; text-align: center; font-size: 9px; letter-spacing: .15em; }
.receipt h2 { margin: 6px 0 12px; text-align: center; font-size: 22px; }
.receipt-rule { border-top: 2px dashed #776b59; margin: 12px 0; }
.receipt ol { list-style: none; margin: 0; padding: 0; font-size: 11px; }
.receipt li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dotted #998d78; }
.receipt li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt li b { white-space: nowrap; }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; }
.receipt-total strong { font-size: 20px; }
.receipt-note { min-height: 32px; color: #7a342d; font-size: 9px; line-height: 1.5; }
.best-result { position: absolute; left: 14px; right: 14px; bottom: 28px; padding: 9px 5px; border: 2px solid #944f43; color: #7c372f; font-size: 10px; text-align: center; transform: rotate(-1deg); }

.fake-cursor { position: absolute; z-index: 20; left: -7px; top: -5px; width: 17px; height: 25px; opacity: 0; pointer-events: none; background: #f3db9f; clip-path: polygon(0 0,100% 68%,55% 70%,72% 100%,55% 100%,39% 72%,0 100%); filter: drop-shadow(3px 3px #111); transition: opacity .1s; }
.fake-cursor.is-visible { opacity: .78; }

@keyframes payoff-arrive { from { opacity: 0; translate: -8px 0; filter: blur(2px); } to { opacity: 1; translate: 0 0; filter: blur(0); } }
@keyframes speech-arrive { from { opacity: .2; transform: scale(.88) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes battle-message-arrive { from { opacity: 0; transform: translateX(-9px); } to { opacity: 1; transform: translateX(0); } }
@keyframes hud-impact { 35% { transform: translateY(-5px) scale(1.025); } 100% { transform: translateY(-3px) scale(1); } }

[hidden] { display: none !important; }
.overlay { position: fixed; z-index: 100; inset: 0; display: none; place-items: center; padding: 20px; background: #09070bd9; backdrop-filter: blur(4px); }
.overlay.is-visible { display: grid; }
.start-card, .result-card { width: min(780px, 100%); max-height: calc(100vh - 30px); overflow-y: auto; padding: clamp(22px, 4vw, 38px); text-align: center; border: 2px solid #786251; background: #171318; box-shadow: 10px 12px 0 #050405, inset 0 0 0 4px #271e25; }
.portrait-mini { display: grid; place-items: center; width: 70px; height: 70px; margin: 10px auto; color: #2a1e1c; background: #b07b5e; border: 6px solid #342426; box-shadow: 8px 8px #080608; font-size: 30px; font-weight: 900; }
.character-icon-image { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.start-card h2, .result-card h2 { margin: 12px 0; font-size: clamp(25px, 5vw, 38px); }
.start-card blockquote { margin: 15px 0; color: #eccb8d; font-size: 17px; }
.start-card > p:not(.eyebrow), .result-comment { color: #c5b8a6; font-size: 14px; line-height: 1.85; }
.mission-row { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px; align-items: center; margin: 22px 0; padding: 10px; border: 1px solid #43363a; }
.mission-row span { color: #a09284; font-size: 10px; }.mission-row b { color: #e4bd71; font-size: 14px; }
.primary-button { min-height: 48px; padding: 12px 25px; border: 2px solid #d4a04e; border-bottom-width: 5px; color: #21160d; background: #d5a64a; font-weight: 900; cursor: pointer; box-shadow: 4px 5px #080608; }
.primary-button:hover { background: #f0c56f; transform: translateY(-2px); }
.boot-error {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid #9b5449;
  color: #efb0a5;
  background: #2a1517;
  font-size: 11px;
  line-height: 1.7;
}
.boot-error[hidden] { display: none; }
.boot-error code { color: #f2d28d; }
.result-label { display: inline-block; margin: 0; padding: 4px 8px; color: #181014; background: var(--red); font-size: 11px; font-weight: 900; }
.result-card dl { display: grid; grid-template-columns: repeat(4, 1fr); margin: 23px 0 12px; border: 1px solid #44363a; }
.result-card dl div { padding: 12px 6px; border-right: 1px solid #44363a; }.result-card dl div:last-child { border: 0; }
.result-card dt { color: #a4978a; font-size: 11px; }.result-card dd { margin: 7px 0 0; font-size: 14px; font-weight: 800; }
.result-aftermath { margin: 0 0 20px; color: #ddc99f; font-size: 13px; line-height: 1.75; }
.result-title-badge { margin: 0 0 12px; color: #a4978a; font-size: 12px; }
.result-title-badge strong { display: inline-block; margin-left: 8px; color: #f0c56f; font-size: 19px; }
.run-score { margin: 0 0 13px; padding: 9px; color: #92cc9d; border: 1px solid #4e7458; background: #112018; font-size: 17px; font-weight: 900; letter-spacing: .12em; }
.share-card-preview { display: block; width: min(100%, 600px); height: auto; margin: 0 auto 18px; border: 2px solid #5c4b42; box-shadow: 6px 7px #09070a; background: #120f13; }
.result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.secondary-button { min-height: 48px; padding: 12px 20px; border: 2px solid #756253; border-bottom-width: 5px; color: #d7c8ae; background: #221b20; font-weight: 800; cursor: pointer; box-shadow: 4px 5px #080608; }
.secondary-button:hover { border-color: #d4a04e; transform: translateY(-2px); }
.share-button, .survival-button, .x-share-button { min-height: 48px; padding: 12px 20px; border: 2px solid #78ae83; border-bottom-width: 5px; color: #102014; background: #82bd8e; font-weight: 900; cursor: pointer; box-shadow: 4px 5px #080608; }
.share-button:hover, .survival-button:hover, .x-share-button:hover { background: #9ad0a5; transform: translateY(-2px); }
.x-share-button { color: #fff; border-color: #50545a; background: #08090a; }
.x-share-button:hover { border-color: #aeb5bd; background: #1d2023; }
.x-share-hint { margin: 16px 0 0; padding: 9px 12px; color: #cfd4d9; border: 1px solid #464c52; background: #101316; font-size: 10px; line-height: 1.6; }
.survival-button { color: #24170d; border-color: #e6b95f; background: #d5a64a; }
.survival-button:hover { background: #f0c56f; }
.survival-button span { display: block; color: #684615; font-size: 8px; letter-spacing: .16em; }

.enemy-select-overlay { overflow-y: auto; place-items: start center; }
.enemy-select-card { width: min(1120px, 100%); margin: auto 0; padding: clamp(22px, 3vw, 38px); border: 2px solid #786251; background: #171318; box-shadow: 10px 12px 0 #050405, inset 0 0 0 4px #271e25; }
.select-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.select-heading h2 { margin: 2px 0 0; font-size: clamp(25px, 4vw, 38px); }
.select-heading > p { width: min(440px, 48%); margin: 0; color: #b5a795; font-size: 13px; line-height: 1.75; text-align: right; }
.meta-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -7px 0 14px; padding-bottom: 12px; border-bottom: 1px solid #3b3033; }
.meta-toolbar p { margin: 0; color: #91cc9c; font-size: 12px; }
.compact-button { min-height: 34px; padding: 6px 12px; border-bottom-width: 3px; font-size: 10px; }
.enemy-select-layout { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.6fr); gap: 14px; }
.enemy-roster { display: grid; align-content: start; gap: 9px; }
.enemy-card { width: 100%; min-height: 96px; padding: 12px; display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid #493a3b; border-bottom-width: 4px; background: #100d11; cursor: pointer; }
.enemy-card:hover, .enemy-card.is-selected { border-color: #d3a351; background: #251c20; }
.enemy-card.is-selected::after { content: "SELECTED"; margin-left: auto; color: #d3a351; font-size: 8px; writing-mode: vertical-rl; }
.enemy-card.is-locked { opacity: .44; cursor: not-allowed; filter: grayscale(1); }
.enemy-card-portrait { flex: 0 0 52px; height: 52px; display: grid; place-items: center; color: #281c1c; background: #aa745b; border: 4px solid #382628; font-size: 22px; font-weight: 900; }
.enemy-card-portrait:has(.character-icon-image), .portrait-mini:has(.character-icon-image) { overflow: hidden; padding: 0; background: #24191a; }
.enemy-card > span:not(.enemy-card-portrait) { display: grid; gap: 6px; min-width: 0; }
.enemy-card strong { font-size: 15px; }
.enemy-card small { color: #a99b8e; font-size: 11px; line-height: 1.5; }
.enemy-detail { padding: 18px 20px 20px; border: 1px solid #493b3e; background: linear-gradient(135deg, #1f181d, #120f13); }
.enemy-profile-head { display: flex; align-items: center; gap: 20px; }
.enemy-profile-head .portrait-mini { flex: 0 0 70px; margin: 0; }
.enemy-type { margin: 0 0 5px; color: #c85b4b; font-size: 9px; letter-spacing: .12em; }
.enemy-detail h3 { margin: 0; font-size: clamp(21px, 3vw, 31px); }
.enemy-detail blockquote { margin: 8px 0 0; color: #e5bf79; font-size: 15px; line-height: 1.55; }
.enemy-description { margin: 17px 0; color: #c1b4a3; font-size: 13px; line-height: 1.85; }
.survival-rules { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 0 0 13px; padding: 0; }
.survival-rules li { display: grid; grid-template-columns: auto 1fr; gap: 9px; align-items: center; padding: 9px 10px; border: 1px solid #3c3134; background: #100d11; }
.survival-rules b { color: #d6a852; font-size: 11px; }
.survival-rules span { color: #aa9d90; font-size: 10px; line-height: 1.55; }
.enemy-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 13px; }
.enemy-stats > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 1px solid #3c3134; background: #100d11; }
.enemy-stats span { color: #b8aa9a; font-size: 11px; }
.enemy-stats i { display: flex; gap: 3px; }
.enemy-stats i b { width: 7px; height: 12px; background: #342a2e; }
.enemy-stats i b.is-on { background: #d09c4a; box-shadow: 0 0 6px #d09c4a44; }
.enemy-rules { display: grid; grid-template-columns: .65fr 1.25fr 1.6fr; border: 1px solid #45373b; }
.enemy-rules p { margin: 0; padding: 10px 12px; border-right: 1px solid #45373b; }
.enemy-rules p:last-child { border: 0; }
.enemy-rules span { display: block; margin-bottom: 6px; color: #9d9084; font-size: 10px; }
.enemy-rules b { color: #e2cda8; font-size: 11px; line-height: 1.6; }
.enemy-detail .mission-row { margin: 13px 0; }
.start-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.enemy-detail .start-actions > button { width: 100%; }
.enemy-select-card > .boot-error { text-align: center; }

.story-run-bar {
  display: grid;
  grid-template-columns: minmax(140px, .7fr) minmax(280px, 1.4fr) minmax(180px, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid #554437;
  background: linear-gradient(90deg, #211714, #171319 54%, #11151a);
  box-shadow: inset 3px 0 #c38d43;
}
.choice-number::before { content: "▶"; position: absolute; left: 8px; top: 50%; color: #f0c56f; font-size: 12px; opacity: 0; translate: -4px -50%; transition: opacity .12s ease, translate .12s ease; }
.choice-card:hover .choice-number::before,
.choice-card:focus-visible .choice-number::before,
.choice-card.is-focusing .choice-number::before { opacity: 1; translate: 0 -50%; }
.story-run-bar > div { display: grid; gap: 3px; }
.story-run-bar > div span { color: #c85b4b; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.story-run-bar > div strong { color: #efd18e; font-size: 13px; }
.story-run-bar ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 0; padding: 0; list-style: none; }
.story-run-bar li { position: relative; padding: 7px 8px; color: #6e6360; border: 1px solid #382f31; background: #100e11; font-size: 10px; text-align: center; }
.story-run-bar li + li::before { content: ""; position: absolute; left: -6px; top: 50%; width: 6px; height: 1px; background: #6d573b; }
.story-run-bar li.is-cleared { color: #142018; border-color: #52705a; background: #7bb487; }
.story-run-bar li.is-current { color: #28180d; border-color: #e0ad55; background: #d5a64a; box-shadow: 0 0 12px #d5a64a44; font-weight: 900; }
.story-run-bar > p { margin: 0; color: #9f9185; font-size: 10px; line-height: 1.55; text-align: right; }

.story-start-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, .95fr);
  width: min(1120px, 100%);
  margin: auto 0;
  overflow: hidden;
  border: 2px solid #786251;
  background: #171318;
  box-shadow: 12px 14px 0 #050405, inset 0 0 0 4px #271e25;
}
.story-start-copy { align-self: center; padding: clamp(28px, 5vw, 58px); }
.story-start-copy .story-prologue { margin: 0 0 20px; color: #9b8e82; font-family: var(--font-story); font-size: 12px; line-height: 1.9; }
.story-start-copy h2 { margin: 8px 0 18px; color: #f0d9a8; font-size: clamp(31px, 5vw, 53px); line-height: 1.18; letter-spacing: -.05em; text-shadow: 3px 3px #5b2925; }
.story-start-copy > p:not(.eyebrow, .story-prologue) { max-width: 530px; margin: 0 0 25px; color: #b9aa9b; font-family: var(--font-story); font-size: 13px; line-height: 1.9; }
.story-start-button { min-width: min(320px, 100%); text-align: left; }
.story-start-button span { display: block; color: #6b4719; font-size: 8px; letter-spacing: .18em; }
.story-start-visual { position: relative; min-height: 500px; overflow: hidden; border-left: 1px solid #5c493e; background: radial-gradient(circle at 70% 12%, #d7b66d20 0 9%, transparent 10%), linear-gradient(#11151f 0 52%, #191316 52% 100%); isolation: isolate; }
.story-start-visual::after { content: ""; position: absolute; z-index: 5; inset: 0; pointer-events: none; background: linear-gradient(90deg, #0b0b10bb, transparent 22% 78%, #0b0b10aa), repeating-linear-gradient(0deg, transparent 0 3px, #00000014 4px); mix-blend-mode: multiply; }
.story-moon { position: absolute; top: 42px; right: 70px; width: 62px; height: 62px; border-radius: 50%; background: #e2c886; box-shadow: 0 0 45px #ddb95e55; }
.story-rain { position: absolute; z-index: 4; inset: -80px; opacity: .32; background: repeating-linear-gradient(105deg, transparent 0 18px, #adc2d055 19px 20px, transparent 21px 34px); transform: rotate(4deg); }
.story-rain.rain-b { opacity: .18; transform: translateX(13px) rotate(4deg); }
.story-buildings { position: absolute; z-index: 1; inset: auto 0 112px; height: 260px; display: flex; align-items: end; }
.story-buildings i { flex: 1; height: 80%; border: 2px solid #0c0c10; background: repeating-linear-gradient(90deg, #181820 0 32px, #a6603133 33px 43px, #16171e 44px 66px); box-shadow: inset 0 -70px #0a0a0d; }
.story-buildings i:nth-child(2) { height: 100%; background: repeating-linear-gradient(90deg, #1b171e 0 26px, #cc713d44 27px 36px, #17151b 37px 61px); }
.story-buildings i:nth-child(3) { height: 67%; }
.story-road { position: absolute; z-index: 2; left: -10%; right: -10%; bottom: -100px; height: 260px; background: linear-gradient(110deg, #0a0b10, #202127 48%, #0b0b0e); transform: perspective(240px) rotateX(36deg); box-shadow: inset 0 28px #a1482b22; }
.story-road::after { content: ""; position: absolute; left: 32%; top: 0; width: 8px; height: 100%; background: linear-gradient(#d5a64a66, transparent); transform: skewX(-18deg); filter: blur(2px); }
.story-path { position: absolute; z-index: 6; left: 24px; right: 24px; bottom: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.story-path li { min-height: 112px; padding: 12px 10px; border: 1px solid #795738; background: #130f13e8; box-shadow: 5px 6px #080609aa, inset 0 3px #9d4938; }
.story-path li:nth-child(2) { transform: translateY(-17px); box-shadow: 5px 6px #080609aa, inset 0 3px #765d96; }
.story-path li:nth-child(3) { transform: translateY(-34px); box-shadow: 5px 6px #080609aa, inset 0 3px #527d75; }
.story-path span { display: block; margin-bottom: 12px; color: #c95a4b; font-size: 9px; letter-spacing: .14em; }
.story-path b { display: block; color: #f0d59d; font-size: 17px; }
.story-path small { display: block; margin-top: 5px; color: #8f8177; font-size: 8px; line-height: 1.45; }
.story-rule-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #4b3c38; border-bottom: 1px solid #4b3c38; background: #100d11; }
.story-rule-strip p { margin: 0; padding: 13px 20px; border-right: 1px solid #3e3335; }
.story-rule-strip p:last-child { border: 0; }
.story-rule-strip b { display: block; margin-bottom: 4px; color: #d29d4b; font-size: 9px; letter-spacing: .12em; }
.story-rule-strip span { color: #a79a8f; font-size: 10px; }
.other-modes { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; padding: 13px 20px 17px; }
.other-modes > span { margin-right: auto; color: #6f6560; font-size: 8px; letter-spacing: .18em; }
.story-start-card > .boot-error { grid-column: 1 / -1; margin: 0 20px 18px; text-align: center; }

.result-card.has-story { width: min(980px, 100%); }
.story-intermission { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); overflow: hidden; margin: 18px 0 22px; border: 1px solid #655044; background: #100e12; text-align: left; }
.story-transition-art { position: relative; min-height: 330px; overflow: hidden; background: linear-gradient(#111723 0 58%, #151215 58%); isolation: isolate; }
.story-transition-art::after { content: ""; position: absolute; z-index: 8; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 3px, #0002 4px), radial-gradient(circle at 50% 35%, transparent, #07070bbd 90%); pointer-events: none; }
.transition-sky { position: absolute; inset: 0; background: radial-gradient(circle at 72% 17%, #d9c281 0 5%, #d9c28133 6%, transparent 17%); }
.transition-window { position: absolute; z-index: 2; left: 7%; bottom: 20%; width: 42%; height: 45%; border: 7px solid #0c0c10; background: repeating-linear-gradient(90deg, #2a1b21 0 32px, #bd684b 33px 48px); box-shadow: 0 0 35px #a9593833; }
.transition-neon { position: absolute; z-index: 3; right: 8%; top: 20%; width: 72px; height: 124px; border: 4px solid #7e3434; background: #35171c; box-shadow: 0 0 17px #c74d4d99, inset 0 0 20px #c74d4d66; }
.transition-neon::after { content: "酒\A 場"; white-space: pre; position: absolute; inset: 10px; display: grid; place-items: center; color: #ed9c84; font: 900 23px/1.7 Georgia, serif; text-shadow: 0 0 8px #f06655; }
.transition-person { position: absolute; z-index: 5; left: 54%; bottom: 6%; width: 62px; height: 150px; border-radius: 45% 45% 8% 8%; background: #08080b; box-shadow: 18px 0 0 -8px #0b0a0e; }
.transition-person::before { content: ""; position: absolute; left: 8px; top: -39px; width: 46px; height: 48px; border-radius: 50%; background: #09090c; }
.transition-phone { position: absolute; z-index: 6; left: calc(54% + 56px); bottom: 42%; width: 16px; height: 27px; border: 3px solid #09090b; background: #9fd5ca; box-shadow: 0 0 18px #77cabd; transform: rotate(-12deg); }
.transition-platform { position: absolute; z-index: 4; left: -10%; right: -10%; bottom: -13%; height: 36%; background: linear-gradient(105deg, #090a0e, #25242a 55%, #0b0b0e); transform: skewY(-5deg); }
.story-transition-art[data-scene="neon-invite"] { background: linear-gradient(#1c1325 0 58%, #121014 58%); }
.story-transition-art[data-scene="neon-invite"] .transition-neon { right: 13%; width: 115px; height: 76px; border-color: #4f607c; box-shadow: 0 0 22px #7497c799; }
.story-transition-art[data-scene="neon-invite"] .transition-neon::after { content: "歓迎会"; color: #aac9f3; font-size: 17px; line-height: 1; }
.story-transition-art[data-scene="neon-invite"] .transition-person { left: 27%; }
.story-transition-art[data-scene="neon-invite"] .transition-phone { left: calc(27% + 57px); background: #e7a56b; box-shadow: 0 0 18px #e78c51; }
.story-transition-art[data-scene="platform-dawn"] { background: linear-gradient(#20293a 0 48%, #b7755d 49% 58%, #17151a 59%); }
.story-transition-art[data-scene="platform-dawn"] .transition-window { left: 0; bottom: 25%; width: 100%; height: 34%; border-width: 7px 0; background: repeating-linear-gradient(90deg, #272d38 0 68px, #d7a472 69px 75px, #202630 76px 142px); opacity: .7; }
.story-transition-art[data-scene="platform-dawn"] .transition-neon, .story-transition-art[data-scene="platform-dawn"] .transition-phone { display: none; }
.story-transition-art[data-scene="platform-dawn"] .transition-person { left: 48%; bottom: 9%; }
.story-transition-copy { padding: 24px clamp(20px, 4vw, 35px); }
.story-transition-copy h3 { margin: 7px 0 12px; color: #efd39c; font: 700 clamp(20px, 3vw, 28px)/1.45 var(--font-story); }
.story-transition-copy > p:not(.eyebrow) { color: #aa9e94; font-family: var(--font-story); font-size: 11px; line-height: 1.85; }
.story-effect-title { display: flex; align-items: baseline; gap: 10px; margin-top: 17px; padding-top: 14px; border-top: 1px solid #43373a; }
.story-effect-title span { color: #8f8277; font-size: 9px; letter-spacing: .12em; }
.story-effect-title strong { color: #e9b85e; font-size: 15px; }
.story-effect-note { margin: 6px 0 10px; }
.story-resource-changes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.story-resource-change { min-width: 0; padding: 8px 5px; border: 1px solid #3e3436; background: #181418; text-align: center; }
.story-resource-change span { display: block; color: #8f8379; font-size: 8px; }
.story-resource-change strong { display: block; margin-top: 5px; color: #ddd0bd; font-size: 12px; }
.story-resource-change small { display: block; margin-top: 3px; color: #72b982; font-size: 8px; }
.story-resource-change.is-loss small { color: #d06b5c; }
.story-next-lead { margin: 13px 0 0; color: #e4c27e !important; font-weight: 800; }

.daytime-overlay {
  overflow-y: auto;
  place-items: start center;
  background:
    linear-gradient(180deg, #17242a55 0%, #0a1017a8 58%, #05080dcc 100%),
    url("./assets/backgrounds/daytime-office-pixel.png") center / cover no-repeat fixed;
  backdrop-filter: none;
}
.daytime-card {
  width: min(720px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  margin: auto 0;
  padding: clamp(22px, 5vw, 42px);
  color: #e9dfcf;
  border: 1px solid #a8b8b7;
  background: linear-gradient(180deg, #202a30f2 0, #11191eea 48%, #0a1015f2 100%);
  box-shadow: 0 18px 50px #020507cc, inset 0 0 0 3px #a9c1c11a;
  backdrop-filter: blur(4px);
}
.daytime-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.daytime-heading h2 { margin: 4px 0 0; color: #f1dfba; font-size: clamp(26px, 5vw, 38px); }
.daytime-heading .eyebrow { margin: 0; }
.daytime-quit { padding: 6px 9px; color: #9e9388; border: 1px solid #5b5152; background: #18151a; font-size: 9px; cursor: pointer; }
.daytime-quit:hover, .daytime-quit:focus-visible { color: #ead8ba; border-color: #a78958; }
.daytime-progress { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin: 22px 0 25px; padding: 0; list-style: none; }
.daytime-progress li { padding: 7px 4px; color: #766f6a; border: 1px solid #494349; background: #111015; font-size: 9px; text-align: center; }
.daytime-progress li.is-complete { color: #172018; border-color: #6d8c72; background: #84ae8a; }
.daytime-progress li.is-current { color: #291c0f; border-color: #dfb25d; background: #dfb25d; font-weight: 900; }
.daytime-panel { display: grid; gap: 18px; }
.daytime-wake { margin: 0; color: #d1c6b7; font: 400 15px/1.9 var(--font-story); }
.daytime-hangover { display: grid; gap: 5px; padding: 11px 13px; border-left: 3px solid currentColor; background: #111116aa; }
.daytime-hangover span { font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.daytime-hangover small { color: #a9a097; font-size: 10px; line-height: 1.6; }
.daytime-hangover[data-level="0"] { color: #86bc90; }
.daytime-hangover[data-level="1"] { color: #e0ad55; }
.daytime-hangover[data-level="2"] { color: #dc7666; }
.daytime-resources { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.daytime-resources .story-resource-change { min-width: 0; }
.daytime-event { display: grid; gap: 12px; padding: 18px; border: 1px solid #778a8b66; background: #071015aa; box-shadow: inset 0 0 22px #02060777; }
.daytime-event .eyebrow { margin: 0; color: #c79e57; }
.daytime-event h3 { margin: -2px 0 0; color: #f1dfba; font-size: 18px; line-height: 1.5; }
.daytime-event-text { margin: 0; color: #ddd2c4; font-size: 14px; line-height: 1.8; }
.daytime-choices { display: grid; gap: 10px; }
.daytime-choice {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 3px 9px;
  min-height: 62px;
  padding: 12px 14px;
  color: #e7dcc9;
  border: 1px solid #607174;
  background: #121c21e8;
  text-align: left;
  cursor: pointer;
}
.daytime-choice-number::before { content: "▶"; position: absolute; left: 8px; top: 50%; color: #e0ad55; font-size: 11px; opacity: 0; translate: -4px -50%; transition: opacity .12s ease, translate .12s ease; }
.daytime-choice:hover:not(:disabled) .daytime-choice-number::before,
.daytime-choice:focus-visible .daytime-choice-number::before,
.daytime-choice.is-selected .daytime-choice-number::before { opacity: 1; translate: 0 -50%; }
.daytime-choice:hover:not(:disabled), .daytime-choice:focus-visible { border-color: #e0ad55; background: #263139; }
.daytime-choice-number { grid-row: span 2; color: #d4a95d; font-size: 10px; font-weight: 900; }
.daytime-choice strong { font-size: 14px; line-height: 1.45; }
.daytime-choice small { color: #a99d91; font-size: 10px; line-height: 1.55; }
.daytime-choice:disabled { cursor: default; opacity: .45; }
.daytime-choice.is-selected { opacity: 1; color: #e0f2e3; border-color: #8dc399; background: #193027; box-shadow: 0 0 18px #82bd8e33; }
.daytime-choice.is-specific::after { content: "今夜向け"; position: absolute; right: 8px; top: 7px; color: #b9d7bd; font-size: 8px; }
.daytime-message-window { position: relative; margin-top: 2px; padding: 22px 18px 17px; color: #e7eee8; border: 2px solid #b6c7bd; background: #07100eef; box-shadow: 0 7px 0 #020504, inset 0 0 22px #203d3377; }
.daytime-message-speaker { position: absolute; left: 12px; top: -13px; margin: 0; padding: 5px 10px; color: #102018; border: 1px solid #c7d6cb; background: #aac4b2; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.daytime-message-text { margin: 0; font: 700 14px/1.8 var(--font-game); text-shadow: 1px 1px 0 #020504; }
.daytime-effect-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0 0; padding: 12px 0 0; border-top: 1px solid #53675c; list-style: none; }
.daytime-effect-list li { padding: 5px 8px; color: #cce5d2; border: 1px solid #52715b; background: #12271a; font-size: 10px; font-weight: 800; }
.daytime-night-summary { display: grid; gap: 12px; margin-top: 4px; padding-top: 18px; border-top: 1px solid #6c5941; }
.daytime-night-summary .eyebrow { margin: 0; color: #e0ad55; }
.daytime-night-effects { margin: 0; color: #c7bba9; font-size: 11px; line-height: 1.7; }
.daytime-to-night { width: 100%; margin-top: 2px; }

.collection-overlay { overflow-y: auto; place-items: start center; }
.collection-card { width: min(920px, 100%); margin: auto 0; padding: clamp(20px, 4vw, 36px); border: 2px solid #786251; background: #171318; box-shadow: 10px 12px #050405, inset 0 0 0 4px #271e25; }
.collection-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.collection-heading h2 { margin: 3px 0 0; font-size: clamp(23px, 4vw, 36px); }
.collection-summary { margin: 18px 0 23px; padding: 12px; border: 1px solid #6b563f; color: #e4bd71; background: #211811; font-size: 12px; }
.collection-card section + section { margin-top: 24px; }
.collection-card h3 { margin: 0 0 10px; color: #a99c86; font-size: 12px; letter-spacing: .12em; }
.collection-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.collection-grid.title-grid { grid-template-columns: repeat(3, 1fr); }
.collection-item { min-height: 82px; display: grid; grid-template-columns: 38px 1fr; gap: 11px; align-items: center; padding: 11px; border: 1px solid #46393c; background: #110e12; }
.collection-item > span { width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid #4a3d3d; color: #65595a; background: #211a1e; font-weight: 900; }
.collection-item strong { font-size: 12px; }
.collection-item p { margin: 6px 0 0; color: #81756a; font-size: 9px; line-height: 1.5; }
.collection-item.is-unlocked { border-color: #806941; background: #1c1715; }
.collection-item.is-unlocked > span { color: #1b261d; border-color: #82bd8e; background: #82bd8e; }
.collection-item.is-unlocked strong { color: #e8c478; }
.collection-item.is-locked { opacity: .55; }
.collection-item-bonus { display: block; margin: 6px 0 0; color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .04em; }
.collection-item.is-locked .collection-item-bonus { color: #a98a4c; }

.medal-total-note { margin: 8px 0 0; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.medal-new-badge { display: inline-block; margin: 0 0 0 8px; padding: 2px 7px; color: #24170d; border: 1px solid var(--gold); background: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .06em; line-height: 1.2; white-space: nowrap; }

.guide-overlay { overflow-y: auto; place-items: start center; }
.guide-card { width: min(760px, 100%); margin: auto 0; padding: clamp(20px, 4vw, 36px); border: 2px solid #786251; background: #171318; box-shadow: 10px 12px #050405, inset 0 0 0 4px #271e25; }
.guide-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.guide-heading h2 { margin: 3px 0 0; font-size: clamp(23px, 4vw, 36px); }
.guide-sections { display: grid; gap: 18px; margin-top: 20px; }
.guide-section { padding: 26px 18px 16px; }
.guide-section p { margin: 0; color: #d8cdb9; font-size: 13px; line-height: 1.85; }
.guide-section p + p { margin-top: 10px; }
.guide-list { margin: 0 0 12px; padding-left: 1.3em; color: #d8cdb9; font-size: 13px; line-height: 1.75; }
.guide-list li + li { margin-top: 4px; }

@media (max-width: 640px) {
  .guide-overlay { padding: 10px; }
  .guide-card { padding: 18px 14px; }
  .guide-sections { gap: 14px; }
  .guide-section { padding: 24px 12px 14px; }
}

.game-shell[data-patience-danger="true"] .dialog-box { border-color: #9d4d48; box-shadow: inset 0 0 0 3px #3b1e25, 6px 6px #070609aa, 0 0 25px #a23f3833; }

@keyframes rain { from { transform: translateY(-35px) rotate(12deg); } to { transform: translateY(70px) rotate(12deg); } }
@keyframes tipsy-1 { 0%,100% { transform: translate(0,0) rotate(0); } 40% { transform: translate(1.5px,-1px) rotate(.3deg); } 70% { transform: translate(-1.5px,1px) rotate(-.3deg); } }
@keyframes tipsy-2 { 0%,100% { transform: translate(0,0) rotate(0); } 35% { transform: translate(3px,-2px) rotate(.5deg); } 72% { transform: translate(-3px,2px) rotate(-.5deg); } }
@keyframes tipsy-3 { 0%,100% { transform: translate(0,0) rotate(0); } 30% { transform: translate(5px,-3px) rotate(.8deg); } 68% { transform: translate(-5px,3px) rotate(-.8deg); } }
@keyframes tipsy-4 { 0%,100% { transform: translate(0,0) rotate(0); } 28% { transform: translate(8px,-4px) rotate(1.2deg); } 65% { transform: translate(-8px,4px) rotate(-1.2deg); } }
@keyframes softPulse { 50% { opacity: .6; } }
@keyframes dialog-advance-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .18; } }
@keyframes focus-sweep { from { left: 0; } to { left: 100%; } }
@keyframes misclick-screen { 0% { opacity: 0; } 10%, 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes misclick-card {
  0% { opacity: 0; transform: scale(.72) rotate(-3deg); }
  12% { opacity: 1; transform: scale(1.05) rotate(1deg); }
  22%, 76% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(.96) translateY(10px); }
}

.game-shell[data-drunk-stage="1"] .senpai .glass,
.game-shell[data-drunk-stage="1"] .choice-card { animation: tipsy-1 2.6s ease-in-out infinite; }
.game-shell[data-drunk-stage="2"] .senpai .glass,
.game-shell[data-drunk-stage="2"] .choice-card { animation: tipsy-2 1.9s ease-in-out infinite; }
.game-shell[data-drunk-stage="3"] .senpai .glass,
.game-shell[data-drunk-stage="3"] .choice-card { animation: tipsy-3 1.35s ease-in-out infinite; }
.game-shell[data-drunk-stage="4"] .senpai .glass,
.game-shell[data-drunk-stage="4"] .choice-card { animation: tipsy-4 1.05s ease-in-out infinite; }
.game-shell[data-drunk-stage="2"] .choice-card:nth-child(2),
.game-shell[data-drunk-stage="3"] .choice-card:nth-child(2),
.game-shell[data-drunk-stage="4"] .choice-card:nth-child(2) { animation-delay: -.37s; }
.game-shell[data-drunk-stage="2"] .choice-card:nth-child(3),
.game-shell[data-drunk-stage="3"] .choice-card:nth-child(3),
.game-shell[data-drunk-stage="4"] .choice-card:nth-child(3) { animation-delay: -.71s; }
.game-shell[data-drunk-stage="2"] .dialog-text::after,
.game-shell[data-drunk-stage="3"] .dialog-text::after { display: block; opacity: .24; transform: translate(3px, 2px); }
.game-shell[data-drunk-stage="4"] .dialog-text::after { display: block; opacity: .34; transform: translate(5px, 3px); }
.game-shell[data-drunk-stage="2"] .dialog-text::after { display: block; opacity: .18; transform: translate(2px, 1px); }
.game-shell[data-drunk-stage="2"] .choice-card small { text-shadow: 2px 1px #65a9b866; }
.game-shell[data-drunk-stage="2"] .choice-card:hover small,
.game-shell[data-drunk-stage="3"] .choice-card:hover small,
.game-shell[data-drunk-stage="4"] .choice-card.is-focusing small { text-shadow: none; filter: none; opacity: 1; }
.game-shell[data-drunk-stage="4"] .choice-card:not([data-anchored="true"]):not(.is-focusing) strong { text-shadow: 4px 2px #65a9b877, -3px -1px #c85b4b55; filter: blur(.35px); }
.game-shell[data-drunk-stage="4"] .choice-card:not([data-anchored="true"]):not(.is-focusing) small { opacity: .48; filter: blur(.45px); }
.game-shell[data-braced="true"] .choice-card { animation-play-state: paused; }
.game-shell[data-braced="true"] .choice-card strong,
.game-shell[data-braced="true"] .choice-card small { opacity: 1 !important; filter: none !important; text-shadow: none !important; }
.game-shell[data-drunk-stage="3"] .choice-card[data-danger="true"][data-tone-visible="true"] { box-shadow: 4px 5px #120b0a99, 0 0 12px #c85b4b33; }
.game-shell[data-drunk-stage="4"] .choice-card[data-danger="true"][data-tone-visible="true"] { border-color: #b84e43; box-shadow: 4px 5px #120b0a99, 0 0 24px #c85b4b66; }
.game-shell[data-drunk-stage="4"] .bar-backdrop { filter: saturate(1.25) contrast(1.06); box-shadow: inset 5px 0 #6bb0bd22, inset -5px 0 #d05d5222; }
.effects-off .fake-cursor { display: none !important; }

@media (max-width: 820px) {
  .hud { grid-template-columns: 1fr 1fr; }
  .play-layout { grid-template-columns: 1fr; }
  .receipt { min-height: 230px; clip-path: none; }
  .best-result { position: static; margin-top: 18px; }
  .bar-stage { min-height: 760px; }
  .enemy-speech { width: min(42%, 300px); }
  .choices { grid-template-columns: repeat(2, 1fr); }
  .choices > .choice-card:last-child:nth-child(odd) { grid-column: span 2; }
  .choice-card { min-height: 132px; }
  .enemy-select-layout { grid-template-columns: 1fr; }
  .enemy-roster { grid-template-columns: 1fr 1fr; }
  .collection-grid.title-grid { grid-template-columns: repeat(2, 1fr); }
  .story-run-bar { grid-template-columns: 1fr 1.5fr; }
  .story-run-bar > p { grid-column: 1 / -1; text-align: left; }
  .story-start-card { grid-template-columns: 1fr; }
  .story-start-visual { min-height: 420px; border-top: 1px solid #5c493e; border-left: 0; }
  .story-intermission { grid-template-columns: 1fr; }
  .story-transition-art { min-height: 250px; }
}

@media (max-width: 560px) {
  .game-shell { padding: 12px 8px 20px; }
  .topbar { align-items: flex-start; }
  .brand-enemy { flex-basis: 100%; margin-top: 4px; }
  .settings { flex-direction: column; align-items: flex-end; }
  .hud { gap: 5px; }
  .mood-card { grid-column: span 2; }
  .meter-card, .number-card { min-height: 56px; padding: 8px; }
  .bar-stage { grid-template-rows: 275px auto 1fr; min-height: 790px; }
  .bar-backdrop { height: 330px; }
  .window { width: 118px; height: 95px; left: 3%; }
  .bottle-shelf { width: 135px; right: 1%; }.bottle:nth-child(even) { display: none; }
  .senpai { transform: scale(.86); transform-origin: bottom center; top: 72px; }
  .enemy-speech { left: 3%; top: 160px; width: 43%; min-height: 82px; padding: 9px 10px; }
  .enemy-speech::after { right: -19px; width: 22px; }
  .enemy-speech .dialog-text { font-size: 11px; }
  .dialog-box { margin: 0 9px 8px; padding: 12px; }
  .battle-messages { grid-template-columns: 1fr; gap: 4px; }
  .counter { padding: 13px 9px; }
  .choices { gap: 6px; }
  .choice-card { min-height: 152px; padding: 11px 9px; }
  .choice-card strong { font-size: 13px; }
  .choice-card small { font-size: 11px; }
  .choices-heading small { display: none; }
  .focus-tools { grid-template-columns: 1fr; }
  .brace-button { width: 100%; min-width: 0; }
  .result-card dl { grid-template-columns: 1fr; }
  .result-card dl div { border-right: 0; border-bottom: 1px solid #44363a; }
  .select-heading { display: block; }
  .select-heading > p { width: 100%; margin-top: 8px; text-align: left; }
  .enemy-roster { grid-template-columns: 1fr; }
  .enemy-profile-head { align-items: flex-start; gap: 12px; }
  .enemy-stats { grid-template-columns: repeat(2, 1fr); }
  .survival-rules { grid-template-columns: 1fr; }
  .enemy-rules { grid-template-columns: 1fr; }
  .enemy-rules p { border-right: 0; border-bottom: 1px solid #45373b; }
  .start-actions, .collection-grid, .collection-grid.title-grid { grid-template-columns: 1fr; }
  .meta-toolbar { align-items: flex-start; flex-direction: column; }
  .story-run-bar { grid-template-columns: 1fr; }
  .story-run-bar > p { grid-column: auto; }
  .story-start-copy { padding: 30px 24px; }
  .story-start-copy h2 { font-size: 34px; }
  .story-start-visual { min-height: 390px; }
  .story-path { left: 10px; right: 10px; gap: 5px; }
  .story-path li { min-height: 108px; padding: 10px 7px; }
  .story-path b { font-size: 14px; }
  .story-rule-strip { grid-template-columns: 1fr; }
  .story-rule-strip p { border-right: 0; border-bottom: 1px solid #3e3335; }
  .other-modes { align-items: stretch; flex-direction: column; }
  .other-modes > span { margin: 0; }
  .story-resource-changes { grid-template-columns: repeat(2, 1fr); }
  .daytime-overlay { padding: 8px; }
  .daytime-card { max-height: calc(100dvh - 16px); padding: 22px 16px; }
  .daytime-heading { gap: 10px; }
  .daytime-resources { grid-template-columns: repeat(2, 1fr); }
  .daytime-choice { padding: 11px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
  .choice-card.is-focusing .focus-track b,
  .tutorial-practice.is-focusing .focus-track b { animation-duration: var(--focus-duration, 1200ms) !important; animation-iteration-count: infinite !important; }
  .misclick-alert.is-visible, .misclick-alert.is-visible .misclick-alert-card { animation: none !important; opacity: 1; }
  .preparation-chip.is-trouble { animation: none !important; }
}

/* Main play screen: one 1989 RPG-window grammar inside a 2026 meta frame. */
:root {
  --window-ink: #e9dfc7;
  --window-bg: #0c090cf0;
}

.game-shell {
  width: min(1600px, 100%);
  padding: 0 24px 32px;
}

.topbar {
  width: calc(100% + 48px);
  height: 52px;
  margin: 0 -24px 24px;
  padding: 0 20px;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid #2a2229;
  background: #141016;
}

.meta-brand,
.topbar .brand-lockup {
  display: flex;
  align-items: center;
}

.meta-brand { gap: 14px; min-width: 0; }
.topbar .brand-lockup { margin: 0; gap: 14px; font-size: 15px; letter-spacing: .08em; }
.topbar .brand-title { font-size: 15px; }
.topbar .brand-roman { color: var(--gold); font: 700 9px/1 ui-monospace, monospace; letter-spacing: .22em; }
.topbar .brand-enemy { display: none; }
.topbar .version-badge {
  margin: 0;
  padding: 3px 9px;
  color: #a99c86;
  border: 1px solid #3a3138;
  border-radius: 99px;
  background: transparent;
  font: 400 10px/1.4 ui-monospace, monospace;
  letter-spacing: .02em;
}

.topbar .settings { gap: 18px; }
.topbar .best-result {
  position: static;
  margin: 0;
  padding: 0;
  color: #8f8276;
  border: 0;
  background: transparent;
  font-size: 11px;
  text-align: right;
  transform: none;
}
.topbar .toggle { gap: 9px; color: #8f8276; font-size: 11px; }
.topbar .toggle input { position: absolute; opacity: 0; }
.topbar .toggle .toggle-track {
  order: 2;
  width: 36px;
  height: 20px;
  border: 0;
  border-radius: 99px;
  background: #3d3440;
}
.topbar .toggle .toggle-track::after {
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #817469;
}
.topbar .toggle input:checked + .toggle-track { border-color: transparent; background: #3d3440; }
.topbar .toggle input:checked + .toggle-track::after { background: var(--gold); transform: translateX(16px); }
.topbar .icon-button {
  min-width: 58px;
  min-height: 32px;
  padding: 4px 12px;
  color: #8f8276;
  border-color: #3a3138;
  border-radius: 99px;
  background: transparent;
}
.topbar .icon-button:hover { color: var(--gold); border-color: var(--gold); }

.rpg-window {
  position: relative;
  color: var(--ink);
  border: 3px solid var(--window-ink);
  border-radius: 5px;
  background: var(--window-bg);
  box-shadow: inset 0 0 0 3px #0c090c, inset 0 0 0 4px #5a4f44, 5px 6px #070609aa;
}

/* 危険度ウィンドウ（DQ式の枠色フィードバック）: 戦闘画面のRPGウィンドウ枠のみに限定する。 */
.bar-stage .rpg-window { transition: border-color .3s; }
.game-shell[data-danger="1"] .bar-stage .rpg-window { border-color: var(--danger-caution); }
.game-shell[data-danger="2"] .bar-stage .rpg-window {
  border-color: var(--danger-critical);
  animation: danger-window-pulse 1.2s ease-in-out infinite;
}
@keyframes danger-window-pulse {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50% { filter: drop-shadow(0 0 10px #c85b4b99); }
}

.rpg-window-tab {
  position: absolute;
  z-index: 4;
  top: -16px;
  left: 12px;
  min-width: 68px;
  padding: 3px 11px;
  color: var(--ink);
  border: 3px solid var(--window-ink);
  border-radius: 4px;
  background: #0c090c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.play-layout {
  grid-template-columns: minmax(0, 1fr) clamp(260px, 19vw, 310px);
  gap: 14px;
}

.bar-stage {
  min-height: clamp(720px, calc(100vh - 105px), 920px);
  grid-template-rows: auto minmax(260px, 1fr) auto auto;
  border: 4px solid #4b3b36;
  background: #120f13;
  box-shadow: 0 16px 45px #000a, inset 0 0 0 3px #0c090c, inset 0 0 0 4px #756253;
}

.bar-stage > .hud {
  grid-row: 1;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 22px 18px 0;
}

.hud-window {
  min-height: 116px;
  padding: 23px 15px 12px;
}
.hud-row {
  min-height: 22px;
  display: grid;
  grid-template-columns: 58px minmax(80px, 1fr) 48px;
  gap: 8px;
  align-items: center;
  transition: color .2s, filter .2s, transform .2s;
}
.hud-row.meter-card {
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  filter: none;
}
.hud-row > span,
.tonight-row > span { color: #a99b8d; font-size: 12px; white-space: nowrap; }
.hud-row > strong {
  color: #f1e6cd;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.hud-row.is-changing,
.tonight-row.is-changing { filter: brightness(1.4); transform: translateY(-1px); }
.hud-row.is-danger-1,
.tonight-row.is-danger-1 { filter: brightness(1.12); }
.hud-row.is-danger-2,
.tonight-row.is-danger-2 { filter: brightness(1.22); }
.hud-row.is-danger-1 > strong { color: var(--danger-caution); text-shadow: 0 0 6px #d08a3e55; }
.hud-row.is-danger-2 > strong { color: var(--danger-critical); text-shadow: 0 0 7px #c85b4b66; }
.danger-mark {
  margin-left: 3px;
  font-weight: 900;
  font-size: 11px;
}
.is-danger-1 .danger-mark { color: var(--danger-caution); }
.is-danger-2 .danger-mark { color: var(--danger-critical); }
.hud-footnote {
  display: inline-block;
  margin-top: 5px;
  color: #8b7d70;
  font-size: 10px;
  line-height: 1.35;
}
.drunk-warning { position: absolute; right: 14px; bottom: 10px; margin: 0; }

.meter {
  width: auto;
  height: auto;
  position: relative;
  padding: 2px;
  border: 2px solid #201a1c;
  border-radius: 8px;
  background: #120e10;
}
.meter .meter-fill {
  display: block;
  width: 0;
  height: 8px;
  border-radius: 4px;
  background: #82bd8e;
  transition: width .55s cubic-bezier(.25, .9, .3, 1), background-color .3s ease;
}
.meter[data-level="warn"] .meter-fill { background: #d8b55d; }
.meter[data-level="danger"] .meter-fill { background: #c85b4b; }
/* 交渉帯: バー下のゴールド目盛り（JSが left/width を%指定） */
.meter .meter-band {
  position: absolute;
  top: calc(100% + 2px);
  height: 0;
  border-bottom: 3px dashed #f0c56f;
  pointer-events: none;
}
/* 目盛りが次の行に重ならないよう、きげん行の下に余白 */
.mood-card > .hud-row:first-of-type { margin-bottom: 6px; }
.hud-window .mood-zone { margin-right: 2px; color: #8fc999; }
.hud-window .enemy-drunk { float: none; margin: 5px 0 0; color: #8fc999; font-size: 10px; }
.enemy-drunk-row + .hud-footnote { margin-top: 5px; }

.tonight-row {
  min-height: 25px;
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: baseline;
}
.tonight-row.number-card {
  min-height: 25px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  filter: none;
}
.tonight-row.number-card strong {
  margin: 0;
  color: #f1e6cd;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.tonight-row.is-danger-1 > strong { color: var(--danger-caution); text-shadow: 0 0 6px #d08a3e55; }
.tonight-row.is-danger-2 > strong { color: var(--danger-critical); text-shadow: 0 0 7px #c85b4b66; }
.hud-row .urgent,
.tonight-row .urgent { color: #ff7664; animation: softPulse 1.5s ease-in-out infinite; }

.bar-backdrop {
  inset: 136px 0 auto;
  z-index: 0;
  height: 440px;
}
.window { top: 66px; }
.bottle-shelf { top: 90px; }
.lamp { top: 8px; }
.senpai { top: 132px; }

.enemy-speech.dialog-box {
  position: relative;
  inset: auto;
  grid-row: 3;
  width: auto;
  min-height: 158px;
  margin: 0 18px 18px;
  padding: 30px 28px 18px;
  color: var(--ink);
  transform: none;
  transform-origin: center;
}
.enemy-speech.dialog-box::after { display: none; }
.enemy-speech.dialog-box.is-speaking { animation: none; }
.enemy-speech .speech-speaker {
  display: block;
  min-width: 132px;
  color: #171116;
  border-color: var(--window-ink);
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}
.enemy-speech .speech-speaker span { display: none; }
.enemy-speech .dialog-text {
  margin: 0;
  padding: 0 14px 0 2.3em;
  color: #f0e6d2;
  font-size: clamp(17px, 1.45vw, 22px);
  font-weight: 700;
  line-height: 1.8;
  text-indent: -2.3em;
}
.dialog-result { margin-top: 8px; }
.reaction {
  margin: 0;
  color: #c1b3a0;
  font-size: 12px;
  line-height: 1.7;
}
.reaction::before { content: "＊"; margin-right: 5px; color: #c1b3a0; }
.battle-messages { margin-top: 6px; }
.battle-messages li { font-size: 12px; }
.dialog-advance {
  display: none;
  left: 50%;
  right: auto;
  bottom: 2px;
  color: var(--window-ink);
  font-size: 13px;
  transform: translateX(-50%);
  animation: blink .9s steps(1) infinite;
}
.game-shell[data-resolving="true"] .dialog-advance { display: block; }
.game-shell[data-resolving="true"] .dialog-box {
  border-color: var(--window-ink);
  box-shadow: inset 0 0 0 3px #0c090c, inset 0 0 0 4px #5a4f44, 5px 6px #070609aa, 0 0 22px #65a9b833;
}
.game-shell[data-patience-danger="true"] .dialog-box {
  border-color: #9d4d48;
  box-shadow: inset 0 0 0 3px #0c090c, inset 0 0 0 4px #6e3835, 5px 6px #070609aa, 0 0 25px #a23f3833;
}

.counter {
  grid-row: 4;
  min-height: 222px;
  padding: 24px 18px 18px;
}
.command-window {
  min-height: 184px;
  padding: 23px 8px 0;
}
.command-window .choices-heading {
  display: block;
  min-width: 240px;
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  letter-spacing: .08em;
}
.command-window .hand-info {
  position: absolute;
  z-index: 4;
  top: -14px;
  right: 16px;
  padding: 3px 10px;
  color: #aa9380;
  border: 1px solid #5a4f44;
  background: #171318;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
}
.command-window .focus-tools {
  grid-template-columns: auto minmax(0, 1fr);
  margin: 0 5px 6px;
  padding: 5px 7px;
}
.command-window .brace-button { min-height: 36px; }

.command-window .choices {
  display: block;
}
.command-window .choice-card {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 22px 30px minmax(0, 1fr) auto;
  gap: 0;
  align-items: center;
  margin: 0;
  padding: 9px 12px;
  color: var(--ink);
  border: 0;
  border-top: 1px dashed #3a2f33;
  background: transparent;
  box-shadow: none;
  text-align: left;
  translate: none;
}
.command-window .choice-card:first-child { border-top: 0; }
.command-window .choice-card:hover,
.command-window .choice-card:focus-visible {
  color: #f0c56f;
  border-color: #3a2f33;
  background: #1a141788;
  box-shadow: none;
  translate: none;
}
.command-window .choice-card:active { margin: 0; border-bottom-width: 0; translate: none; }
.command-window .choice-card::before,
.command-window .choice-card::after,
.command-window .choice-number::before { display: none !important; }
.choice-cursor {
  color: transparent;
  font-size: 14px;
}
.choice-card:hover .choice-cursor,
.choice-card:focus-visible .choice-cursor,
.choice-card.is-focusing .choice-cursor { color: #f0c56f; }
.command-window .choice-number {
  position: static;
  color: #ad8e70;
  font-size: 12px;
}
.choice-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
}
.command-window .choice-card strong {
  flex: 0 0 auto;
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
}
.command-window .choice-card small {
  min-width: 0;
  margin-left: 14px;
  overflow: hidden;
  color: #b9aa98;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.choice-tail {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 8px;
}
.choice-tone-tag,
.choice-anchor-badge,
.choice-payoff-badge,
.choice-result-badge,
.fatigue-badge {
  position: static;
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #b8aa98;
  color: #b8aa98;
  background: transparent;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .05em;
  white-space: nowrap;
}
.choice-tone-tag { visibility: hidden; }
.choice-card[data-tone-visible="true"] .choice-tone-tag { visibility: visible; }
.choice-card.tone-danger .choice-tone-tag,
.choice-card.tone-drink .choice-tone-tag { color: var(--red); border-color: var(--red); }
.choice-card.tone-food .choice-tone-tag { color: var(--gold); border-color: var(--gold); }
.choice-card.tone-safe .choice-tone-tag,
.choice-card.tone-leave .choice-tone-tag { color: var(--green); border-color: var(--green); }
.choice-anchor-badge { color: #142019; border-color: #82bd8e; background: #82bd8e; font-weight: 900; }
.choice-payoff-badge { color: #d6f3d9; border-color: #82bd8e; background: #1a2b1d; font-weight: 900; }
.fatigue-badge { color: var(--gold); border-color: var(--gold); background: #2b2312; font-weight: 900; }
.choice-card.is-fatigued-max .fatigue-badge { color: var(--red); border-color: var(--red); background: #2b1614; }
.command-window .choice-card[data-anchored="true"],
.command-window .choice-card[data-payoff-ready="true"] { border-left: 2px solid #75ad7f; background: #16201988; box-shadow: none; }
.command-window .choice-card.is-fatigued { border-left: 2px solid var(--gold); opacity: .92; }
.command-window .choice-card.is-fatigued-max { border-left: 2px solid var(--red); opacity: .82; }
.command-window .choice-card.is-focusing {
  z-index: 6;
  color: #f0c56f;
  border-color: #6e5c49 !important;
  background: #32271f;
  box-shadow: inset 0 0 18px #f0c56f20 !important;
  translate: none;
}
.command-window .focus-track { left: 12px; right: 12px; bottom: 0; }
.command-window .choice-card.is-answer-reveal { translate: none; }
.command-window .choice-card.is-answer-reveal.tone-danger,
.command-window .choice-card.is-answer-reveal.tone-drink { color: #fff2e7; background: #32191b; box-shadow: inset 3px 0 var(--red); }
.command-window .choice-card.is-answer-reveal.tone-safe,
.command-window .choice-card.is-answer-reveal.tone-leave { color: #dff0e1; background: #17251a; box-shadow: inset 3px 0 var(--green); }
.command-window .choice-card.is-answer-reveal.tone-food { color: #f5d99d; background: #2e2415; box-shadow: inset 3px 0 var(--gold); }

.command-footer {
  min-height: 32px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 2px;
  padding: 5px 12px;
  color: #766b5e;
  border-top: 2px solid #5a4f44;
  font-size: 10px;
}
.command-footer .preparations {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 0;
}
.command-footer .preparations-label { color: #b09a7f; letter-spacing: .02em; }
.command-footer .preparation-list { padding: 0; }
.command-footer .preparation-chip,
.command-footer .preparation-empty { padding: 1px 5px; }

.receipt { min-height: 100%; }

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (max-width: 980px) {
  .topbar .best-result { display: none; }
  .play-layout { grid-template-columns: 1fr; }
  .receipt { min-height: 260px; clip-path: none; }
}

@media (max-width: 820px) {
  .game-shell { padding-right: 12px; padding-left: 12px; }
  .topbar { width: calc(100% + 24px); margin-right: -12px; margin-left: -12px; }
  .bar-stage > .hud { grid-template-columns: 1fr; gap: 20px; }
  .hud-window { min-height: 105px; }
  .bar-stage { min-height: 1050px; grid-template-rows: auto minmax(210px, 1fr) auto auto; }
  .bar-backdrop { top: 390px; }
  .enemy-speech.dialog-box { min-height: 148px; }
}

@media (max-width: 560px) {
  .game-shell { padding: 0 7px 20px; }
  .topbar {
    width: calc(100% + 14px);
    height: 50px;
    margin: 0 -7px 14px;
    padding: 0 10px;
    align-items: center;
  }
  .meta-brand { gap: 8px; }
  .topbar .brand-lockup { gap: 7px; }
  .topbar .version-badge { display: none; }
  .topbar .settings { flex-direction: row; gap: 10px; align-items: center; }
  .toggle-label { display: none; }
  .topbar .icon-button { min-width: 50px; }
  .bar-stage > .hud { padding: 22px 9px 0; }
  .hud-row { grid-template-columns: 54px minmax(70px, 1fr) 44px; }
  .bar-stage { min-height: 1030px; }
  .bar-backdrop { top: 375px; height: 360px; }
  .enemy-speech.dialog-box { margin: 0 9px 12px; padding: 28px 15px 15px; }
  .enemy-speech .dialog-text { font-size: 16px; }
  .counter { padding: 22px 9px 12px; }
  .command-window { padding-top: 25px; }
  .command-window .choices-heading { min-width: 205px; }
  .command-window .hand-info { display: none; }
  .command-window .choice-card { grid-template-columns: 20px 26px minmax(0, 1fr) auto; padding: 9px 7px; }
  .command-window .choice-card strong { font-size: 14px; }
  .command-window .choice-card small { display: none; }
  .choice-tail { gap: 3px; margin-left: 3px; }
  .choice-tone-tag, .choice-anchor-badge, .choice-payoff-badge, .choice-result-badge, .fatigue-badge { padding: 2px 4px; font-size: 9px; }
  .command-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
  .command-footer .preparations { min-width: 0; }
  .command-footer .preparation-list { max-width: 190px; }
}

/* Wide laptops with a short browser viewport (for example, a Zenbook at 768px high). */
@media (min-width: 821px) and (max-height: 820px) {
  .game-shell { padding-bottom: 12px; }
  .topbar { height: 46px; margin-bottom: 14px; }

  .story-run-bar {
    gap: 8px;
    margin-bottom: 4px;
    padding: 4px 10px;
  }
  .story-run-bar li { padding: 3px 6px; }
  .story-run-bar > div { gap: 0; }

  .bar-stage {
    min-height: calc(100dvh - 72px);
    grid-template-rows: auto minmax(145px, 1fr) auto auto;
  }
  .game-shell:has(.story-run-bar:not([hidden])) .bar-stage {
    min-height: calc(100dvh - 112px);
  }

  .bar-stage > .hud {
    gap: 9px;
    padding: 17px 14px 0;
  }
  .hud-window {
    min-height: 94px;
    padding: 18px 12px 8px;
  }
  .hud-row,
  .hud-row.meter-card { min-height: 18px; }
  .hud-footnote,
  .hud-window .enemy-drunk { margin-top: 2px; font-size: 9px; }
  .drunk-warning { right: 10px; bottom: 6px; font-size: 9px; }

  .bar-backdrop {
    inset: 108px 0 auto;
    height: 350px;
  }
  .window { top: 42px; transform: scale(.84); transform-origin: left top; }
  .bottle-shelf { top: 58px; transform: scale(.86); transform-origin: right top; }
  .lamp { top: -8px; transform: scale(.88); transform-origin: top center; }
  .senpai { top: 64px; transform: scale(.84); transform-origin: bottom center; }
  .game-shell[data-enemy-id="tsuburekake-kohai"] .senpai {
    transform: scale(.84) rotate(3deg) translateY(7px);
  }

  .enemy-speech.dialog-box {
    min-height: 126px;
    margin: 0 14px 10px;
    padding: 24px 22px 11px;
  }
  .enemy-speech .dialog-text {
    font-size: clamp(16px, 1.25vw, 19px);
    line-height: 1.55;
  }
  .dialog-result { margin-top: 3px; }
  .reaction { font-size: 11px; line-height: 1.45; }
  .battle-messages { gap: 2px 12px; margin-top: 3px; }
  .battle-messages li { font-size: 11px; line-height: 1.35; }
  .payoff-notes { margin-top: 3px; font-size: 10px; line-height: 1.35; }

  .counter {
    min-height: 176px;
    padding: 18px 14px 11px;
    border-top-width: 5px;
  }
  .command-window {
    min-height: 148px;
    padding: 19px 6px 0;
  }
  .command-window .choices-heading { top: -14px; }
  .command-window .hand-info { top: -13px; }
  .command-window .choice-card {
    min-height: 43px;
    padding: 5px 10px;
  }
  .command-window .choice-card strong { font-size: 15px; }
  .command-window .choice-card small { font-size: 10px; }
  .command-window .focus-tools {
    min-height: 36px;
    margin-bottom: 3px;
    padding: 3px 6px;
  }
  .command-window .brace-button { min-height: 31px; }
  .command-footer {
    min-height: 26px;
    padding: 3px 10px;
  }
  .command-footer .preparation-chip,
  .command-footer .preparation-empty { padding-top: 0; padding-bottom: 0; }
}

/* Title screen: the enemy select is the first RPG screen, not a modal card. */
.survival-meta-status {
  margin: 0;
  color: #91cc9c;
  font-size: 11px;
  white-space: nowrap;
}

.topbar .collection-button { min-width: 62px; }

body:has(#startOverlay.is-visible) { overflow: hidden; }
body:has(#startOverlay.is-visible) .topbar .toggle { display: none; }

.enemy-select-overlay {
  inset: 52px 0 0;
  z-index: 90;
  place-items: start center;
  padding: 24px;
  overflow-y: auto;
  background: #09070b;
  backdrop-filter: none;
}

.enemy-select-card.title-stage {
  width: min(1180px, 100%);
  min-height: max(680px, calc(100dvh - 100px));
  margin: 0 auto;
  padding: 0 0 28px;
  overflow: hidden;
  border: 4px solid #4b3b36;
  background: #120f13;
  box-shadow: 0 16px 45px #000a, inset 0 0 0 3px #0c090c, inset 0 0 0 4px #756253;
}

.title-lockup {
  position: relative;
  isolation: isolate;
  min-height: clamp(320px, 31vw, 430px);
  display: grid;
  place-items: center;
  align-content: center;
  padding: 58px 20px 28px;
  overflow: hidden;
  border-bottom: 3px solid #4b3b36;
  text-align: center;
  background: #0b090c;
  box-shadow: inset 0 -18px 28px #050406cc;
}

.title-lockup::before,
.title-lockup::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.title-lockup::before {
  z-index: -2;
  background: url("./assets/backgrounds/title-bar-hero-pixel.png") center 47% / cover no-repeat;
  image-rendering: pixelated;
  filter: saturate(.82) contrast(1.06) brightness(.72);
  transform: scale(1.012);
}

.title-lockup::after {
  z-index: -1;
  background:
    linear-gradient(180deg, #050406b8 0, #09070b38 22%, #09070b24 55%, #09070bd9 100%),
    radial-gradient(ellipse at 50% 44%, transparent 0 18%, #08060940 52%, #050406d8 100%);
  box-shadow: inset 0 0 0 2px #8a71533b, inset 0 -28px 38px #050406b8;
}

.title-eyebrow,
.title-roman,
.title-tagline { position: relative; z-index: 2; margin: 0; }
.title-eyebrow {
  padding: 6px 10px 5px;
  color: #d5a64a;
  border: 1px solid #d5a64a70;
  background: #0a080bc9;
  box-shadow: 3px 3px 0 #050406;
  font: 700 11px/1.2 ui-monospace, monospace;
  letter-spacing: .3em;
}
.title-lockup h2 {
  position: relative;
  z-index: 2;
  margin: 28px 0 14px;
  padding-left: .14em;
  color: #eadfc8;
  font-family: "DotGothic16", "MS Gothic", monospace;
  font-size: 84px;
  font-weight: 400;
  line-height: .86;
  letter-spacing: .14em;
  filter: drop-shadow(0 0 14px #d5a64a24);
  text-shadow: 3px 3px 0 #28161a, 7px 7px 0 #8a2c31, 14px 14px 0 #050406;
}
.title-roman {
  color: #d5a64a;
  font: 700 12px/1.2 ui-monospace, monospace;
  letter-spacing: .4em;
  text-shadow: 2px 2px 0 #050406;
}
.title-tagline {
  margin-top: 15px;
  padding: 5px 11px;
  color: #e2d4bc;
  border-top: 1px solid #8f765c77;
  border-bottom: 1px solid #8f765c77;
  background: #09070b99;
  font-size: 14px;
  letter-spacing: .22em;
  text-shadow: 2px 2px 0 #050406;
}

.title-rain {
  position: absolute;
  z-index: 1;
  width: 2px;
  height: 38px;
  background: #75899a55;
  transform: rotate(12deg);
  animation: titleRain 2.8s linear infinite;
}
.title-rain.rain-one { top: 90px; left: 8%; }
.title-rain.rain-two { top: 108px; left: 16%; animation-delay: -1.4s; }
.title-rain.rain-three { top: 67px; right: 15%; animation-delay: -.7s; }
.title-rain.rain-four { top: 183px; right: 8%; animation-delay: -2.1s; }

@keyframes titleRain {
  from { translate: 0 -8px; opacity: .25; }
  35% { opacity: .8; }
  to { translate: 0 28px; opacity: 0; }
}

.enemy-select-region[hidden] { display: none; }
.enemy-select-region {
  margin-top: 34px;
  padding-top: 8px;
  border-top: 3px solid #4b3b36;
  animation: titleSelectReveal .22s ease-out both;
}
@keyframes titleSelectReveal {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.title-stage .enemy-select-layout {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.5fr);
  gap: 18px;
  padding: 42px 26px 8px;
}

.title-select-actions {
  width: min(650px, calc(100% - 52px));
  margin: 20px auto 0;
  display: flex;
  gap: 12px;
  justify-content: center;
}
.title-select-actions button { flex: 1 1 0; max-width: 300px; }

.title-stage #titleMedalTotal {
  width: min(650px, calc(100% - 52px));
  margin: 14px auto 0;
  text-align: center;
}

.enemy-roster-window {
  min-height: 362px;
  padding: 24px 8px 0;
}
.enemy-roster-window > .rpg-window-tab { min-width: 166px; }
.title-stage .enemy-roster { display: block; }
.title-stage .enemy-card {
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: 20px 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  color: var(--ink);
  border: 0;
  border-top: 1px dashed #3a2f33;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.title-stage .enemy-card:first-child { border-top: 0; }
.title-stage .enemy-card:hover,
.title-stage .enemy-card:focus-visible,
.title-stage .enemy-card.is-selected {
  color: #f0c56f;
  border-color: #3a2f33;
  background: #1a141788;
}
.title-stage .enemy-card.is-selected::after { display: none; content: none; }
.enemy-card-cursor {
  display: block;
  color: transparent;
  font-size: 13px;
}
.title-stage .enemy-card.is-selected .enemy-card-cursor { color: #f0c56f; }
.title-stage .enemy-card-portrait {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #281c1c;
  background: #aa745b;
  border: 3px solid #382628;
  font-size: 17px;
  font-weight: 900;
}
.title-stage .enemy-card-copy { min-width: 0; display: grid; gap: 2px; }
.title-stage .enemy-card strong { font-size: 15px; line-height: 1.35; }
.title-stage .enemy-card small { color: #a99b8e; font-size: 10px; line-height: 1.4; }
.title-stage .enemy-card.is-locked {
  opacity: .48;
  cursor: not-allowed;
  filter: none;
}
.title-stage .enemy-card.is-locked .enemy-card-portrait { color: #4a3d3d; background: #211a1e; }
.title-stage .enemy-card.is-locked strong { letter-spacing: .25em; }
.enemy-roster-help {
  margin: 2px 0 0;
  padding: 8px 12px 6px;
  color: #8f8276;
  border-top: 2px solid #5a4f44;
  font-size: 10px;
}

.title-stage .enemy-detail {
  min-height: 362px;
  padding: 31px 24px 18px;
  background: #0c090cf0;
}
.title-stage .enemy-name-tab {
  min-width: 150px;
  margin: 0;
  color: #171116;
  border-color: var(--window-ink);
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}
.title-stage .enemy-type {
  position: absolute;
  z-index: 4;
  top: -16px;
  right: 14px;
  margin: 0;
  padding: 3px 10px;
  color: #aa9380;
  border: 1px solid #5a4f44;
  background: #171318;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: .04em;
}
.title-stage .enemy-profile-head {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.title-stage .enemy-profile-head .portrait-mini {
  width: 72px;
  height: 72px;
  margin: 0;
  color: #281c1c;
  background: #b07b5e;
  border: 5px solid #342426;
  box-shadow: 5px 5px #080608;
  font-size: 27px;
  font-weight: 900;
}
.enemy-profile-copy { min-width: 0; }
.title-stage .enemy-detail blockquote {
  margin: 0 0 9px;
  color: #e5bf79;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
}
.title-stage .enemy-description {
  margin: 0;
  color: #c1b4a3;
  font-size: 12px;
  line-height: 1.8;
}
.title-stage .enemy-description::before { content: "＊"; margin-right: 4px; }
.title-stage .enemy-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 22px;
  margin: 19px 0 12px;
  padding: 12px;
  border: 1px solid #5a4f44;
  background: #110d11;
}
.title-stage .enemy-stats > div {
  display: grid;
  grid-template-columns: minmax(52px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}
.title-stage .enemy-stats span { color: #b8aa9a; font-size: 11px; }
.title-stage .enemy-stats i { display: flex; gap: 3px; }
.title-stage .enemy-stats i b { width: 7px; height: 12px; background: #342a2e; }
.title-stage .enemy-stats i b.is-on { background: #d09c4a; box-shadow: none; }
.title-stage .enemy-rules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  margin: 0;
  border: 0;
}
.title-stage .enemy-rules > div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 0;
  align-items: baseline;
}
.title-stage .enemy-rules dt { color: #a99b8d; font-size: 11px; }
.title-stage .enemy-rules dd {
  margin: 0;
  color: #e2cda8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}
.title-stage .enemy-rules b { color: #e4bd71; font-size: inherit; }
.title-stage #enemySweetSpot { color: #8fc999; }

.title-command-window {
  width: min(650px, calc(100% - 52px));
  margin: 58px auto 0;
  padding: 20px 8px 5px;
}
.title-command-window > .rpg-window-tab { min-width: 104px; }
.title-command {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 0;
  align-items: center;
  padding: 9px 14px;
  color: var(--ink);
  border: 0;
  border-top: 1px dashed #3a2f33;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.title-command:first-of-type { border-top: 0; }
.title-command:hover,
.title-command:focus-visible { color: #f0c56f; background: #1a141788; }
.title-command-cursor { color: transparent; font-size: 13px; }
.title-command.is-selected .title-command-cursor,
.title-command:hover .title-command-cursor,
.title-command:focus-visible .title-command-cursor { color: #f0c56f; }
.title-command.is-selected strong { color: #f0c56f; }
.title-command-copy { min-width: 0; display: flex; gap: 20px; align-items: baseline; }
.title-command strong { font-size: 17px; line-height: 1.4; }
.title-command em { color: #b9aa98; font-size: 11px; font-style: normal; }
.title-command > small { color: #8f8276; font: 400 10px/1.2 ui-monospace, monospace; }
.title-command :is(.survival-command-tag, .custom-slot-tag) {
  padding: 2px 9px;
  border: 1px solid;
  font-family: var(--font-game);
}
.title-command .survival-command-tag { color: #8fc999; border-color: #6e9b78; }
.title-command .custom-slot-tag { color: #9fd5aa; border-color: #477856; }
.title-command.story-command {
  background: linear-gradient(90deg, #2c231440, transparent 65%);
}
.title-command.story-command .title-command-cursor { color: #7a6440; }
.title-command.story-command strong { color: #e4c67a; }
.title-command.story-command:hover,
.title-command.story-command:focus-visible { background: linear-gradient(90deg, #2c231477, #1a141788 70%); }
.title-command.story-command.is-selected {
  background: linear-gradient(90deg, #2c2314cc, #1a141788 70%);
  box-shadow: inset 0 0 0 1px #d5a64a44, 0 0 14px #d5a64a2e;
}
.title-command.story-command.is-selected strong { color: var(--gold); text-shadow: 0 0 8px #d5a64a55; }
.title-stage > .boot-error {
  width: min(720px, calc(100% - 40px));
  margin: 14px auto 0;
  text-align: center;
}

/* くんしょう展開領域（敵選択と同じ流儀）。 */
.medals-region[hidden] { display: none; }
.medals-region {
  margin-top: 34px;
  padding-top: 8px;
  border-top: 3px solid #4b3b36;
  animation: titleSelectReveal .22s ease-out both;
}
.medals-window {
  width: min(760px, calc(100% - 52px));
  margin: 42px auto 0;
  padding: 26px 16px 16px;
}
.medals-window > .rpg-window-tab { min-width: 120px; }
.medals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.medals-help { margin: 14px 2px 0; color: #8f8276; font-size: 10px; text-align: center; letter-spacing: .04em; }
.title-stage .medals-region-total {
  width: min(650px, calc(100% - 52px));
  margin: 14px auto 0;
  text-align: center;
}

/* リセット展開領域（敵選択・くんしょうと同じ流儀）。 */
.reset-region[hidden] { display: none; }
.reset-region {
  margin-top: 34px;
  padding-top: 8px;
  border-top: 3px solid #4b3b36;
  animation: titleSelectReveal .22s ease-out both;
}
.reset-window {
  width: min(650px, calc(100% - 52px));
  margin: 42px auto 0;
  padding: 26px 18px 20px;
}
.reset-window > .rpg-window-tab { min-width: 100px; }
.reset-warning { margin: 0; color: #cdbfa8; font-size: 12px; line-height: 1.7; }
.reset-complete { margin: 0; color: #8fc999; font-size: 13px; font-weight: 700; line-height: 1.7; }

.danger-button {
  min-height: 48px; padding: 12px 20px;
  border: 2px solid #8a3c36; border-bottom-width: 5px;
  color: #f0c9c2; background: #2c1917;
  font-weight: 800; cursor: pointer; box-shadow: 4px 5px #080608;
}
.danger-button:hover { border-color: var(--red); color: #ffd9d2; transform: translateY(-2px); }
.danger-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.danger-button:disabled:hover { border-color: #8a3c36; color: #f0c9c2; }

.medal-item { position: relative; min-height: 62px; cursor: default; }
.medal-item:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.medal-item-hint { display: block; margin: 5px 0 0; color: #8f8276; font-size: 9px; letter-spacing: .03em; }
.medal-item.is-locked .medal-item-hint { color: #6b5f52; }
/* ツールチップは項目の横幅（left:0/right:0）に収め、画面端でも横にはみ出さない。 */
.medal-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  padding: 9px 11px;
  color: #cdbfa8;
  border: 1px solid #806941;
  background: #0c090c;
  box-shadow: 4px 5px 0 #050406aa;
  font-size: 10px;
  line-height: 1.55;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.medal-tooltip b { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .03em; }
.medal-item:hover .medal-tooltip,
.medal-item:focus .medal-tooltip,
.medal-item:focus-within .medal-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .medal-tooltip { transition: none; }
  .enemy-select-region, .medals-region, .reset-region { animation: none; }
}

@media (max-width: 1040px) {
  .survival-meta-status { display: none; }
  .title-stage .enemy-stats { column-gap: 10px; }
}

@media (max-width: 820px) {
  .enemy-select-overlay { padding: 12px; }
  .enemy-select-card.title-stage { min-height: calc(100dvh - 76px); }
  .title-lockup { min-height: 280px; padding: 42px 18px 24px; }
  .title-lockup::before { background-position: 50% 44%; }
  .title-lockup h2 { margin-top: 22px; font-size: 60px; }
  .title-stage .enemy-select-layout { grid-template-columns: 1fr; gap: 38px; padding: 48px 18px 8px; }
  .title-stage .enemy-roster { grid-template-columns: 1fr; }
  .enemy-roster-window { min-height: auto; }
  .title-stage .enemy-detail { min-height: auto; }
  .title-command-window { width: calc(100% - 36px); margin-top: 48px; }
  .medals-window { width: calc(100% - 36px); margin-top: 48px; }
  .medals-grid { grid-template-columns: repeat(2, 1fr); }
  .reset-window { width: calc(100% - 36px); margin-top: 48px; }
}

@media (max-width: 560px) {
  .topbar .best-result,
  .topbar .collection-button { display: none; }
  .enemy-select-overlay { inset: 50px 0 0; padding: 6px; }
  .enemy-select-card.title-stage { border-width: 3px; }
  .title-lockup { min-height: 246px; padding-top: 36px; }
  .title-lockup::before { background-position: 48% 43%; }
  .title-eyebrow { font-size: 9px; }
  .title-lockup h2 { font-size: 50px; text-shadow: 2px 2px 0 #28161a, 5px 5px 0 #8a2c31, 10px 10px 0 #070609; }
  .title-roman { font-size: 10px; }
  .title-tagline { font-size: 11px; }
  .title-stage .enemy-select-layout { padding-right: 10px; padding-left: 10px; }
  .title-stage .enemy-detail { padding: 34px 14px 16px; }
  .title-stage .enemy-type { display: none; }
  .title-stage .enemy-profile-head { grid-template-columns: 62px minmax(0, 1fr); gap: 12px; }
  .title-stage .enemy-profile-head .portrait-mini { width: 56px; height: 56px; font-size: 22px; }
  .title-stage .enemy-detail blockquote { font-size: 13px; }
  .title-stage .enemy-stats { grid-template-columns: 1fr 1fr; gap: 7px 14px; }
  .title-stage .enemy-rules > div { grid-template-columns: 58px minmax(0, 1fr); }
  .title-stage .enemy-rules dd { font-size: 11px; }
  .title-command-window { width: calc(100% - 20px); }
  .title-command { grid-template-columns: 22px minmax(0, 1fr) auto; padding: 8px; }
  .title-command strong { font-size: 14px; }
  .title-command em { display: none; }
  .title-select-actions { width: calc(100% - 20px); flex-direction: column; }
  .title-select-actions button { max-width: none; }
  /* #enemySelectCard の overflow:hidden は position:sticky の基準を
     実際のスクロール元である .enemy-select-overlay から切り離してしまう
     （overflow:hidden も「見た目上visible以外」としてスクロールコンテナ扱いされるため）。
     敵選択リージョン表示中に限定して解除し、下のスティッキー指定を効かせる。
     メダル・リセット画面は #enemySelectRegion が [hidden] のままなので対象外。 */
  #enemySelectCard:has(#enemySelectRegion:not([hidden])) { overflow: visible; }
  /* 敵選択のCTAは詳細カードより下にあり初期表示で画面外に落ちる。
     スクロール中も「この敵で飲む」へ常時到達できるよう下部に貼り付ける */
  #enemySelectRegion .title-select-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-direction: row;
    width: 100%;
    margin: 14px 0 0;
    padding: 10px 0 12px;
    background: #171318;
    border-top: 1px solid #3b3033;
  }
  .medals-window { width: calc(100% - 20px); }
  .medals-grid { grid-template-columns: 1fr; }
  .reset-window { width: calc(100% - 20px); }
}

@media (min-width: 821px) and (max-height: 860px) {
  .enemy-select-overlay { padding-top: 12px; }
  .enemy-select-card.title-stage { min-height: 760px; }
  .title-lockup { min-height: 250px; padding-top: 30px; }
  .title-lockup h2 { margin: 15px 0 8px; font-size: 64px; }
  .title-tagline { margin-top: 7px; }
  .title-stage .enemy-select-layout { padding-top: 42px; }
  .title-stage .enemy-card { min-height: 61px; }
  .enemy-roster-window,
  .title-stage .enemy-detail { min-height: 326px; }
  .title-command-window { margin-top: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .dialog-advance { animation: none !important; }
}
/* Result screen: rank-readable RPG windows with a separate meta share bar. */
body:has(#resultOverlay.is-visible) { overflow: hidden; }
.result-overlay { place-items: start center; padding: 26px; overflow-y: auto; background: #09070b; backdrop-filter: none; }
.result-shell { width: min(980px, 100%); margin: 0 auto; }
.result-card.result-stage {
  width: 100%; max-height: none; overflow: visible; padding: 54px 40px 36px; color: var(--ink);
  border: 4px solid #4b3b36; background: #120f13;
  box-shadow: 0 16px 45px #000a, inset 0 0 0 3px #0c090c, inset 0 0 0 4px #756253; text-align: left;
}
.result-overlay[data-outcome="perfect"] .result-stage { background: radial-gradient(circle at 50% 8%, #e4a64d24 0 18%, transparent 48%), #120f13; }
.result-overlay[data-outcome="practical"] .result-stage { background: radial-gradient(circle at 50% 8%, #e4a64d14 0 18%, transparent 48%), #120f13; }
.result-overlay[data-outcome="collapse"] .result-stage {
  border-color: #5c332f;
  background: radial-gradient(circle at 50% 110%, #c85b4b1e 0 30%, transparent 62%), linear-gradient(#0000 60%, #1b0d0f88), #150e10;
  box-shadow: 0 16px 45px #000a, inset 0 0 0 3px #0c090c, inset 0 0 0 4px #6d403a;
}
.result-banner { min-height: 250px; display: grid; place-items: center; align-content: center; text-align: center; }
.result-stars { display: flex; gap: .5em; justify-content: center; margin: 0 0 26px; padding-left: .5em; font-size: 20px; line-height: 1; }
.result-stars .is-on { color: #d5a64a; }
.result-stars .is-off { color: #554537; }
.result-overlay[data-outcome="practical"] .result-stars .is-on { color: #82bd8e; }
.result-overlay[data-outcome="honorable"] .result-stars .is-on { color: #b8aa98; }
.result-overlay[data-outcome="collapse"] .result-stars .is-on { color: #7a5a56; }
.result-overlay[data-outcome="collapse"] .result-stars .is-off { color: #503b3c; }
.result-stage .result-label {
  margin: 0; padding: 0 0 0 .1em; color: #f0c56f; background: transparent;
  font-family: "DotGothic16", "MS Gothic", monospace; font-size: 58px; font-weight: 400; line-height: 1; letter-spacing: .1em;
  text-shadow: 5px 5px 0 #8a2c31, 10px 10px 0 #070609;
}
.result-overlay[data-outcome="practical"] .result-label { color: #82bd8e; text-shadow: 5px 5px 0 #2c4a33, 10px 10px 0 #070609; }
.result-overlay[data-outcome="honorable"] .result-label { color: #b8aa98; text-shadow: 5px 5px 0 #45373b, 10px 10px 0 #070609; }
.result-overlay[data-outcome="collapse"] .result-label { color: #ef6656; text-shadow: 5px 5px 0 #3d1d25, 10px 10px 0 #070609; }
.result-stage .result-quote { margin: 36px 0 0; color: #f1e6cd; font-size: 17px; font-weight: 700; line-height: 1.7; }
.result-stage .result-comment { max-width: 720px; margin: 14px auto 0; color: #c1b3a0; font-size: 12px; line-height: 1.7; }
.result-overlay[data-outcome="collapse"] .result-comment { color: #b39c93; }
.result-record { margin-top: 22px; padding: 22px 20px 10px; }
.result-record > .rpg-window-tab { min-width: 164px; }
.result-stage .result-record dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 34px; margin: 0; border: 0; }
.result-stage .result-record dl > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 0; border: 0; }
.result-stage .result-record dt { color: #a99b8d; font-size: 12px; }
.result-stage .result-record dd { margin: 0; color: #f1e6cd; font-size: 16px; font-weight: 800; line-height: 1.55; font-variant-numeric: tabular-nums; }
.result-stage .result-record dd[data-tone="good"] { color: #8fc999; }
.result-stage .result-record dd[data-tone="warning"] { color: #e08a7a; }
.result-stage .result-record dd[data-tone="bad"] { color: #ef6656; }
.result-stage .result-aftermath { margin: 9px 0 0; padding-top: 9px; color: #c1b3a0; border-top: 1px dashed #3a2f33; font-size: 11px; line-height: 1.6; }
.result-stage .result-aftermath::before { content: "\ff0a"; margin-right: 4px; }
.result-stage .result-aftermath[data-tone="warning"] { color: #d99a8c; }
.result-stage .run-score { margin: 8px 0 0; padding: 6px 0 0; color: #8fc999; border: 0; border-top: 1px dashed #3a2f33; background: transparent; font-size: 13px; font-weight: 900; letter-spacing: .1em; }
.result-lower { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; margin-top: 34px; }
.result-command-window { min-height: 132px; padding: 19px 8px 6px; }
.result-command-window > .rpg-window-tab { min-width: 110px; }
.result-command {
  width: 100%; min-height: 48px; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center;
  margin: 0; padding: 8px 14px; color: var(--ink); border: 0; border-top: 1px dashed #3a2f33;
  background: transparent; box-shadow: none; cursor: pointer; font-size: 15px; font-weight: 700; text-align: left; transform: none;
}
.result-command:not([hidden]):first-of-type, .result-command[hidden] + .result-command:not([hidden]) { border-top: 0; }
.result-command::before { content: "\25b6"; color: transparent; font-size: 12px; }
.result-command.is-selected { color: #f0c56f; }
.result-command.is-selected::before, .result-command:hover::before, .result-command:focus-visible::before { color: #f0c56f; }
.result-command:hover, .result-command:focus-visible { color: #f0c56f; border-color: #3a2f33; background: #1a141788; box-shadow: none; transform: none; }
.result-honor-window { min-height: 132px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 25px 15px 14px; text-align: center; }
.result-honor-window > .rpg-window-tab { min-width: 110px; }
.result-honor-window > strong { color: #f0c56f; font-size: 19px; line-height: 1.4; }
.result-honor-window > small { color: #8b7d70; font-size: 10px; line-height: 1.5; }
.result-overlay[data-outcome="practical"] .result-honor-window > strong { color: #82bd8e; }
.result-overlay[data-outcome="honorable"] .result-honor-window > strong { color: #b8aa98; }
.result-overlay[data-outcome="collapse"] .result-honor-window > strong { color: #e08a7a; }
.result-share-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border: 1px solid #2a2229; border-radius: 8px; background: #141016; }
.result-share-bar > span { margin-right: auto; color: #8f8276; font-size: 10px; white-space: nowrap; }
.result-share-bar .share-card-preview { width: 88px; height: 50px; margin: 0; object-fit: cover; border: 1px solid #3a3138; border-radius: 4px; background: #120f13; box-shadow: none; }
.result-share-bar .result-meta-button { min-height: 30px; padding: 5px 14px; color: #a99c86; border: 1px solid #3a3138; border-radius: 99px; background: transparent; box-shadow: none; font-size: 10px; font-weight: 400; transform: none; }
.result-share-bar .x-share-button { color: #fff; background: #08090a; }
.result-share-bar .result-meta-button:hover { color: #f0c56f; border-color: #d5a64a; background: #1d171c; transform: none; }
.result-share-bar .x-share-hint { flex: 1 0 100%; margin: 0; padding: 7px 9px; }
.result-stage .story-intermission { margin: 30px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .result-overlay.is-visible .result-stars { animation: resultReveal .25s ease both; }
  .result-overlay.is-visible .result-label { animation: resultReveal .3s .08s ease both; }
  .result-overlay.is-visible .result-record, .result-overlay.is-visible .result-lower { animation: resultReveal .3s .16s ease both; }
}
@keyframes resultReveal { from { opacity: 0; translate: 0 7px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 700px) {
  .result-overlay { padding: 12px; }
  .result-card.result-stage { padding: 42px 22px 26px; }
  .result-lower { grid-template-columns: 1fr; gap: 32px; }
  .result-share-bar { flex-wrap: wrap; }
  .result-share-bar > span { min-width: calc(100% - 110px); }
}
@media (max-width: 560px) {
  .result-overlay { padding: 6px; }
  .result-card.result-stage { padding: 34px 12px 20px; border-width: 3px; }
  .result-banner { min-height: 218px; }
  .result-stars { margin-bottom: 21px; font-size: 17px; }
  .result-stage .result-label { font-size: 40px; text-shadow: 4px 4px 0 #8a2c31, 8px 8px 0 #070609; }
  .result-overlay[data-outcome="practical"] .result-label { text-shadow: 4px 4px 0 #2c4a33, 8px 8px 0 #070609; }
  .result-overlay[data-outcome="honorable"] .result-label { text-shadow: 4px 4px 0 #45373b, 8px 8px 0 #070609; }
  .result-overlay[data-outcome="collapse"] .result-label { text-shadow: 4px 4px 0 #3d1d25, 8px 8px 0 #070609; }
  .result-stage .result-quote { margin-top: 28px; font-size: 14px; }
  .result-stage .result-comment { font-size: 11px; }
  .result-record { padding: 22px 12px 10px; }
  .result-stage .result-record dl { grid-template-columns: 1fr; gap: 5px; }
  .result-stage .result-record dl > div { grid-template-columns: 70px minmax(0, 1fr); }
  .result-command { padding-right: 8px; padding-left: 8px; }
  .result-share-bar .share-card-preview { width: 76px; height: 43px; }
}
/* Daytime phase: office story framed as a full-screen 1989 RPG interface. */
.daytime-overlay {
  z-index: 70;
  place-items: start center;
  padding: 0;
  overflow: auto;
  background: #09070a;
  backdrop-filter: none;
}

.daytime-card.daytime-stage {
  width: min(1540px, 100%);
  max-height: none;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 28px 34px;
  overflow: visible;
  color: #e9dfc7;
  border: 0;
  background: #09070a;
  box-shadow: none;
  backdrop-filter: none;
}

.daytime-meta-bar {
  width: calc(100% + 56px);
  height: 64px;
  margin: 0 -28px 26px;
  padding: 0 36px;
  align-items: center;
  border-bottom: 1px solid #2b242c;
  background: #141016;
}

.daytime-meta-bar > div,
.daytime-story-label {
  display: flex;
  align-items: center;
}

.daytime-meta-bar > div { gap: 20px; }
.daytime-brand {
  color: #e9dfc7;
  font: 400 19px/1 var(--font-game);
  letter-spacing: .08em;
}
.daytime-story-label {
  gap: 8px;
  color: #d7a847;
  font: 700 12px/1 ui-monospace, monospace;
  letter-spacing: .16em;
}
.daytime-story-label .eyebrow {
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}
.daytime-quit {
  min-width: 140px;
  padding: 9px 18px;
  color: #91857a;
  border: 1px solid #40373f;
  border-radius: 999px;
  background: transparent;
  font-size: 11px;
}
.daytime-quit:hover,
.daytime-quit:focus-visible {
  color: #e2c37b;
  border-color: #8e7345;
}

.daytime-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 46px;
  min-height: calc(100dvh - 124px);
  padding: 54px 40px 38px;
  border: 4px solid #4d3d39;
  background:
    linear-gradient(180deg, #11182018 0 235px, #0e1519e6 375px, #0e1519 100%),
    url("./assets/backgrounds/daytime-office-pixel.png") center top / 100% auto no-repeat,
    #0e1519;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 3px #09070a, inset 0 0 0 4px #766152, 0 18px 45px #000b;
}

.daytime-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 30px;
  min-height: 210px;
  padding: 8px 8px 0;
}
.daytime-hero h2 {
  margin: 0;
  color: #eee7d6;
  font: 400 clamp(38px, 4vw, 64px)/1.1 var(--font-game);
  letter-spacing: .04em;
  text-shadow: 5px 4px 0 #1f3037, 8px 7px 0 #07090b;
}
.daytime-wake {
  grid-column: 1 / -1;
  align-self: end;
  margin: 0;
  color: #e4dccc;
  font: 400 clamp(14px, 1.7vw, 21px)/1.8 var(--font-story);
  letter-spacing: .06em;
  text-shadow: 2px 2px 0 #0a0b0d;
}
.daytime-progress-wrap {
  align-self: start;
  margin-top: 28px;
  padding: 8px 15px;
  border: 1px solid #59483d;
  background: #0c090cdf;
}
.daytime-progress {
  display: flex;
  grid-template-columns: none;
  gap: 0;
  margin: 0;
  padding: 0;
}
.daytime-progress li {
  padding: 0;
  color: #9e9184;
  border: 0;
  background: transparent;
  font-size: 11px;
}
.daytime-progress li + li::before {
  content: " \25b8  ";
  color: #c1ad94;
}
.daytime-progress li.is-current,
.daytime-progress li.is-complete {
  color: #c9b69e;
  border: 0;
  background: transparent;
  font-weight: 400;
}
.daytime-progress li.is-complete::after {
  content: " \2713";
  color: #83b88f;
}

.daytime-upper-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 30px;
}
.daytime-morning-window,
.daytime-work-window,
.daytime-command-window,
.daytime-result-rpg {
  border-color: #e9dfc7;
  background: #0c090cf3;
  box-shadow: inset 0 0 0 3px #0c090c, inset 0 0 0 4px #5a4f44, 7px 8px #05040599;
}
.daytime-morning-window,
.daytime-work-window {
  min-height: 260px;
  padding: 36px 24px 22px;
}
.daytime-morning-tab {
  min-width: 224px;
  color: #142019;
  border-color: #e9dfc7;
  background: #8ebd96;
}
.daytime-morning-window[data-level="1"] .daytime-morning-tab { color: #2b2010; background: #d6a952; }
.daytime-morning-window[data-level="2"] .daytime-morning-tab { color: #2b1110; background: #d46d60; }
.daytime-work-tab {
  min-width: 112px;
  color: #28120f;
  border-color: #e9dfc7;
  background: #dc7464;
}
.daytime-event-chip {
  position: absolute;
  top: -15px;
  right: 14px;
  max-width: 62%;
  margin: 0;
  padding: 7px 12px;
  color: #aa9a8c;
  border: 1px solid #5a493d;
  background: #171116;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.25;
}
.daytime-work-window {
  display: grid;
  align-content: start;
  gap: 18px;
}
.daytime-event-text {
  display: grid;
  gap: 17px;
  margin: 0;
}
.daytime-event-text strong {
  color: #efe6d3;
  font: 700 clamp(14px, 1.5vw, 18px)/1.85 var(--font-game);
}
.daytime-event-text span {
  color: #aaa096;
  font: 400 13px/1.75 var(--font-story);
}

.daytime-resources {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
}
.daytime-resources .story-resource-change {
  display: grid;
  grid-template-columns: 74px 110px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
}
.daytime-resources .story-resource-change > span {
  color: #a89c90;
  font-size: 11px;
}
.daytime-resources .story-resource-change > strong {
  color: #e5dccb;
  font-size: 16px;
}
.daytime-resources .story-resource-change > small {
  color: #8abc93;
  font-size: 11px;
  text-align: left;
}
.daytime-resources .story-resource-change.is-loss > small { color: #d97868; }
#daytimeHangoverTone {
  display: block;
  margin-top: 14px;
  padding-top: 14px;
  color: #a79d92;
  border-top: 1px dashed #504348;
  font: 400 11px/1.7 var(--font-story);
}

.daytime-command-window {
  padding: 30px 10px 7px;
}
.daytime-command-tab { min-width: 260px; font-size: 13px; }
.daytime-command-hint {
  position: absolute;
  top: -14px;
  right: 16px;
  padding: 6px 11px;
  color: #8e7e70;
  border: 1px solid #4b3f3a;
  background: #171116;
  font-size: 9px;
}
.daytime-choices { display: grid; gap: 0; }
.daytime-choice {
  display: grid;
  grid-template-columns: 36px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 12px 14px;
  color: #ddd3c2;
  border: 0;
  border-bottom: 1px dashed #352e34;
  background: transparent;
}
.daytime-choice:last-child { border-bottom: 0; }
.daytime-choice:hover:not(:disabled),
.daytime-choice:focus-visible {
  color: #e9f5eb;
  border-color: #443a3e;
  outline: 1px solid #78ae84;
  background: #102019;
}
.daytime-choice-number {
  position: relative;
  grid-row: auto;
  color: #6f6156;
  font-size: 13px;
  text-align: center;
}
.daytime-choice-number::before {
  left: -2px;
  top: 50%;
  color: #79bd8b;
}
.daytime-choice-copy {
  display: grid;
  grid-template-columns: minmax(200px, auto) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
}
.daytime-choice strong { font-size: clamp(14px, 1.5vw, 19px); }
.daytime-choice small { color: #857a71; font-size: 11px; }
.daytime-choice-tags {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.daytime-preview-tag {
  padding: 5px 9px;
  border: 1px solid #554942;
  color: #aa9c8c;
  font-size: 10px;
  white-space: nowrap;
}
.daytime-preview-tag.is-cost { color: #da7969; border-color: #b75548; }
.daytime-preview-tag.is-gain,
.daytime-preview-tag.is-combo { color: #89c497; border-color: #60956b; }
.daytime-preview-tag.is-warn { color: #d3a853; border-color: #8b6b30; }
.daytime-choice.is-specific::after { content: none; }
.daytime-choice:disabled { opacity: .42; }
.daytime-choice.is-selected {
  opacity: 1;
  color: #e6f2e8;
  border-color: #3c5843;
  background: #102019;
  box-shadow: inset 4px 0 #79bd8b;
}

.daytime-result-rpg {
  display: grid;
  gap: 11px;
  padding: 34px 28px 18px;
}
.daytime-result-rpg[hidden] { display: none; }
.daytime-result-tab {
  top: -16px;
  left: 24px;
  min-width: 110px;
  margin: 0;
  color: #e9dfc7;
  border-color: #e9dfc7;
  background: #0c090c;
}
.daytime-message-text {
  margin: 0;
  color: #eee5d2;
  font: 700 15px/1.8 var(--font-game);
}
.daytime-message-text::before { content: "\ff0a"; }
.daytime-effect-list {
  gap: 8px;
  margin: 0;
  padding: 0 0 14px;
  border-top: 0;
  border-bottom: 1px dashed #504348;
}
.daytime-effect-list li {
  padding: 0;
  color: #9fd5aa;
  border: 0;
  background: transparent;
  font-size: 11px;
}
.daytime-night-summary {
  gap: 10px;
  margin: 0;
  padding: 7px 0 0;
  border: 0;
}
.daytime-night-summary .eyebrow { display: none; }
.daytime-night-summary .daytime-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.daytime-night-summary .story-resource-change {
  display: flex;
  min-height: 0;
  gap: 5px;
}
.daytime-night-summary .story-resource-change > span,
.daytime-night-summary .story-resource-change > strong { font-size: 12px; }
.daytime-night-effects {
  margin: 0;
  color: #95c99f;
  font-size: 11px;
}
.daytime-to-night {
  position: relative;
  width: 100%;
  min-height: 60px;
  margin: 6px 0 0;
  padding: 13px 90px 13px 52px;
  color: #e1b65b;
  border: 0;
  border-top: 2px solid #594b3e;
  border-radius: 0;
  background: #191418;
  font: 700 18px/1.5 var(--font-game);
  text-align: left;
}
.daytime-to-night::before {
  content: "\25b6";
  position: absolute;
  left: 18px;
}
.daytime-to-night::after {
  content: "Enter";
  position: absolute;
  right: 18px;
  color: #887d73;
  font: 400 10px/1 ui-monospace, monospace;
}
.daytime-to-night:hover,
.daytime-to-night:focus-visible {
  color: #f0cb79;
  background: #211a1a;
  outline: 1px solid #d6a952;
}

@media (max-width: 900px) {
  .daytime-card.daytime-stage { padding: 0 12px 20px; }
  .daytime-meta-bar { width: calc(100% + 24px); margin: 0 -12px 18px; padding: 0 18px; }
  .daytime-panel { gap: 40px; padding: 38px 20px 28px; background-size: auto 370px; }
  .daytime-hero { min-height: 180px; }
  .daytime-upper-grid { grid-template-columns: 1fr; gap: 38px; }
  .daytime-choice { grid-template-columns: 30px minmax(0, 1fr); }
  .daytime-choice-copy { grid-template-columns: 1fr; gap: 4px; }
  .daytime-choice-tags { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .daytime-card.daytime-stage { padding-inline: 6px; }
  .daytime-meta-bar { width: calc(100% + 12px); height: 58px; margin-inline: -6px; padding-inline: 12px; }
  .daytime-meta-bar > div { gap: 10px; }
  .daytime-brand { font-size: 16px; }
  .daytime-story-label { font-size: 9px; letter-spacing: .09em; }
  .daytime-quit { min-width: 0; padding: 7px 10px; font-size: 9px; }
  .daytime-panel { gap: 36px; min-height: calc(100dvh - 84px); padding: 28px 12px 22px; border-width: 3px; }
  .daytime-hero { grid-template-columns: 1fr; gap: 14px; min-height: 220px; }
  .daytime-hero h2 { font-size: 36px; }
  .daytime-progress-wrap { justify-self: start; margin-top: 0; }
  .daytime-wake { font-size: 13px; }
  .daytime-morning-window,
  .daytime-work-window { min-height: 0; padding: 32px 15px 18px; }
  .daytime-morning-tab { min-width: 190px; }
  .daytime-event-chip { position: static; max-width: none; margin: -10px 0 0; }
  .daytime-command-tab { min-width: 220px; font-size: 11px; }
  .daytime-command-hint { display: none; }
  .daytime-choice { min-height: 90px; padding-inline: 7px; }
  .daytime-choice strong { font-size: 15px; }
  .daytime-preview-tag { padding: 4px 6px; font-size: 8px; }
  .daytime-resources .story-resource-change { grid-template-columns: 58px 95px minmax(0, 1fr); }
  .daytime-result-rpg { padding: 32px 12px 12px; }
  .daytime-to-night { padding-left: 42px; padding-right: 56px; font-size: 14px; }
}

@media (max-width: 560px) {
  .result-share-bar .result-meta-button { flex: 1 1 calc(50% - 8px); }
}

body:has(#daytimeOverlay.is-visible) { overflow: hidden; }

/* Custom opponent maker: a full-screen retro RPG creation room. */
body:has(#characterMakerOverlay.is-visible) { overflow: hidden; }
.character-maker-overlay {
  z-index: 90;
  place-items: start center;
  padding: 22px;
  overflow-y: auto;
  background:
    linear-gradient(#09070bd9, #09070bf2),
    repeating-linear-gradient(0deg, transparent 0 3px, #ffffff05 3px 4px);
  backdrop-filter: blur(5px);
}
.character-maker-card {
  width: min(1120px, 100%);
  margin: 0 auto 30px;
  padding: 28px;
  color: #eee5d2;
  border: 4px solid #4b3b36;
  border-radius: 8px;
  background: #120f13;
  box-shadow: 0 0 0 2px #100d10, 0 0 0 5px #2b2226, 0 22px 70px #000c;
}
.character-maker-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.character-maker-header h2 { margin: 4px 0 8px; color: #e7ba60; font: 700 34px/1.2 var(--font-game); letter-spacing: .08em; }
.character-maker-header p:last-child { margin: 0; color: #a99d8d; font-size: 13px; }
.custom-slot-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin: 0 0 34px; padding: 11px 15px; border: 1px solid #3d3434; background: #191419;
}
.custom-slot-bar > div { display: flex; align-items: center; gap: 12px; }
.custom-slot-bar span { color: #998e80; font-size: 11px; }
.custom-slot-bar strong { color: #9fd5aa; font-size: 15px; }
.custom-slot-bar p { margin: 0; color: #d3c9b8; font-size: 11px; }
.custom-slot-bar p[data-tone="error"] { color: #e89586; }
.custom-slot-bar p[data-tone="success"] { color: #9fd5aa; }
.character-maker-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(310px, .8fr); gap: 28px; align-items: start; }
.character-maker-fields { display: grid; gap: 34px; }
.maker-section { margin: 0; padding: 35px 20px 20px; border-color: #4b4246; background: #171216; }
fieldset.maker-section { min-width: 0; }
.maker-section > .rpg-window-tab, .maker-section > legend.rpg-window-tab { min-width: 175px; color: #e7ba60; }
.maker-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.maker-field { display: grid; gap: 7px; margin-bottom: 14px; color: #c7bcaa; font-size: 11px; }
.maker-field span { display: flex; align-items: baseline; gap: 7px; }
.maker-field b, .maker-upload b { color: #e89586; font-size: 9px; }
.maker-field small { color: #746b64; font-size: 9px; }
.maker-field input, .maker-field select, .maker-field textarea {
  width: 100%; min-height: 43px; padding: 10px 12px; color: #f2eadb; border: 1px solid #51444a;
  border-radius: 3px; background: #0d0b0e; font: 700 13px/1.6 var(--font-game);
}
.maker-field textarea { resize: vertical; }
.maker-field input:focus, .maker-field select:focus, .maker-field textarea:focus { outline: 2px solid #d5a64a; outline-offset: 2px; }
.maker-option-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.maker-option-grid label, .personality-options label { cursor: pointer; }
.maker-option-grid input, .personality-options input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.maker-option-grid label > span {
  display: grid; gap: 5px; min-height: 76px; padding: 12px; border: 1px solid #443a3f; background: #0f0c10; text-align: center;
}
.maker-option-grid b { color: #d8cdbb; font-size: 13px; }
.maker-option-grid small { color: #81766d; font-size: 9px; line-height: 1.5; }
.maker-option-grid input:checked + span { border-color: #d5a64a; background: #261e18; box-shadow: inset 0 0 0 1px #755b2d; }
.maker-option-grid input:checked + span b { color: #f0c56f; }
.maker-option-grid input:focus-visible + span, .personality-options input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.personality-fieldset { margin: 2px 0 0; padding: 0; border: 0; }
.personality-fieldset legend { margin-bottom: 9px; color: #c7bcaa; font-size: 11px; }
.personality-fieldset legend small { color: #746b64; }
.personality-options { display: flex; flex-wrap: wrap; gap: 7px; }
.personality-options label > span { display: block; padding: 7px 10px; color: #9d9183; border: 1px solid #443a3f; border-radius: 2px; background: #0f0c10; font-size: 10px; }
.personality-options input:checked + span { color: #d9e7d5; border-color: #5e9068; background: #17251b; }
.maker-image-help, .maker-consent { margin: 0 0 13px; color: #94887b; font-size: 10px; line-height: 1.7; }
.maker-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.maker-upload { display: grid; gap: 8px; padding: 12px; border: 1px dashed #65534a; background: #100d10; color: #d5c9b7; font-size: 11px; }
.maker-upload input { width: 100%; color: #91867b; font-size: 10px; }
.maker-upload small { color: #746b64; font-size: 9px; }
.maker-consent { margin: 12px 0 0; }
.character-maker-preview { position: sticky; top: 10px; display: grid; gap: 32px; }
.maker-preview-window { padding: 34px 16px 18px; border-color: #624f43; background: #130f13; }
.maker-preview-window > .rpg-window-tab { color: #e7ba60; }
.maker-sprite-preview {
  position: relative; display: grid; place-items: center; height: 320px; overflow: hidden;
  border: 1px solid #3d3137; background: radial-gradient(circle at 50% 35%, #3a2930 0, #171116 47%, #0b090c 100%);
}
.maker-sprite-preview::after { content: ""; position: absolute; inset: auto 0 0; height: 28%; background: linear-gradient(transparent, #0a080bd9); pointer-events: none; }
.maker-sprite-preview > span { color: #5e4c51; font: 700 70px/1 var(--font-game); }
.maker-sprite-preview img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.maker-preview-profile { padding: 14px 4px 0; }
.maker-preview-name { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 11px; align-items: center; }
.maker-preview-name > span { display: grid; place-items: center; width: 58px; height: 58px; overflow: hidden; color: #d9c7a7; border: 2px solid #695248; background: #21191d; font-size: 19px; }
.maker-preview-name img { width: 100%; height: 100%; object-fit: cover; }
.maker-preview-name div { display: grid; gap: 5px; }
.maker-preview-name strong { color: #eee5d2; font-size: 16px; }
.maker-preview-name small { color: #c69752; font-size: 9px; }
.maker-preview-profile blockquote { margin: 15px 0 8px; color: #efd18d; font-size: 12px; line-height: 1.7; }
.maker-preview-profile > p { margin: 0 0 12px; color: #a99d8d; font-size: 10px; line-height: 1.7; }
.maker-preview-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; margin: 0; }
.maker-preview-stats div { display: flex; justify-content: space-between; gap: 6px; color: #80756c; font-size: 9px; }
.maker-preview-stats dt, .maker-preview-stats dd { margin: 0; }
.maker-preview-stats dd { color: #9fd5aa; letter-spacing: .08em; }
.maker-coming-soon { padding: 32px 15px 14px; border-style: dashed; background: #100d10; }
.maker-coming-soon > .rpg-window-tab { color: #8b7b6c; }
.maker-coming-soon > p { margin: 0 0 12px; color: #81766d; font-size: 10px; line-height: 1.6; }
.maker-coming-soon ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.maker-coming-soon li { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; border-top: 1px solid #2f282c; color: #9b8f82; font-size: 10px; }
.maker-coming-soon li b { color: #b07870; font-size: 9px; }
.maker-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid #31282e; }
.maker-actions-spacer { flex: 1; }
.maker-actions button { min-width: 150px; }
.maker-play-button:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .45; }

@media (max-width: 850px) {
  .character-maker-overlay { padding: 10px; }
  .character-maker-card { padding: 20px; }
  .character-maker-layout { grid-template-columns: 1fr; }
  .character-maker-preview { position: static; grid-template-columns: 1fr 1fr; }
  .maker-sprite-preview { height: 280px; }
}
@media (max-width: 600px) {
  .character-maker-overlay { inset: 50px 0 0; padding: 5px; }
  .character-maker-card { margin: 0; padding: 14px 10px 18px; border-width: 3px; }
  .character-maker-header h2 { font-size: 25px; }
  .character-maker-header p:last-child { display: none; }
  .custom-slot-bar { align-items: flex-start; flex-direction: column; margin-bottom: 30px; }
  .maker-field-grid, .maker-upload-grid, .character-maker-preview { grid-template-columns: 1fr; }
  .maker-option-grid { grid-template-columns: 1fr; }
  .maker-option-grid label > span { min-height: 0; text-align: left; }
  .maker-section { padding: 34px 12px 15px; }
  .maker-sprite-preview { height: 300px; }
  .maker-actions { align-items: stretch; flex-direction: column; }
  .maker-actions-spacer { display: none; }
  .maker-actions button { width: 100%; max-width: none; }
  #deleteCustomCharacterButton { order: 4; }
}

/* 伝票モーダルの閉じるボタンはモバイル開時のみ表示 */
.receipt-close { display: none; }

/* 長押し照準の対象。touch-action を切らないと、タッチ端末では指のわずかな動きが
   スクロール扱いになり pointercancel で照準が即キャンセルされる（iOSで選択不能になる）。
   長押し時のテキスト選択・コールアウトも無効化する。 */
.choice-card, .brace-button, .tutorial-practice {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* =====================================================================
   モバイル1画面レイアウト（縦持ちスマホ・幅700px以下）
   設計: docs/plans/2026-07-22-mobile-game-layout-design.md
   ここより上の 560px/820px ルールを意図的に上書きする。追記は必ずこの
   セクション内に行うこと。
   ===================================================================== */
@media (max-width: 700px) and (orientation: portrait) {
  /* --- ページ全体: スクロールを廃止し100dvhに固定 --- */
  html, body { height: 100%; overflow: hidden; }
  /* スクロール上端からの下引きで Chrome の pull-to-refresh が発火し対戦進行が消えるのを防ぐ */
  html { overscroll-behavior: none; }
  .game-shell { overscroll-behavior: contain; }

  /* タイトル/敵選択オーバーレイ表示中は背後の戦闘UIを完全に隠す。iOSのツールバー
     伸縮で fixed オーバーレイの外側に背後の上端（トップバー・あいて窓）が露出するため */
  .game-shell:has(.enemy-select-overlay.is-visible) .topbar,
  .game-shell:has(.enemy-select-overlay.is-visible) .play-layout { visibility: hidden; }
  .enemy-select-overlay { background: #09070b; backdrop-filter: none; }
  /* タイトルの中身が低い画面高を超えたときに切れないようオーバーレイ内スクロールを許可 */
  .overlay.enemy-select-overlay { overflow-y: auto; }
  .game-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    overflow-x: hidden;
    overflow-y: auto;
  }

  /* --- トップバー: 1行の薄型に固定 --- */
  .topbar {
    flex: 0 0 auto;
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0 10px;
    align-items: center;
  }
  .topbar .brand-lockup { font-size: 15px; }
  .topbar .icon-button { min-height: 24px; padding: 2px 8px; font-size: 11px; }
  .toggle span { width: 28px; height: 14px; }

  /* 戦闘中は進行バー非表示。進行は幕間とリザルトで確認できる */
  .story-run-bar { display: none; }

  /* --- 盤面: 残り高さ全部を使う縦グリッド --- */
  .play-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: block;
  }
  .bar-stage {
    /* height固定だと溢れがクリップされスクロール不能になる。autoで伸ばし .game-shell 側でスクロール */
    height: auto;
    min-height: 100%;
    display: grid;
    /* ステージ行は最低250pxを保証（メッセージ窓拡大とどうぐ欄常時表示の縦予算を360×640で成立させる値。
       削れるのはメッセージ窓背面の立ち絵脚部で、顔の可視域には影響しない。超過分は微スクロール） */
    grid-template-rows: minmax(250px, 1fr) auto auto;
    /* 行: 1=ステージ(HUDを重ねる) 2=メッセージ 3=コマンド */
  }

  /* --- HUD 3窓をグリッドアイテムに昇格 --- */
  .bar-stage > .hud { display: contents; }

  /* 共通: RPG窓を薄型バーに変える */
  /* --- ポケモン風HPバー: パネル角丸・タブは中の見出しに --- */
  .bar-stage .hud-window {
    min-height: 0;
    margin: 0 6px;
    padding: 7px 12px 7px;
    border-width: 3px;
    border-radius: 10px;
    box-shadow: 3px 4px #070609aa;
  }
  .bar-stage .hud-window .rpg-window-tab {
    position: static;
    display: inline-block;
    min-width: 0;
    margin: 0 0 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #d5a64a;
    font-size: 10px;
    letter-spacing: .12em;
    text-align: left;
  }
  .bar-stage .hud-window .hud-footnote { display: none; }
  /* バー: 細い連続ピル型（セグメントの隙間と影を消して連続に見せる） */
  .bar-stage .meter { border-radius: 7px; align-self: center; }
  .bar-stage .meter .meter-fill { height: 6px; border-radius: 3px; }
  .mood-card > .hud-row:first-of-type { margin-bottom: 7px; }
  .hud-row { min-height: 17px; grid-template-columns: 44px minmax(60px, 1fr) 40px; gap: 6px; }
  .hud-row > span { font-size: 10px; }
  .hud-row > strong { font-size: 12px; }

  /* 敵HUD（あいて）: 最上段 */
  .bar-stage .mood-card {
    grid-row: 1; grid-column: 1;
    align-self: start; justify-self: start;
    z-index: 5;
    width: 52%;
    margin: 14px 0 0 6px;
    background: #0c090cd8;
  }
  /* 敵ステータス行とプレッシャーバッジは1行に並べて高さを節約 */
  .mood-card .enemy-drunk { float: none; display: inline-block; margin: 1px 8px 0 0; font-size: 9px; }
  .mood-card .zone-pressure-badge { display: inline-block; margin-top: 1px; padding: 1px 5px; font-size: 9px; vertical-align: middle; }

  /* 自分HUD（じぶん）: ステージ右上（あいてと水平に並べ、下端をメッセージ窓に譲る） */
  .bar-stage .self-window {
    grid-row: 1; grid-column: 1;
    align-self: start; justify-self: end;
    z-index: 5;
    width: 44%;
    margin: 14px 6px 0 0;
    background: #0c090cd8;
  }
  /* 44%幅では共通の 44px/60px/40px 列（3171行）が溢れるため、じぶん側だけ列を締める */
  .self-window .hud-row { grid-template-columns: 40px minmax(34px, 1fr) 34px; }
  /* 照準開始はバーの黄変で伝わるため、警告文は出さない（数値と重なるのを防ぐ） */
  .self-window .drunk-warning { display: none; }

  /* こんや（終電・支払）: じぶん窓（3193行）直下・右寄せの縦2段。
     margin-top はグリッド行1セル先頭からの絶対位置で実測調整した値。じぶん窓の
     下端は viewport高に依存せず y≈137px（375x812/390x844/375x667/360x640の4VPで
     実測して共通確認済み。行1セルの高さは minmax(250px, 1fr) だが上端位置は
     viewport高で動かないため、margin-top固定で全VPに効く）。#shareCard タップで
     伝票モーダルを開く動線は 3237 行付近のまま維持 */
  .bar-stage .tonight-window {
    grid-row: 1; grid-column: 1;
    align-self: start; justify-self: end;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 44%;
    margin: 106px 6px 0 0;
    padding: 4px 10px;
    background: #0c090c;
  }
  .bar-stage .tonight-window .rpg-window-tab { display: none; }
  .tonight-window .tonight-row {
    display: flex;
    gap: 4px;
    align-items: baseline;
    justify-content: space-between;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    filter: none;
    min-height: 0;
  }
  .tonight-window .tonight-row > span { font-size: 9px; }
  .tonight-window .tonight-row > strong { font-size: 10px; white-space: nowrap; }
  /* 支払カードはタップで伝票を開く（Task 2）: タップ可能に見せる */
  .tonight-window #shareCard { border-bottom: 1px dashed #776b59; cursor: pointer; }

  /* --- 背景と立ち絵: ステージ全域に敷き、立ち絵は空き行の中央へ --- */
  .bar-backdrop {
    inset: 0;
    /* 1381行の z-index: 0 上書きを打ち消す。DOM順で後ろの背景がHUD窓を覆うため -1 必須 */
    z-index: -1;
    height: auto;
  }
  /* 錨点は上基準（あいてバー直下）。下基準だと低い画面で顔が「じぶん」バーの裏に来る */
  .senpai {
    top: 118px;
    bottom: auto;
    transform-origin: top center;
  }
  .senpai[data-visual-mode="image"] {
    width: min(80vw, 320px);
    height: min(100vw, 400px);
    left: calc(50% - min(40vw, 160px));
    top: 118px;
    bottom: auto;
  }
  /* 同期・後輩は画像内の人物が下寄り小さめ＋拡大補正（1.35/1.4・下端基準）のため、
     上基準だと顔が枠外へ突き抜ける。足元をメッセージ＋コマンドの高さぶん浮かせた
     下基準に切り替え、人物が帯内へ上方向に伸びるようにする */
  .game-shell[data-enemy-id="nakijozu-doki"] .senpai,
  .game-shell[data-enemy-id="nakijozu-doki"] .senpai[data-visual-mode="image"],
  .game-shell[data-enemy-id="tsuburekake-kohai"] .senpai,
  .game-shell[data-enemy-id="tsuburekake-kohai"] .senpai[data-visual-mode="image"] {
    top: auto;
    bottom: calc(106px + clamp(88px, 16dvh, 168px));
  }

  /* --- メッセージウィンドウ: 行2・内部スクロール --- */
  .enemy-speech.dialog-box {
    grid-row: 2;
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    min-height: clamp(120px, 22dvh, 210px);
    max-height: clamp(120px, 22dvh, 210px);
    overflow-y: auto;
    margin: 0 6px 6px;
    padding: 18px 12px 10px;
    /* 基底 --window-bg #0c090cf0 の半透明を打ち消し完全不透明化。立ち絵の胴が
       透けて見える問題対策（rev2 1項） */
    background: #0c090c;
  }
  .enemy-speech .dialog-text { font-size: 14px; line-height: 1.6; }
  /* overflow-y: auto がタブ（top: -16px）をクリップするため、タブは枠内に置く。
     font-size を絞るのは padding 圧縮後にタブが本文と重なる／枠外に出るのを防ぐため */
  .enemy-speech.dialog-box .rpg-window-tab { top: 4px; left: 8px; font-size: 9px; }
  .enemy-speech .speech-speaker { min-width: 0; font-size: 10px; }
  .dialog-result { margin-top: 3px; }
  .reaction, .battle-messages li { font-size: 11px; }
  /* result域タイポグラフィ圧縮: セリフ＋リアクションを画面外へ逃がさず読み切らせるため、
     短landscape用ブロック（1746-1750行）の実績値を移植 */
  .reaction { line-height: 1.45; }
  .battle-messages { margin-top: 3px; gap: 2px 12px; }
  .battle-messages li { line-height: 1.35; }

  /* --- コマンドウィンドウ: 最下段 --- */
  .counter {
    grid-row: 3;
    min-height: 0;
    padding: 12px 6px 6px;
  }
  .command-window { min-height: 0; padding: 14px 4px 0; }
  /* Material 8dp下限: 誤タップ低減。縦予算に無影響な横方向のみ広げる */
  .choices { gap: 8px; }
  .command-window .choices-heading { min-width: 0; font-size: 10px; }
  .command-window .hand-info { display: none; }
  .command-window .choice-card { min-height: 44px; padding: 5px 8px; }
  .command-window .choice-card strong { font-size: 14px; }
  .command-window .choice-card small { display: none; }
  .choice-tone-tag, .choice-anchor-badge, .choice-payoff-badge,
  .choice-result-badge, .fatigue-badge { padding: 1px 4px; font-size: 9px; }
  /* 命綱UIは1行に圧縮（照準の説明はチュートリアルで学習済みのため出さない） */
  #focusHint { display: none; }
  .command-window .focus-tools { grid-template-columns: 1fr; margin: 0 2px 3px; padding: 3px 6px; }
  .command-window .brace-button {
    min-height: 26px;
    display: flex;
    gap: 8px;
    align-items: baseline;
    justify-content: center;
    padding: 3px 8px;
  }
  .command-window .brace-button strong { font-size: 12px; }
  .command-window .brace-button span,
  .command-window .brace-button small { font-size: 9px; }
  /* どうぐ欄は常時表示・固定高（出現でレイアウトが動かないように）。空表示は既存DOMの
     「どうぐ（仕込み）：なし」（index.html:165 + main.js の preparation-empty）をそのまま使う。
     min-height だけだと長い仕込み名やフォント拡大設定で折り返した場合に高さが伸び得るため、
     実測高（375x812/390x844/375x667/360x640で25.5px固定）に height を合わせ、white-space:
     nowrap + overflow: hidden で二重に1行を保証する（チップ列自体は .preparation-list の
     overflow-x: auto が既に横スクロールで吸収している）。 */
  .command-footer {
    display: flex;
    align-items: center;
    height: 25.5px;
    min-height: 25.5px;
    padding: 3px 8px;
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
  }
  .command-footer > span:last-child { display: none; }

  /* --- 伝票: 常設はやめる（Task 2 でモーダル化） --- */
  .play-layout > .receipt { display: none; }

  /* 伝票モーダル: 支払カードのタップで開く */
  .receipt-close { display: none; }
  body.receipt-modal-open .play-layout > .receipt {
    display: block;
    position: fixed;
    z-index: 140;
    left: 50%;
    top: 50%;
    width: min(320px, calc(100vw - 40px));
    max-height: min(70dvh, 480px);
    overflow-y: auto;
    transform: translate(-50%, -50%);
    /* box-shadow の広がりで背景を暗転させる（別要素不要） */
    box-shadow: 0 0 0 100vmax #060509cc, 10px 12px 0 #050405;
  }
  body.receipt-modal-open .receipt-close {
    display: grid;
    place-items: center;
    position: sticky;
    top: 0;
    margin-left: auto;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--paper-ink);
    border: 2px solid var(--paper-ink);
    background: var(--paper);
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
  }

  /* --- 低背丈端末フォールバック: 600px未満はスクロール許容 --- */
  @media (max-height: 600px) {
    html, body { overflow: auto; }
    .game-shell { height: auto; overflow: visible; }
    .bar-stage { grid-template-rows: 220px auto auto; }
  }

  /* --- リザルト画面: シェアカードを主役に圧縮 ---
     実行時 DOM は prepareResultScreen() が再構築する（canvas は .result-share-bar 直下、
     4 コマンドは .result-command-window 内の .result-command、.result-actions は削除済み）。
     そのため実DOMに存在する要素へ、既存ルールの詳細度を上回るセレクタで当てる。 */
  .result-overlay { padding: 8px; }
  .result-card.result-stage { padding: 30px 10px 16px; border-width: 3px; }
  .result-banner { min-height: 0; }
  .result-stars { margin: 0 0 12px; font-size: 15px; }
  .result-stage .result-label { font-size: 34px; text-shadow: 3px 3px 0 #8a2c31, 6px 6px 0 #070609; }
  .result-stage .result-quote { margin: 16px 0 0; font-size: 14px; }
  .result-stage .result-comment { margin: 8px auto 0; font-size: 11px; }
  .result-record { margin-top: 14px; padding: 16px 12px 8px; }
  .result-stage .result-record dl { grid-template-columns: 1fr; gap: 3px; }
  .result-stage .result-record dt { font-size: 11px; }
  .result-stage .result-record dd { font-size: 14px; }

  /* コマンドウィンドウ: 4コマンドを2列に畳んで縦占有を半減（.result-command は width:100% を上書き） */
  .result-command-window {
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 20px 8px 10px;
  }
  .result-command-window > .rpg-window-tab { min-width: 88px; }
  .result-command-window .result-command {
    width: auto;
    flex: 1 1 calc(50% - 8px);
    min-height: 44px;
    padding: 8px 10px;
    border-top: 0;
  }

  /* シェアバー: canvas(.share-card-preview) を幅いっぱいのヒーローに（既存 88px/76px を上書き） */
  .result-share-bar { margin-top: 14px; flex-wrap: wrap; }
  .result-share-bar .share-card-preview {
    flex: 1 1 100%;
    width: 100%;
    height: auto;
    margin: 0 0 10px;
    object-fit: contain;
  }
  .result-share-bar .result-meta-button { flex: 1 1 calc(50% - 8px); min-height: 42px; padding: 8px 6px; }

  /* story-intermission は実行時 .result-stage の子。既存 .result-stage .story-intermission に詳細度で並べ、後勝ちさせる */
  .result-stage .story-intermission { margin: 12px 0 14px; }
  .story-transition-art { min-height: 180px; }

  /* --- 日中画面: 選択肢がファーストビューに入るよう圧縮 ---
     実行時 DOM は prepareDaytimeScreen() が再構築する（card は .daytime-stage、見出し h2 は
     .daytime-hero の子、.daytime-hangover は hidden 化）。実DOMに存在する要素へ詳細度で当てる。 */
  .daytime-overlay { padding: 6px; }
  .daytime-card.daytime-stage { padding: 0 8px 16px; }
  .daytime-meta-bar { height: 50px; margin-bottom: 12px; }
  .daytime-panel { gap: 16px; min-height: calc(100dvh - 74px); padding: 22px 12px 18px; }
  .daytime-hero { min-height: 0; gap: 10px; padding: 4px 2px 0; }
  .daytime-hero h2 { font-size: 23px; text-shadow: 3px 2px 0 #1f3037, 5px 4px 0 #07090b; }
  .daytime-progress-wrap { margin-top: 0; padding: 6px 12px; }
  .daytime-wake { font-size: 12px; line-height: 1.6; }
  .daytime-upper-grid { gap: 18px; }
  .daytime-morning-window,
  .daytime-work-window { padding: 26px 14px 14px; }
  .daytime-event-text { font-size: 11px; line-height: 1.6; }
  .daytime-event h3 { margin: 4px 0 6px; font-size: 15px; }
  .daytime-choices { gap: 6px; }
  .daytime-command-window { padding: 26px 12px 12px; }
  .daytime-choice { min-height: 0; padding: 9px 8px; }
  .daytime-choice strong { font-size: 14px; }
}

.daytime-kind-chip { display: inline-block; flex: none; width: fit-content; margin-right: 8px; padding: 1px 8px; border-radius: 999px; font-size: 0.68rem; letter-spacing: 0.08em; border: 1px solid currentColor; vertical-align: middle; }
.daytime-kind-chip.is-safe { color: #89c497; }
.daytime-kind-chip.is-gamble { color: #d3a853; }
.daytime-kind-chip.is-setup { color: #9aa7d6; }
.daytime-gamble-stamp { display: inline-block; margin-left: 10px; padding: 2px 10px; border: 2px solid currentColor; border-radius: 4px; font-weight: 700; transform: rotate(-4deg); }
.daytime-gamble-stamp.is-success { color: #89c497; }
.daytime-gamble-stamp.is-failure { color: #da7969; }
