:root {
  color-scheme: light;
  --navy: #1b2a4d;
  --deep-navy: #081428;
  --midnight: #050b18;
  --gold: #c2a14a;
  --cream: #faf6ee;
  --soft-blue: #dce6f3;
  --charcoal: #2b2b33;
  --panel: rgba(9, 18, 38, 0.92);
  --panel-border: rgba(194, 161, 74, 0.76);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--midnight);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(65, 103, 157, 0.28), transparent 42rem),
    linear-gradient(180deg, #101d35 0%, #050b18 60%, #030711 100%);
  color: var(--cream);
  font-family: "Segoe UI", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.page-shell {
  width: min(100%, 1760px);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 28px);
}

.game-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 16px;
}

.eyebrow,
.game-label {
  margin: 0;
  color: var(--soft-blue);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-header h1 {
  margin: 4px 0 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.025em;
}

.privacy-note {
  max-width: 390px;
  padding: 10px 14px;
  border: 1px solid rgba(194, 161, 74, 0.5);
  border-radius: 999px;
  background: rgba(4, 10, 24, 0.72);
  color: var(--soft-blue);
  font-size: 0.86rem;
  text-align: center;
}

.privacy-note span {
  margin-right: 6px;
  color: var(--gold);
}

.game-shell {
  position: relative;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 2px solid rgba(194, 161, 74, 0.72);
  border-radius: clamp(10px, 1.4vw, 22px);
  background: #050b18;
  box-shadow: var(--shadow);
  isolation: isolate;
  outline: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 4;
  top: clamp(8px, 1.4vw, 20px);
  left: clamp(8px, 1.4vw, 20px);
  right: clamp(8px, 1.4vw, 20px);
  display: flex;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}

.hud-card,
.hud-button {
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(5, 11, 24, 0.77);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(7px);
}

.hud-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 118px;
  padding: 8px 14px;
}

.hud-card-wide {
  min-width: 220px;
  gap: 2px;
  font-size: clamp(0.72rem, 1.35vw, 0.95rem);
}

.hud-label {
  color: var(--soft-blue);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#hud-distance {
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.hud-button {
  margin-left: auto;
  padding: 0 16px;
  cursor: pointer;
  pointer-events: auto;
}

.hud-button:hover,
.hud-button:focus-visible {
  border-color: var(--gold);
  outline: none;
}

.hud-button-secondary {
  margin-left: 0;
  min-width: 108px;
}


.status-message {
  position: absolute;
  z-index: 5;
  top: 90px;
  left: 50%;
  min-width: 260px;
  transform: translateX(-50%);
  color: #fff3c5;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}

.overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 54px);
  background: linear-gradient(180deg, rgba(4, 9, 20, 0.38), rgba(2, 6, 15, 0.78));
  backdrop-filter: blur(2px);
}

.overlay[hidden] {
  display: none;
}

.overlay-panel {
  width: min(680px, 92%);
  max-height: 92%;
  overflow: auto;
  padding: clamp(20px, 4vw, 44px);
  border: 2px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.56);
  text-align: center;
}

.overlay-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.overlay h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4.6vw, 3.3rem);
  line-height: 1.02;
}

.overlay p {
  margin: 0;
  color: #edf3fb;
  font-size: clamp(0.9rem, 1.8vw, 1.08rem);
  line-height: 1.65;
}

.small-copy {
  color: #bdc9db;
  font-size: 0.86em;
}

.loading-bar {
  width: min(420px, 100%);
  height: 10px;
  margin: 22px auto 8px;
  overflow: hidden;
  border: 1px solid rgba(194, 161, 74, 0.62);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
}

.loading-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8e712c, #dfc16d);
  transition: width 140ms linear;
}

.loading-text {
  color: #bdc9db !important;
  font-size: 0.82rem !important;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.button {
  min-width: 150px;
  min-height: 48px;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.button-primary {
  border: 2px solid #f2d787;
  background: var(--gold);
  color: #10182d;
}

.button-secondary {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: 3px solid rgba(220, 230, 243, 0.42);
  outline-offset: 2px;
}

.motion-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: #bdc9db;
  font-size: 0.83rem;
  cursor: pointer;
}

.motion-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.mobile-controls {
  position: absolute;
  z-index: 6;
  right: clamp(10px, 2vw, 26px);
  bottom: clamp(10px, 2vw, 26px);
  left: clamp(10px, 2vw, 26px);
  display: none;
  justify-content: space-between;
  pointer-events: none;
}

.control-button {
  display: grid;
  place-items: center;
  width: clamp(82px, 16vw, 132px);
  aspect-ratio: 1.35;
  border: 2px solid rgba(242, 215, 135, 0.84);
  border-radius: 22px;
  background: rgba(5, 11, 24, 0.78);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(7px);
  pointer-events: auto;
  touch-action: none;
}

.control-button span {
  display: block;
  color: var(--gold);
  font-size: 1.35em;
  line-height: 0.75;
}

.control-button:active {
  transform: scale(0.96);
  background: rgba(27, 42, 77, 0.94);
}

.game-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 1600px;
  margin: 16px auto 0;
}

.game-notes > div {
  padding: 16px 18px;
  border: 1px solid rgba(194, 161, 74, 0.28);
  border-radius: 14px;
  background: rgba(8, 18, 38, 0.62);
}

.game-notes h2 {
  margin: 0 0 8px;
  color: #f2d787;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
}

.game-notes p {
  margin: 0;
  color: #cfdaea;
  font-size: 0.86rem;
  line-height: 1.55;
}

@media (pointer: coarse), (max-width: 900px) {
  .mobile-controls {
    display: flex;
  }

  .game-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 8px;
  }

  .game-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .privacy-note {
    max-width: none;
    padding: 7px 10px;
    font-size: 0.72rem;
  }

  .hud-card-wide {
    display: none;
  }

  .hud-card,
  .hud-button {
    min-height: 42px;
    border-radius: 9px;
  }

  .hud-card {
    min-width: 92px;
    padding: 5px 10px;
  }

  .hud-button {
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .status-message {
    top: 58px;
    font-size: 0.78rem;
  }

  .overlay-panel {
    border-radius: 16px;
  }
}

@media (orientation: portrait) and (max-width: 720px) {
  .game-shell::after {
    position: absolute;
    z-index: 3;
    right: 10px;
    bottom: 8px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(5, 11, 24, 0.7);
    color: rgba(255, 255, 255, 0.78);
    content: "Landscape works best";
    font-size: 0.62rem;
    pointer-events: none;
  }
}

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


/* v0.9.0 mobile landscape foundation */
.button-danger {
  border: 1px solid rgba(255, 132, 132, 0.78);
  background: rgba(115, 25, 34, 0.72);
  color: #fff;
}

.mobile-exit-control,
.mobile-gate {
  display: none;
}

.mobile-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  place-items: center;
  padding:
    calc(18px + env(safe-area-inset-top, 0px))
    calc(18px + env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    calc(18px + env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 50% 20%, rgba(70, 108, 160, 0.32), transparent 34rem),
    rgba(3, 8, 18, 0.97);
  overscroll-behavior: none;
}

.mobile-gate:not([hidden]) {
  display: grid;
}

.mobile-gate-panel {
  width: min(520px, 94vw);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: clamp(22px, 5vw, 42px);
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  background: rgba(7, 15, 31, 0.96);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.58);
  text-align: center;
}

.mobile-gate-panel h2 {
  margin: 4px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 7vw, 3rem);
}

.mobile-gate-panel > p:not(.overlay-kicker) {
  margin: 0;
  color: #e8eef8;
  line-height: 1.55;
}

.phone-rotate-icon {
  position: relative;
  width: 116px;
  height: 86px;
  margin: 0 auto 12px;
}

.phone-shape {
  position: absolute;
  top: 9px;
  left: 22px;
  width: 45px;
  height: 70px;
  border: 5px solid #f2d787;
  border-radius: 10px;
  transform: rotate(-18deg);
}

.phone-shape::after {
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f2d787;
  content: "";
  transform: translateX(-50%);
}

.rotate-arrow {
  position: absolute;
  right: 12px;
  bottom: 1px;
  color: #dce6f3;
  font-size: 4rem;
  line-height: 1;
  transform: rotate(-22deg);
}

.mobile-fullscreen-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(280px, 86vw);
  margin-top: 22px;
}

.mobile-fullscreen-action[hidden] {
  display: none;
}

.mobile-fullscreen-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.mobile-gate-status {
  margin-top: 13px !important;
  color: #aebcd0 !important;
  font-size: 0.82rem;
}

body.mobile-device:not(.mobile-play-mode) .mobile-controls {
  display: none !important;
}

html.mobile-play-mode,
body.mobile-play-mode {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #020611;
}

body.mobile-play-mode {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

body.mobile-play-mode .game-header,
body.mobile-play-mode .game-notes {
  display: none;
}

body.mobile-play-mode .page-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(28, 49, 82, 0.48), transparent 75%),
    #020611;
}

body.mobile-play-mode .game-shell {
  width: min(100vw, 177.7778vh);
  width: min(100dvw, 177.7778dvh);
  height: min(100vh, 56.25vw);
  height: min(100dvh, 56.25dvw);
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.75);
}

body.mobile-play-mode .mobile-exit-control {
  position: absolute;
  z-index: 30;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(8px + env(safe-area-inset-left, 0px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 54px;
  min-height: 46px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  background: rgba(4, 10, 22, 0.82);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(7px);
  pointer-events: auto;
  touch-action: manipulation;
}

body.mobile-play-mode .mobile-exit-control > span:first-child {
  font-size: 1.35rem;
  line-height: 1;
}

body.mobile-play-mode .hud {
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(76px + env(safe-area-inset-left, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  gap: 6px;
}

body.mobile-play-mode .hud-card,
body.mobile-play-mode .hud-button {
  min-height: 46px;
  border-radius: 10px;
}

body.mobile-play-mode .hud-card {
  min-width: 86px;
  padding: 5px 9px;
}

body.mobile-play-mode .hud-card-wide {
  display: flex;
  min-width: 150px;
  padding: 5px 10px;
  font-size: clamp(0.62rem, 1.55vw, 0.84rem);
}

body.mobile-play-mode .hud-button {
  display: none;
}

body.mobile-play-mode .status-message {
  top: calc(62px + env(safe-area-inset-top, 0px));
  max-width: 70%;
  min-width: 0;
  font-size: clamp(0.7rem, 1.8vw, 0.92rem);
}

body.mobile-play-mode .overlay {
  z-index: 40;
  padding:
    calc(10px + env(safe-area-inset-top, 0px))
    calc(12px + env(safe-area-inset-right, 0px))
    calc(10px + env(safe-area-inset-bottom, 0px))
    calc(12px + env(safe-area-inset-left, 0px));
}

body.mobile-play-mode .overlay-panel {
  width: min(620px, 88%);
  max-height: 92%;
  padding: clamp(14px, 3.2vh, 30px) clamp(18px, 4vw, 38px);
  border-radius: 18px;
}

body.mobile-play-mode .overlay h2 {
  font-size: clamp(1.45rem, 5.5vh, 2.7rem);
}

body.mobile-play-mode .overlay p {
  font-size: clamp(0.76rem, 2.5vh, 1rem);
  line-height: 1.45;
}

body.mobile-play-mode .overlay-actions {
  margin-top: 14px;
}

body.mobile-play-mode .button {
  min-height: 44px;
  padding: 9px 17px;
}

body.mobile-play-mode .motion-toggle {
  margin-top: 12px;
}

body.mobile-play-mode .mobile-controls {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: block;
  pointer-events: none;
}

body.mobile-play-mode .control-button {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
  width: 46%;
  height: 100%;
  aspect-ratio: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: #fff;
  opacity: 1;
  pointer-events: auto;
  touch-action: none;
}

body.mobile-play-mode .duck-control {
  left: 0;
}

body.mobile-play-mode .jump-control {
  right: 0;
}

body.mobile-play-mode .control-button:active {
  transform: none;
  background: transparent;
}

body.mobile-play-mode .control-guide {
  position: absolute;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  min-width: clamp(116px, 24vw, 190px);
  min-height: clamp(66px, 13vh, 108px);
  padding: 10px 18px;
  border: 2px solid rgba(242, 215, 135, 0.88);
  border-radius: 22px;
  background: rgba(5, 11, 24, 0.74);
  color: #fff;
  font-size: clamp(0.78rem, 2.4vw, 1.18rem);
  letter-spacing: 0.08em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
  opacity: 0.10;
  transform: translateY(0);
  transition: opacity 550ms ease, transform 550ms ease;
  pointer-events: none;
}

body.mobile-play-mode .duck-control .control-guide {
  left: calc(18px + env(safe-area-inset-left, 0px));
}

body.mobile-play-mode .jump-control .control-guide {
  right: calc(18px + env(safe-area-inset-right, 0px));
}

body.mobile-play-mode .game-shell.show-control-guides .control-guide {
  opacity: 0.93;
  transform: translateY(0);
}

body.mobile-play-mode .control-arrow {
  display: block;
  color: #ff5b5b;
  font-size: clamp(1.7rem, 5.5vw, 3.2rem);
  line-height: 0.85;
}

@media (max-height: 470px) and (orientation: landscape) {
  body.mobile-play-mode .mobile-exit-control {
    min-width: 48px;
    min-height: 40px;
    padding: 0 9px;
  }

  body.mobile-play-mode .exit-label {
    display: none;
  }

  body.mobile-play-mode .hud {
    left: calc(62px + env(safe-area-inset-left, 0px));
  }

  body.mobile-play-mode .hud-card,
  body.mobile-play-mode .hud-button {
    min-height: 40px;
  }

  body.mobile-play-mode .hud-card {
    min-width: 72px;
    padding: 3px 7px;
  }

  body.mobile-play-mode .hud-card-wide {
    min-width: 126px;
    font-size: 0.62rem;
  }

  body.mobile-play-mode .control-guide {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    min-width: 110px;
    min-height: 58px;
    padding: 7px 12px;
    border-radius: 16px;
  }
}

@media (orientation: portrait) and (pointer: coarse) {
  body.mobile-device .game-shell::after {
    content: none;
  }
}


/* v0.9.1 mobile rendering performance */
body.mobile-play-mode .hud-card,
body.mobile-play-mode .hud-button,
body.mobile-play-mode .mobile-exit-control,
body.mobile-play-mode .control-button {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body.mobile-play-mode #game-canvas {
  contain: none;
}


/* v0.9.3 stable rendering hotfix */
@media (orientation: landscape) and (max-height: 720px) {
  .mobile-gate {
    padding:
      calc(8px + env(safe-area-inset-top, 0px))
      calc(10px + env(safe-area-inset-right, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px))
      calc(10px + env(safe-area-inset-left, 0px));
  }

  .mobile-gate-panel {
    width: min(720px, 96vw);
    max-height: calc(100dvh - 16px);
    overflow: hidden;
    padding: clamp(12px, 3vh, 22px) clamp(18px, 4vw, 34px);
    border-radius: 18px;
  }

  .mobile-gate-panel .phone-rotate-icon {
    display: none;
  }

  .mobile-gate-panel .overlay-kicker {
    margin: 0 0 3px;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
  }

  .mobile-gate-panel h2 {
    margin: 0 0 8px;
    font-size: clamp(1.55rem, 6vh, 2.35rem);
    line-height: 1.02;
  }

  .mobile-fullscreen-action {
    min-width: min(290px, 74vw);
    min-height: 46px;
    margin: 2px auto 9px;
    padding: 10px 22px;
    font-size: 1rem;
  }

  .mobile-gate-panel > p:not(.overlay-kicker) {
    margin: 0;
    font-size: clamp(0.82rem, 2.4vh, 0.98rem);
    line-height: 1.3;
  }

  .mobile-gate-status {
    margin-top: 6px !important;
    font-size: 0.72rem !important;
  }
}


/* Global rendering stability */
#game-canvas {
  image-rendering: auto;
}


/* Public start screen and anonymous Top 10 */
.overlay-panel {
  scrollbar-color: rgba(194, 161, 74, 0.62) rgba(5, 11, 24, 0.36);
}

.overlay-main {
  min-width: 0;
}

.overlay[data-view="ready"] .overlay-panel,
.overlay[data-view="gameover"] .overlay-panel {
  width: min(1040px, 94%);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  text-align: left;
}

.overlay[data-view="ready"] .overlay-main,
.overlay[data-view="gameover"] .overlay-main {
  padding-right: clamp(0px, 1vw, 12px);
}

.overlay[data-view="ready"] h2,
.overlay[data-view="gameover"] h2 {
  font-size: clamp(2.2rem, 5vw, 4.4rem);
}

.overlay[data-view="ready"] .overlay-actions,
.overlay[data-view="gameover"] .overlay-actions {
  justify-content: flex-start;
}

.overlay[data-view="ready"] .motion-toggle,
.overlay[data-view="gameover"] .motion-toggle {
  margin-top: 18px;
}

.book-note {
  margin-top: 18px !important;
  color: #aebbd0 !important;
  font-size: 0.78rem !important;
  line-height: 1.45 !important;
}

.leaderboard-panel {
  min-height: 390px;
  padding: 22px;
  border: 1px solid rgba(194, 161, 74, 0.58);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(8, 18, 38, 0.96), rgba(4, 10, 24, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 16px 36px rgba(0, 0, 0, 0.28);
  text-align: left;
}

.leaderboard-panel[hidden] {
  display: none;
}

.leaderboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(194, 161, 74, 0.28);
}

.leaderboard-eyebrow {
  margin: 0 !important;
  color: var(--gold) !important;
  font-size: 0.66rem !important;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.leaderboard-heading h3 {
  margin: 0;
  color: #fff8dd;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
}

.leaderboard-list {
  display: grid;
  gap: 4px;
  margin: 14px 0 12px;
  padding: 0;
  list-style: none;
  counter-reset: top-runs;
}

.leaderboard-list li {
  counter-increment: top-runs;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  min-height: 27px;
  padding: 3px 8px;
  border-radius: 8px;
  color: #e8eef8;
  font-variant-numeric: tabular-nums;
}

.leaderboard-list li::before {
  content: counter(top-runs);
  color: #c2a14a;
  font-weight: 800;
}

.leaderboard-list li:nth-child(-n + 3) {
  background: rgba(194, 161, 74, 0.08);
}

.leaderboard-list li span {
  justify-self: end;
  font-weight: 700;
}

.leaderboard-list li.is-empty span {
  color: #718098;
  font-weight: 500;
}

.leaderboard-status {
  color: #9fadc2 !important;
  font-size: 0.72rem !important;
  line-height: 1.45 !important;
}

body.mobile-play-mode .leaderboard-panel,
body.mobile-play-mode .book-note {
  display: none !important;
}

@media (max-width: 900px) {
  .overlay[data-view="ready"] .overlay-panel,
  .overlay[data-view="gameover"] .overlay-panel {
    display: block;
    width: min(680px, 94%);
    text-align: center;
  }

  .overlay[data-view="ready"] .overlay-actions,
  .overlay[data-view="gameover"] .overlay-actions {
    justify-content: center;
  }

  .leaderboard-panel {
    margin-top: 20px;
    min-height: auto;
  }
}

/* Cinematic title screen */
.title-screen {
  position: absolute;
  z-index: 9;
  inset: 0;
  overflow: hidden;
  background: #071225;
  color: #fff;
}

.title-screen[hidden] {
  display: none;
}

.title-hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  user-select: none;
  pointer-events: none;
}

.title-hero-still {
  z-index: 0;
}

.title-hero-video {
  z-index: 1;
  opacity: 1;
  transition: opacity 360ms ease;
}

.title-screen.video-ended .title-hero-video,
.title-screen.video-skipped .title-hero-video {
  opacity: 0;
}

.title-screen-shade {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 7, 16, 0.05) 0%, rgba(2, 7, 16, 0.08) 36%, rgba(2, 7, 16, 0.54) 60%, rgba(2, 7, 16, 0.92) 100%),
    linear-gradient(180deg, rgba(2, 7, 16, 0.12) 0%, rgba(2, 7, 16, 0.03) 55%, rgba(2, 7, 16, 0.68) 100%);
  pointer-events: none;
}

.title-screen-content {
  position: absolute;
  z-index: 3;
  top: 5.5%;
  right: clamp(24px, 4.5vw, 78px);
  bottom: 4.5%;
  display: flex;
  flex-direction: column;
  width: min(43%, 610px);
  min-width: 390px;
  overflow: hidden;
  padding: clamp(20px, 2.8vw, 42px);
  border: 1px solid rgba(194, 161, 74, 0.58);
  border-radius: clamp(18px, 2vw, 28px);
  background: linear-gradient(180deg, rgba(6, 14, 31, 0.82), rgba(4, 10, 23, 0.90));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(5px);
}

.title-copy {
  transform: translateY(0);
  opacity: 1;
}

.title-screen.intro-playing .title-copy {
  animation: title-copy-arrive 900ms cubic-bezier(0.22, 0.78, 0.2, 1) 180ms both;
}

@keyframes title-copy-arrive {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.title-kicker {
  margin: 0 0 8px;
  color: #f1d47b;
  font-size: clamp(0.68rem, 1.05vw, 0.86rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.title-logo {
  margin: 0;
  color: #fffaf0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 0.96;
  text-shadow: 0 6px 22px rgba(0, 0, 0, 0.54);
}

.title-logo span {
  display: block;
  margin-bottom: 8px;
  color: #dce6f3;
  font-size: clamp(1.15rem, 2.1vw, 1.9rem);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.title-logo strong {
  display: block;
  color: #fff7de;
  font-size: clamp(2.5rem, 5.4vw, 5.35rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.title-tagline {
  max-width: 36rem;
  margin: 14px 0 0;
  color: #dbe6f4;
  font-size: clamp(0.9rem, 1.35vw, 1.15rem);
  line-height: 1.45;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(16px, 2.2vh, 24px);
}

.title-actions .button {
  min-width: 142px;
}

.title-start-action {
  box-shadow: 0 0 0 0 rgba(242, 215, 135, 0.0), 0 10px 28px rgba(0, 0, 0, 0.34);
  animation: title-start-pulse 2.6s ease-in-out infinite;
}

.title-start-action:disabled {
  cursor: wait;
  opacity: 0.66;
  animation: none;
}

@keyframes title-start-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 215, 135, 0.0), 0 10px 28px rgba(0, 0, 0, 0.34); }
  50% { box-shadow: 0 0 0 8px rgba(242, 215, 135, 0.08), 0 12px 34px rgba(0, 0, 0, 0.42); }
}

.title-audio-actions {
  display: flex;
  gap: 14px;
  margin-top: 11px;
}

.title-text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #becbdb;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(194, 161, 74, 0.48);
  text-underline-offset: 3px;
}

.title-text-button:hover,
.title-text-button:focus-visible {
  color: #fff4c9;
  outline: none;
}

.title-load-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: #9fb0c7;
  font-size: 0.72rem;
}

.title-book-note {
  margin: 5px 0 0;
  color: #8f9eb2;
  font-size: 0.68rem;
}

.title-leaderboard {
  min-height: 0;
  margin-top: auto;
  padding-top: clamp(14px, 2vh, 20px);
  border-top: 1px solid rgba(194, 161, 74, 0.26);
}

.title-leaderboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.title-leaderboard-heading > span {
  color: #c2a14a;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.title-leaderboard-heading h3 {
  margin: 0;
  color: #fff7de;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 1.65vw, 1.45rem);
}

.title-leaderboard-list {
  display: grid;
  gap: 1px;
  margin: 9px 0 7px;
  padding: 0;
  list-style: none;
  counter-reset: title-top-runs;
}

.title-leaderboard-list li {
  counter-increment: title-top-runs;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 21px;
  padding: 1px 6px;
  border-radius: 6px;
  color: #e6edf7;
  font-size: clamp(0.68rem, 0.9vw, 0.78rem);
  font-variant-numeric: tabular-nums;
}

.title-leaderboard-list li::before {
  content: counter(title-top-runs);
  color: #c2a14a;
  font-weight: 800;
}

.title-leaderboard-list li:nth-child(-n + 3) {
  background: rgba(194, 161, 74, 0.08);
}

.title-leaderboard-list li span {
  justify-self: end;
  font-weight: 700;
}

.title-leaderboard-list li.is-empty span {
  color: #738097;
  font-weight: 500;
}

.title-leaderboard-status {
  margin: 0;
  color: #8493a8;
  font-size: 0.62rem;
  line-height: 1.35;
}

body.title-screen-active .hud,
body.title-screen-active .status-message,
body.title-screen-active .mobile-controls,
body.title-screen-active .mobile-exit-control {
  visibility: hidden;
}

body.mobile-device .title-screen,
body.mobile-play-mode .title-screen {
  display: none !important;
}

@media (max-width: 1180px) and (pointer: fine) {
  .title-screen-content {
    right: 24px;
    width: min(48%, 560px);
    min-width: 360px;
    padding: 24px;
  }

  .title-logo strong {
    font-size: clamp(2.45rem, 5vw, 4.25rem);
  }

  .title-leaderboard-list li {
    min-height: 18px;
    font-size: 0.66rem;
  }
}

@media (max-height: 720px) and (pointer: fine) {
  .title-screen-content {
    top: 3.5%;
    bottom: 3.5%;
    padding: 20px 24px;
  }

  .title-logo span {
    margin-bottom: 4px;
    font-size: 1.15rem;
  }

  .title-logo strong {
    font-size: clamp(2.35rem, 5vw, 4.1rem);
  }

  .title-tagline {
    margin-top: 8px;
    font-size: 0.88rem;
  }

  .title-actions {
    margin-top: 12px;
  }

  .title-actions .button {
    min-height: 42px;
    padding: 8px 16px;
  }

  .title-audio-actions {
    margin-top: 7px;
  }

  .title-load-status,
  .title-book-note {
    margin-top: 4px;
  }

  .title-leaderboard {
    padding-top: 9px;
  }

  .title-leaderboard-list {
    margin: 5px 0 4px;
  }

  .title-leaderboard-list li {
    min-height: 16px;
    font-size: 0.61rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-screen.intro-playing .title-copy,
  .title-start-action {
    animation: none !important;
  }

  .title-hero-video {
    display: none;
  }
}


/* v1.0.0 public release navigation */
.overlay-site-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(194, 161, 74, 0.22);
}

.overlay-site-actions[hidden] {
  display: none;
}

.overlay-site-button {
  min-width: 190px;
}

.title-actions .button {
  flex: 1 1 142px;
}

@media (max-height: 720px) and (pointer: fine) {
  .title-actions .button {
    flex-basis: 128px;
    min-width: 128px;
    font-size: 0.75rem;
  }
}

body.mobile-play-mode .overlay-site-actions {
  margin-top: 9px;
  padding-top: 9px;
}

body.mobile-play-mode .overlay-site-button {
  min-width: 150px;
  min-height: 40px;
  padding: 7px 12px;
  font-size: 0.72rem;
}


/* Explicit Top 10 view */
.overlay[data-view="leaderboard"] .overlay-panel {
  width: min(1040px, 94%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.78fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  text-align: left;
}

.overlay[data-view="leaderboard"] .overlay-actions {
  justify-content: flex-start;
}

body.mobile-play-mode .overlay[data-view="leaderboard"] .overlay-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(220px, 1.1fr);
  width: min(1040px, 96%);
  max-height: 94%;
  gap: 14px;
  padding: 14px 18px;
}

body.mobile-play-mode .overlay[data-view="leaderboard"] .leaderboard-panel {
  display: block !important;
  min-height: auto;
  max-height: 72vh;
  overflow: auto;
  padding: 14px;
}

body.mobile-play-mode .overlay[data-view="leaderboard"] .leaderboard-list {
  margin: 7px 0;
}

body.mobile-play-mode .overlay[data-view="leaderboard"] .leaderboard-list li {
  min-height: 20px;
  font-size: 0.68rem;
}

@media (max-width: 900px) {
  .overlay[data-view="leaderboard"] .overlay-panel {
    display: block;
    width: min(680px, 94%);
    text-align: center;
  }

  .overlay[data-view="leaderboard"] .overlay-actions {
    justify-content: center;
  }

  .overlay[data-view="leaderboard"] .leaderboard-panel {
    margin-top: 18px;
    min-height: auto;
  }
}
