:root {
  --ink: #14101a;
  --panel: #241824;
  --panel-2: #33212e;
  --gold: #c9a24a;
  --gold-hi: #f0d68a;
  --cream: #f3ead2;
  --muted: #b3a48c;
  --wine: #8a1c24;
  --testimony: #a6e3a1;
  --thought: #9cc3e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Noto Sans', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
  font-size: clamp(16px, 2.1vw, 20px);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

#app {
  position: relative;
  width: 100%;
  /* The picture is as wide as the window's height allows once the bars below it are counted: the top bar and the
     action buttons (about 105px) and the dialogue box with its margin and the buttons' padding (12em). */
  max-width: min(960px, calc((100vh - 12em - 115px) * 16 / 9));
  max-width: min(960px, calc((100dvh - 12em - 115px) * 16 / 9));
  min-width: min(100%, 320px);
  margin: 0 auto;
  padding: 0 0 env(safe-area-inset-bottom);
  min-height: 100vh;
}

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  color: var(--cream);
  background: var(--panel-2);
  border: 2px solid var(--gold);
  box-shadow: 0 3px 0 #000;
  padding: 0.45em 0.9em;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover, .btn:focus-visible { background: var(--wine); outline: none; border-color: var(--gold-hi); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.btn.small { min-height: 36px; padding: 0.15em 0.6em; font-size: 0.85em; white-space: nowrap; flex: none; }
.btn.icon { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; padding: 0 0.5em; }
.btn.icon .leave, .btn.icon[aria-pressed="true"] .enter { display: none; }
.btn.icon[aria-pressed="true"] .leave { display: inline; }
.btn.ghost { background: transparent; border-style: dashed; }
.btn.primary { background: var(--wine); }
.btn[disabled] { opacity: 0.4; cursor: default; }

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35em 0.5em;
  font-size: 0.85em;
  color: var(--muted);
  min-height: 48px;
}
#hud .spacer { flex: 1; }
#hud-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 520px) { #hud-title { display: none; } }
#cred { color: var(--gold-hi); white-space: nowrap; letter-spacing: 0.1em; }
#cred .lost { color: #5a4a50; }

/* ---------- stage ---------- */
#stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 2px solid var(--gold);
  background: #000;
  user-select: none;
}
#bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#stage.shake { animation: shake 0.35s steps(6); }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 3px); }
}

#hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute;
  background: transparent;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.hotspot::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 0.7em; height: 0.7em;
  margin: -0.35em 0 0 -0.35em;
  background: var(--gold-hi);
  border: 2px solid #000;
  transform: rotate(45deg);
  animation: pulse 1.2s steps(2) infinite;
}
.hotspot.seen::after { background: #6a6258; animation: none; }
.hotspot.move::after { background: #8ed0f0; border-radius: 50%; }
.hotspot:hover, .hotspot:focus-visible { border-color: var(--gold-hi); background: rgba(240, 214, 138, 0.14); outline: none; }
.hotspot span {
  position: absolute; left: 50%; bottom: 100%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--ink); color: var(--cream);
  border: 1px solid var(--gold);
  padding: 0 0.4em; font-size: 0.75em;
  display: none;
  pointer-events: none;
  z-index: 3;
}
.hotspot.low span { bottom: auto; top: 100%; }
.hotspot:hover span, .hotspot:focus-visible span { display: block; }
@keyframes pulse { 50% { opacity: 0.35; } }

#tbar {
  position: absolute; left: 0; top: 0;
  background: var(--wine); color: var(--cream);
  border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
  padding: 0.1em 0.7em; font-size: 0.85em;
}

#portrait {
  position: absolute; bottom: 0;
  width: 31%;
  aspect-ratio: 1;
  border: 3px solid var(--gold);
  border-bottom: 0;
  background: #000;
  box-shadow: 0 0 0 2px #000;
}
#portrait.left { left: 3%; }
#portrait.right { right: 3%; }
#portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
#portrait.flip img { scale: -1 1; } /* turned to face the speaker on the left */
#portrait.dim img { filter: brightness(0.55); }

#banner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 16, 26, 0.55);
  z-index: 5;
}
#banner span {
  display: block; width: 120%;
  text-align: center;
  background: var(--wine); color: var(--gold-hi);
  border-top: 4px solid var(--gold); border-bottom: 4px solid var(--gold);
  font-size: clamp(28px, 8vw, 72px); line-height: 1.5;
  letter-spacing: 0.08em;
  transform: rotate(-4deg);
  animation: slam 0.25s steps(4);
  text-shadow: 3px 3px 0 #000;
}
#banner.card span { font-size: clamp(20px, 5vw, 44px); transform: none; background: var(--panel); color: var(--cream); }
@keyframes slam { from { transform: rotate(-4deg) scale(2.2); opacity: 0; } }

#toast {
  position: absolute; left: 50%; top: 8%;
  transform: translateX(-50%);
  background: var(--panel); color: var(--cream);
  border: 2px solid var(--gold-hi);
  padding: 0.3em 0.9em; text-align: center;
  z-index: 4; max-width: 92%;
  box-shadow: 0 4px 0 #000;
}
#toast b { color: var(--gold-hi); font-weight: normal; display: block; }

/* ---------- dialogue ---------- */
#dialog {
  position: relative;
  margin-top: 0.9em;
  background: var(--panel);
  border: 2px solid var(--gold);
  padding: 0.9em 1em 1em;
  min-height: 7.6em;
  cursor: pointer;
}
#name {
  position: absolute; left: 0.8em; top: -0.95em;
  background: var(--gold); color: var(--ink);
  padding: 0 0.7em; line-height: 1.5;
  border: 2px solid #000;
}
#text { margin: 0; overflow-wrap: anywhere; }
#text .hid { visibility: hidden; }
#text.narration { color: var(--muted); }
#text.thought { color: var(--thought); }
#text.testimony { color: var(--testimony); }
#text.prompt { color: var(--muted); }
#text .solved { color: var(--muted); }
#text .idx { color: var(--gold-hi); margin-right: 0.6em; }
ruby rt { font-size: 0.5em; color: inherit; opacity: 0.85; }
#more { position: absolute; right: 0.6em; bottom: 0.2em; color: var(--gold-hi); animation: pulse 0.9s steps(2) infinite; }

#actions {
  display: flex; flex-wrap: wrap; gap: 0.5em;
  padding: 0.6em 0.5em 1em;
  justify-content: center;
  min-height: 60px;
}
#actions .btn { flex: 1 1 8em; max-width: 14em; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0;
  z-index: 10;
  display: flex; align-items: flex-start; justify-content: center;
  background: rgba(14, 10, 18, 0.93);
  padding: 4vh 0.8em;
  overflow: auto;
}
.overlay[hidden], [hidden] { display: none !important; }
.title-card { text-align: center; max-width: 34em; width: 100%; }
#t-title {
  margin: 0; font-weight: normal;
  font-size: clamp(34px, 9vw, 76px); line-height: 1.25;
  color: var(--gold-hi); text-shadow: 4px 4px 0 var(--wine);
}
#t-alt { margin: 0.2em 0 0; color: var(--cream); letter-spacing: 0.2em; }
#t-lang {
  position: absolute; top: max(0.7em, env(safe-area-inset-top)); right: max(0.8em, env(safe-area-inset-right)); z-index: 2;
  min-height: 36px; padding: 0.3em 0.9em; font: inherit; font-size: 0.9em; color: var(--cream);
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--gold-hi); border-radius: 999px; cursor: pointer;
}
/* a globe, so the button reads as "language" to someone who cannot read the word */
#t-lang::before {
  content: ""; display: inline-block; width: 1em; height: 1em; margin-right: 0.45em; vertical-align: -0.15em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E") center / contain no-repeat;
}
#t-lang:hover, #t-lang:focus-visible { background: var(--wine); color: var(--gold-hi); }
#t-episode { color: var(--muted); margin: 1.6em 0 1.2em; }
.title-buttons { display: flex; flex-direction: column; gap: 0.7em; align-items: center; }
.title-buttons .btn { width: min(100%, 16em); }
#e-heading { color: var(--gold-hi); font-weight: normal; font-size: 1.6em; margin-top: 1.5em; }
#e-next { color: var(--testimony); }

.record-card {
  width: 100%; max-width: 40em;
  background: var(--panel); border: 2px solid var(--gold);
  padding: 0.8em 1em 1em;
}
.record-card header { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.record-card h2 { margin: 0; font-weight: normal; color: var(--gold-hi); font-size: 1.2em; }
#r-pick { color: var(--testimony); margin: 0.5em 0 0; }
#r-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: 0.5em; margin: 0.8em 0; }
.ev {
  font: inherit; color: var(--cream); text-align: left;
  background: var(--panel-2); border: 2px solid #5a4a50;
  padding: 0.4em 0.5em; cursor: pointer; min-height: 52px;
  display: flex; align-items: center; gap: 0.5em;
}
.ev i { font-style: normal; color: var(--gold-hi); font-size: 1.4em; width: 1.2em; text-align: center; flex: none; }
.ev.sel { border-color: var(--gold-hi); background: var(--wine); }
#r-detail { border-top: 2px dashed #5a4a50; padding-top: 0.6em; min-height: 8em; }
#r-name { margin: 0 0 0.3em; font-weight: normal; color: var(--gold-hi); }
#r-desc { margin: 0 0 0.8em; }

@media (prefers-reduced-motion: reduce) {
  #stage.shake, #banner span, .hotspot::after, #more { animation: none; }
}

/* ---------- supplied art ---------- */
#portrait.placeholder::after {
  content: attr(data-initial);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(40px, 12vw, 120px);
  color: rgba(243, 234, 210, 0.55);
}
.ev i img { width: 100%; display: block; image-rendering: pixelated; }

/* ---------- type: Cinzel marks Roman things (names, headings, glossary terms) ---------- */
:root { --roman: 'Cinzel', 'Noto Sans JP', serif; --nota: #7fd6c2; }
#name, #t-title, #t-alt, #banner span, #tbar, .tabs .tab, #e-heading, #n-term { font-family: var(--roman); font-weight: 700; letter-spacing: 0.04em; }
#t-alt { font-weight: 500; }
.term {
  font: inherit; color: var(--gold-hi); background: none; border: 0; padding: 0; margin: 0;
  border-bottom: 2px dotted var(--gold); cursor: help; line-height: inherit;
}
html[lang="en"] .term { font-family: var(--roman); font-weight: 500; font-size: 0.95em; }
.term:hover, .term:focus-visible { background: rgba(240, 214, 138, 0.15); outline: none; }
#text.nota { color: var(--nota); }
#name.nota { background: var(--nota); }
.tabs { display: flex; gap: 0.4em; }
.tabs .tab { opacity: 0.6; }
.tabs .tab.on { opacity: 1; background: var(--wine); }
.overlay.note { z-index: 20; align-items: center; background: rgba(14, 10, 18, 0.7); }
.note-card {
  width: 100%; max-width: 30em;
  background: #14262a; border: 2px solid var(--nota);
  padding: 0.8em 1em 1em; box-shadow: 0 6px 0 #000;
}
#n-who { margin: 0; color: var(--nota); font-size: 0.8em; letter-spacing: 0.15em; }
#n-term { margin: 0.1em 0 0.4em; color: var(--gold-hi); font-size: 1.2em; }
#n-note { margin: 0 0 0.9em; }
#n-term .term, #n-note .term, #r-name .term, #r-desc .term { border: 0; cursor: inherit; color: inherit; }

/* ---- Nota's badge (set from data/assets.json at start-up) ---- */
#title-screen #t-episode { color: var(--cream); text-shadow: 0 2px 0 #000; }
.has-nota-art #name.nota::before, .has-nota-art #n-who::before {
  content: ''; display: inline-block; width: 1.6em; height: 1.6em; margin-right: 0.4em; vertical-align: middle;
  background: var(--nota-art) center / cover no-repeat; image-rendering: pixelated; border-radius: 50%;
}
.has-nota-art #n-who::before { width: 2.6em; height: 2.6em; }

/* ---------- puzzles ---------- */
.hotspot.puzzle::after {
  content: '?'; transform: none; border-radius: 50%; background: var(--nota); color: #000;
  width: 1.3em; height: 1.3em; margin: -0.65em 0 0 -0.65em; font-size: 0.8em; line-height: 1.2em; text-align: center; font-weight: 700;
}
.puzzle-card { border-color: var(--nota); }
.puzzle-card h2 { color: var(--nota); font-family: var(--roman); }
#p-text { margin: 0.8em 0; }
#p-input { display: grid; gap: 0.5em; margin: 0.8em 0; }
#p-input .opt { font: inherit; color: var(--cream); text-align: left; background: var(--panel-2); border: 2px solid #5a4a50; padding: 0.5em 0.7em; min-height: 44px; cursor: pointer; }
#p-input .opt.sel { border-color: var(--gold-hi); background: var(--wine); }
#p-number { font: inherit; font-size: 1.4em; width: 6em; padding: 0.2em 0.5em; background: var(--ink); color: var(--cream); border: 2px solid var(--gold); text-align: center; justify-self: center; }
#p-feedback { color: var(--gold-hi); margin: 0 0 0.6em; }
#p-feedback.solved { color: var(--testimony); }
#p-hints { margin: 0 0 0.8em; padding-left: 1.4em; color: var(--thought); }
#p-hints:empty { display: none; }
.puzzle-buttons { display: flex; gap: 0.6em; justify-content: flex-end; flex-wrap: wrap; }
#e-puzzles { color: var(--nota); }

/* ---------- drama: shakes, damage, sweat, blink-ready portraits ---------- */
#dialog.shake { animation: boxshake 0.4s steps(8); }
@keyframes boxshake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-8px, 0); } 30% { transform: translate(7px, 1px); } 45% { transform: translate(-6px, -1px); }
  60% { transform: translate(5px, 0); } 75% { transform: translate(-3px, 1px); } 90% { transform: translate(2px, 0); }
}
@keyframes breathe { 50% { transform: translateY(0.8%) scaleY(0.992); } }
#portrait.hit-recoil { animation: recoil 0.55s ease-out; }
@keyframes recoil { 20% { transform: translateX(10%) scale(0.92) rotate(3deg); filter: brightness(1.6) sepia(1) hue-rotate(-40deg) saturate(4); } 100% { transform: none; } }
#portrait.right.hit-recoil { animation-name: recoil-r; }
@keyframes recoil-r { 20% { transform: translateX(-10%) scale(0.92) rotate(-3deg); filter: brightness(1.6) sepia(1) hue-rotate(-40deg) saturate(4); } 100% { transform: none; } }
#portrait.hit-flash { animation: flash 0.7s steps(7); }
@keyframes flash { 0%, 28% { filter: brightness(3) contrast(0.6); transform: scale(1.06); } 14%, 42% { filter: invert(1); } 100% { filter: none; transform: none; } }
#portrait.hit-tremble { animation: tremble 0.9s linear; }
@keyframes tremble { 0%, 100% { transform: none; } 10%, 30%, 50%, 70%, 90% { transform: translate(-3px, 1px); } 20%, 40%, 60%, 80% { transform: translate(3px, -1px); } }
#portrait.hit-crumble { animation: crumble 1.4s ease-in forwards; }
@keyframes crumble { 0% { transform: none; filter: none; } 15% { transform: translateY(-3%); } 100% { transform: translateY(7%) rotate(2deg); filter: grayscale(0.85) brightness(0.7); } }
#portrait .sweat { position: absolute; inset: 0; pointer-events: none; }
#portrait .sweat i {
  /* a 5x7 pixel drop in the game's own ink, cream and blue */
  position: absolute; width: 5.5%; aspect-ratio: 5 / 7; display: none; image-rendering: pixelated;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 7' shape-rendering='crispEdges'%3E%3Cpath fill='%2314101a' d='M2 0h1v1h1v2h1v3h-1v1h-3v-1h-1v-3h1v-2h1z'/%3E%3Cpath fill='%23f3ead2' d='M2 1h1v2h1v3h-3v-3h1z'/%3E%3Cpath fill='%239cc3e8' d='M3 4h1v2h-2v-1h1z'/%3E%3Cpath fill='%23fff' d='M1 3h1v1h-1z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  animation: drip 1.6s steps(8) infinite;
}
#portrait .sweat i:nth-child(1) { left: 28%; top: 16%; }
#portrait .sweat i:nth-child(2) { left: 66%; top: 12%; animation-delay: 0.55s; }
#portrait .sweat i:nth-child(3) { left: 72%; top: 30%; animation-delay: 1.1s; }
#portrait[data-sweat="1"] .sweat i:nth-child(1),
#portrait[data-sweat="2"] .sweat i:nth-child(-n+2),
#portrait[data-sweat="3"] .sweat i { display: block; }
#portrait[data-sweat="3"] .sweat i { animation-duration: 1s; }
@keyframes drip { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 15% { opacity: 1; transform: scale(1); } 100% { transform: translateY(160%); opacity: 0; } }

/* ---------- court: crowd, staff strike, counter-objection, choices, verdict ---------- */
#crowd { position: absolute; left: 0; right: 0; bottom: 0; height: 17%; display: flex; align-items: flex-end; pointer-events: none; }
#crowd i { flex: 1; height: var(--h); margin: 0 -1.2%; background: #0b0810; border-radius: 45% 45% 0 0 / 30% 30% 0 0; position: relative; }
#crowd i::before { content: ''; position: absolute; left: 30%; width: 40%; aspect-ratio: 1; top: -28%; border-radius: 50%; background: #0b0810; }
#crowd.react i { animation: hop 0.5s ease-out; animation-delay: var(--d); }
@keyframes hop { 30% { transform: translateY(-22%); } }
#gavel { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 8; image-rendering: pixelated; pointer-events: none; }
#banner.counter span { background: #1c3a6a; color: #dfeeff; transform: rotate(4deg); animation-name: slam-r; border-color: #8ec8f0; }
@keyframes slam-r { from { transform: rotate(4deg) scale(2.2); opacity: 0; } }
#choices { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.5em; background: rgba(14, 10, 18, 0.6); padding: 0 6%; }
#choices .choice {
  font: inherit; width: min(100%, 30em); text-align: left; color: var(--cream); background: var(--panel);
  border: 2px solid var(--gold); box-shadow: 0 3px 0 #000; padding: 0.4em 0.8em; min-height: 44px; cursor: pointer; animation: slidein 0.25s ease-out backwards;
}
#choices .choice:nth-child(2) { animation-delay: 0.06s; } #choices .choice:nth-child(3) { animation-delay: 0.12s; }
#choices .choice:hover, #choices .choice:focus-visible { background: var(--wine); border-color: var(--gold-hi); outline: none; }
@keyframes slidein { from { transform: translateX(-30%); opacity: 0; } }
#lower { position: absolute; left: 0; bottom: 10%; z-index: 4; background: linear-gradient(90deg, rgba(20,16,26,0.95) 70%, rgba(20,16,26,0)); padding: 0.3em 3em 0.4em 1em; border-left: 6px solid var(--gold); max-width: 80%; }
#lower b { display: block; font-family: var(--roman); color: var(--gold-hi); font-size: 1.25em; letter-spacing: 0.06em; }
#lower span { display: block; font-size: 0.8em; color: var(--cream); }
#lower { max-width: 62%; } /* the portrait takes the other third of the stage */
#lower.right { left: auto; right: 0; text-align: right; border-left: 0; border-right: 6px solid var(--gold); padding: 0.3em 1em 0.4em 3em; background: linear-gradient(270deg, rgba(20,16,26,0.95) 70%, rgba(20,16,26,0)); }
#lower.go { animation: lower 0.6s ease-out; }
#lower.right.go { animation-name: lower-r; }
@keyframes lower { from { transform: translateX(-100%); } }
@keyframes lower-r { from { transform: translateX(100%); } }
#verdict { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(14, 10, 18, 0.82); padding: 0 8%; text-align: center; }
#v-label { margin: 0; color: var(--muted); font-family: var(--roman); letter-spacing: 0.2em; font-size: 0.85em; }
#v-claim { margin: 0.2em 0 0; font-size: 1.15em; color: var(--cream); }
#verdict.stamped #v-claim { text-decoration: line-through 3px var(--wine); color: var(--muted); }
#v-stamp {
  margin-top: 0.3em; font-family: var(--roman); font-weight: 700; font-size: clamp(30px, 8vw, 70px); color: #e0302a; letter-spacing: 0.08em;
  border: 6px double #e0302a; padding: 0 0.4em; transform: rotate(-8deg); opacity: 0; text-shadow: 2px 2px 0 #000; background: rgba(0,0,0,0.25);
}
#verdict.stamped #v-stamp { opacity: 1; animation: stamp 0.3s cubic-bezier(.3,1.6,.6,1); }
@keyframes stamp { from { transform: rotate(-8deg) scale(3); opacity: 0; } }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 9; pointer-events: none; }

/* ---------- prologue, establishing shot, chapter cards ---------- */
#bg { transition: opacity 0.45s; }
#stage.dark #bg { opacity: 0; }
#stage.pushin #bg { animation: pushin 18s ease-out forwards; transform-origin: 39% 48%; }
@keyframes pushin { to { transform: scale(1.2); } }
body.cinema #stage::before, body.cinema #stage::after { content: ''; position: absolute; left: 0; right: 0; height: 7%; background: #000; z-index: 3; }
body.cinema #stage::before { top: 0; } body.cinema #stage::after { bottom: 0; }
body.cinema #dialog { background: #000; border-color: #000; text-align: center; }
body.cinema #text.narration { color: var(--cream); font-size: 1.05em; }
#chapter { position: absolute; inset: 0; z-index: 15; background: #000; display: flex; align-items: center; justify-content: center; text-align: center; }
#chapter .ch-inner > * { opacity: 0; }
#chapter.go #ch-emblem { animation: rise 1s ease-out forwards; }
#chapter.go #ch-ep { animation: rise 0.8s ease-out 0.4s forwards; }
#chapter.go #ch-num { animation: rise 0.8s ease-out 0.7s forwards; }
#chapter.go #ch-title { animation: rise 1s ease-out 1s forwards; }
#chapter.out { opacity: 0; transition: opacity 0.6s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
#ch-emblem { width: clamp(64px, 16vw, 120px); margin: 0 auto 0.6em; color: var(--gold-hi); filter: drop-shadow(0 0 12px rgba(240, 214, 138, 0.45)); }
#ch-ep { margin: 0; color: var(--muted); font-size: 0.8em; letter-spacing: 0.2em; }
#ch-num { margin: 0.3em 0 0; color: var(--gold); font-family: var(--roman); letter-spacing: 0.3em; }
#ch-title { margin: 0.1em 0 0; font-family: var(--roman); font-weight: 700; color: var(--cream); font-size: clamp(26px, 6vw, 52px); border-top: 2px solid var(--gold); padding-top: 0.2em; }
#fade { position: absolute; inset: 0; z-index: 16; background: #000; display: flex; align-items: center; justify-content: center; padding: 0 12%; }
#fade-text { opacity: 0; transition: opacity 1.8s; color: var(--cream); text-align: center; font-size: 1.1em; line-height: 1.9; max-width: 30em; }
#fade.in #fade-text { opacity: 1; }
#fade.out #fade-text { opacity: 0; transition-duration: 1.1s; }

@media (prefers-reduced-motion: reduce) {
  #dialog.shake, #portrait img, #portrait[class*="hit-"], #crowd.react i, #stage.pushin #bg, #portrait .sweat i { animation: none; }
}

/* ---------- objection in the speaker's own tongue ---------- */
#banner.cry span { width: auto; background: var(--wine); border: 4px solid var(--gold-hi); padding: 0.1em 0.6em 0.25em; display: flex; flex-direction: column; align-items: center; line-height: 1.15; box-shadow: 6px 6px 0 #000; }
#banner.cry b { color: #fffdf2; -webkit-text-stroke: 6px #000; paint-order: stroke fill; text-shadow: 0 5px 0 #000; }
#banner.cry small { font-size: 0.3em; color: var(--gold-hi); background: #000; padding: 0 0.7em; letter-spacing: 0.15em; text-shadow: none; }
#banner.counter.cry span { background: #23405c; border-color: var(--cream); }

/* ---------- visual puzzles ---------- */
#p-input canvas { image-rendering: pixelated; display: block; }
#p-input .p-target { width: min(40%, 150px); justify-self: center; border: 2px solid var(--gold); }
#p-input .p-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.5em; text-align: center; }
#p-input .p-row .opt { text-align: center; padding: 0.3em; }
#p-input .p-row .opt canvas { width: 100%; }
#p-input .p-board { width: 100%; border: 2px solid var(--gold); cursor: pointer; }
#p-input .p-board.round { width: min(100%, 320px); justify-self: center; border: 0; image-rendering: auto; }
#p-input .pegs { color: var(--muted); font-family: var(--roman); }
#p-input .pegs .last { color: var(--gold-hi); }
#p-input.done { pointer-events: none; }

#banner.cry.art span { background: none; border: 0; box-shadow: none; padding: 0; transform: none; }
#banner.cry.art img { width: min(38vw, 360px); display: block; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.6)); }
#banner.cry.art b { font-size: clamp(15px, 3.6vw, 34px); margin-top: -0.9em; background: #000; border: 2px solid var(--gold-hi); padding: 0 0.7em; -webkit-text-stroke: 0; text-shadow: none; color: var(--gold-hi); letter-spacing: 0.12em; }
#banner.counter.cry b { color: var(--cream); }

/* ---------- picture puzzles and the puzzle room ---------- */
#p-input img.p-board, #p-input .p-spot img { width: 100%; display: block; image-rendering: auto; cursor: default; }
#p-input .p-spot { position: relative; border: 2px solid var(--gold); cursor: crosshair; }
#p-input .p-spot i { position: absolute; width: 9%; aspect-ratio: 1; margin: -4.5% 0 0 -4.5%; border: 3px solid var(--gold-hi); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #000; pointer-events: none; }
#p-input .p-board.smooth { image-rendering: auto; }
#p-input .p-board.square { width: min(100%, 340px); justify-self: center; }
#room-note { color: var(--muted); margin: 0.6em 0; }
#room-list { display: grid; gap: 0.4em; }

/* ---------- title screen: the picture, the two sides, the name ---------- */
#title-screen { background: #0e0a12; overflow-x: hidden; padding-top: 2vh; }
.t-bg { position: absolute; inset: 0 0 auto 0; aspect-ratio: 16 / 9; background: linear-gradient(transparent 60%, rgba(14, 10, 18, 0.55) 84%, #0e0a12 99%), var(--title-art, none) center / cover no-repeat; image-rendering: pixelated; animation: dawn 2.2s steps(12) both; }
@keyframes dawn { from { filter: brightness(0.25); } }
#title-screen .title-card { position: relative; padding-top: min(36vw, 350px, 26vh); }
.t-bg { position: absolute; inset: 0; background: linear-gradient(rgba(14, 10, 18, 0.15), rgba(14, 10, 18, 0.55) 40%, rgba(14, 10, 18, 0.96) 78%), var(--title-art, none) center top / cover no-repeat; image-rendering: pixelated; animation: drift 40s ease-in-out infinite alternate; transform-origin: 60% 40%; }
@keyframes drift { to { transform: scale(1.18); } }
#title-screen .title-card { position: relative; }
.t-versus { position: relative; display: flex; justify-content: center; height: clamp(110px, 30vw, 250px); margin: 0 4% 0.4em; }
.t-face { position: relative; flex: 0 1 47%; overflow: hidden; background: #000; border: 3px solid var(--gold); box-shadow: 0 0 0 2px #000, 0 8px 0 rgba(0, 0, 0, 0.55); transform: skewX(-9deg); }
.t-face::before { content: ''; position: absolute; inset: 0 -14%; transform: skewX(9deg); background: var(--face) center 18% / cover no-repeat; image-rendering: pixelated; }
.t-face.left { --face: var(--face-l); animation: tin-l 0.45s steps(6) both; }
.t-face.right { --face: var(--face-r); animation: tin-r 0.45s steps(6) both; }
.t-face.right::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(138, 28, 36, 0.45), transparent 60%); }
@keyframes tin-l { from { transform: translateX(-120%) skewX(-9deg); } }
@keyframes tin-r { from { transform: translateX(120%) skewX(-9deg); } }
.t-clash { position: absolute; left: 50%; top: -7%; bottom: -7%; width: 8px; margin-left: -4px; z-index: 1; transform: skewX(-9deg); background: #fffdf2; box-shadow: 0 0 0 3px #000, 0 0 22px 8px rgba(240, 214, 138, 0.75); animation: clash 0.5s steps(4) 0.4s both, flicker 3.2s steps(2) 1s infinite; }
@keyframes clash { 0% { opacity: 0; transform: skewX(-9deg) scaleY(0); } 40% { opacity: 1; transform: skewX(-9deg) scaleX(6); } }
@keyframes flicker { 0%, 92% { opacity: 1; } 96% { opacity: 0.55; } }
#t-title { background: linear-gradient(#fffbe0, #f0d68a 42%, #c9a24a 58%, #7a5a22); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(3px 3px 0 var(--wine)) drop-shadow(2px 3px 0 #000); animation: tslam 0.3s steps(4) 0.75s both; }
@keyframes tslam { from { transform: scale(1.9); opacity: 0; } }
#t-alt { text-shadow: 0 2px 0 #000; }
#t-episode { margin: 0.9em 0 0.9em; display: flex; align-items: center; gap: 0.8em; justify-content: center; }
#t-episode::before, #t-episode::after { content: ''; height: 2px; width: 3em; background: var(--gold); }
#t-start { background: var(--wine); font-size: 1.1em; animation: beckon 1.6s steps(8) infinite; }
#t-continue { background: var(--wine); }
@keyframes beckon { 50% { box-shadow: 0 3px 0 #000, 0 0 0 4px rgba(240, 214, 138, 0.55); } }
@media (prefers-reduced-motion: reduce) { .t-bg, #t-title, #t-start { animation: none; } }

/* ---------- type and trim ----------
   Speech is set large, a phrase at a time. Frames are engraved: a gold rule, a dark gap, a fine inner rule, and a
   stud at each corner of the dialogue box. A meander band closes the top bar and the headers of the cards. */
:root {
  --meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10'%3E%3Cpath d='M0 8.5H16M13.5 8.5V1.5H4.5V5.5H9.5' fill='none' stroke='%23c9a24a' stroke-opacity='.5' stroke-width='1.2'/%3E%3C/svg%3E");
  --engrave: inset 0 0 0 3px var(--ink), inset 0 0 0 4px rgba(240, 214, 138, 0.34);
}
html { background: radial-gradient(120% 60% at 50% 0%, #2b1f30 0%, var(--ink) 65%) fixed var(--ink); }
body { background: transparent; }

#hud { background: var(--meander) repeat-x left bottom / 16px 10px; padding-bottom: calc(0.35em + 13px); }
/* Nothing is drawn outside a frame's own edge: the chapter cards and overlays cover the game exactly, and anything
   further out would show beside them. */

#dialog {
  display: flex; align-items: center;
  margin-top: 1.2em; padding: 1em 1.3em 1.1em; min-height: 9.2em;
  background: linear-gradient(#2c1e2c, #1e1520);
  box-shadow: var(--engrave);
}
#dialog::before {
  content: ''; position: absolute; inset: -2px; pointer-events: none;
  background:
    linear-gradient(var(--gold-hi), var(--gold)) left 2px top 2px / 6px 6px no-repeat, linear-gradient(#000, #000) left top / 10px 10px no-repeat,
    linear-gradient(var(--gold-hi), var(--gold)) right 2px top 2px / 6px 6px no-repeat, linear-gradient(#000, #000) right top / 10px 10px no-repeat,
    linear-gradient(var(--gold-hi), var(--gold)) left 2px bottom 2px / 6px 6px no-repeat, linear-gradient(#000, #000) left bottom / 10px 10px no-repeat,
    linear-gradient(var(--gold-hi), var(--gold)) right 2px bottom 2px / 6px 6px no-repeat, linear-gradient(#000, #000) right bottom / 10px 10px no-repeat;
}
#text { width: 100%; font-size: 1.4em; line-height: 1.5; }
/* Japanese: a little smaller and much more leading, so furigana has its own space above every line */
html[lang="ja"] #text { font-size: 1.32em; line-height: 2.1; }
html[lang="ja"] #text ruby rt { font-size: 0.46em; }
#text.testimony { font-size: 1.15em; }   /* a statement stays whole, so it is set smaller */
#text.prompt { font-size: 1.05em; text-align: center; }
#name {
  left: 1.1em; top: -1em; z-index: 1; border: 0; padding: 0.05em 1.3em; font-size: 1.05em;
  background: linear-gradient(var(--gold-hi), var(--gold));
  clip-path: polygon(0.6em 0, calc(100% - 0.6em) 0, 100% 50%, calc(100% - 0.6em) 100%, 0.6em 100%, 0 50%);
}
#name.nota { background: var(--nota); }
#more { right: 0.9em; bottom: 0.45em; }
body.cinema #dialog { background: #000; box-shadow: none; }
body.cinema #dialog::before { display: none; }
body.cinema #text.narration { font-size: 1.4em; }
html[lang="ja"] body.cinema #text.narration { font-size: 1.32em; }

.btn { background: linear-gradient(#3b2735, #291a27); box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px rgba(240, 214, 138, 0.26), 0 3px 0 #000; }
.btn:hover, .btn:focus-visible, .btn.primary { background: linear-gradient(#9d2631, #791820); }
.btn:active { box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px rgba(240, 214, 138, 0.26), 0 1px 0 #000; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover, .btn.ghost:focus-visible { background: rgba(138, 28, 36, 0.6); }

.record-card, .note-card, #choices .choice { box-shadow: var(--engrave); }
/* scrollbars in the game's colours, not the browser's pale default */
.overlay, .record-card, html { scrollbar-width: thin; scrollbar-color: rgba(201, 162, 74, 0.45) transparent; }
.overlay::-webkit-scrollbar, .record-card::-webkit-scrollbar { width: 8px; background: transparent; }
.overlay::-webkit-scrollbar-thumb, .record-card::-webkit-scrollbar-thumb { background: rgba(201, 162, 74, 0.45); }
#bg.smooth { image-rendering: auto; }   /* a camera shot drawn from its large picture */
#p-input .p-target.finished { width: min(30%, 110px); image-rendering: auto; }
.record-card header { background: var(--meander) repeat-x left bottom / 16px 10px; padding-bottom: 15px; }

/* the end screen's one link (Episode 5) */

/* ---------- play-through notes, November 2026 ---------- */
/* a record arrives: its picture beside its name */
#toast { display: flex; align-items: center; gap: 0.7em; text-align: left; padding: 0.4em 0.9em; animation: rise 0.35s ease-out; }
#toast[hidden] { display: none; }
#toast img { width: 3.2em; height: 3.2em; image-rendering: pixelated; flex: none; border: 1px solid var(--gold); background: #000; }
/* the cry sits under the seal, not across it */
#banner.cry.art b { margin-top: 0.25em; }
/* the crowd has no lower edge to show when it jumps */
#crowd i::after { content: ''; position: absolute; left: 0; right: 0; top: 99%; height: 60%; background: #0b0810; }
/* on a narrow screen a name card shrinks with the stage, so it stays off the faces */
@media (max-width: 640px) {
  #lower { font-size: min(1em, 3.1vw); max-width: 56%; bottom: 6%; padding-right: 1.6em; }
  #lower.right { padding-left: 1.6em; padding-right: 0.8em; }
}

/* ---------- the end of an episode ---------- */
#e-card, #e-roll { margin: auto; }
#end-screen.joy { background: radial-gradient(ellipse at 50% 0%, rgba(240, 214, 138, 0.32), rgba(138, 28, 36, 0.18) 45%, rgba(14, 10, 18, 0.96) 80%), #0e0a12; }
#e-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
#e-roll { width: 100%; max-width: 30em; min-height: 78vh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 12vh; text-align: center; cursor: pointer; position: relative; }
#e-roll-head { position: absolute; top: 0; left: 0; right: 0; margin: 0; color: var(--gold); font-family: var(--roman); letter-spacing: 0.2em; font-size: 0.9em; }
#e-lines p { margin: 0.5em 0; color: var(--cream); font-size: clamp(1.25em, 4.4vw, 1.9em); line-height: 1.5; animation: rise 0.9s ease-out; transition: font-size 0.7s, color 0.7s, opacity 0.7s; }
#e-lines p.old { font-size: clamp(0.9em, 2.6vw, 1.05em); color: var(--muted); }
#e-lines p.old:nth-last-child(n+5) { opacity: 0.35; }
#e-roll-more { position: absolute; bottom: 4vh; left: 0; right: 0; color: var(--gold-hi); animation: pulse 1.2s infinite; }
#e-card { max-width: 32em; position: relative; z-index: 2; }
#e-card.in { animation: rise 0.8s ease-out; }
#e-heading { margin: 0.4em 0 0.7em; padding-bottom: 0.45em; border-bottom: 2px solid var(--gold); display: inline-block; }
#e-body { list-style: none; margin: 0 auto 1.1em; padding: 0; text-align: left; max-width: 28em; }
#e-body li { position: relative; padding: 0.28em 0 0.28em 1.5em; line-height: 1.5; color: var(--cream); }
#e-body li::before { content: '◆'; position: absolute; left: 0.1em; top: 0.5em; font-size: 0.7em; color: var(--gold); }
#e-body li:last-child { color: var(--gold-hi); }
#e-next { margin: 0 auto 1.1em; padding: 0.6em 0.9em; border: 1px solid var(--gold); border-left-width: 5px; background: rgba(0, 0, 0, 0.35); text-align: left; max-width: 28em; line-height: 1.55; }
#e-puzzles { margin: 0.6em 0 0.2em; }
#e-secret { margin: 0 0 1em; color: var(--muted); font-size: 0.8em; }
#end-screen .title-buttons { margin-top: 1em; }
/* the invitation to read: the one bright button on the last screen */
#e-link { display: inline-flex; align-items: center; justify-content: center; gap: 0.6em; margin: 0.2em auto 0.8em; padding: 0.7em 1.4em; min-height: 52px; max-width: 100%; text-decoration: none; font-size: 1.1em; color: #1a1208 !important; background: linear-gradient(180deg, #f6e2a0, #c9a24a); border: 2px solid #fff3c4; box-shadow: 0 4px 0 #5a4420, 0 0 0 3px #000; animation: beckon 2.4s infinite; }
#e-link::before { content: ''; width: 1.1em; height: 1.3em; flex: none; background: linear-gradient(90deg, #5a1218 0 18%, #8a1c24 18% 100%); border: 2px solid #1a1208; box-shadow: inset -3px 0 0 #f3ead2; }
#e-link:hover, #e-link:focus-visible { background: linear-gradient(180deg, #fff3c4, #e0bb60); outline: none; }
/* sources and more */
#sources { z-index: 21; }
#s-title { margin: 0; font-size: 1.1em; color: var(--gold-hi); font-weight: normal; }
#s-refs { list-style: none; margin: 0.8em 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4em; }
#s-refs li { border: 1px solid #5a4a50; background: var(--panel-2); padding: 0.2em 0.6em; font-size: 0.85em; line-height: 1.5; }
#s-notes p { margin: 0.6em 0; line-height: 1.6; font-size: 0.92em; padding-left: 0.8em; border-left: 3px solid var(--gold); }
#s-credits { margin-top: 1.2em; padding-top: 0.8em; border-top: 1px solid #5a4a50; color: var(--muted); font-size: 0.78em; line-height: 1.5; }
/* the credits roll */
#credits { position: fixed; inset: 0; z-index: 30; background: #000; overflow: hidden; cursor: pointer; text-align: center; }
#c-roll { position: absolute; left: 0; right: 0; top: 100%; padding: 0 1em; }
#c-roll h3 { margin: 2.6em 0 0.5em; font-family: var(--roman); font-weight: 700; letter-spacing: 0.2em; color: var(--gold-hi); font-size: 1.05em; }
#c-roll h3:first-child { font-size: clamp(1.6em, 6vw, 2.6em); letter-spacing: 0.08em; text-shadow: 3px 3px 0 var(--wine); }
#c-roll p { margin: 0.25em 0; color: var(--cream); line-height: 1.6; }
@keyframes credits { to { transform: translateY(calc(-100% - 100vh)); } }
/* joy: light breaks over the stage */
#stage.joy::after { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at 50% 20%, rgba(255, 244, 200, 0.85), rgba(240, 214, 138, 0.35) 45%, rgba(240, 214, 138, 0) 75%); animation: glory 3.2s ease-out forwards; }
@keyframes glory { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #stage.joy::after, #e-link, #e-lines p { animation: none; } #stage.joy::after { opacity: 0; } }
#fade-text { white-space: pre-line; }

/* ---------- play-test notes, 16 November 2026 ---------- */
/* a new record: a large picture, and the notice keeps to the half of the stage the portrait is not in */
#toast { top: 6%; max-width: 58%; font-size: min(1em, 3.4vw); gap: 0.8em; padding: 0.5em 0.8em; }
#toast { left: 0; right: 0; margin: 0 auto; width: fit-content; transform: none; }
#toast.left { margin-left: 2%; }
#toast.right { margin-right: 2%; }
#toast img { width: clamp(64px, 15vw, 128px); height: auto; aspect-ratio: 1; border: 2px solid var(--gold-hi); box-shadow: 0 0 0 2px #000; }
#toast span { color: var(--muted); font-size: 0.85em; }
#toast b { color: var(--gold-hi); font-size: 1.2em; line-height: 1.35; }
@media (max-width: 640px) { #toast { flex-direction: column; text-align: center; gap: 0.3em; } }
/* Japanese breaks only where the text allows it (text.js marks the places), so a word is never cut in two */
html[lang="ja"] body { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
/* the desk slam: a full-screen picture that lands hard, then holds under the cry */
#slam { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; image-rendering: pixelated; object-fit: cover; }
#slam.go { animation: slam-in 0.22s steps(5); }
@keyframes slam-in { from { transform: scale(1.35) translateY(-6%); filter: brightness(2.2); } }
@media (prefers-reduced-motion: reduce) { #slam.go { animation: none; } }

/* ---------- the log and the settings panel ---------- */
#log-list { max-height: 68vh; overflow: auto; margin-top: 0.6em; scrollbar-width: thin; scrollbar-color: rgba(201, 162, 74, 0.45) transparent; }
#log-list p { margin: 0 0 0.7em; overflow-wrap: anywhere; }
#log-list b { display: block; color: var(--gold-hi); font-size: 0.85em; }
#log-list p.narration { color: var(--muted); }
#log-list p.thought { color: var(--thought); }
#log-list p.testimony span { color: var(--testimony); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1em; flex-wrap: wrap; margin: 1em 0; }
.set-row input[type="range"] { flex: 1; min-width: 9em; max-width: 18em; height: 36px; accent-color: var(--gold); }
#set-speed { flex-wrap: wrap; }
#set-to-title { width: 100%; margin-top: 0.6em; white-space: normal; }
#set-save-code { width: 100%; box-sizing: border-box; font: 0.8em/1.4 ui-monospace, monospace; background: var(--panel-2); color: var(--cream); border: 1px solid var(--gold); padding: 0.5em; overflow-wrap: anywhere; resize: vertical; }
#set-save-note { margin: 0.4em 0; color: var(--muted); min-height: 1.4em; }
#set-save-load { width: 100%; }
.set-row .tabs { flex-wrap: wrap; }
#eps-list { display: grid; gap: 0.5em; margin-top: 0.8em; }
#eps-note { color: var(--muted); margin: 0.6em 0 0; }

/* ---------- loading: a bar on the title screen until the pictures and the text have arrived ---------- */
#t-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(60%, 14em); height: 8px; border: 1px solid var(--gold); background: var(--panel); }
#t-load i { display: block; height: 100%; width: 0; background: var(--gold-hi); transition: width 0.15s linear; }
body:not(.loading) #t-load { display: none; }
body.loading .title-card { visibility: hidden; }

/* ---------- title screen on a landscape window ----------
   Sized by the window's height as well as its width, with the buttons in two columns, so the whole screen fits
   without scrolling (in a laptop window, or embedded in a page). */
#t-title { font-size: clamp(34px, min(9vw, 8vh), 76px); }
@media (min-aspect-ratio: 1/1) and (min-width: 520px) {
  #title-screen .title-buttons { flex-flow: row wrap; justify-content: center; gap: 0.6em; max-width: 26.6em; margin: 0 auto; }
  #title-screen .title-buttons .btn { flex: 0 0 13em; width: auto; }
  /* the main button has a row to itself, unless Continue is there to share it */
  #title-screen #t-start { flex-basis: 16em; margin-inline: calc((100% - 16em) / 2); }
  #title-screen #t-continue:not([hidden]) ~ #t-start { flex-basis: 13em; margin-inline: 0; }
  #title-screen #t-episode { margin: 0.6em 0; }
}
