:root {
  --ink: var(--rl-ink);
  --paper: var(--rl-paper);
  --soft: var(--rl-foam);
  --line: var(--rl-divider);
  --muted: var(--rl-muted);
  --sun: var(--rl-sun);
  --coral: var(--rl-coral);
  --orange: var(--rl-warning);
  --wave: var(--rl-wave);
  --display: var(--rl-font-display);
  --body: var(--rl-font-body);
  --shadow: 0 18px 60px rgba(17, 16, 13, 0.08);
}

.fukurokuju-clone-hud { display: grid; gap: 6px; }
.fukurokuju-clone-hp { display: grid; gap: 2px; min-width: 9rem; font-size: .68rem; font-weight: 900; text-align: right; text-shadow: 0 1px 5px rgba(0, 0, 0, .8); }
.fukurokuju-clone-hp__track { display: block; height: 6px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .48); border-radius: 99px; background: rgba(0, 0, 0, .34); }
.fukurokuju-clone-hp__track b { display: block; width: var(--clone-hp, 100%); height: 100%; background: linear-gradient(90deg, #ff8f70, #ffd447); transition: width 120ms linear; }
.fukurokuju-clone-hp.is-defeated { opacity: .42; filter: grayscale(1); }

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.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;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  background:
    repeating-linear-gradient(105deg, rgba(14, 165, 198, 0.055) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(72deg, rgba(255, 255, 255, 0.36) 0 1px, transparent 1px 46px),
    radial-gradient(circle at 82% 10%, rgba(255, 255, 255, 0.72), transparent 18rem),
    radial-gradient(circle at 18% 68%, rgba(151, 218, 226, 0.22), transparent 32rem),
    linear-gradient(180deg, #f9feff 0%, #edf8f8 46%, #fbfaf7 100%);
  background-size: 220px 220px, 260px 260px, auto, auto, auto;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  content: "";
  pointer-events: none;
}

body::before {
  inset: -16%;
  background:
    linear-gradient(104deg, transparent 3%, rgba(255, 255, 255, 0.5) 15%, transparent 32%),
    linear-gradient(116deg, transparent 16%, rgba(255, 255, 255, 0.28) 31%, transparent 50%),
    linear-gradient(128deg, transparent 38%, rgba(14, 165, 198, 0.08) 48%, transparent 64%),
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.76), transparent 54%);
  opacity: 0.62;
  transform: skewX(-9deg);
  animation: water-light 18s ease-in-out infinite alternate;
}

body::after {
  inset: -18% 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.86) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(14, 165, 198, 0.2) 0 1px, transparent 3px),
    radial-gradient(circle, rgba(255, 191, 0, 0.18) 0 1px, transparent 2px);
  background-position: 12% 96%, 62% 112%, 88% 104%;
  background-size: 150px 240px, 220px 320px, 310px 380px;
  opacity: 0.66;
  animation: tiny-bubbles 32s linear infinite;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(14, 165, 198, 0.55);
  outline-offset: 5px;
}

.site-nav {
  position: fixed;
  z-index: 20;
  top: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, calc(100% - 28px));
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-right: 12px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: var(--ink);
  font-size: 11px;
  font-weight: 950;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links a {
  padding: 11px 13px;
  border-radius: 999px;
  color: rgba(17, 16, 13, 0.62);
}

.nav-links a:hover {
  background: rgba(17, 16, 13, 0.05);
}

.game-page {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 102px 0 48px;
}

.game-hero {
  margin-bottom: 12px;
}

.section-label {
  margin: 0 0 14px;
  color: var(--orange);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.section-label.blue {
  color: var(--wave);
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(24px, 3.6vw, 44px);
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 8px 0 0;
  color: rgba(17, 16, 13, 0.72);
  font-size: clamp(14px, 1.6vw, 17px);
  font-weight: 700;
  line-height: 1.75;
}

.hero-metrics,
.hud,
.control-grid,
.boss-card {
  font-family: var(--display);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 10px;
}

.hero-metrics span,
.hud span,
.control-grid section,
.boss-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-metrics span {
  min-width: 106px;
  padding: 14px;
  border-radius: 18px;
  color: rgba(17, 16, 13, 0.62);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
}

.play-surface {
  display: grid;
  gap: 12px;
}

.game-details {
  display: block;
}

.run-panel {
  display: grid;
  gap: 8px;
}

.run-panel h2 {
  margin: 0;
  color: var(--orange);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.hud span {
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 16px;
  color: rgba(17, 16, 13, 0.56);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  text-transform: none;
}

.viewport-shell {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  border-radius: 30px;
  outline: 1px solid rgba(17, 16, 13, 0.18);
  outline-offset: -1px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 191, 0, 0.26), transparent 24rem),
    linear-gradient(180deg, #dff8fb 0%, #f9feff 50%, #fbfaf7 100%);
  box-shadow: 0 28px 80px rgba(17, 16, 13, 0.13);
}

.viewport-shell::before {
  display: block;
  width: 100%;
  padding-top: 56.25%;
  content: "";
}

.game-layer,
.ending-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ending-layer[hidden],
.credits-overlay[hidden],
.ending-fade[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  cursor: crosshair;
}

#gameCanvas.is-legend-dead-color {
  filter: grayscale(0.98) contrast(1.12) brightness(0.92);
}

#gameCanvas.is-legend-transition-color {
  filter: grayscale(0.35) contrast(1.15) brightness(1.04);
}

.underwater-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%,
      transparent 48%,
      rgba(210, 250, 255, 0.055) 70%,
      rgba(160, 226, 238, 0.12) 100%);
  opacity: 0.62;
  transition:
    opacity 320ms ease,
    background 520ms ease,
    backdrop-filter 520ms ease;
}

.underwater-vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-radial-gradient(circle at 17% 31%, rgba(255, 255, 255, 0.18) 0 0.45px, rgba(0, 0, 0, 0.14) 0.55px 1px, transparent 1.1px 3.4px),
    repeating-radial-gradient(circle at 73% 67%, rgba(0, 0, 0, 0.12) 0 0.4px, transparent 0.6px 2.8px);
  background-size: 5px 5px, 7px 7px;
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 520ms ease;
}

.underwater-vignette.is-legend-dead {
  background:
    radial-gradient(circle at 50% 50%,
      transparent 50%,
      rgba(220, 220, 220, 0.06) 72%,
      rgba(150, 150, 150, 0.15) 100%);
  opacity: 0.68;
}

.underwater-vignette.is-legend-alive {
  background:
    radial-gradient(circle at 50% 50%,
      transparent 48%,
      rgba(210, 240, 255, 0.06) 70%,
      rgba(255, 216, 107, 0.13) 100%);
  opacity: 0.64;
}

.ingame-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: min(330px, calc(100% - 28px));
  font-family: var(--display);
  pointer-events: none;
}

.ingame-hud span {
  min-width: 74px;
  padding: 8px 10px 9px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 14px;
  color: rgba(16, 24, 32, 0.7);
  background:
    linear-gradient(145deg, rgba(247, 255, 255, 0.6), rgba(220, 246, 250, 0.32)),
    rgba(255, 255, 255, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    0 10px 28px rgba(0, 120, 160, 0.14);
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
  backdrop-filter: blur(10px) saturate(1.05);
}

.ingame-hud strong {
  display: block;
  color: #101820;
  font-size: 17px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.42);
  text-transform: none;
}

.ingame-hud em {
  font-style: normal;
}

.viewport-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
}

.viewport-shell:fullscreen::before {
  display: none;
}

.viewport-shell:fullscreen .game-layer,
.viewport-shell:fullscreen .ending-layer,
.viewport-shell:fullscreen #gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.charge-meter {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  width: min(220px, calc(100% - 36px));
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.charge-meter.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.charge-meter__track {
  position: relative;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(0, 24, 32, 0.42), rgba(0, 10, 18, 0.58));
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.45),
    0 0 10px rgba(126, 233, 255, 0.12);
}

.charge-meter__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: rgb(255, 64, 64);
  transition:
    width 70ms linear,
    background-color 80ms linear,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.charge-meter__mark {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 2px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.charge-meter__mark--power {
  left: 50%;
  transform: translateX(-1px);
}

.charge-meter.is-charged .charge-meter__mark--power {
  background: rgba(255, 216, 80, 0.95);
  box-shadow: 0 0 8px rgba(255, 216, 80, 0.55);
}

.charge-meter.is-full .charge-meter__bar {
  background: rgb(255, 255, 255);
  animation: tideChargeFullPulse 620ms ease-in-out infinite alternate;
}

.charge-meter.is-full .charge-meter__track {
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.45),
    0 0 14px rgba(255, 255, 255, 0.38),
    0 0 26px rgba(255, 216, 107, 0.26);
}

@keyframes tideChargeFullPulse {
  from {
    filter: brightness(1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.42);
  }
  to {
    filter: brightness(1.65);
    box-shadow:
      0 0 16px rgba(255, 255, 255, 0.8),
      0 0 28px rgba(255, 216, 107, 0.42);
  }
}

.weapon-dock {
  position: absolute;
  left: 18px;
  bottom: 38px;
  z-index: 6;
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.weapon-dock.is-hidden {
  display: none;
}

.weapon-slot {
  display: grid;
  grid-template-columns: auto auto minmax(28px, auto);
  align-items: center;
  gap: 8px;
  min-width: 118px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 14px;
  background: rgba(236, 252, 255, 0.58);
  color: rgba(16, 24, 32, 0.78);
  font-family: var(--display);
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 10px 28px rgba(0, 60, 88, 0.14);
}

.weapon-slot kbd {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid rgba(16, 24, 32, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: rgba(16, 24, 32, 0.82);
  font: inherit;
  box-shadow: 0 2px 0 rgba(16, 24, 32, 0.12);
}

.weapon-slot b {
  justify-self: end;
  font-size: 13px;
}

.weapon-slot.is-active {
  border-color: rgba(255, 216, 107, 0.86);
  background: rgba(255, 246, 202, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 0 0 2px rgba(255, 216, 107, 0.18),
    0 12px 32px rgba(255, 190, 64, 0.16);
}

.weapon-slot.is-empty {
  opacity: 0.45;
}

.compass {
  position: absolute;
  bottom: 58px;
  left: 50%;
  z-index: 5;
  width: min(320px, calc(100% - 96px));
  height: 28px;
  border: 1px solid rgba(220, 255, 255, 0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(23, 132, 176, 0.24));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 8px 22px rgba(25, 79, 88, 0.18),
    0 0 18px rgba(127, 233, 255, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
  backdrop-filter: blur(14px);
}

.compass.is-hidden {
  display: none;
}

.compass::before {
  position: absolute;
  inset: 50% 14px auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(14, 165, 198, 0.55), transparent);
}

.compass-center {
  position: absolute;
  left: 50%;
  top: 5px;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(-50%);
}

.compass-marker {
  position: absolute;
  top: 50%;
  z-index: 1;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--coral);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 85, 90, 0.16);
  transform: translate(-50%, -50%);
}

.player-health-meter {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  width: min(220px, calc(100% - 36px));
  height: 12px;
  color: #fff;
  font-family: var(--display);
  transform: translateX(-50%);
  pointer-events: none;
}

.player-health-meter span {
  position: absolute;
  right: 6px;
  bottom: 100%;
  margin-bottom: 2px;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .85);
}

.player-health-meter__track {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 24, 32, .42), rgba(0, 10, 18, .58));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45), 0 0 10px rgba(255, 122, 96, .14);
}

.player-health-meter__track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--orange), var(--sun));
  transition: width 100ms linear;
}

.underwater-vignette.is-low-health {
  background:
    radial-gradient(circle at 50% 50%,
      transparent 42%,
      rgba(180, 10, 18, var(--low-health-mid-alpha, 0.08)) 68%,
      rgba(150, 0, 10, var(--low-health-edge-alpha, 0.46)) 100%);
  opacity: var(--low-health-opacity, 0.82);
  -webkit-backdrop-filter: blur(var(--low-health-blur, 0.65px)) brightness(var(--low-health-brightness, 0.95));
  backdrop-filter: blur(var(--low-health-blur, 0.65px)) brightness(var(--low-health-brightness, 0.95));
  animation: lowHealthVignettePulse 1.05s ease-in-out infinite;
}

.underwater-vignette.is-low-health::after {
  opacity: var(--low-health-noise, 0.055);
}

.player-health-meter.is-low-health {
  animation: none;
}

.player-health-meter.is-low-health .player-health-meter__track {
  animation: lowHealthTrackPulse 0.72s ease-in-out infinite;
}

.player-health-meter.is-low-health strong {
  color: #b00016;
}

@keyframes lowHealthVignettePulse {
  50% { opacity: min(1, calc(var(--low-health-opacity, 0.82) + 0.06)); }
}

@keyframes lowHealthTrackPulse {
  0%,
  100% { transform: scale(1); filter: none; }
  50% { transform: scale(1.08); filter: saturate(1.4) brightness(1.12); }
}

.compass-marker.mechanic {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #ffe16b;
  box-shadow: 0 0 0 3px rgba(255, 225, 107, 0.2), 0 0 12px rgba(255, 225, 107, 0.72);
  transform: translate(-50%, -50%) rotate(45deg);
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 24px;
  height: 24px;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair::before,
.crosshair::after {
  position: absolute;
  left: 50%;
  top: 50%;
  content: "";
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(17, 16, 13, 0.5), 0 2px 8px rgba(17, 16, 13, 0.22);
  transform: translate(-50%, -50%);
}

.crosshair::before {
  width: 18px;
  height: 2px;
}

.crosshair::after {
  width: 2px;
  height: 18px;
}

.crosshair.is-visible {
  opacity: 0.74;
}

.crosshair.is-firing::before,
.crosshair.is-firing::after {
  animation: crosshairFireKick 140ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

@keyframes crosshairFireKick {
  0% { transform: translate(-50%, -50%) scale(1); background: rgba(255, 255, 255, 0.9); }
  35% { transform: translate(-50%, -50%) scale(1.55); background: rgba(158, 238, 255, 1); }
  100% { transform: translate(-50%, -50%) scale(1); background: rgba(255, 255, 255, 0.88); }
}

@media (prefers-reduced-motion: reduce) {
  .crosshair.is-firing::before,
  .crosshair.is-firing::after {
    animation: none;
    background: rgba(158, 238, 255, 1);
  }
}

.compass-marker.boss {
  width: 14px;
  height: 14px;
  background: var(--sun);
  box-shadow: 0 0 0 4px rgba(255, 191, 0, 0.2);
}

.compass-marker.goal {
  width: 15px;
  height: 15px;
  border: 2px solid #ffffff;
  border-radius: 3px;
  background: #ffd447;
  box-shadow: 0 0 0 3px rgba(78, 228, 244, 0.72), 0 0 0 6px rgba(7, 42, 58, 0.72), 0 0 15px rgba(255, 212, 71, 0.84);
  transform: translate(-50%, -50%) rotate(45deg);
}

.compass-marker.goal::before {
  position: absolute;
  inset: 2px;
  border: 1px solid #4ee4f4;
  border-radius: 2px;
  content: "";
}

.compass-marker.goal::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  background: #4ee4f4;
  content: "";
  transform: translate(-50%, -50%) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .compass-marker.goal {
    animation: none;
    transition: none;
  }
}

.hit-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  color: var(--coral);
  font-family: var(--display);
  font-size: 32px;
  font-weight: 950;
  line-height: 54px;
  text-align: center;
  text-shadow: 0 2px 12px rgba(255, 85, 90, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.hit-indicator.is-visible {
  opacity: 0.9;
}

.screen-flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98), rgba(255, 191, 0, 0.52) 42%, transparent 72%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

.screen-flash.is-visible {
  opacity: 0.95;
}

.legend-cinematic-fade {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(2, 6, 9, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.legend-cinematic-fade.is-visible {
  opacity: 1;
}

.boss-intro,
.stage-banner {
  position: absolute;
  left: 50%;
  z-index: 9;
  color: var(--ink);
  font-family: var(--display);
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
}

.boss-intro {
  top: 42%;
  display: grid;
  gap: 6px;
  min-width: min(420px, calc(100% - 48px));
  padding: 18px 22px;
  border: 1px solid rgba(17, 16, 13, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(17, 16, 13, 0.18);
  opacity: 0;
  transform: translate(-50%, 14px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(14px);
}

.boss-intro.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.boss-intro span {
  color: var(--wave);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.boss-intro strong {
  font-size: clamp(24px, 4vw, 44px);
  font-weight: 950;
  line-height: 1;
}

.stage-banner {
  top: auto;
  bottom: 98px;
  max-width: min(82vw, 620px);
  padding: 6px 12px;
  border-radius: 10px;
  color: white;
  background: rgba(17, 16, 13, 0.58);
  box-shadow: 0 12px 42px rgba(17, 16, 13, 0.22);
  font-size: clamp(12px, 1.55vw, 18px);
  font-weight: 950;
  line-height: 1.38;
  letter-spacing: 0.025em;
  white-space: pre-line;
  text-wrap: balance;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  transform: translate(-50%, 12px);
}

.stage-banner.is-visible {
  opacity: 0.78;
  transform: translate(-50%, 0);
}

.dialogue-layer {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  width: min(88%, 1180px);
  min-height: 132px;
  margin: 0;
  padding: 18px 24px 16px 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 244, 194, 0.72);
  border-radius: 20px;
  color: #effcff;
  background: linear-gradient(135deg, rgba(3, 25, 40, 0.96), rgba(9, 66, 88, 0.94));
  box-shadow: 0 18px 60px rgba(1, 18, 30, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.dialogue-layer[hidden] { display: none; }
.dialogue-layer.is-visible { opacity: 1; transform: translate(-50%, 0); }
.dialogue-layer.is-blocking { pointer-events: auto; cursor: pointer; outline: none; }
.dialogue-layer.is-blocking:focus-visible { box-shadow: 0 0 0 3px #ffe16b, 0 18px 60px rgba(1, 18, 30, 0.5); }
.dialogue-layer__portrait-frame { width: 112px; height: 92px; overflow: hidden; border: 2px solid #d6b85b; border-radius: 16px; background: #fffdf5; }
.dialogue-layer__portrait-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.dialogue-layer__copy { min-width: 0; }
.dialogue-layer__copy strong { display: block; margin-bottom: 8px; color: #fff1a8; font-size: clamp(16px, 1.8vw, 22px); letter-spacing: .08em; }
.dialogue-layer__copy p { margin: 0; min-height: 2.9em; overflow-wrap: anywhere; white-space: pre-wrap; font-size: clamp(20px, 2.15vw, 30px); font-weight: 750; line-height: 1.45; }
.dialogue-layer__copy small { display: block; min-height: 1.2em; margin-top: 7px; color: rgba(239, 252, 255, .84); font-size: clamp(11px, 1.1vw, 14px); letter-spacing: .08em; text-align: right; }
.dialogue-layer.is-gate-ready .dialogue-layer__copy small { color: #fff1a8; }
@media (prefers-reduced-motion: no-preference) {
  .dialogue-layer.is-gate-ready .dialogue-layer__copy small { animation: dialogue-gate-ready 1.4s ease-in-out infinite; }
}
@keyframes dialogue-gate-ready { 50% { opacity: .68; } }
.dialogue-layer:not(.has-portrait) { grid-template-columns: minmax(0, 1fr); }
.dialogue-layer.is-narration .dialogue-layer__portrait-frame,
.dialogue-layer__portrait-frame[hidden] { display: none; }

.dialogue-layer.is-combat-bark {
  bottom: max(98px, env(safe-area-inset-bottom));
  width: min(78%, 720px);
  min-height: 58px;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 14px;
  pointer-events: none;
}
.dialogue-layer.is-combat-bark .dialogue-layer__portrait-frame { width: 54px; height: 42px; border-radius: 10px; }
.dialogue-layer.is-combat-bark .dialogue-layer__copy strong { margin-bottom: 2px; font-size: 12px; }
.dialogue-layer.is-combat-bark .dialogue-layer__copy p { min-height: 1.45em; font-size: clamp(13px, 1.35vw, 17px); line-height: 1.45; }
.dialogue-layer.is-combat-bark .dialogue-layer__copy small { display: none; }

.dialogue-layer.is-rescue-cut-in,
.dialogue-layer.is-combat-resolution {
  bottom: max(132px, calc(env(safe-area-inset-bottom) + 104px));
  width: min(64%, 640px);
  min-height: 52px;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 13px 7px 7px;
  border-radius: 13px;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(3, 25, 40, 0.88), rgba(9, 66, 88, 0.82));
  box-shadow: 0 12px 34px rgba(1, 18, 30, 0.34);
}

.compass-marker.valve {
  width: 14px;
  height: 14px;
  border: 2px solid #f7cf62;
  background: #4ee4f4;
  box-shadow: 0 0 0 4px rgba(78, 228, 244, 0.22), 0 0 16px rgba(247, 207, 98, 0.78);
}

.compass-marker.valve::after {
  position: absolute;
  left: 50%;
  top: 17px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(5, 34, 45, 0.82);
  color: #fff4bd;
  content: attr(data-label);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
  transform: translateX(-50%);
  white-space: nowrap;
}
.dialogue-layer.is-rescue-cut-in { border-color: rgba(255, 225, 107, 0.76); }
.dialogue-layer.is-combat-resolution { border-color: rgba(142, 235, 255, 0.7); }
.dialogue-layer.is-rescue-cut-in .dialogue-layer__portrait-frame,
.dialogue-layer.is-combat-resolution .dialogue-layer__portrait-frame { width: 46px; height: 38px; border-radius: 9px; }
.dialogue-layer.is-rescue-cut-in .dialogue-layer__copy strong,
.dialogue-layer.is-combat-resolution .dialogue-layer__copy strong { margin-bottom: 1px; font-size: 11px; }
.dialogue-layer.is-rescue-cut-in .dialogue-layer__copy p,
.dialogue-layer.is-combat-resolution .dialogue-layer__copy p { min-height: 1.35em; font-size: clamp(13px, 1.28vw, 17px); line-height: 1.4; }
.dialogue-layer.is-rescue-cut-in .dialogue-layer__copy small,
.dialogue-layer.is-combat-resolution .dialogue-layer__copy small { display: none; }

.dialogue-layer.is-combat-bark:not(.has-portrait),
.dialogue-layer.is-combat-resolution:not(.has-portrait) { grid-template-columns: minmax(0, 1fr); }

#dialogueLayer[data-dialogue-id="waterway.open"] {
  width: min(88%, 860px);
  max-width: calc(100% - 16px);
}

#dialogueLayer[data-dialogue-id="waterway.open"] .dialogue-layer__copy p {
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: pretty;
}

.ending-fade {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: none;
  background: rgba(255, 255, 255, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 760ms ease;
}

.ending-fade.is-visible {
  display: block;
  background: rgba(255, 255, 255, 0.96);
  opacity: 1;
}

.ending-fade.is-visible.is-throne-transition {
  background: rgba(9, 13, 24, 0.98);
}

.ending-fade.is-visible.is-whiteout {
  background: radial-gradient(circle at 50% 48%, #fff 0 16%, rgba(255,255,255,.96) 40%, rgba(255,255,255,.72) 68%, rgba(255,255,255,0) 100%);
  animation: ending-dissolve 1.8s cubic-bezier(.2,.75,.25,1) forwards;
}

@keyframes ending-dissolve {
  from { opacity: 0; filter: blur(14px); transform: scale(1.08); }
  55% { opacity: .86; filter: blur(6px); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}

.throne-clear { position: absolute; inset: 0; z-index: 19; display: grid; place-content: center; gap: 7px; color: #fff7cf; text-align: center; text-shadow: 0 0 18px rgba(255,191,0,.8), 0 2px 10px #000; pointer-events: none; }
.throne-clear small { font-size: clamp(11px, 1.3vw, 16px); font-weight: 900; letter-spacing: .22em; }
.throne-clear strong { font-family: var(--display); font-size: clamp(38px, 7vw, 76px); font-weight: 950; letter-spacing: .08em; }
.throne-clear span { font-size: clamp(13px, 1.8vw, 21px); font-weight: 850; letter-spacing: .12em; }
.throne-clear.is-visible { animation: throne-clear-reveal 3.2s ease both; }
@keyframes throne-clear-reveal { 0% { opacity: 0; transform: scale(.72); filter: blur(12px); } 18%, 76% { opacity: 1; transform: scale(1); filter: blur(0); } 100% { opacity: .35; transform: scale(1.06); } }

.game-layer.is-throne-room .ingame-hud,
.game-layer.is-throne-room .boss-health,
.game-layer.is-throne-room .boss-card,
.game-layer.is-throne-room .mechanic-hud,
.game-layer.is-throne-room .multi-boss-hud,
.game-layer.is-throne-room .boss-adds-hud,
.game-layer.is-throne-room .weapon-dock,
.game-layer.is-throne-room .charge-meter,
.game-layer.is-throne-room .player-health-meter,
.game-layer.is-throne-room .crosshair,
.game-layer.is-throne-room .compass {
  display: none !important;
}

.game-layer.is-throne-room .underwater-vignette {
  background: radial-gradient(circle at 50% 44%, transparent 55%, rgba(8, 10, 18, 0.34) 100%);
  opacity: 0.72;
}

.boss-health {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 4;
  display: none;
  width: min(360px, 40vw);
  max-width: 360px;
  padding: 7px 12px 9px;
  border: 1px solid rgba(220, 255, 255, 0.54);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(54, 170, 210, 0.52), rgba(9, 92, 130, 0.24)),
    rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 16px 42px rgba(0, 96, 140, 0.22),
    0 0 22px rgba(127, 233, 255, 0.18);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.boss-health.is-visible {
  display: grid;
  gap: 7px;
}

.boss-health span {
  color: rgba(255, 255, 255, 0.94);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(95, 235, 255, 0.36);
}

.boss-health div {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(220, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(2, 58, 84, 0.34);
}

.boss-health i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--orange), var(--sun));
}

.mechanic-hud {
  position: absolute;
  top: 66px;
  left: 50%;
  z-index: 5;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  width: min(430px, 44vw);
  padding: 8px 12px;
  border: 1px solid rgba(220, 255, 255, 0.72);
  border-radius: 14px;
  color: #f7ffff;
  background: rgba(3, 59, 83, 0.78);
  box-shadow: 0 12px 34px rgba(0, 60, 90, 0.3);
  font-family: var(--display);
  font-size: 11px;
  transform: translateX(-50%);
  pointer-events: none;
}

.multi-boss-hud { position: absolute; inset: 0; z-index: 5; color: #fff8d2; pointer-events: none; }
.legend-blessings { position: absolute; top: 68px; left: 50%; min-width: min(340px, 46vw); padding: 7px 10px; border: 1px solid rgba(255, 241, 168, .65); border-radius: 12px; background: rgba(40, 28, 55, .78); text-align: center; letter-spacing: .16em; transform: translateX(-50%); }
.legend-blessings small { display: block; margin-top: 3px; color: #fff; font-size: 9px; letter-spacing: .02em; }
.seven-god-bars { position: absolute; top: 78px; right: 14px; display: grid; grid-template-columns: minmax(130px, 170px); gap: 5px; }
.seven-god-bar { min-width: 0; font-size: 9px; font-weight: 900; text-align: right; text-shadow: 0 1px 5px rgba(0, 0, 0, .8); }
.seven-god-bar__label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seven-god-bar__track { display: block; height: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,.45); border-radius: 99px; background: rgba(0,0,0,.35); }
.seven-god-bar__track b { display: block; width: var(--god-hp, 100%); height: 100%; background: linear-gradient(90deg, #ff7a60, #ffd447); transition: width 160ms ease; }
.seven-god-bar.is-defeated { opacity: .42; filter: grayscale(1); }
.seven-god-bar.is-locked .seven-god-bar__track { filter: grayscale(.75); opacity: .72; }
.seven-god-bar.is-locked .seven-god-bar__label::after { content: " 🔒"; }

.boss-adds-hud { position: absolute; top: 78px; right: 14px; z-index: 5; color: #fff8d2; pointer-events: none; }

.gate-transition { position: absolute; inset: -25%; z-index: 17; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.96) 0 4%, rgba(87,214,178,.86) 16%, rgba(14,165,198,.74) 34%, rgba(3,36,58,.98) 72%); opacity: 0; transform: scale(1.12); filter: blur(12px); pointer-events: none; }
.gate-transition.is-visible { animation: gate-pass .9s cubic-bezier(.2,.7,.2,1) both; }
@keyframes gate-pass { 0% { opacity: 0; transform: scale(1.12); filter: blur(14px); } 45% { opacity: 1; transform: scale(1.04); filter: blur(2px); } 100% { opacity: 0; transform: scale(1); filter: blur(18px); } }

@media (prefers-reduced-motion: reduce) {
  .seven-god-bar__track b { transition: none; }
  .underwater-vignette.is-low-health,
  .player-health-meter.is-low-health .player-health-meter__track { animation: none; }
  .multi-boss-hud, .multi-boss-hud * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .ending-fade.is-visible.is-whiteout,
  .throne-clear.is-visible { animation: none; }
  .dialogue-layer { transition: none; }
  .dialogue-layer.is-rescue-cut-in,
  .dialogue-layer.is-combat-resolution { transition: none; }
  .gate-transition.is-visible { animation: none; opacity: .92; transform: none; filter: none; }
}

.mechanic-hud:not([hidden]) { display: grid; }
.mechanic-hud strong { font-size: 13px; text-align: center; }
.mechanic-hud small { grid-column: 1 / -1; min-height: 1em; text-align: center; letter-spacing: 0.08em; }
.mechanic-hud__shield { font-weight: 950; }
.mechanic-hud.is-vulnerable { border-style: dashed; background: rgba(85, 70, 15, 0.82); }
.mechanic-hud.is-warning { animation: mechanicWindowWarning 280ms ease-in-out infinite alternate; }
.mechanic-hud.is-shield-blocked { animation: mechanicShieldRipple 260ms ease-out; }

@keyframes mechanicWindowWarning { to { filter: brightness(1.55); } }
@keyframes mechanicShieldRipple { 50% { box-shadow: 0 0 0 8px rgba(130, 240, 255, 0.2), 0 0 28px rgba(130, 240, 255, 0.6); } }

.quick-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 12;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: min(520px, calc(100% - 28px));
  padding: 6px;
  border: 1px solid rgba(220, 255, 255, 0.38);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(50, 177, 216, 0.42), rgba(13, 96, 135, 0.24)),
    rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    0 12px 32px rgba(0, 96, 140, 0.22);
  backdrop-filter: blur(16px) saturate(1.16);
}

.quick-actions.is-ending-hidden:not(.is-menu-visible) {
  display: none !important;
}

.quick-actions.is-playing-hidden:not(.is-menu-visible) {
  display: none !important;
}

.quick-actions.is-menu-visible {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: auto;
  z-index: 30;
  display: flex !important;
  pointer-events: auto;
}

.quick-actions.is-pause-visible {
  top: 14px;
  bottom: auto;
  z-index: 30;
  display: flex !important;
  pointer-events: auto;
}

.quick-actions button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgba(220, 255, 255, 0.44);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(27, 135, 179, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 950;
  cursor: pointer;
}

@media (pointer: coarse) {
  .quick-actions.is-pause-visible #fullscreenButton {
    min-width: 44px;
    min-height: 44px;
  }
}

.audio-slider {
  display: grid;
  gap: 2px;
  width: 82px;
  color: rgba(235, 255, 255, 0.88);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.audio-slider input {
  width: 100%;
  accent-color: var(--wave);
  cursor: pointer;
}

.quality-select {
  display: grid;
  gap: 2px;
  width: 92px;
  color: rgba(235, 255, 255, 0.88);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.quality-select select {
  min-height: 24px;
  border: 1px solid rgba(220, 255, 255, 0.44);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(27, 135, 179, 0.78);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 950;
  text-align: center;
  cursor: pointer;
}

.boss-card {
  position: absolute;
  top: 14px;
  right: 14px;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: min(240px, calc(100% - 28px));
  padding: 7px 10px 7px 7px;
  border-radius: 999px;
}

.boss-card.is-visible {
  display: flex;
}

.boss-card img {
  width: 42px;
  height: 42px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
  background: white;
}

.boss-card p {
  margin: 0 0 2px;
  color: var(--wave);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.boss-card strong {
  font-size: 12px;
  font-weight: 950;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 16;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(127, 233, 255, 0.22), transparent 34rem),
    rgba(3, 58, 83, 0.52);
  backdrop-filter: blur(18px) saturate(1.12);
}

.overlay.is-hidden {
  display: none;
}

.overlay h2 {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--display);
  font-size: clamp(38px, 7vw, 84px);
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 12px 38px rgba(0, 86, 130, 0.35);
}

.overlay p:not(.section-label) {
  max-width: 640px;
  margin: 0 auto;
  color: rgba(235, 255, 255, 0.84);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.8;
}

.overlay button {
  border: 1px solid rgba(220, 255, 255, 0.54);
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, rgba(17, 135, 185, 0.96), rgba(2, 74, 113, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 12px 30px rgba(0, 96, 140, 0.24);
  font-weight: 950;
  cursor: pointer;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.overlay-actions[hidden] { display: none; }

.player-name-form {
  display: grid;
  gap: 10px;
  width: min(460px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px;
  border: 1px solid rgba(220, 255, 255, 0.42);
  border-radius: 20px;
  background: rgba(3, 58, 83, 0.62);
  box-shadow: 0 18px 48px rgba(0, 35, 62, 0.28);
  text-align: left;
}

.player-name-form[hidden] { display: none; }

.player-name-form label {
  color: white;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.player-name-form input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgba(220, 255, 255, 0.68);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  font: 800 16px/1.4 var(--body);
}

.player-name-form input:focus-visible {
  outline: 3px solid rgba(255, 216, 107, 0.92);
  outline-offset: 2px;
}

.overlay .player-name-help,
.overlay .player-name-error {
  width: 100%;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.overlay .player-name-error {
  min-height: 1.5em;
  color: #fff0b8;
}

.player-name-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.asset-loading {
  display: grid;
  gap: 10px;
  width: min(360px, 80vw);
  margin: 2px auto 0;
}

.asset-loading[hidden] {
  display: none !important;
}

.asset-loading__label {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: rgba(235, 255, 255, 0.86);
  text-align: center;
  text-shadow: 0 4px 16px rgba(0, 80, 120, 0.22);
}

.asset-loading__status {
  color: rgba(235, 255, 255, 0.72);
  font-size: 11px;
  text-align: center;
}

.asset-loading__bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(4, 64, 88, 0.18);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 120, 160, 0.12);
}

.asset-loading__bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(126, 233, 255, 0.82), rgba(255, 216, 107, 0.92));
  transition: width 180ms ease;
}

.overlay button {
  justify-self: center;
  min-width: 176px;
  min-height: 52px;
  padding: 12px 22px;
}

.overlay button:disabled {
  cursor: wait;
  opacity: 0.66;
  filter: grayscale(0.18);
}

.overlay button[hidden] {
  display: none;
}

.overlay-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  width: min(620px, calc(100vw - 64px));
  margin: 0 auto;
  color: rgba(17, 16, 13, 0.72);
  font-family: var(--display);
}

.overlay-details[hidden] {
  display: none;
}

.overlay-details span {
  padding: 8px 10px;
  border: 1px solid rgba(17, 16, 13, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 900;
}

.overlay-details strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.credits-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 191, 0, 0.2), transparent 18rem),
    linear-gradient(180deg, rgba(251, 250, 247, 0.98), rgba(224, 248, 251, 0.94));
  font-family: var(--display);
  text-align: center;
  pointer-events: auto;
}

.credits-overlay.is-visible {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.credits-mask {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.credits-roll {
  position: absolute;
  left: 50%;
  top: 100%;
  z-index: 1;
  display: grid;
  gap: 9px;
  width: min(700px, calc(100% - 48px));
  padding-bottom: 34vh;
  transform: translateX(-50%) translateY(0);
  will-change: transform;
}

.credits-roll h2 {
  margin: 26px 0 12px;
  color: var(--orange);
  font-size: clamp(24px, 4vw, 48px);
  font-weight: 950;
  line-height: 1;
}

.credits-roll p {
  margin: 18px 0 4px;
  color: var(--wave);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.18em;
}

.credits-roll span {
  font-size: clamp(14px, 1.8vw, 21px);
  font-weight: 850;
}

.credits-roll .credits-and-you {
  display: block;
  max-width: 100%;
  margin: 1.25rem 0 2rem;
  color: var(--orange);
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.credits-roll .credits-end {
  margin-top: 10px;
  color: var(--coral);
  font-size: clamp(22px, 3.4vw, 40px);
  font-weight: 950;
}

.credits-controls-hint {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: grid;
  gap: 3px;
  justify-items: end;
}

.credits-controls-hint small {
  color: rgba(17, 16, 13, 0.58);
  font-size: 11px;
  font-weight: 900;
}

@media (pointer: coarse) {
  .credits-fast-forward-hint {
    display: none;
  }
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.info-grid {
  align-items: start;
}

.control-grid section {
  padding: 16px 18px;
  border-radius: 22px;
}

.control-grid p {
  margin: 0;
  color: rgba(17, 16, 13, 0.68);
  font-weight: 800;
  line-height: 1.75;
}

.control-title {
  margin-bottom: 8px !important;
  color: var(--orange) !important;
  font-size: 12px;
  font-weight: 950 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 1.1em;
  color: rgba(17, 16, 13, 0.68);
  font-weight: 850;
  line-height: 1.65;
}

.key-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.key-table div {
  display: grid;
  grid-template-columns: minmax(78px, auto) 1fr;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid rgba(17, 16, 13, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.key-table dt {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 7px;
  color: white;
  background: var(--ink);
  font-size: 11px;
  font-weight: 950;
}

.key-table dd {
  margin: 0;
  color: rgba(17, 16, 13, 0.7);
  font-size: 12px;
  font-weight: 850;
}

@keyframes water-light {
  from {
    opacity: 0.48;
    transform: translateY(0) skewX(-9deg);
  }
  to {
    opacity: 0.72;
    transform: translateY(-24px) skewX(-7deg);
  }
}

@keyframes tiny-bubbles {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-180px);
  }
}

@media (max-width: 960px) {
  .hero-metrics,
  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .game-page {
    width: min(100% - 22px, 1160px);
    padding-top: 104px;
  }

  .site-nav {
    width: min(100% - 20px, 1160px);
  }

  .nav-links a {
    padding: 10px 9px;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .viewport-shell,
  #gameCanvas {
    min-height: 0;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .boss-card {
    left: auto;
    right: 10px;
    top: 58px;
    max-width: min(190px, calc(100% - 20px));
  }

  .quick-actions {
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 5px;
    max-width: min(230px, calc(100% - 20px));
    padding: 5px;
  }

  .quick-actions button {
    min-height: 26px;
    padding: 5px 7px;
    font-size: 10px;
  }

  .audio-slider {
    width: 64px;
    font-size: 8px;
  }

  .ingame-hud {
    top: 8px;
    left: 8px;
    width: min(250px, calc(100% - 116px));
    gap: 4px;
  }

  .ingame-hud span {
    min-width: 54px;
    padding: 4px 6px;
    font-size: 8px;
  }

  .ingame-hud strong {
    font-size: 12px;
  }

  .compass {
    bottom: 76px;
    width: min(250px, calc(100% - 116px));
  }

  .charge-meter {
    left: 8px;
    bottom: 26px;
    width: min(244px, calc(100% - 16px));
  }

  .player-health-meter {
    bottom: 6px;
    width: min(220px, calc(100% - 16px));
  }

  .weapon-dock {
    left: 8px;
    bottom: 46px;
    display: flex;
    gap: 4px;
  }

  .weapon-slot {
    grid-template-columns: auto auto minmax(18px, auto);
    gap: 4px;
    min-width: 76px;
    padding: 4px 5px;
    border-radius: 10px;
    font-size: 10px;
  }

  .weapon-slot kbd {
    width: 22px;
    height: 22px;
    border-radius: 7px;
  }

  .weapon-slot b {
    font-size: 10px;
  }

  .boss-health {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    padding: 6px 9px;
    transform: none;
  }

  .boss-health span {
    font-size: 10px;
  }

  .boss-health div {
    height: 7px;
  }

  .mechanic-hud {
    top: 120px;
    width: min(350px, 88vw);
    grid-template-columns: 1fr 1fr;
    padding: 7px 9px;
  }

  .multi-boss-hud {
    inset: 0;
  }

  .legend-blessings {
    top: 120px;
    right: 8px;
    left: 8px;
    min-width: 0;
    padding: 5px 8px;
    font-size: 9px;
    transform: none;
  }

  .seven-god-bars,
  .boss-adds-hud {
    top: 165px;
    right: 8px;
  }

  .boss-adds-hud {
    top: 225px;
  }

  .seven-god-bars {
    grid-template-columns: minmax(105px, 140px);
  }

  .mechanic-hud strong { grid-column: 1 / -1; grid-row: 1; }
}

@media (max-width: 520px) {
  .dialogue-layer {
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    grid-template-columns: 58px minmax(0, 1fr);
    width: calc(100% - 16px);
    gap: 9px;
    min-height: 112px;
    padding: 11px 10px 9px 8px;
  }
  .dialogue-layer__portrait-frame { width: 58px; height: 48px; }
  .dialogue-layer__copy strong { margin-bottom: 4px; font-size: 13px; }
  .dialogue-layer__copy p { min-height: 3em; font-size: 18px; line-height: 1.4; }
  .dialogue-layer__copy small { margin-top: 3px; font-size: 11px; }
  .dialogue-layer.is-combat-bark { bottom: max(82px, env(safe-area-inset-bottom)); width: calc(100% - 16px); min-height: 58px; grid-template-columns: 52px minmax(0, 1fr); }
  .dialogue-layer.is-combat-bark .dialogue-layer__portrait-frame { width: 52px; height: 42px; }
}

.credits-roll .credits-track-title {
  color: var(--ink);
  font-size: clamp(16px, 2.15vw, 24px);
  font-weight: 950;
  line-height: 1.2;
}

.credits-roll .credits-track-credit {
  color: rgba(17, 16, 13, 0.68);
  font-size: clamp(12px, 1.45vw, 17px);
  font-weight: 850;
  line-height: 1.25;
}

.credits-track {
  display: grid;
  gap: 3px;
  margin: 10px auto 6px;
  padding: 10px 18px;
  width: min(92%, 560px);
  border: 1px solid rgba(14, 165, 198, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 24px rgba(14, 165, 198, 0.08);
}

.credits-character {
  position: absolute;
  top: calc((var(--credit-index) + 0.5) * 6.666%);
  z-index: 0;
  width: clamp(92px, 13vw, 150px);
  margin: 0;
  color: rgba(17, 16, 13, 0.72);
  filter: drop-shadow(0 12px 18px rgba(0, 80, 100, 0.2));
}

.credits-roll > :not(.credits-character) { position: relative; z-index: 1; }

.credits-character.is-left { left: clamp(-138px, -10vw, -72px); }
.credits-character.is-right { right: clamp(-138px, -10vw, -72px); }
.credits-character.is-legend {
  left: 50%;
  width: clamp(130px, 18vw, 210px);
  color: #d36a00;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 22px rgba(255, 191, 0, 0.5));
}

.credits-character img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.credits-character figcaption {
  margin-top: -5px;
  font-size: clamp(10px, 1.15vw, 13px);
  font-weight: 950;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .credits-roll { width: calc(100% - 72px); }
  .credits-character { width: 78px; opacity: 0.72; }
  .credits-character.is-left { left: -54px; }
  .credits-character.is-right { right: -54px; }
  .credits-character.is-legend { width: 112px; }
  .credits-character figcaption { display: none; }
}

/* Racco Legends work page */
:root {
  --ocean-deep: #06384d;
  --ocean-ink: #072c3b;
  --ocean-mid: #087b96;
  --foam: #f4fbf9;
  --foam-muted: #d9efea;
  --signal: #ffc928;
  --signal-hot: #ff6c55;
  --page-line: rgba(7, 44, 59, .18);
  --page-focus: #ffe064;
  /* Legacy component tokens stay inside the underwater palette. */
  --ink: var(--ocean-ink);
  --paper: var(--foam);
  --soft: var(--foam-muted);
  --line: var(--page-line);
  --muted: #315966;
  --sun: var(--signal);
  --coral: var(--signal-hot);
  --orange: #ff7a60;
  --wave: var(--ocean-mid);
  --shadow: 0 18px 60px rgba(7, 44, 59, .14);
}

html {
  scroll-behavior: smooth;
  background: var(--ocean-deep);
}

body {
  color: var(--ocean-ink);
  background-color: var(--ocean-deep);
  background-image:
    linear-gradient(180deg, rgba(6, 56, 77, .25) 0%, rgba(6, 56, 77, .82) 48%, #032b3d 100%),
    url("../ocean-background.webp");
  background-position: center, center top;
  background-repeat: no-repeat;
  background-size: cover, max(118vw, 1600px) auto;
  background-attachment: fixed;
}

body::before {
  inset: 0;
  background: linear-gradient(112deg, transparent 18%, rgba(207, 249, 255, .12) 31%, transparent 44%);
  opacity: .65;
  transform: none;
  animation: none;
}

body::after {
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .72) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(183, 244, 250, .48) 0 1px, transparent 3px);
  background-position: 14% 94%, 82% 108%;
  background-size: 190px 300px, 280px 390px;
  opacity: .46;
  animation: none;
}

.skip-link {
  position: fixed;
  z-index: 60;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: var(--ocean-ink);
  background: var(--page-focus);
  font-weight: 900;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid var(--page-focus);
  outline-offset: 4px;
}

.site-nav {
  top: 12px;
  width: min(1160px, calc(100% - 28px));
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  color: var(--ocean-ink);
  background: rgba(244, 251, 249, .96);
  box-shadow: 0 6px 0 rgba(1, 30, 43, .28);
  backdrop-filter: none;
  transition: opacity 180ms ease-out, box-shadow 180ms ease-out;
}

.brand-mark {
  color: var(--ocean-ink);
  background: var(--signal);
}

.nav-links a {
  border-radius: 8px;
}

.nav-links a[aria-current="page"] {
  color: white;
  background: var(--ocean-mid);
}

.game-page {
  width: min(1160px, calc(100% - 28px));
  padding-top: 98px;
}

.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, .75fr);
  gap: clamp(26px, 5vw, 64px);
  align-items: end;
  padding: clamp(28px, 5vw, 58px);
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  color: white;
  background:
    linear-gradient(116deg, rgba(6, 56, 77, .98), rgba(8, 123, 150, .9)),
    url("./assets/textures/floor-caustics.webp") center / cover;
  box-shadow: 0 8px 0 rgba(1, 29, 42, .42);
  transition: opacity 200ms ease-out, filter 200ms ease-out;
}

.hero-copy { max-width: 680px; }

.game-hero .section-label {
  color: #bfeef2;
  letter-spacing: .035em;
  text-transform: none;
}

.game-hero h1 {
  max-width: 11em;
  margin: 10px 0 16px;
  color: white;
  font-size: clamp(2.45rem, 5.8vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.game-hero .lead {
  max-width: 62ch;
  color: #e5f7f6;
  font-size: clamp(15px, 1.8vw, 19px);
  line-height: 1.8;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  margin-top: 24px;
  color: #c9ecec;
  font-size: 13px;
  font-weight: 800;
}

.hero-primary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 9px;
  color: var(--ocean-ink);
  background: var(--signal);
  font-weight: 950;
  transition: transform 160ms ease-out, background-color 160ms ease-out;
}

.hero-primary:hover { background: #ffe064; transform: translateY(-2px); }






.play-surface {
  margin-top: 24px;
  padding: clamp(10px, 1.5vw, 18px);
  border: 0;
  border-radius: 16px;
  background: var(--foam);
  box-shadow: 0 8px 0 rgba(1, 29, 42, .42);
}

.play-heading {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 4px 6px 14px;
  color: var(--ocean-ink);
}

.play-heading div { display: grid; gap: 1px; }
.play-heading span { color: #16798e; font-size: 10px; font-weight: 950; letter-spacing: .12em; }
.play-heading strong { font-family: var(--display); font-size: 17px; letter-spacing: .025em; }
.play-heading p { margin: 0; color: #315966; font-size: 11px; font-weight: 800; }
.play-heading kbd { padding: 3px 6px; border-radius: 5px; color: white; background: var(--ocean-ink); font: 800 10px var(--display); }

.viewport-shell {
  overflow: hidden;
  border: 6px solid var(--ocean-ink);
  border-radius: 12px;
  background: #021d2a;
  box-shadow: none;
}

#gameCanvas { outline-offset: -5px; }

.run-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  color: white;
  background: var(--ocean-ink);
}

.run-panel h2 { margin: 0; color: #d9f3ef; font-size: 13px; white-space: nowrap; }
.run-panel .hud { margin: 0; }
.run-panel .hud span {
  border: 0;
  border-radius: 6px;
  color: #d9efea;
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
  backdrop-filter: none;
}
.run-panel .hud strong { color: var(--signal); }

.control-grid {
  gap: 0;
  margin-top: 22px;
  border-top: 1px solid var(--page-line);
  border-bottom: 1px solid var(--page-line);
}

.control-grid section {
  min-width: 0;
  padding: 20px;
  border: 0;
  border-right: 1px solid var(--page-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.control-grid section:last-child { border-right: 0; }
.control-title { color: #0b6f85 !important; letter-spacing: .04em; text-transform: none; }
.quick-list, .control-grid p, .key-table dd { color: #274b57; }
.key-table div { border: 0; border-radius: 6px; background: #e5f3f0; }
.key-table dt { border-radius: 5px; background: var(--ocean-deep); }

.small-screen-note {
  display: none;
  margin: 14px 4px 2px;
  color: #315966;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.65;
}

.game-footer {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, calc(100% - 28px));
  margin: 26px auto 0;
  padding: 24px 4px 34px;
  color: #d7eeee;
}

.game-footer span { color: white; font-family: var(--display); font-weight: 950; }
.game-footer p { flex: 1; margin: 0; font-size: 12px; }
.game-footer a { color: var(--signal); font-size: 12px; font-weight: 900; }

body[data-game-state="playing"] .site-nav { opacity: .58; box-shadow: none; }
body[data-game-state="playing"] .site-nav:hover,
body[data-game-state="paused"] .site-nav { opacity: 1; }
body[data-game-state="playing"] .game-hero { opacity: .44; filter: saturate(.72); }
body[data-game-state="playing"] .control-grid,
body[data-game-state="playing"] .game-footer { opacity: .68; }

@keyframes dive-light {
  from { opacity: .4; transform: translateX(-3%); }
  to { opacity: .72; transform: translateX(3%); }
}

@keyframes dive-bubbles {
  from { transform: translateY(0); }
  to { transform: translateY(-180px); }
}

@media (max-width: 800px) {
  .game-hero { grid-template-columns: 1fr; gap: 26px; }
  .play-heading p { display: none; }
  .run-panel { grid-template-columns: 1fr; gap: 10px; }
  .control-grid { grid-template-columns: 1fr; }
  .control-grid section { border-right: 0; border-bottom: 1px solid var(--page-line); }
  .control-grid section:last-child { border-bottom: 0; }
  .small-screen-note { display: block; }
  .game-footer { flex-wrap: wrap; }
  .game-footer p { flex-basis: 100%; order: 3; }
}

@media (max-width: 520px) {
  .site-nav { top: 6px; width: calc(100% - 12px); min-height: 48px; padding: 6px; }
  .nav-brand { gap: 7px; font-size: 12px; }
  .brand-mark { width: 30px; height: 30px; }
  .nav-links a { padding: 8px 7px; font-size: 10px; }
  .game-page { width: calc(100% - 12px); padding-top: 70px; }
  .game-hero { padding: 24px 18px; border-radius: 12px; }
  .game-hero h1 { font-size: clamp(2.15rem, 12vw, 3.2rem); }
  .game-hero .lead { font-size: 14px; }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .play-surface { margin-top: 12px; padding: 6px; border-radius: 10px; }
  .play-heading { min-height: 50px; padding: 4px 6px 10px; }
  .viewport-shell { border-width: 3px; border-radius: 8px; }
  .quick-actions,
  .quick-actions.is-menu-visible,
  .quick-actions.is-pause-visible {
    top: 4px;
    right: 4px;
    bottom: auto;
    left: 4px;
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: flex-end;
    max-width: none;
    padding: 3px;
  }
  .quick-actions button { min-width: 34px; min-height: 22px; padding: 3px 4px; font-size: 7px; }
  .audio-slider { width: 38px; font-size: 6px; }
  .audio-slider input { width: 38px; }
  .mouse-sensitivity-slider { width: 44px; }
  .quality-select { width: 46px; }
  .quality-select span { display: none; }
  .quality-select select { min-height: 22px; padding: 2px; font-size: 7px; }
  .overlay {
    align-content: end;
    gap: 4px;
    padding: 42px 8px 6px;
  }
  .overlay > .section-label { display: none; }
  .overlay h2 { font-size: clamp(24px, 9vw, 34px); line-height: 1; }
  .overlay p:not(.section-label) { font-size: 9px; line-height: 1.35; }
  .overlay-actions { gap: 4px; }
  .overlay button { min-width: 120px; min-height: 30px; padding: 5px 12px; font-size: 10px; }
  .player-name-form { gap: 6px; width: min(360px, calc(100% - 12px)); padding: 10px; border-radius: 14px; }
  .player-name-form label { font-size: 11px; }
  .player-name-form input { min-height: 44px; font-size: 16px; }
  .overlay .player-name-help, .overlay .player-name-error { font-size: 9px; }
  .player-name-actions { gap: 6px; }
  .player-name-actions .overlay button,
  .player-name-actions button { min-width: 128px; min-height: 44px; }
  .asset-loading { gap: 3px; width: min(220px, 70vw); margin-top: 0; }
  .asset-loading__label { font-size: 8px; }
  .asset-loading__bar { height: 5px; }
  .run-panel { margin-top: 6px; padding: 10px; }
  .run-panel .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-grid section { padding: 18px 10px; }
  .key-table { grid-template-columns: 1fr; }
  .game-footer { width: calc(100% - 20px); }
}

@media (max-width: 340px) {
  body.has-mobile-controls .player-name-form:not([hidden]) {
    position: absolute;
    inset: 4px;
    z-index: 3;
    width: auto;
    margin: 0;
    padding: 6px 8px;
    gap: 3px;
    align-content: center;
    overflow-y: auto;
    border-radius: 10px;
    background: rgba(3, 58, 83, 0.96);
  }

  body.has-mobile-controls .player-name-form label {
    font-size: 10px;
    line-height: 1.1;
  }

  body.has-mobile-controls .player-name-form input {
    min-height: 44px;
    padding: 7px 10px;
  }

  body.has-mobile-controls .overlay .player-name-help,
  body.has-mobile-controls .overlay .player-name-error {
    font-size: 8px;
    line-height: 1.15;
  }

  body.has-mobile-controls .overlay .player-name-error {
    min-height: 1.15em;
  }

  body.has-mobile-controls .player-name-actions {
    gap: 4px;
  }

  body.has-mobile-controls .player-name-actions button {
    min-width: 44px;
    min-height: 44px;
    padding: 4px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before,
  body::after { animation: none; }
  .site-nav,
  .game-hero,
  .hero-primary { transition: none; }
}

/* 2026 interface pass: keep the game in the first viewport */
@media (min-width: 801px) {
  .site-nav,
  .game-page,
  .game-footer {
    width: min(1320px, calc(100% - 32px));
  }

  .site-nav {
    top: 10px;
    min-height: 52px;
    background: rgba(244, 251, 249, .84);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .72), 0 12px 32px rgba(1, 29, 42, .12);
    backdrop-filter: blur(12px) saturate(1.08);
  }

  .game-page {
    padding-top: 76px;
  }

  .game-hero {
    grid-template-columns: minmax(0, 1fr) minmax(310px, .62fr);
    gap: clamp(24px, 4vw, 58px);
    padding: 18px 28px;
    border: 1px solid rgba(207, 249, 255, .22);
    border-radius: 12px;
    background:
      linear-gradient(108deg, rgba(4, 48, 66, .88), rgba(8, 123, 150, .66)),
      url("./assets/textures/floor-caustics.webp") center / cover;
    box-shadow: 0 18px 52px rgba(1, 29, 42, .18);
    backdrop-filter: blur(8px) saturate(1.08);
  }

  .game-hero h1 {
    max-width: none;
    margin: 3px 0 6px;
    font-size: clamp(2rem, 3.4vw, 3.6rem);
    line-height: .94;
  }

  .game-hero .lead {
    margin: 0;
    font-size: clamp(13px, 1.15vw, 16px);
    line-height: 1.55;
  }

  .game-hero .section-label {
    font-size: 10px;
  }

  .hero-actions {
    gap: 10px 14px;
    margin-top: 10px;
    font-size: 11px;
  }

  .hero-primary {
    min-height: 34px;
    padding-inline: 16px;
  }







  .play-surface {
    margin-top: 12px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 12px;
    background: rgba(244, 251, 249, .82);
    box-shadow: 0 20px 60px rgba(1, 29, 42, .2);
    backdrop-filter: blur(12px) saturate(1.06);
  }

  .play-heading {
    min-height: 42px;
    padding: 0 8px 7px;
  }

  .viewport-shell {
    width: min(100%, calc((100svh - 370px) * 16 / 9));
    min-width: 760px;
    margin-inline: auto;
    aspect-ratio: 16 / 9;
    border-width: 4px;
    border-radius: 8px;
  }

  .run-panel {
    width: min(100%, calc((100svh - 370px) * 16 / 9));
    margin-inline: auto;
  }
}

@media (min-width: 801px) and (max-height: 820px) {
  .game-page { padding-top: 68px; }
  .game-hero { padding-block: 11px; }
  .game-hero h1 { font-size: clamp(1.8rem, 3vw, 2.8rem); }
  .game-hero .lead { line-height: 1.4; }
  .hero-actions { margin-top: 6px; }
  .play-surface { margin-top: 8px; }
  .play-heading { min-height: 34px; padding-bottom: 4px; }
  .viewport-shell,
  .run-panel { width: min(100%, calc((100svh - 315px) * 16 / 9)); }
}

@media (max-width: 800px) {
  body { background-attachment: scroll; }

  .site-nav,
  .game-page,
  .game-footer {
    width: min(100% - 20px, 720px);
  }

  .site-nav {
    background: rgba(244, 251, 249, .88);
    backdrop-filter: blur(10px);
  }

  .game-page { padding-top: 78px; }

  .game-hero {
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(150deg, rgba(4, 48, 66, .9), rgba(8, 123, 150, .7));
  }

  .game-hero h1 {
    margin-block: 4px 8px;
    font-size: clamp(1.9rem, 7.5vw, 3.2rem);
  }

  .game-hero .lead { line-height: 1.5; }
  .game-hero .hero-actions { margin-top: 10px; }

  .play-surface {
    padding: 6px;
    border-radius: 10px;
    background: rgba(244, 251, 249, .86);
    backdrop-filter: blur(10px);
  }

  .viewport-shell {
    border-width: 3px;
    border-radius: 7px;
  }
}

@media (max-width: 760px) {
  .dialogue-layer:not(.has-portrait) {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Mobile game controls */
#gameCanvas,
.mobile-controls,
.mobile-controls button,
.weapon-dock,
.weapon-dock button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#gameCanvas,
.mobile-controls,
.mobile-controls button,
.weapon-dock,
.weapon-dock button {
  touch-action: none;
}

body.has-mobile-controls .game-layer {
  --mobile-safe-top: max(8px, env(safe-area-inset-top));
  --mobile-safe-left: max(8px, env(safe-area-inset-left));
  --mobile-safe-right: max(8px, env(safe-area-inset-right));
  --mobile-safe-bottom: max(8px, env(safe-area-inset-bottom));
  --mobile-stick-size: clamp(116px, 31vw, 138px);
  --mobile-action-size: clamp(44px, 11.5vw, 48px);
  --mobile-fire-size: clamp(60px, 16vw, 66px);
  --mobile-cluster-size: clamp(124px, 34vw, 140px);
}

.mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  overflow: hidden;
  pointer-events: none;
}

.mobile-controls.is-visible {
  display: block;
}

.mobile-joystick,
.mobile-action-cluster {
  visibility: hidden;
  opacity: 0;
  transition: opacity 140ms ease-out;
}

.mobile-controls.is-input-active .mobile-action-cluster:not(.is-combat-disabled) {
  visibility: visible;
  opacity: 1;
}

.mobile-controls button {
  margin: 0;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, .58);
  color: rgba(255, 255, 255, .94);
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 10px rgba(0, 12, 20, .18);
  -webkit-backdrop-filter: blur(2px) saturate(115%);
  backdrop-filter: blur(2px) saturate(115%);
  appearance: none;
  cursor: default;
}

.mobile-controls button:focus-visible {
  outline: 3px solid var(--page-focus);
  outline-offset: 2px;
}

.mobile-menu-button {
  position: absolute;
  top: var(--mobile-safe-top);
  right: var(--mobile-safe-right);
  z-index: 2;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  pointer-events: auto;
}

.mobile-control-icon--menu {
  width: 58%;
  height: 58%;
  stroke-width: 2;
}

.mobile-joystick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--mobile-stick-size);
  height: var(--mobile-stick-size);
  border: 0 !important;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.mobile-controls.is-input-active .mobile-joystick.is-visible {
  visibility: visible;
  opacity: 1;
}

.mobile-joystick__base {
  position: absolute;
  inset: 3px;
  border: 1.5px solid rgba(255, 255, 255, .48);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 8px rgba(255, 255, 255, .1), 0 2px 10px rgba(0, 12, 20, .14);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.mobile-joystick__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42%;
  height: 42%;
  border: 1.5px solid rgba(255, 255, 255, .76);
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  box-shadow: 0 2px 8px rgba(0, 12, 20, .2), inset 0 1px 3px rgba(255, 255, 255, .2);
  transform: translate(-50%, -50%);
  will-change: transform;
}

.mobile-joystick.is-active .mobile-joystick__base {
  border-color: rgba(255, 255, 255, .92);
  background: rgba(255, 255, 255, .16);
}

.mobile-action-cluster {
  position: absolute;
  right: calc(var(--mobile-safe-right) + 15px);
  bottom: calc(var(--mobile-safe-bottom) + 15px);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  place-items: center;
  width: var(--mobile-cluster-size);
  height: var(--mobile-cluster-size);
  pointer-events: none;
}

.mobile-action {
  width: var(--mobile-action-size);
  height: var(--mobile-action-size);
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  pointer-events: auto;
}

.mobile-action--crouch { grid-area: 1 / 1; }
.mobile-action--jump { grid-area: 1 / 3; }
.mobile-action--fire { grid-area: 2 / 2; }
.mobile-action--prone { grid-area: 3 / 1; }
.mobile-action--dash { grid-area: 3 / 3; }

.mobile-control-icon {
  display: block;
  width: 60%;
  height: 60%;
  margin: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.mobile-control-icon--fire {
  width: 58%;
  height: 58%;
  stroke-width: 1.6;
}

.mobile-action--fire {
  width: var(--mobile-fire-size);
  height: var(--mobile-fire-size);
  border-width: 2px !important;
  border-color: rgba(255, 255, 255, .78) !important;
  background: rgba(255, 255, 255, .18);
  color: #fff !important;
  box-shadow: inset 0 1px 8px rgba(255, 255, 255, .18), 0 3px 12px rgba(0, 12, 20, .22);
}

.mobile-action.is-active,
.mobile-action[aria-pressed="true"] {
  border-color: rgba(255, 255, 255, .94);
  background: rgba(255, 255, 255, .3);
  box-shadow: inset 0 1px 8px rgba(255, 255, 255, .22), 0 3px 12px rgba(0, 12, 20, .26);
}

.mobile-action--fire.is-active {
  background: rgba(255, 255, 255, .36);
  transform: scale(.94);
}

.mobile-narrow-hint {
  position: absolute;
  z-index: 2;
  display: none;
  align-items: center;
  min-height: 16px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 5px;
  color: rgba(255, 255, 255, .92);
  background: rgba(0, 22, 34, .48);
  font: 800 7px/1 var(--body);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  pointer-events: none;
}

body.has-mobile-controls .weapon-dock {
  right: auto;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 38px);
  left: calc(50% - 6px);
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
}

body.has-mobile-controls .weapon-dock.is-hidden {
  display: none;
}

body.has-mobile-controls .weapon-slot {
  grid-template-columns: 1fr;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 3px;
  gap: 0;
  border-radius: 9px;
  font-size: 9px;
}

body.has-mobile-controls .weapon-slot kbd {
  display: none;
}

body.has-mobile-controls .weapon-slot b {
  font-size: 8px;
}

body.has-mobile-controls .player-health-meter {
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(112px, 30%);
}

body.has-mobile-controls .charge-meter {
  right: calc(var(--mobile-safe-right) + 15px);
  bottom: calc(var(--mobile-safe-bottom) + 15px + var(--mobile-cluster-size) + 8px);
  left: auto;
  width: min(130px, var(--mobile-cluster-size));
}

body.has-mobile-controls .compass {
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 76px);
  width: min(150px, 38%);
}

html.is-theater-mode,
body.is-theater-mode {
  overflow: hidden;
  overscroll-behavior: none;
}

body.is-theater-mode .play-surface {
  backdrop-filter: none;
}

.viewport-shell.is-theater-mode {
  position: fixed;
  z-index: 100;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.viewport-shell.is-theater-mode::before {
  display: none;
}

.viewport-shell.is-theater-mode .game-layer,
.viewport-shell.is-theater-mode .ending-layer,
.viewport-shell.is-theater-mode #gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .game-layer {
  --mobile-safe-left: max(14px, env(safe-area-inset-left));
  --mobile-safe-right: max(14px, env(safe-area-inset-right));
  --mobile-safe-bottom: max(12px, env(safe-area-inset-bottom));
  --mobile-stick-size: clamp(150px, 24vmin, 180px);
  --mobile-action-size: clamp(52px, 9vmin, 62px);
  --mobile-fire-size: clamp(78px, 13vmin, 88px);
  --mobile-cluster-size: clamp(170px, 29vmin, 204px);
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .mobile-menu-button {
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-card {
  display: none !important;
}

@media (orientation: portrait) {
  body.has-mobile-controls .player-health-meter {
    top: 52px;
    bottom: auto;
    left: 8px;
    transform: none;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  body.has-mobile-controls:not(.is-theater-mode) .ingame-hud {
    width: auto;
    max-width: 184px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .ingame-hud span {
    min-width: 54px;
    padding: 4px 6px;
    font-size: 7px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .ingame-hud strong {
    font-size: 10px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-health {
    top: 8px;
    right: auto;
    left: 70px;
    width: 132px;
    padding: 3px 6px;
    gap: 2px;
    transform: none;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-health span {
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-health div {
    height: 5px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-card {
    top: 58px;
    right: 8px;
    left: auto;
    gap: 3px;
    width: 134px;
    max-width: 134px;
    padding: 1px 3px 1px 1px;
    overflow: hidden;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-card img {
    width: 20px;
    height: 20px;
    border-width: 1px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-card div {
    min-width: 0;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-card p,
  body.has-mobile-controls:not(.is-theater-mode) .boss-card strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-card p {
    margin-bottom: 1px;
    font-size: 6px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-card strong {
    font-size: 8px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .charge-meter {
    bottom: calc(var(--mobile-safe-bottom) + 15px + var(--mobile-cluster-size) + 1px);
  }

  body.has-mobile-controls:not(.is-theater-mode) .charge-meter__track {
    height: 7px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .mechanic-hud {
    top: 42px;
    right: auto;
    left: 8px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1px 4px;
    width: min(184px, calc(56% - 12px));
    padding: 3px 5px;
    border-radius: 8px;
    font-size: 7px;
    line-height: 1.05;
    transform: none;
  }

  body.has-mobile-controls:not(.is-theater-mode) .mechanic-hud strong {
    grid-row: auto;
    grid-column: auto;
    overflow: hidden;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls:not(.is-theater-mode) .mechanic-hud small {
    grid-column: 2 / -1;
    min-height: 0;
    overflow: hidden;
    font-size: 6px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls:not(.is-theater-mode) .legend-blessings {
    top: 42px;
    right: auto;
    left: 8px;
    width: min(184px, calc(56% - 12px));
    min-width: 0;
    padding: 3px 5px;
    border-radius: 8px;
    font-size: 7px;
    line-height: 1.05;
    letter-spacing: .04em;
    transform: none;
  }

  body.has-mobile-controls:not(.is-theater-mode) .legend-blessings small {
    margin-top: 1px;
    overflow: hidden;
    font-size: 6px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls:not(.is-theater-mode) .seven-god-bars {
    top: 65px;
    right: auto;
    left: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px 4px;
    width: min(184px, calc(56% - 12px));
  }

  body.has-mobile-controls:not(.is-theater-mode) .seven-god-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 2px;
    align-items: center;
    font-size: 6.5px;
    line-height: 1;
    text-align: left;
  }

  body.has-mobile-controls:not(.is-theater-mode) .seven-god-bar__track {
    height: 4px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .boss-adds-hud {
    top: 73px;
    right: auto;
    left: calc(max(8px, env(safe-area-inset-left)) + clamp(78px, 21vw, 92px) + 12px);
    width: 94px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .fukurokuju-clone-hud {
    gap: 1px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .fukurokuju-clone-hp {
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: center;
    gap: 2px;
    min-width: 0;
    font-size: 7px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .fukurokuju-clone-hp__track {
    height: 4px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .player-health-meter {
    top: 78px;
    left: 8px;
    width: 86px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .multi-boss-hud:not([hidden]) ~ .player-health-meter {
    top: 96px;
  }

  body.has-mobile-controls:not(.is-theater-mode) .weapon-dock {
    bottom: 50px;
    left: calc(max(8px, env(safe-area-inset-left)) + clamp(78px, 21vw, 92px) + 12px);
    transform: none;
  }

  body.has-mobile-controls:not(.is-theater-mode) .compass {
    right: auto;
    bottom: 15px;
    left: calc(max(8px, env(safe-area-inset-left)) + clamp(78px, 21vw, 92px) + 12px);
    width: 94px;
    transform: none;
  }
}

@media (min-width: 341px) and (max-width: 720px) and (orientation: portrait) {
  body.has-mobile-controls:not(.is-theater-mode) .boss-card {
    display: none !important;
  }

  body.has-mobile-controls:not(.is-theater-mode) .charge-meter {
    right: auto;
    left: calc(var(--mobile-safe-left) + 55px);
  }
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-health {
  top: max(14px, env(safe-area-inset-top));
  right: auto;
  left: calc(max(14px, env(safe-area-inset-left)) + 86px);
  width: 240px;
  transform: none;
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .ingame-hud {
  width: auto;
  max-width: 184px;
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .legend-blessings {
  top: max(12px, env(safe-area-inset-top));
  left: calc(50% + 65px);
  min-width: 0;
  width: min(278px, 34vw);
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .seven-god-bars {
  top: calc(max(12px, env(safe-area-inset-top)) + 60px);
  right: max(14px, env(safe-area-inset-right));
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  gap: 3px 8px;
  width: min(300px, 42vw);
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .seven-god-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 4px;
  align-items: center;
  text-align: left;
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .seven-god-bar__track {
  height: 5px;
}

body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .compass {
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 88px);
}

@media (max-width: 340px) and (orientation: portrait) {
  .mobile-controls.is-narrow-embedded .mobile-joystick,
  .mobile-controls.is-narrow-embedded .mobile-action-cluster {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .mobile-controls.is-narrow-embedded .mobile-action {
    pointer-events: none;
  }

  .mobile-controls.is-visible.is-narrow-embedded .mobile-narrow-hint {
    top: max(34px, env(safe-area-inset-top));
    right: calc(var(--mobile-safe-right) + 50px);
    display: flex;
  }

  .mobile-controls.is-narrow-embedded .mobile-menu-button {
    top: max(4px, env(safe-area-inset-top));
    right: var(--mobile-safe-right);
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .boss-card {
    display: none !important;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .boss-health {
    top: 8px;
    right: auto;
    left: 70px;
    width: 132px;
    transform: none;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .charge-meter {
    top: 56px;
    right: var(--mobile-safe-right);
    bottom: auto;
    left: auto;
    width: 100px;
    height: 7px;
    transition: none;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .legend-blessings,
  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .mechanic-hud {
    width: min(146px, calc(54% - 8px));
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .seven-god-bars {
    width: 130px;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .seven-god-bar {
    grid-template-columns: minmax(0, 1fr) 24px;
    gap: 1px;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .weapon-dock {
    right: var(--mobile-safe-right);
    bottom: var(--mobile-safe-bottom);
    left: auto;
    flex-direction: row;
    gap: 1px;
    width: 134px;
    transform: none;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .weapon-slot {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    overflow: hidden;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .compass {
    right: auto;
    bottom: var(--mobile-safe-bottom);
    left: var(--mobile-safe-left);
    width: 120px;
    transform: none;
  }

  body.has-mobile-controls.is-mobile-narrow-embedded:not(.is-theater-mode) .player-health-meter {
    top: auto;
    bottom: calc(var(--mobile-safe-bottom) + 34px);
    left: var(--mobile-safe-left);
    width: 100px;
    transform: none;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-health {
    top: max(8px, env(safe-area-inset-top));
    left: calc(max(8px, env(safe-area-inset-left)) + 62px);
    width: 132px;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-card {
    top: calc(max(8px, env(safe-area-inset-top)) + 62px);
    right: max(14px, env(safe-area-inset-right));
    left: auto;
    gap: 3px;
    width: 134px;
    max-width: 134px;
    padding: 1px 3px 1px 1px;
    overflow: hidden;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-card img {
    width: 20px;
    height: 20px;
    border-width: 1px;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-card p,
  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .boss-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .legend-blessings {
    top: calc(max(8px, env(safe-area-inset-top)) + 62px);
    right: auto;
    left: max(8px, env(safe-area-inset-left));
    width: 146px;
    min-width: 0;
    padding: 3px 5px;
    border-radius: 8px;
    font-size: 7px;
    line-height: 1.05;
    letter-spacing: .04em;
    transform: none;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .legend-blessings small {
    margin-top: 1px;
    overflow: hidden;
    font-size: 6px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .seven-god-bars {
    top: calc(max(8px, env(safe-area-inset-top)) + 88px);
    right: auto;
    left: max(8px, env(safe-area-inset-left));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px 4px;
    width: 146px;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .seven-god-bar {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 2px;
    font-size: 6.5px;
    line-height: 1;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .seven-god-bar__track {
    height: 4px;
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .weapon-dock {
    top: calc(max(8px, env(safe-area-inset-top)) + 142px);
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  body.has-mobile-controls .viewport-shell:is(:fullscreen, .is-theater-mode) .compass {
    right: auto;
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 192px);
    left: max(14px, env(safe-area-inset-left));
    width: 120px;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-joystick,
  .mobile-action-cluster {
    transition: none;
  }
}

/* Game UI: a compact entry, readable menus, and small HUD groups around the view. */
body { background: var(--rl-abyss); }
body::before, body::after { display: none; }
body[data-game-state] .game-hero { opacity: 1; filter: none; }
.game-page { padding-top: 24px; }
.game-hero { display: block; padding: 0 0 20px; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; }
.hero-copy { max-width: 100%; }
.game-hero h1 { margin: 6px 0 10px; font: 900 clamp(1.65rem, 3.1vw, 2.75rem)/1.25 var(--rl-font-display); letter-spacing: -.025em; }
.game-hero .section-label { font-size: 12px; }
.game-hero .lead { max-width: 56rem; font-size: 15px; font-weight: 500; line-height: 1.7; }
.game-hero .hero-actions { flex-direction: row; align-items: center; margin-top: 12px; font-size: 12px; }
.hero-primary { min-height: 44px; border-radius: var(--rl-radius-small); }
.play-surface { margin-top: 0; padding: 8px; border: 1px solid var(--rl-boundary); border-radius: 8px; background: var(--rl-abyss); box-shadow: none; backdrop-filter: none; }
.play-heading { min-height: 40px; color: var(--rl-hud-text); }
.play-heading strong { color: inherit; font-size: 14px; }
.play-heading p { color: #d2e8ed; font-size: 12px; }
.play-heading kbd { color: #d2e8ed; border-color: var(--rl-boundary); background: transparent; }
.viewport-shell { border-color: var(--rl-boundary); background: var(--rl-abyss); box-shadow: none; }
.control-grid { gap: 24px; }
.control-grid > section { border-radius: 0; box-shadow: none; }

#startOverlay { align-content: start; justify-items: center; place-content: start center; gap: 12px; overflow: auto; overscroll-behavior: contain; padding: 24px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); color: var(--rl-hud-text); background: #032d4af5; backdrop-filter: none; scrollbar-color: #92bac3 #032d4a; }
#startOverlay > * { flex-shrink: 0; max-width: 100%; }
#startOverlay h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.25; text-shadow: none; }
#startOverlay p:not(.section-label) { color: #deedf0; font-size: 14px; font-weight: 500; line-height: 1.65; }
#startOverlay .section-label { display: block; margin: 0; color: var(--rl-sun); font-size: 12px; }
#startOverlay button, #startOverlay select { min-width: 44px; min-height: 44px; padding: 10px 16px; border: 1px solid #92bac3; border-radius: 6px; color: #f7fcfb; background: #064f69; box-shadow: none; font-size: 14px; line-height: 1.4; }
#startOverlay #startButton, #startOverlay #playerNameStartButton { min-width: 180px; color: var(--rl-ink); border-color: var(--rl-sun); background: var(--rl-sun); }
#startOverlay button:focus-visible, #startOverlay select:focus-visible, #startOverlay input:focus-visible { outline: 3px solid var(--rl-sun); outline-offset: 3px; }
#startOverlay .quick-actions { position: static; display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; gap: 16px; width: min(760px, 100%); max-width: 100%; margin-top: 6px; padding: 16px 0 0; border: 0; border-top: 1px solid var(--rl-boundary); border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; text-align: left; }
#startOverlay .quick-actions h3 { grid-column: 1 / -1; margin: 0; font-size: 14px; color: #deedf0; }
.setting-group { display: flex; flex-direction: column; justify-content: end; align-items: stretch; gap: 8px; min-width: 0; }
#startOverlay .setting-group button { width: 100%; }
#startOverlay .audio-slider, #startOverlay .quality-select { width: 100%; color: #deedf0; font-size: 12px; line-height: 1.4; text-align: left; }
#startOverlay input[type="range"] { width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--rl-sun); }
#startOverlay .quality-select span { display: block; }
#startOverlay .quality-select select { width: 100%; padding-inline: 8px; }
#startOverlay .player-name-form { position: static; width: min(460px, 100%); padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
#startOverlay:has(.player-name-form:not([hidden])) .quick-actions { display: none !important; }
#startOverlay .overlay-details { width: min(620px, 100%); gap: 8px; }
#startOverlay .overlay-details span { border: 0; border-bottom: 1px solid var(--rl-boundary); border-radius: 0; background: transparent; color: #deedf0; font-size: 12px; }
#startOverlay .overlay-details strong { color: #f7fcfb; font-size: 20px; font-variant-numeric: tabular-nums; }
#startOverlay .asset-loading { width: min(360px, 100%); }
#startOverlay .asset-loading__label, #startOverlay .asset-loading__status { color: #deedf0; font-size: 12px; }

#gameLayer { --hud-top: max(12px, env(safe-area-inset-top)); --hud-left: max(12px, env(safe-area-inset-left)); --hud-right: max(12px, env(safe-area-inset-right)); --hud-bottom: max(12px, env(safe-area-inset-bottom)); }
#gameLayer .ingame-hud { top: var(--hud-top); left: var(--hud-left); width: auto; max-width: 190px; gap: 4px; }
#gameLayer .ingame-hud span { min-width: 70px; padding: 5px 7px; border: 1px solid #648992; border-radius: 4px; color: #deedf0; background: var(--rl-hud-surface); box-shadow: none; font-size: 11px; line-height: 1.3; backdrop-filter: none; }
#gameLayer .ingame-hud strong { color: var(--rl-hud-text); font-size: 16px; text-shadow: none; font-variant-numeric: tabular-nums; }
#playerHealthMeter { top: auto; left: 50%; bottom: var(--hud-bottom); width: 200px; height: auto; padding: 6px 10px; border: 1px solid var(--rl-boundary); border-radius: 4px; background: var(--rl-hud-surface); transform: translateX(-50%); }
#playerHealthMeter span { position: static; display: block; margin: 0 0 4px; text-align: right; font-size: 14px; text-shadow: none; }
#screenHealthValue { display: inline-block; min-width: 3ch; font-size: 18px; font-variant-numeric: tabular-nums; }
#playerHealthMeter .player-health-meter__track { height: 10px; }
#weaponDock { top: auto; width: max-content; right: auto; bottom: var(--hud-bottom); left: var(--hud-left); gap: 4px; transform: none; }
#weaponDock:not(.is-hidden) { display: flex; }
#weaponDock .weapon-slot { grid-template-columns: auto auto 3ch; gap: 5px; min-width: 84px; min-height: 44px; padding: 6px; border: 1px solid var(--rl-boundary); border-radius: 4px; color: #f7fcfb; background: var(--rl-hud-surface); box-shadow: none; font-size: 13px; }
#weaponDock .weapon-slot kbd { width: 22px; height: 24px; border: 0; border-radius: 2px; color: #deedf0; background: #064f69; box-shadow: none; font-size: 11px; }
#weaponDock .weapon-slot b { font-size: 13px; font-variant-numeric: tabular-nums; }
#weaponDock .weapon-slot.is-active { border-color: var(--rl-sun); color: var(--rl-ink); background: var(--rl-sun); }
#weaponDock .weapon-slot.is-empty { opacity: .75; }
#chargeMeter { height: 10px; top: auto; bottom: calc(var(--hud-bottom) + 52px); left: var(--hud-left); width: 260px; }
#chargeMeter .charge-meter__track { height: 10px; }
#compass { right: auto; bottom: calc(var(--hud-bottom) + 60px); left: 50%; width: 220px; height: 24px; border-radius: 4px; background: var(--rl-hud-surface); box-shadow: none; backdrop-filter: none; transform: translateX(-50%); }
#bossHealth { top: var(--hud-top); right: auto; left: 50%; width: min(300px, 38%); padding: 7px 10px; border: 1px solid #92bac3; border-radius: 4px; background: var(--rl-hud-surface); box-shadow: none; backdrop-filter: none; transform: translateX(-50%); }
#bossHealth span { overflow: visible; font-size: 13px; line-height: 1.35; text-overflow: clip; white-space: normal; text-shadow: none; }
#bossHealth div { height: 8px; }
#bossCard { top: var(--hud-top); right: var(--hud-right); left: auto; max-width: 170px; padding: 5px; border-radius: 4px; background: var(--rl-hud-surface); box-shadow: none; }
#bossCard img { width: 38px; height: 38px; border-radius: 2px; }
#bossCard p { font-size: 11px; color: #deedf0; }
#bossCard strong { color: #f7fcfb; font-size: 12px; }
#mechanicHud { top: calc(var(--hud-top) + 64px); left: 50%; right: auto; width: min(360px, 43%); gap: 3px 6px; padding: 7px 9px; border-radius: 4px; background: var(--rl-hud-surface); box-shadow: none; font-size: 12px; line-height: 1.4; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
#mechanicHud strong { grid-column: auto; grid-row: auto; overflow: visible; font-size: 13px; white-space: normal; }
#mechanicHud small { grid-column: 1 / -1; overflow: visible; font-size: 12px; white-space: normal; }
#legendBlessings { top: calc(var(--hud-top) + 64px); right: auto; left: var(--hud-left); width: min(240px, 32%); min-width: 0; padding: 7px 9px; border-radius: 4px; background: var(--rl-hud-surface); font-size: 13px; line-height: 1.4; letter-spacing: .04em; transform: none; }
#legendBlessings small { overflow: visible; font-size: 12px; line-height: 1.4; white-space: normal; }
#sevenGodBars { top: calc(var(--hud-top) + 62px); right: var(--hud-right); left: auto; width: min(260px, 32%); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 8px; padding: 5px; border-radius: 4px; background: var(--rl-hud-surface); }
#sevenGodBars .seven-god-bar { display: grid; grid-template-columns: 1fr; gap: 0; font-size: 12px; line-height: 1.4; text-align: left; text-shadow: none; }
#sevenGodBars .seven-god-bar__label { overflow: visible; white-space: normal; text-overflow: clip; }
#sevenGodBars .seven-god-bar__track { height: 3px; }
#sevenGodBars .seven-god-bar.is-locked .seven-god-bar__label::after { font-size: 10px; }
#bossAddsHud { top: calc(var(--hud-top) + 68px); right: var(--hud-right); left: auto; font-size: 12px; }

#dialogueLayer { width: min(90%, 860px); min-height: 0; max-height: calc(100% - 32px); gap: 16px; padding: 16px; border-radius: 6px; background: #032d4af5; box-shadow: none; overflow: auto; }
#dialogueLayer.is-blocking { grid-template-columns: 80px minmax(0, 1fr); bottom: var(--hud-bottom); }
body:not(.has-mobile-controls) #dialogueLayer.is-blocking { bottom: calc(var(--hud-bottom) + 64px); max-height: calc(100% - 96px); }
#dialogueLayer .dialogue-layer__portrait-frame { width: 80px; height: 100px; border: 1px solid var(--rl-boundary); border-radius: 3px; }
#dialogueLayer #dialogueSpeaker { margin-bottom: 6px; font-size: 16px; line-height: 1.4; letter-spacing: .03em; }
#dialogueLayer #dialogueBody { min-height: 0; font-size: 20px; font-weight: 500; line-height: 1.65; }
#dialogueLayer #dialogueContinuation { font-size: 12px; line-height: 1.4; }
#dialogueLayer:is(.is-combat-bark, .is-rescue-cut-in, .is-combat-resolution) { bottom: calc(var(--hud-bottom) + 106px); width: min(56%, 640px); grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 8px; }
#dialogueLayer:is(.is-combat-bark, .is-rescue-cut-in, .is-combat-resolution) .dialogue-layer__portrait-frame { width: 44px; height: 44px; }
#dialogueLayer:is(.is-combat-bark, .is-rescue-cut-in, .is-combat-resolution) #dialogueSpeaker { margin-bottom: 2px; font-size: 12px; }
#dialogueLayer:is(.is-combat-bark, .is-rescue-cut-in, .is-combat-resolution) #dialogueBody { font-size: 14px; line-height: 1.5; }
#bossIntro { top: max(calc(var(--hud-top) + 64px), 15%); max-width: calc(100% - 32px); border: 1px solid #ffffffb8; border-radius: 10px; color: #173c42; background: #f4faf5e6; box-shadow: 0 8px 24px #03263824; }
#bossIntro span { color: #285765; }
#stageBanner { border-radius: 4px; background: var(--rl-hud-surface); box-shadow: none; }
#mobileControls button { border-color: #c0dae0; background: #032d4acc; box-shadow: none; backdrop-filter: none; }
#mobileControls .mobile-action--fire { background: #064f69e8; }
#mobileControls .mobile-action.is-active, #mobileControls .mobile-action[aria-pressed="true"] { border-color: var(--rl-sun); color: var(--rl-ink); background: var(--rl-sun); }
#mobileJoystick .mobile-joystick__base { border-color: #c0dae0; background: #032d4aaa; backdrop-filter: none; }
#mobileJoystick .mobile-joystick__knob { background: #dff3efcc; }

body.has-mobile-controls #bossCard { display: none !important; }
body.has-mobile-controls #weaponDock { left: 50%; bottom: var(--hud-bottom); transform: translateX(-50%); }
body.has-mobile-controls #weaponDock .weapon-slot { grid-template-columns: 1fr; min-width: 44px; padding: 3px 6px; gap: 0; }
body.has-mobile-controls #playerHealthMeter { top: auto; bottom: calc(var(--hud-bottom) + 52px); left: 50%; width: 140px; transform: translateX(-50%); }
body.has-mobile-controls #compass { bottom: calc(var(--hud-bottom) + 110px); width: 140px; }
body.has-mobile-controls #chargeMeter { right: calc(var(--mobile-safe-right) + 15px); bottom: calc(var(--mobile-safe-bottom) + 23px + var(--mobile-cluster-size)); left: auto; width: var(--mobile-cluster-size); }

@media (max-width: 800px) {
  .game-page { padding-top: 20px; }
  .game-hero { padding: 0 0 16px; }
  .play-heading p { display: none; }
  #startOverlay { padding-block: 16px; gap: 10px; }
  #startOverlay .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #dialogueLayer #dialogueBody { font-size: 16px; }
  #dialogueLayer.is-blocking { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 12px; }
  #dialogueLayer .dialogue-layer__portrait-frame { width: 64px; height: 80px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  /* Embedded portrait keeps enough vertical space for readable HUD and touch targets. */
  .viewport-shell:not(:fullscreen):not(.is-theater-mode) { aspect-ratio: auto; }
  .viewport-shell:not(:fullscreen):not(.is-theater-mode)::before { padding-top: calc(166.6667% + env(safe-area-inset-top) + env(safe-area-inset-bottom)); }
  #gameLayer { --hud-top: max(8px, env(safe-area-inset-top)); --hud-left: max(8px, env(safe-area-inset-left)); --hud-right: max(8px, env(safe-area-inset-right)); --hud-bottom: max(8px, env(safe-area-inset-bottom)); }
  #gameLayer .ingame-hud { max-width: calc(100% - 62px); flex-wrap: nowrap; }
  #gameLayer .ingame-hud span { min-width: 64px; padding: 4px 6px; }
  #gameLayer:has(#bossHealth.is-visible) .ingame-hud { max-width: 88px; flex-direction: column; }
  #gameLayer .ingame-hud strong { font-size: 14px; }
  #bossHealth { top: var(--hud-top); left: calc(var(--hud-left) + 96px); width: calc(100% - var(--hud-left) - var(--hud-right) - 148px); max-width: none; padding: 6px; transform: none; }
  #bossHealth span { font-size: 12px; }
  #mechanicHud { top: calc(var(--hud-top) + 114px); left: var(--hud-left); width: calc(100% - var(--hud-left) - var(--hud-right)); transform: none; }
  #legendBlessings { top: calc(var(--hud-top) + 62px); left: var(--hud-left); width: calc(100% - var(--hud-left) - var(--hud-right)); transform: none; }
  #sevenGodBars { top: calc(var(--hud-top) + 142px); right: var(--hud-right); width: calc(100% - var(--hud-left) - var(--hud-right)); gap: 3px 6px; padding: 5px; }
  #bossAddsHud { top: calc(var(--hud-top) + 114px); right: var(--hud-right); width: 150px; }
  #bossCard { display: none !important; }
  #dialogueLayer { width: calc(100% - 16px); }
  #dialogueLayer:is(.is-combat-bark, .is-rescue-cut-in, .is-combat-resolution) { bottom: calc(var(--hud-bottom) + 150px); width: calc(100% - 24px); }
  body.has-mobile-controls #playerHealthMeter { left: var(--hud-left); bottom: calc(var(--hud-bottom) + 56px); width: 120px; transform: none; }
  body.has-mobile-controls #weaponDock { left: var(--hud-left); bottom: var(--hud-bottom); transform: none; }
  body.has-mobile-controls #compass { left: var(--hud-left); bottom: calc(var(--hud-bottom) + 114px); width: 120px; transform: none; }
  body.has-mobile-controls #chargeMeter { top: auto; right: var(--hud-right); bottom: calc(var(--mobile-safe-bottom) + 23px + var(--mobile-cluster-size)); width: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  #dialogueLayer, #dialogueContinuation, #bossIntro, #stageBanner, #mobileControls * { animation: none; transition: none; }
}

@media (max-width: 340px) and (orientation: portrait) {
  #mobileControls.is-narrow-embedded #mobileNarrowHint { top: auto; right: var(--hud-right); bottom: calc(var(--hud-bottom) + 12px); width: 116px; min-height: 24px; font-size: 12px; line-height: 1.4; }
}

@media (max-width: 340px) and (orientation: portrait) {
  .viewport-shell:is(:fullscreen, .is-theater-mode) #weaponDock { flex-direction: column; }
  .viewport-shell:is(:fullscreen, .is-theater-mode) #playerHealthMeter { width: 90px; bottom: calc(var(--hud-bottom) + 152px); }
  .viewport-shell:is(:fullscreen, .is-theater-mode) #compass { width: 90px; bottom: calc(var(--hud-bottom) + 210px); }
}

.control-grid { color: var(--rl-ink); background: var(--rl-paper); border-radius: 6px; }
.control-grid .control-title { color: var(--rl-deep) !important; }
.small-screen-note { color: #deedf0; }
.run-panel .hud strong { font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#creditsOverlay { background: var(--rl-paper); }
#creditsRoll h2, #creditsRoll .credits-and-you, #creditsRoll .credits-end { color: var(--rl-deep); }
#creditsRoll p { color: var(--rl-muted); }
#creditsRoll .credits-track { border: 0; border-bottom: 1px solid var(--rl-divider); border-radius: 0; background: transparent; }
.credits-controls-hint { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); padding: 6px 10px; background: #fffaf1f5; border: 1px solid var(--rl-boundary); border-radius: 4px; }
.credits-controls-hint small { color: var(--rl-ink); font-size: 12px; }
.credits-touch-hint { display: none; }
@media (pointer: coarse) {
  .credits-touch-hint { display: block; }
  .credits-skip { display: none; }
}

#gameLayer .ingame-hud span:first-child { width: 110px; flex-shrink: 0; }
#mechanicTimer { grid-column: 1 / -1; min-height: 1.4em; text-align: center; }
#startOverlay .overlay-details strong { overflow-wrap: anywhere; }
@media (max-width: 600px) and (orientation: portrait) {
  #gameLayer .ingame-hud span:first-child { width: 88px; }
  #gameLayer .ingame-hud strong { font-size: 13px; }
}

#dialogueLayer:not(.has-portrait) { grid-template-columns: minmax(0, 1fr); }
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .viewport-shell:not(:fullscreen):not(.is-theater-mode) { aspect-ratio: auto; height: calc(100svh + 10px); }
  .viewport-shell:not(:fullscreen):not(.is-theater-mode)::before { display: none; }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 400px) {
  #legendBlessings { width: min(220px, 26%); }
  #sevenGodBars { top: calc(var(--hud-top) + 58px); width: min(500px, 60%); grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Quiet peripheral instruments; geometry and input targets stay unchanged. */
#gameLayer { --rl-hud-surface: #032638b8; --rl-sun: #d9e9cf; }
#gameLayer .overlay-details { color: #e2efec; }
#gameLayer .ingame-hud span, #playerHealthMeter, #bossHealth, #bossCard, #mechanicHud, #legendBlessings, #sevenGodBars { border: 0; border-radius: 2px; background: linear-gradient(100deg, #031c2ebd, #031c2e8c); }
#gameLayer .ingame-hud strong, #gameLayer .ingame-hud span { text-shadow: 0 1px 2px #021522; }
#gameLayer .ingame-hud strong { font-weight: 600; }
#weaponDock .weapon-slot { border: 0; border-bottom: 2px solid transparent; border-radius: 2px; background: #031c2ebd; font-weight: 500; }
#weaponDock .weapon-slot kbd { background: transparent; color: #dbe9e7; }
#weaponDock .weapon-slot.is-active { color: #f0f4df; background: #133e4fc9; border-bottom-color: #d4e9d9; }
#weaponDock .weapon-slot.is-active kbd { color: #f0f4df; }
#playerHealthMeter span { font-weight: 600; }
#compass { background: linear-gradient(90deg, transparent, #031c2ebd 25% 75%, transparent); }
#bossHealth span, #mechanicHud, #legendBlessings, #sevenGodBars { color: #edf5ee; text-shadow: 0 1px 2px #031523; }
#dialogueLayer { background: linear-gradient(100deg, #062635f5, #0b3143ef); border: 0; border-radius: 3px; }
#dialogueLayer .dialogue-layer__portrait-frame { border: 0; }
#mobileControls button { border-color: #d1e6e266; background: #072c3bad; }
#mobileControls .mobile-action--fire { background: #184352b8; }
#mobileControls .mobile-action.is-active, #mobileControls .mobile-action[aria-pressed="true"] { color: #f2faf0; background: #34616acf; border-color: #e0edce; }
#mobileJoystick .mobile-joystick__base { border-color: #b8d5cf70; background: #072c3b55; }
#mobileJoystick .mobile-joystick__knob { background: #d2e3d7a8; }
#startOverlay { background: linear-gradient(150deg, #0c3547f0, #041a2be8); }
#startOverlay #startButton, #startOverlay #playerNameStartButton { background: #dce6d6; color: #173b43; border-color: #dce6d6; }
.run-panel { background: #06263866; }
.viewport-shell { box-shadow: 0 18px 48px #0213212b; }


#startOverlay { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; padding: 24px; gap: 0; }
#startOverlay.is-hidden { display: none; }
.start-primary { display: grid; justify-items: center; flex: 0 0 auto; width: min(760px,100%); gap: 12px; margin-top: auto; }
#startOverlay .quick-actions { flex: 0 0 auto; width: min(620px,100%); margin: 20px auto auto; }
#startOverlay .asset-loading { height: 40px; min-height: 40px; }
#startOverlay .start-primary:has(.player-name-form[hidden]) .asset-loading[hidden] { display: grid !important; visibility: hidden; }
@media(min-width:900px) and (min-height:800px) {
  #startOverlay { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(24px,1fr) auto minmax(24px,1fr); align-content: stretch; }
  #startOverlay.is-hidden { display: none; }
  #startOverlay .start-primary { grid-column: 1; grid-row: 2; justify-self: center; margin: 0; }
  #startOverlay .quick-actions { grid-column: 1; grid-row: 3; align-self: start; margin-top: 20px; }
}

#startOverlay .asset-loading:not([hidden]) + .overlay-actions { visibility: hidden; }
