:root {
  --bg: #060607;
  --panel: #111115;
  --panel-2: #18181e;
  --red: #c91a1a;
  --red-hi: #e8352f;
  --red-deep: #91080a;
  --silver: #bababa;
  --silver-hi: #e0e0e0;
  --white: #fdeff3;
  --text: #ecebef;
  --dim: #8e8c96;
  --line: rgba(255, 255, 255, 0.09);
  --photo: #1c1726;

  --f-display: 'Anton', 'Impact', sans-serif;
  --f-ui: 'Chakra Petch', 'Segoe UI', sans-serif;
  --f-body: 'Barlow', 'Segoe UI', sans-serif;

  --head: 64px;
  --ease: cubic-bezier(0.2, 0.9, 0.2, 1);
  --snap: cubic-bezier(0.7, 0, 0.3, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: var(--red); color: #fff; }

.ico { display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.cast-chip img, .pol-photo img, .vn-actor { image-rendering: pixelated; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1100px 600px at 88% -12%, rgba(201, 26, 26, 0.2), transparent 60%),
    radial-gradient(900px 520px at -12% 112%, rgba(145, 8, 10, 0.26), transparent 60%);
  overflow: hidden;
}
.backdrop::after {
  content: 'AZ';
  position: absolute;
  right: -6vw;
  bottom: -14vw;
  font: 52vw/0.8 var(--f-display);
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.035);
  transform: rotate(-10deg);
  letter-spacing: -0.04em;
}

body[data-route='play'] .backdrop { background: none; }

.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--head);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(14px, 3vw, 32px);
  background: linear-gradient(180deg, rgba(6, 6, 7, 0.94), rgba(6, 6, 7, 0.7));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 180px;
  height: 2px;
  background: linear-gradient(90deg, var(--red), transparent);
}

.brand { display: flex; align-items: center; transition: opacity 0.2s; }
.brand img { height: 46px; width: auto; display: block; }
.brand:hover { opacity: 0.8; }

.tabs { position: relative; display: flex; gap: 2px; }
.tabs a {
  position: relative;
  z-index: 1;
  padding: 10px 16px;
  font: 600 0.8rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.25s;
}
.tabs a::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 4px;
  height: 1px;
  background: var(--silver);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.tabs a:hover { color: var(--white); }
.tabs a:hover:not(.active)::after { transform: scaleX(1); }
.tabs a.active { color: #fff; }
.tab-ink {
  position: absolute;
  left: 0;
  top: 50%;
  height: 34px;
  margin-top: -17px;
  width: 0;
  background: var(--red);
  box-shadow: 0 0 24px rgba(201, 26, 26, 0.55);
  opacity: 0;
  transition: transform 0.25s ease, width 0.25s ease, opacity 0.2s;
}

.wipe { position: fixed; inset: 0; z-index: 100; pointer-events: none; background: var(--bg); opacity: 0; transition: opacity 0.18s ease; }
.wipe.in { opacity: 1; }

.mode-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 10px 18px;
  border: 0;
  background: var(--panel-2);
  color: var(--text);
  font: 600 0.8rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-decoration: none;
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}
.mode-btn .ico { width: 16px; height: 16px; }
.mode-btn:hover { background: var(--silver-hi); color: #111; }
.mode-btn.primary { background: var(--red); color: #fff; }
.mode-btn.primary:hover { background: var(--red-hi); }
.mode-btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--silver-hi); outline-offset: 3px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(14, 14, 18, 0.75);
  color: var(--silver-hi);
  cursor: pointer;
  text-decoration: none;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--red); color: #fff; }
.icon-btn.accent, .icon-btn.on { background: var(--red); color: #fff; border-color: transparent; }
.icon-btn.accent:hover, .icon-btn.on:hover { background: var(--red-hi); }

#view { overflow-x: clip; }
body[data-route='home'] #view { min-height: 100svh; display: flex; flex-direction: column; }

.home {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--head) + 30px) 16px 30px;
  min-height: 440px;
}

.home-stage { position: relative; }
.home-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100vw;
  height: clamp(200px, 30vw, 340px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  animation: fade 0.6s ease both;
}
@media (max-width: 560px) {
  .home-wave {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  }
}

.home-logo {
  position: relative;
  margin: 0;
  line-height: 0;
  animation: fade 0.6s ease both;
}
.home-logo img {
  display: block;
  width: min(960px, 94vw);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.55)) drop-shadow(0 0 40px rgba(201, 26, 26, 0.35));
}

.home-cta {
  position: relative;
  margin-top: clamp(28px, 6vh, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fade 0.6s ease both;
}
.cta-buttons { display: flex; gap: 10px; }
.cta-buttons .mode-btn { padding: 14px 28px; font-size: 0.9rem; }

.cast-strip {
  position: relative;
  margin: 10px 0 16px;
  padding: 16px 0;
  background: linear-gradient(180deg, #0d0d10, #08080a);
  border-top: 2px solid var(--red);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  animation: fade 0.6s ease both;
}
.cast-strip::before, .cast-strip::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12vw;
  z-index: 2;
  pointer-events: none;
}
.cast-strip::before { left: 0; background: linear-gradient(90deg, #08080a, transparent); }
.cast-strip::after { right: 0; background: linear-gradient(-90deg, #08080a, transparent); }
.cast-track { display: flex; gap: 14px; padding-right: 14px; width: max-content; animation: marquee 70s steps(var(--steps, 1980)) infinite; }
.cast-strip:hover .cast-track { animation-play-state: paused; }
.home-foot { margin: 0 16px 18px; text-align: center; font: 400 0.75rem / 1.5 var(--f-body); color: var(--dim); }
.cast-chip {
  display: block;
  width: 96px;
  height: 112px;
  flex: none;
  background: var(--photo);
  border-bottom: 3px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.cast-chip img { display: block; width: 96px; height: 112px; filter: grayscale(1) brightness(0.55) sepia(0.6) hue-rotate(-30deg) saturate(2.2); transition: filter 0.3s; }
.cast-chip:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, var(--photo)); }
.cast-chip:hover img { filter: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--head) + 48px) clamp(16px, 5vw, 56px) 96px;
}

.page-title {
  margin: 0 0 44px;
  font: 400 clamp(3.2rem, 9vw, 6.4rem) / 0.9 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.page-title span { position: relative; display: inline-block; padding: 0 0.12em; color: #fff; z-index: 0; }
.page-title span::before {
  content: '';
  position: absolute;
  left: -0.25em;
  right: -0.35em;
  bottom: 0.06em;
  height: 0.36em;
  background: var(--red);
  transform: skewX(-18deg);
  z-index: -1;
}
.page-title span::after {
  content: '';
  position: absolute;
  left: 100%;
  bottom: 0.06em;
  margin-left: 0.6em;
  width: 0.22em;
  height: 0.36em;
  background: var(--silver-hi);
  transform: skewX(-18deg);
}

.arc-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 30px;
}
.arc-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 13px 16px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
}
.arc-tab-num {
  font: 400 2.6rem/0.9 var(--f-display);
  color: transparent;
  -webkit-text-stroke: 1.5px var(--red);
  transition: -webkit-text-stroke-color 0.25s;
}
.arc-tab-name {
  font: 600 0.72rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s;
}
.arc-tab:hover { box-shadow: inset 0 0 0 1px rgba(201, 26, 26, 0.6); }
.arc-tab:hover .arc-tab-name { color: var(--white); }
.arc-tab.active { background: var(--red); box-shadow: none; }
.arc-tab.active .arc-tab-num { -webkit-text-stroke-color: #fff; }
.arc-tab.active .arc-tab-name { color: #fff; }
.arc-tab.empty { opacity: 0.45; }
.arc-tab.empty .arc-tab-num { -webkit-text-stroke-color: #5d5c64; }
.arc-tab.empty.active { opacity: 1; background: #26262c; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.arc-tab.empty.active .arc-tab-num { -webkit-text-stroke-color: var(--silver); }

.chapter-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px;
  align-items: start;
}
.chapter-select.solo { grid-template-columns: minmax(0, 1fr); }

.arc-panel-head { margin-bottom: 16px; }
.arc-panel-head h2 {
  margin: 0;
  font: 400 2rem/1 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}
.arc-panel-head p { margin: 6px 0 0; color: var(--dim); font: 500 0.9rem var(--f-ui); letter-spacing: 0.04em; }

.ch-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }

.ch-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  aspect-ratio: 1 / 1.05;
  padding: 10px 10px 13px 12px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: background 0.2s, box-shadow 0.2s;
}
.ch-tile-num { position: relative; font: 400 2.3rem/1 var(--f-display); color: #fff; }
.ch-tile-num small { font-size: 0.45em; color: var(--red); margin-right: 1px; }
.ch-tile-title {
  position: relative;
  font: 600 0.66rem/1.25 var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  hyphens: auto;
}
.ch-tile:hover { box-shadow: inset 0 0 0 1px rgba(201, 26, 26, 0.6); }
.ch-tile.selected { background: var(--red); box-shadow: none; }
.ch-tile.selected .ch-tile-num small, .ch-tile.selected .ch-tile-title { color: #fff; }
.ch-tile:focus-visible { outline: 2px solid var(--silver-hi); outline-offset: 3px; }

.arc-tba {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.03) 0 12px, transparent 12px 24px);
  color: #5d5c64;
  font: 600 0.78rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

.ch-detail { position: sticky; top: calc(var(--head) + 20px); }
.cd {
  position: relative;
  padding: 22px 24px 24px;
  background: linear-gradient(160deg, #17171c, #0c0c0f);
  box-shadow: inset 0 0 0 1px var(--line);
  border-top: 3px solid var(--red);
  overflow: hidden;
  animation: fade 0.2s ease both;
}
.cd-id {
  display: block;
  font: 400 4.6rem/0.95 var(--f-display);
  color: transparent;
  -webkit-text-stroke: 1.5px var(--silver);
}
.cd-title {
  margin: 6px 0 18px;
  font: 400 2rem/1.05 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 3px 3px 0 var(--red-deep);
  overflow-wrap: anywhere;
}
.cd-actions { display: flex; gap: 8px; }
.cd-actions .mode-btn { flex: 1; justify-content: center; padding: 13px 16px; }

.polaroid {
  position: relative;
  display: block;
  padding: 10px 10px 0;
  background: #eeedf1;
  color: #1a1a1f;
  transform: rotate(var(--r));
  box-shadow: 0 16px 30px -14px rgba(0, 0, 0, 0.9), 0 2px 0 rgba(0, 0, 0, 0.35);
}
.polaroid::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  width: 64px;
  height: 20px;
  margin-left: -32px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(2px);
  transform: rotate(calc(var(--r) * -1.5));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.pol-photo {
  display: block;
  aspect-ratio: 96 / 112;
  background: radial-gradient(circle at 50% 30%, #2b2338, var(--photo) 70%);
  overflow: hidden;
}
.pol-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pol-name {
  display: block;
  padding: 9px 0 11px;
  text-align: center;
  font: 700 0.95rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
@keyframes fade { from { opacity: 0; } }

.info-page { max-width: 880px; }
.info-intro { margin-bottom: 72px; }

.info-section { margin-bottom: 72px; }
.info-head {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 22px; padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font: 400 clamp(1.8rem, 4vw, 2.6rem) / 1 var(--f-display);
  text-transform: uppercase;
  color: #fff;
}
.info-head b { color: var(--red); font: 700 0.9rem var(--f-ui); letter-spacing: 0.2em; }

.info-prose p { margin: 0 0 1.1em; font: 400 1.08rem/1.7 var(--f-body); color: #d6d4dc; }

.info-prose p:empty::before, .faq-a p:empty::before, .faq-item summary:empty::before,
.credit h3:empty::before, .credit li:empty::before {
  content: '';
  display: block;
  width: 100%;
  height: 0.7em;
  margin: 0.45em 0;
  background: rgba(255, 255, 255, 0.08);
}
.info-prose p:nth-child(even):empty::before, .faq-a p:empty::before { width: 72%; }
.faq-item summary:empty::before { flex: 0 0 40%; margin: 0; }
.credit h3:empty::before { width: 6em; }
.credit li:empty::before { width: 9em; height: 0.6em; }

.faq { display: grid; gap: 8px; }
.faq-item { border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.03); }
.faq-item[open] { border-color: rgba(201, 26, 26, 0.6); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px;
  font: 700 1rem var(--f-ui);
  color: #fff;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '';
  flex: none;
  width: 12px;
  height: 12px;
  margin-left: auto;
  background:
    linear-gradient(var(--red), var(--red)) center / 12px 2px no-repeat,
    linear-gradient(var(--red), var(--red)) center / 2px 12px no-repeat;
}
.faq-item[open] summary::after { background: linear-gradient(var(--red), var(--red)) center / 12px 2px no-repeat; }
.faq-a { padding: 0 18px 16px; }
.faq-a p { margin: 0; font: 400 1rem/1.65 var(--f-body); color: #c9c7d0; }

.credits p:last-child { margin-bottom: 0; }
.credits-logo { display: block; width: 320px; max-width: 70%; margin: 40px auto 0; opacity: 0.22; image-rendering: pixelated; }

.vn {
  --accent: var(--red);
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(ellipse 90% 60% at 50% 115%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(ellipse at 50% 40%, transparent 40%, rgba(0, 0, 0, 0.6));
  transition: background 0.6s;
}

.vn:not(.ready) { visibility: hidden; }

.vn-bg { position: absolute; inset: 0; opacity: 0; transition: opacity 0.9s; }
.vn-bg.on { opacity: 1; }
.vn-bg img { width: 100%; height: 100%; object-fit: cover; }
.vn-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 30%, transparent 50%, rgba(0, 0, 0, 0.75)); }

.vn-flash { position: absolute; inset: 0; z-index: 35; background: var(--flash, #fff); opacity: 0; pointer-events: none; }
.vn-flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
.vn-flash.dip { background: #000; animation: dip 0.6s ease-out; }
@keyframes dip { 0%, 25% { opacity: 1; } 100% { opacity: 0; } }

.vn-hit { position: absolute; inset: 0; z-index: 1; cursor: pointer; }

.vn-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: max(12px, env(safe-area-inset-top)) clamp(12px, 3vw, 28px) 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent);
  transition: opacity 0.3s;
}
.vn-label { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; font-family: var(--f-display); text-transform: uppercase; }
.vn-label b { color: var(--red); font-size: 1.35rem; font-weight: 400; }
.vn-label span { color: #fff; font-size: 1.15rem; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vn-tools { display: flex; gap: 6px; }

.vn-scene {
  --px: 3;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(62px + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(960px, calc(100% - 24px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  transition: opacity 0.3s;
}
.vn:not(.started) .vn-scene,
.vn[data-beat='profile'] .vn-scene,
.vn[data-beat='image'] .vn-scene,
.vn[data-beat='remaining'] .vn-scene,
.vn.at-end .vn-scene { opacity: 0; }
.vn-scene.scene-change { animation: fade 0.8s ease; }

.vn-stage {
  position: relative;
  height: calc(112px * var(--px));
  margin-bottom: calc(-3px * var(--px));
}
.vn-actor {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: calc(96px * var(--px));
  height: calc(112px * var(--px));
  transform: translateX(-50%);
  transition: left 0.3s var(--ease), filter 0.2s, opacity 0.3s;
  animation: actor-in 0.3s ease both;
}
.vn-actor[data-pos='left'] { left: calc(100% / 6); }
.vn-actor[data-pos='right'] { left: calc(100% * 5 / 6); }
.vn-actor.lit { z-index: 1; }
.vn-actor.dim { filter: brightness(0.45) saturate(0.7); }
.vn-actor.out { opacity: 0; }
@keyframes actor-in { from { opacity: 0; translate: 0 calc(4px * var(--px)); } }
.vn-actor.hop { animation: actor-in 0.3s ease both, hop 0.36s steps(1, end); }
@keyframes hop {
  0% { bottom: calc(2px * var(--px)); }
  15% { bottom: calc(5px * var(--px)); }
  35% { bottom: calc(6px * var(--px)); }
  55% { bottom: calc(4px * var(--px)); }
  75% { bottom: calc(1px * var(--px)); }
  100% { bottom: 0; }
}
.vn-actor.shiver { animation: actor-in 0.3s ease both, shiver 0.48s steps(1, end); }
@keyframes shiver {
  0%, 24%, 48%, 72% { margin-left: calc(1px * var(--px)); }
  12%, 36%, 60%, 84% { margin-left: calc(-1px * var(--px)); }
  100% { margin-left: 0; }
}

.vn-box {
  position: relative;
  z-index: 1;
  isolation: isolate;
  pointer-events: auto;
  cursor: pointer;
  min-height: calc(40px * var(--px));
  padding: calc(10px * var(--px)) calc(12px * var(--px)) calc(9px * var(--px));
}
.vn-box::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border: solid transparent;
  border-width: calc(16px * var(--px));
  border-image: var(--frame) 16 fill / calc(16px * var(--px)) stretch;
  image-rendering: pixelated;
}

.vn-name {
  position: absolute;
  top: 0;
  left: calc(16px * var(--px));
  padding: calc(1px * var(--px)) calc(5px * var(--px)) 0;
  background: var(--accent);
  border: calc(1px * var(--px)) solid #0b0b0d;
  transform: translateY(-55%);
  opacity: 0;
  transition: opacity 0.2s;
}
.vn-name span {
  display: block;
  font: 400 calc(0.5rem * var(--px)) / 1.2 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: calc(0.5px * var(--px)) calc(0.5px * var(--px)) 0 rgba(0, 0, 0, 0.45);
}
.vn-box.named .vn-name { opacity: 1; }
.vn-box.unknown .vn-name { background: #0b0b0d; border-color: var(--red); }
.vn-box.unknown .vn-name span { color: var(--red-hi); }

.vn-text {
  font: 500 clamp(1.04rem, 0.7rem + 0.9vw, 1.28rem) / 1.62 var(--f-body);
  color: #f1eff4;
  max-height: min(34vh, 300px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--red-deep) transparent;
  text-wrap: pretty;
}
.vn-box:not(.named) .vn-text { color: #d6d4dc; }
.vn-text em { font-style: italic; }
.vn-text strong { color: #fff; }
.vn-text .ch { opacity: 0; transition: opacity 0.12s; }
.vn-text .ch.on { opacity: 1; }

.vn-more {
  position: absolute;
  right: calc(9px * var(--px));
  bottom: calc(4px * var(--px));
  display: flex;
  transition: opacity 0.2s;
  animation: more-bob 0.9s ease-in-out infinite;
}
.vn-more i {
  width: 9px;
  height: 14px;
  margin-left: -1px;
  background: var(--accent);
  clip-path: polygon(0 0, 45% 0, 100% 50%, 45% 100%, 0 100%, 55% 50%);
}
.vn-more i + i { opacity: 0.55; }
.vn-box.typing .vn-more { opacity: 0; animation: none; }
@keyframes more-bob { 50% { transform: translateX(4px); } }

.vn-screen {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 80px clamp(20px, 8vw, 120px) 90px;
  background: rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.vn.started.screen[data-beat='text']:not(.at-end) .vn-screen { opacity: 1; }
.vn.screen .vn-box { visibility: hidden; }
.vn-screen-text {
  max-width: 30em;
  margin: 0;
  font: 400 clamp(1.35rem, 0.9rem + 1.6vw, 2.1rem) / 1.5 Arial, Helvetica, sans-serif;
  color: #fff;
  text-align: center;
  text-wrap: pretty;
}
.vn-screen-text em, .vn-log p.log-screen em { font-style: normal; }
.vn-screen-text .ch { opacity: 0; }
.vn-screen-text .ch.on { opacity: 1; }
.vn-screen-text::after {
  content: '';
  display: inline-block;
  width: 0.09em;
  height: 1.05em;
  margin-left: 0.12em;
  vertical-align: -0.17em;
  background: #fff;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vn-screen-text::after { animation: none; } }
@media (prefers-reduced-motion: reduce) { .vn-more { animation: none; } }

.vn-nav {
  position: absolute;
  right: clamp(12px, 4vw, 48px);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  gap: 6px;
  transition: opacity 0.3s;
}
.vn-nav .icon-btn { width: 40px; height: 40px; }
.vn:not(.started) .vn-nav { opacity: 0; pointer-events: none; }

.vn-card {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 72px 16px 56px;
  pointer-events: none;
}
.vn-profile, .vn-image { background: rgba(4, 4, 6, 0.72); }
.vn-profile img, .vn-image img {
  position: relative;
  max-width: min(1100px, 94vw);
  max-height: 76vh;
  object-fit: contain;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.vn-profile.play, .vn-image.play { animation: fade 0.4s ease both; }
.vn-card.wait { opacity: 0; }

.vn-remaining {
  align-content: center;
  gap: clamp(10px, 2.2vh, 22px);
  padding: 64px 12px 48px;
  background:
    radial-gradient(ellipse 80% 70% at 50% 50%, rgba(80, 4, 8, 0.55), transparent 75%),
    rgba(3, 3, 4, 0.94);
}
.rem-count {
  justify-self: end;
  width: min(940px, 94vw, calc((100svh - 300px) * 1.45));
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  font-family: var(--f-display);
  text-transform: uppercase;
  margin: 0 auto;
}
.rem-count b { font-size: clamp(2rem, min(6vh, 10vw), 4rem); line-height: 1; font-weight: 400; color: var(--red-hi); text-shadow: 0 0 24px rgba(232, 53, 47, 0.6); font-variant-numeric: tabular-nums; }
.rem-count span { font-size: clamp(0.9rem, min(2.4vh, 4vw), 1.5rem); letter-spacing: 0.06em; color: var(--silver-hi); }
.rem-grid {
  width: min(940px, 94vw, calc((100svh - 300px) * 1.45));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 18px) clamp(6px, 1.4vw, 16px);
}
.vn-remaining .polaroid { padding: 6% 6% 0; animation: none; transition: none; }
.vn-remaining .polaroid::before { width: 40%; height: 10%; margin-left: -20%; top: -5%; }
.vn-remaining .pol-name { font-size: clamp(0.5rem, 1.1vw, 0.8rem); padding: 6% 0 7%; letter-spacing: 0.08em; }
.vn-remaining .polaroid.out { background: #8f8b98; }
.vn-remaining .polaroid.out .pol-photo { background: #57535f; }
.vn-remaining .polaroid.out img { filter: brightness(0) blur(3px); opacity: 0.75; }
.vn-remaining .polaroid.out .pol-name { text-decoration: line-through 2px var(--red); color: #3c3944; }
.rem-title {
  margin: 0;
  text-align: center;
  font: 400 clamp(1.5rem, min(6.5vh, 7.5vw), 3.8rem) / 1 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #fff;
}
.rem-title span { position: relative; display: inline-block; padding: 0 0.2em; z-index: 0; }
.rem-title span::before {
  content: '';
  position: absolute;
  left: -0.3em;
  right: -0.3em;
  bottom: 0.08em;
  height: 0.4em;
  background: var(--red);
  transform: skewX(-18deg);
  transform-origin: left;
  z-index: -1;
}

.vn-remaining.play { animation: fade 0.5s ease both; }
.vn-remaining.play .rem-title { animation: fade 0.5s 0.6s ease both; }
.vn-remaining.instant, .vn-remaining.instant .rem-title { animation: none; }

.vn-title, .vn-end {
  pointer-events: auto;
  cursor: pointer;
  align-content: center;
  gap: 4px;
  text-align: center;
  background: rgba(0, 0, 0, 0.88);
  animation: fade 0.6s ease both;
}
.vn-end { cursor: default; }
.vn-title-arc {
  font: 600 0.8rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--silver);
}
.vn-title-id {
  font: 400 clamp(3rem, 10vw, 5.5rem) / 1 var(--f-display);
  color: var(--red);
}
.vn-title-name, .vn-end-word {
  margin: 0;
  font: 400 clamp(1.8rem, 6vw, 3.4rem) / 1.1 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
}
.vn-end-word { font-size: clamp(2.6rem, 9vw, 4.5rem); }
.vn-title-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }

.vn-ao3 {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(440px, 100%);
  margin: 30px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.vn-ao3 p { margin: 0; font: 400 0.95rem / 1.5 var(--f-body); color: var(--silver); text-wrap: balance; }
.vn-tap {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s;
}
.vn-title:hover .vn-tap { background: var(--red); border-color: var(--red); }
.vn-tap .ico { width: 20px; height: 20px; margin-left: 3px; }

.vn-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  background: rgba(9, 9, 12, 0.97);
  box-shadow: -1px 0 0 var(--line), -30px 0 60px rgba(0, 0, 0, 0.6);
  animation: fade 0.2s ease;
  user-select: text;
  -webkit-user-select: text;
}
.vn-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--red);
}
.vn-log ol { list-style: none; margin: 0; padding: 8px 12px 30px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--red-deep) transparent; }
.vn-log li {
  padding: 12px 12px 12px 14px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font: 400 0.95rem/1.5 var(--f-body);
  color: #c9c7cf;
  transition: background 0.15s;
}
.vn-log li:hover { background: rgba(255, 255, 255, 0.04); }
.vn-log li.current { border-left-color: var(--red); background: rgba(201, 26, 26, 0.08); color: #fff; }
.vn-log b { display: block; margin-bottom: 2px; font: 400 0.9rem var(--f-display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--c); }
.vn-log p { margin: 0; }
.vn-log p.log-screen { font-family: Arial, Helvetica, sans-serif; color: #fff; }
.vn-log .log-card { color: var(--red-hi); text-align: center; font: 600 0.75rem var(--f-ui); letter-spacing: 0.2em; text-transform: uppercase; }

.vn-settings label {
  display: grid;
  gap: 10px;
  padding: 18px 22px 6px;
  font: 600 0.72rem var(--f-ui);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--dim);
}
.vn-settings input[type='range'] { width: 100%; accent-color: var(--red); }
.vn-bookmark.on .ico { --ico: url('/Assets/icons/bookmark-filled.svg') !important; }

.vn-title.can-resume > .vn-title-actions { display: none; }
.vn-resume { margin-top: 24px; }
.vn-resume .vn-title-actions { margin-top: 0; }

.vn.shake .vn-scene, .vn.shake .vn-card { animation: shake 0.5s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-10px); }
  40%, 60% { transform: translateX(10px); }
}

.loading { min-height: 70vh; display: grid; place-items: center; }
.loading i { width: 30px; height: 30px; background: var(--red); animation: spin 0.9s var(--snap) infinite; }
@keyframes spin { to { transform: rotate(180deg); } }

.missing { text-align: center; }
.missing .page-title { text-align: left; }
.missing p { color: var(--silver-hi); max-width: 34rem; margin: 0 auto 1rem; }
.missing .mode-btn { margin-top: 20px; }

@media (max-width: 860px) {
  .arc-rail {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin: 0 calc(-1 * clamp(16px, 5vw, 56px)) 22px;
    padding: 4px clamp(16px, 5vw, 56px) 6px;
  }
  .arc-rail::-webkit-scrollbar { display: none; }
  .arc-tab { flex: 0 0 118px; scroll-snap-align: start; }
  .chapter-select { grid-template-columns: minmax(0, 1fr); }
  .chapters-page { padding-bottom: 230px; }
  .ch-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ch-detail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 45; }
  .cd {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    background: rgba(10, 10, 13, 0.96);
    backdrop-filter: blur(10px);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.6);
  }
  .cd-id { margin: 0; font-size: 2.6rem; }
  .cd-title { margin: 0; font-size: 1.45rem; }
  .cd-actions { grid-column: 1 / -1; margin-top: 12px; }
}

@media (max-width: 680px) {
  .vn-remaining .pol-name { display: none; }
  .vn-remaining .polaroid { padding-bottom: 6%; }
}

@media (max-width: 900px), (max-height: 820px) {
  .vn-scene { --px: 2; }
}

@media (max-width: 760px) {
  .vn-scene { width: calc(100% - 16px); }
  .vn-text { max-height: 36vh; }
  .vn-label span { display: none; }
  .vn-tools { gap: 4px; }
  .vn-top .icon-btn { width: 38px; height: 38px; }
}

@media (max-width: 560px) {
  :root { --head: 58px; }
  .brand img { height: 36px; }
  .tabs a { padding: 8px 9px; letter-spacing: 0.08em; font-size: 0.72rem; }
  .tabs a::after { left: 9px; right: 9px; }
  .tab-ink { height: 30px; margin-top: -15px; }
  .ch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ch-tile { aspect-ratio: auto; min-height: 92px; padding: 8px 7px 11px 9px; }
  .ch-tile-num { font-size: 2rem; }
  .ch-tile-title { font-size: 0.58rem; letter-spacing: 0.02em; }
  .cta-buttons .mode-btn { padding: 12px 20px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .vn-scene {
    --px: 1.5;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: calc(100% - 140px - env(safe-area-inset-left) - env(safe-area-inset-right));
    margin-left: calc(16px + env(safe-area-inset-left));
  }
  .vn-name span { font-size: 0.72rem; }
  .vn-text { max-height: 30vh; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .cast-track { animation: none; }
}
