*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f1115;
  color: #f2f2f2;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #fafafa;
  cursor: pointer;
}

/* --- Dev tools panel (localhost / ?dev=1 only — hidden in production) --- */
.dev-tools {
  display: none;
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 40;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

body.is-local-dev .dev-tools {
  display: block;
}

.dev-toggle {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 17, 21, 0.82);
  color: #c8d0dc;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.dev-toggle:hover,
.dev-toggle.is-open {
  background: rgba(47, 107, 255, 0.9);
  color: #fff;
  border-color: transparent;
}

.dev-panel {
  margin-top: 8px;
  width: min(280px, calc(100vw - 24px));
  padding: 10px 12px 12px;
  border-radius: 10px;
  background: rgba(15, 17, 21, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8eaef;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.dev-panel[hidden] {
  display: none !important;
}

.dev-panel-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fa0b8;
  margin-bottom: 8px;
}

.dev-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0;
  color: #c5ccd6;
}

.dev-row strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.dev-row.muted {
  color: #7f8a9a;
  font-size: 10px;
}

.dev-row.muted strong {
  color: #b8c0cc;
}

.dev-bar-wrap {
  display: grid;
  grid-template-columns: 72px 1fr 46px;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
}

.dev-bar-label {
  color: #9aa6b8;
}

.dev-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.dev-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6bff, #6b9bff);
  transition: width 0.08s linear;
}

.dev-bar-wrap:nth-of-type(2) .dev-bar > i {
  background: linear-gradient(90deg, #c41818, #f06a4a);
}

/* Gun flash peak meters — warm orange */
.dev-bar.dev-bar-flash > i {
  background: linear-gradient(90deg, #c45a10, #ffb040);
}

/* Big run timer for DJ beat-drop sync */
.dev-run-timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #ffe566 !important;
  letter-spacing: 0.02em;
}

.dev-note {
  margin: 8px 0 6px;
  color: #7a8699;
  font-size: 10px;
}

.dev-divider {
  height: 1px;
  margin: 10px 0 8px;
  background: rgba(255, 255, 255, 0.1);
}

.dev-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.dev-action-btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #2f6bff;
  cursor: pointer;
  text-align: center;
}

.dev-action-btn:hover {
  filter: brightness(1.08);
}

.dev-action-btn:active {
  transform: scale(0.98);
}

.dev-action-link {
  font-size: 11px;
  font-weight: 600;
  color: #8fa0b8;
  text-align: center;
  text-decoration: none;
}

.dev-action-link:hover {
  color: #c5ccd6;
  text-decoration: underline;
}

.dev-slider-wrap {
  display: grid;
  grid-template-columns: 18px 1fr 18px;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
  cursor: pointer;
}

.dev-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

.dev-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6b9bff;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.dev-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6b9bff;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.dev-action-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e8eaef;
}

.dev-action-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  filter: none;
}

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* Always off during play (desktop + mobile). .hud { display:flex } would
   otherwise win over the HTML [hidden] attribute and leave year/status pills up. */
.hud[hidden],
#hud[hidden],
body.is-desktop-ui .hud,
body.is-desktop-ui #hud,
body.is-mobile-ui .hud,
body.is-mobile-ui #hud {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.hud-left,
.hud-right,
.hud-mid {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-left,
.hud-right {
  background: rgba(15, 17, 21, 0.55);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.hud-mid {
  pointer-events: auto;
}

#year-label {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3.2em;
}

.tag {
  font-size: 12px;
  opacity: 0.9;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

#status-label {
  font-size: 12px;
  opacity: 0.95;
}

.hud-btn {
  appearance: none;
  border: none;
  background: rgba(15, 17, 21, 0.7);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

.hud-btn[hidden] {
  display: none !important;
}

.hud-btn:active {
  transform: scale(0.98);
}

/* Bottom action controls */
.controls-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
  background: linear-gradient(to top, rgba(15, 17, 21, 0.35), transparent);
}

.controls-bar[hidden] {
  display: none !important;
}

.control-btn {
  pointer-events: auto;
  appearance: none;
  border: none;
  min-width: 140px;
  min-height: 56px;
  padding: 14px 22px;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.run-btn {
  background: #2f6bff;
  flex: 1.2;
  max-width: 280px;
}

/* Left stays blue; right uses the same red as THE RIGHT / bounds */
#run-btn {
  background: #2f6bff;
}

#run-btn.is-held {
  background: #1a4fd6;
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.45);
}

#right-btn {
  background: #c41818;
}

#right-btn.is-held {
  background: #9e1212;
  box-shadow: 0 4px 12px rgba(196, 24, 24, 0.45);
}

.run-btn.is-held {
  transform: scale(0.98);
}

.jump-btn {
  background: #111;
  flex: 1;
  max-width: 200px;
}

/* Desktop: keyboard only — never show touch bar */
body.is-desktop-ui .controls-bar,
body:not(.is-mobile-ui) #controls.controls-bar {
  display: none !important;
}

/* (HUD hide rules live next to .hud — desktop + mobile) */

.jump-btn:active {
  transform: scale(0.97);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 17, 21, 0.72);
  padding: 20px;
}

/* Post–Play Game menus: solid black (no game bleed-through) */
.overlay.overlay-solid {
  background: #000;
}

.overlay[hidden] {
  display: none !important;
}

/* Mobile fullscreen gate (tap to hide browser chrome) */
.overlay-fs {
  z-index: 35;
}

.panel-fs {
  width: min(340px, 92vw);
  text-align: center;
  padding: 28px 22px 22px;
}

.panel-fs h1 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.35rem;
  margin: 0 0 10px;
}

.panel-fs .blurb {
  margin: 0 auto 20px;
  max-width: 18em;
  color: #444;
  font-size: 0.92rem;
  line-height: 1.4;
}

.panel-fs #fs-go-btn {
  min-width: 180px;
  padding: 12px 28px;
  font-size: 1rem;
}

/* Name / X handle step */
.name-step {
  text-align: center;
  padding: 8px 8px 4px;
  width: 100%;
  box-sizing: border-box;
}

.name-step[hidden] {
  display: none !important;
}

.name-step-hint {
  margin: 0 auto 14px;
  font-size: 0.88rem;
  color: #666;
  font-weight: 500;
}

.name-input {
  display: block;
  width: min(260px, 88%);
  margin: 0 auto 16px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: #111;
  background: #f4f4f7;
  border: 2px solid #111;
  border-radius: 12px;
  outline: none;
  box-sizing: border-box;
}

.name-input::placeholder {
  font-style: italic;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.38);
  opacity: 1;
}

.name-input:focus {
  border-color: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.2);
}

.name-next-btn {
  min-width: 140px;
  padding: 11px 28px;
  font-size: 0.95rem;
}

/* Game-over: handle under YOU face */
.go-you-name {
  margin: 6px 0 0;
  max-width: 5.5em;
  font-size: 0.62rem;
  font-weight: 700;
  color: #333;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.go-you-name[hidden] {
  display: none !important;
}

/* Title screen */
.title-overlay {
  z-index: 30;
  background: #fafafa;
  overflow: hidden; /* blue line can animate to the edge without page scroll */
}

.title-panel {
  width: min(640px, 100%);
  text-align: center;
  padding: 24px 16px;
  overflow: visible; /* blue spectrum may extend past the panel */
}

/* Title cast: left / center / right faces (no labels) */
.title-cast {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  margin: 0 auto 22px;
}

.title-cast-face {
  box-sizing: border-box;
  border-radius: 50%;
  overflow: hidden;
  background: #f0f0f2;
  /* Same ring thickness for all three (~50% of previous 4px) */
  border: 2px solid transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-cast-face img {
  display: block;
  /* Inset so face art doesn’t touch the ring */
  width: 78%;
  height: 78%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.title-cast-left,
.title-cast-right {
  width: 72px;
  height: 72px;
}

.title-cast-left {
  border-color: #2f6bff;
}

/* Crying man: face sits small in frame — scale up + nudge left for optical center */
.title-cast-left img {
  width: 96%;
  height: 96%;
  object-fit: contain;
  object-position: 38% 48%;
  transform: scale(1.08);
  transform-origin: center center;
}

.title-cast-right {
  border-color: #c41818;
}

/* Bigger center face; half-blue / half-red ring — same 2px thickness as sides */
.title-cast-center {
  width: 104px;
  height: 104px;
  border: none;
  padding: 2px; /* ONLY the ring — matches left/right border width */
  background: linear-gradient(90deg, #2f6bff 0 50%, #c41818 50% 100%);
  overflow: visible;
}

/* Inner plate fills the circle so gradient is only the thin ring */
.title-cast-center-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #f0f0f2;
  overflow: hidden;
}

.title-cast-center img {
  /* Inset art inside the plate (not part of the ring) */
  width: 78%;
  height: 78%;
}

.game-title {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #111;
  margin: 0 0 22px;
}

.title-spectrum {
  position: relative;
  width: min(420px, 78vw);
  height: 18px;
  margin: 0 auto 20px;
  overflow: visible;
  z-index: 1;
}

/* Red half — fixed, same height/look as before (right of center tick) */
.title-spectrum-red {
  position: absolute;
  left: 50%;
  right: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(
    90deg,
    #6b4fd8 0%,
    #e11d1d 10%,
    #e11d1d 100%
  );
}

/*
  Blue half — right edge locked to center tick; extends left to the screen edge
  once on load and stays fully extended (no reverse).
*/
.title-spectrum-blue {
  position: absolute;
  right: 50%;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  width: 50%; /* starts as the original left half of the bar */
  border-radius: 999px 0 0 999px;
  background: #2f6bff;
  transform-origin: right center;
  /* Half previous speed (2.8s → 5.6s) */
  animation: title-blue-extend 5.6s ease-out 0.35s forwards;
  will-change: width;
}

@keyframes title-blue-extend {
  0% {
    width: 50%;
  }
  100% {
    /* From center tick past the left viewport edge (desktop + mobile frame) */
    width: 100vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-spectrum-blue {
    animation: none;
    width: 100vw;
  }
}

.title-spectrum-tick {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: #111;
  border-radius: 2px;
  z-index: 2;
}

.game-subtitle {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  color: #444;
  margin: 0 0 44px; /* more air before Start */
  letter-spacing: -0.01em;
}

.title-panel #title-btn {
  min-width: 160px;
  font-size: 1.05rem;
  padding: 14px 36px;
  margin-top: 4px;
}

.title-disclaimer-short {
  /* Wide enough for two lines only (desktop + mobile) */
  max-width: min(42em, 92vw);
  width: min(42em, 92vw);
  margin: 18px auto 2px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.42);
  letter-spacing: 0.01em;
  text-wrap: pretty;
}

.title-disclaimer-link {
  appearance: none;
  border: none;
  background: transparent !important;
  color: rgba(0, 0, 0, 0.5) !important;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 2px 10px 6px !important;
  margin-top: 0;
  min-width: 0 !important;
  cursor: pointer;
  box-shadow: none !important;
}

.title-disclaimer-link:hover {
  color: rgba(0, 0, 0, 0.72) !important;
  background: transparent !important;
  filter: none;
}

.title-disclaimer-link:active {
  transform: none;
}

/* Full disclaimer modal — sits above title */
.disclaimer-overlay {
  z-index: 40;
  background: transparent;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.disclaimer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 21, 0.45);
  cursor: pointer;
}

.panel-disclaimer {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(86vh, 640px);
  overflow: auto;
  text-align: left;
  padding: 22px 22px 20px;
}

.panel-disclaimer h1 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.35rem;
  margin-bottom: 12px;
  text-align: center;
}

.disclaimer-body {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #333;
  margin-bottom: 18px;
}

.disclaimer-body p {
  margin: 0 0 12px;
}

.disclaimer-body p:last-child {
  margin-bottom: 0;
}

.panel-disclaimer #disclaimer-close-btn {
  display: block;
  margin: 0 auto;
  min-width: 120px;
}

.panel-brand {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Controls explainer — single platform column (desktop OR mobile) */
.panel-controls {
  width: min(400px, 100%);
}

.panel-controls h1 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  letter-spacing: -0.02em;
}

.controls-columns {
  display: block;
  text-align: left;
  margin-bottom: 16px;
}

.controls-col[hidden] {
  display: none !important;
}

.panel-controls .controls-col {
  max-width: 320px;
  margin: 0 auto;
}

.panel-controls .controls-col h2 {
  text-align: center;
}

.controls-col {
  background: #f6f6f8;
  border-radius: 12px;
  padding: 14px 16px;
}

.controls-col h2 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 10px;
}

.controls-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.controls-col li {
  font-size: 0.95rem;
  color: #222;
  margin-bottom: 8px;
  line-height: 1.35;
}

/* Mobile controls: no platform label; instructions centered */
.controls-col-mobile {
  text-align: center;
}

.controls-col-mobile ul {
  text-align: center;
}

.controls-col-mobile li {
  text-align: center;
}

.controls-col li:last-child {
  margin-bottom: 0;
}

.controls-col kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 1px 0 #ddd;
}

.controls-note {
  margin-bottom: 18px;
}

@media (max-width: 520px) {
  .controls-columns {
    grid-template-columns: 1fr;
  }
}

.panel {
  width: min(440px, 100%);
  background: #fff;
  color: #111;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   Game-over — landscape match (tight columns, larger polaroid/mascots)
   ========================================================================== */
.overlay-gameover {
  overflow: hidden;
  padding: 12px;
}

.panel-gameover {
  position: relative;
  width: min(540px, 92vw);
  max-width: 92vw;
  /* top pad a touch tighter so the year sits higher; bottom for mascot */
  padding: 12px 18px 12px;
  /* Clip mascot to rounded card so art can’t bleed past the bevel */
  overflow: hidden;
  z-index: 2;
  text-align: center;
  box-sizing: border-box;
  /* base plate; spectrum bevel is ::before */
  background: #fff;
  border: none;
}

/* Thin spectrum bevel: left half blue, right half red (top / sides / bottom) */
.panel-gameover::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2.5px; /* bevel line thickness */
  background: linear-gradient(90deg, #2f6bff 0 50%, #e11d1d 50% 100%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 6;
}

/* Three columns: polaroid | YOU face | year stats (no corner mascot) */
.go-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) auto minmax(0, 1.1fr);
  gap: 4px 12px;
  align-items: center;
  position: relative;
  z-index: 2;
  padding: 0 4px 2px 2px; /* polaroid sits further left */
}

.go-col {
  min-width: 0;
}

.go-col-left {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 2px 0 0 0;
  /* Nudge polaroid + copy left now that mascot is gone */
  margin-left: -2px;
}

.go-col-you {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

.go-you-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.go-you-wrap[hidden] {
  display: none !important;
}

/* Half blue / half red ring — same language as center select (no label text) */
.go-you-avatar {
  box-sizing: border-box;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  padding: 2.5px;
  background: linear-gradient(90deg, #2f6bff 0 50%, #c41818 50% 100%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.go-you-avatar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #f0f0f2;
  overflow: hidden;
}

.go-you-image {
  display: block;
  width: 78%;
  height: 78%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.go-you-label {
  display: none !important;
}

.go-col-right {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 2px 0;
}

.panel-gameover .go-title {
  margin: 0;
  font-size: 1.05rem;
  width: 100%;
}

/* Knock-off copy under polaroid: wider, smaller — keep ≤ ~3 lines */
.panel-gameover .go-detail {
  margin: 4px 0 0;
  max-width: 13.5em;
  width: 100%;
  font-size: 0.64rem;
  line-height: 1.28;
  color: #222;
  text-align: center;
  font-weight: 500;
  text-decoration: none;
}

.panel-gameover .go-detail-prefix {
  color: #333;
  font-weight: 500;
  text-decoration: none;
}

.panel-gameover .go-detail-subject {
  color: #1a4fd8 !important;
  font-weight: 700;
  text-decoration: none;
}

/* Polaroid — slightly smaller so it clears the top bevel on mobile */
.go-hit-wrap {
  position: relative;
  z-index: 2;
  margin: 0;
  width: 128px;
  max-width: 128px;
  padding: 7px 7px 10px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04),
    0 8px 22px rgba(0, 0, 0, 0.14),
    0 2px 5px rgba(0, 0, 0, 0.08);
  /* Default tilt; JS sets --polaroid-tilt with a guaranteed non-zero angle */
  transform: rotate(var(--polaroid-tilt, -5deg));
  box-sizing: border-box;
}

.go-hit-wrap[hidden] {
  display: none !important;
}

.go-hit-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  max-height: none;
  height: auto;
  /* Full obstacle always visible — never crop wide/tall art */
  object-fit: contain;
  object-position: center;
  background: #f3f3f5;
}

.go-hit-file {
  display: none !important;
}

/* Rank under “You stayed centered until …” — single line */
.go-rank {
  margin: 5px 0 0;
  font-size: 0.7rem;
  font-style: italic;
  color: #777;
  letter-spacing: 0.01em;
  line-height: 1.2;
  max-width: none;
  white-space: nowrap;
}

/* Year / progress */
.go-year-progress {
  width: 100%;
  max-width: 210px;
  margin: 0 auto;
}

.go-year-progress[hidden] {
  display: none !important;
}

.go-year-progress-num {
  display: block;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  /* sit a little higher in the card */
  margin: 0 0 5px;
  color: #111;
}

.go-year-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #ececf0;
  overflow: hidden;
  margin: 0 auto;
  max-width: 170px;
}

.go-year-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6bff, #6b4fd8 45%, #e11d1d);
}

.go-year-bar-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.go-year-progress-sub {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: #333;
  line-height: 1.3;
}

.go-year-progress .go-rank {
  margin-top: 5px;
}

.panel-gameover .result-year {
  margin: 0;
}

/* Try again under year stats */
.panel-gameover .go-col-right .go-actions {
  margin-top: 10px;
}

/* Share under Try again — X + first line; hashtag centered under that text */
.go-share {
  display: inline-flex;
  align-items: flex-start; /* X logo lines up with “Screenshot…” row */
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 2px;
}

.go-share-x {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: #111;
  display: block;
  opacity: 0.9;
  /* Optical vertical center with first line of text */
  margin-top: 0.12em;
}

.go-share-copy {
  display: flex;
  flex-direction: column;
  align-items: center; /* #staycentered centered under the line above */
  gap: 1px;
  min-width: 0;
  max-width: 100%;
}

.go-share-text,
.go-share-hashtag {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #222;
  text-align: center;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.55);
  text-underline-offset: 2px;
  text-decoration-thickness: 1.15px;
  white-space: nowrap;
}

.go-share-hashtag {
  font-weight: 700;
  color: #111;
}

.go-share-hashtag strong {
  font-weight: 700;
  color: inherit;
  text-decoration: inherit;
}

/* Click-anywhere hint removed from UI (card still clickable) */
.go-restart-hint {
  display: none !important;
}

.go-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0;
}

.go-actions #retry-btn {
  min-width: 132px;
  padding: 10px 26px;
  font-size: 0.95rem;
}

.go-actions #retry-btn.is-locked,
.go-actions #retry-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   Sound-on prompt (after controls)
   Flow: lasers → title → blurb → centered speaker → OK → pointing man corner
   ========================================================================== */
.panel-sound {
  position: relative;
  width: min(380px, 100%);
  padding: 36px 22px 20px;
  text-align: center;
  overflow: hidden;
}

.panel-sound h1 {
  position: relative;
  z-index: 2;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.45rem;
  margin: 0 0 8px;
}

.sound-blurb {
  position: relative;
  z-index: 2;
  max-width: 18em;
  margin: 0 auto 16px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #444;
}

/* In-game style black towers + blue/red sweeping laser beams (top corners) */
.sound-stage-lasers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sound-laser {
  position: absolute;
  top: 8px;
  width: 14px;
  height: 44px;
}

.sound-laser-left {
  left: 16px;
}

.sound-laser-right {
  right: 16px;
}

/* Black spotlight / lattice tower blocks */
.sound-laser-tower {
  position: absolute;
  top: 0;
  left: 50%;
  width: 11px;
  height: 40px;
  margin-left: -5.5px;
  background:
    linear-gradient(
      180deg,
      #3a3a3e 0%,
      #1a1a1c 12%,
      #2a2a2e 12%,
      #2a2a2e 100%
    );
  border: 1.25px solid #111;
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.sound-laser-tower::before,
.sound-laser-tower::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  height: 1px;
  background: rgba(0, 0, 0, 0.55);
}

.sound-laser-tower::before {
  top: 30%;
}

.sound-laser-tower::after {
  top: 60%;
}

/* Pivot at BOTTOM of tower — beams fire downward from the fitting */
.sound-laser-pivot {
  position: absolute;
  top: 40px; /* matches tower height — flush with bottom of black block */
  left: 50%;
  width: 0;
  height: 0;
  z-index: 1;
}

/*
  Concert beam: thick at origin, fades to tip.
  0° = right; 90° = down. Beams hang from pivot pointing down.
*/
.sound-laser-beam {
  position: absolute;
  top: -5px;
  left: 0;
  width: 130px;
  height: 10px;
  transform-origin: 0 50%;
  border-radius: 2px 999px 999px 2px;
  clip-path: polygon(0 0, 100% 38%, 100% 62%, 0 100%);
  will-change: transform, opacity;
}

.sound-laser-beam.sound-beam-b {
  top: -3.5px;
  width: 105px;
  height: 7px;
  opacity: 0.78;
}

/* Blue — left tower, from bottom, pointing down (≈90°) */
.sound-laser-left .sound-laser-beam {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(47, 107, 255, 0.95) 8%,
    rgba(47, 107, 255, 0.55) 38%,
    rgba(47, 107, 255, 0.18) 72%,
    rgba(47, 107, 255, 0) 100%
  );
  box-shadow:
    0 0 6px 1px rgba(47, 107, 255, 0.65),
    0 0 16px 2px rgba(47, 107, 255, 0.35);
}

/* Primary blue sweeps one way; secondary opposite + different speed */
.sound-laser-left .sound-beam-a {
  animation: sound-sweep-blue-a 2.1s ease-in-out infinite alternate;
}

.sound-laser-left .sound-beam-b {
  animation: sound-sweep-blue-b 1.55s ease-in-out infinite alternate;
  animation-delay: -0.55s;
}

/* Red — right tower, from bottom, pointing down (≈90°) */
.sound-laser-right .sound-laser-beam {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(225, 29, 29, 0.95) 8%,
    rgba(225, 29, 29, 0.55) 38%,
    rgba(225, 29, 29, 0.18) 72%,
    rgba(225, 29, 29, 0) 100%
  );
  box-shadow:
    0 0 6px 1px rgba(225, 29, 29, 0.65),
    0 0 16px 2px rgba(225, 29, 29, 0.35);
}

.sound-laser-right .sound-beam-a {
  animation: sound-sweep-red-a 1.9s ease-in-out infinite alternate;
  animation-delay: -0.3s;
}

.sound-laser-right .sound-beam-b {
  animation: sound-sweep-red-b 2.35s ease-in-out infinite alternate;
  animation-delay: -1.1s;
}

/* Downward sweep around 90° — left beams slightly favor left-of-down */
@keyframes sound-sweep-blue-a {
  0% {
    transform: rotate(72deg);
    opacity: 0.7;
  }
  100% {
    transform: rotate(108deg);
    opacity: 1;
  }
}

@keyframes sound-sweep-blue-b {
  0% {
    transform: rotate(105deg);
    opacity: 0.55;
  }
  100% {
    transform: rotate(78deg);
    opacity: 0.9;
  }
}

/* Right beams: opposite order, slightly favor right-of-down */
@keyframes sound-sweep-red-a {
  0% {
    transform: rotate(108deg);
    opacity: 1;
  }
  100% {
    transform: rotate(72deg);
    opacity: 0.7;
  }
}

@keyframes sound-sweep-red-b {
  0% {
    transform: rotate(78deg);
    opacity: 0.55;
  }
  100% {
    transform: rotate(105deg);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sound-laser-left .sound-beam-a {
    animation: none;
    transform: rotate(88deg);
    opacity: 0.9;
  }
  .sound-laser-left .sound-beam-b {
    animation: none;
    transform: rotate(98deg);
    opacity: 0.7;
  }
  .sound-laser-right .sound-beam-a {
    animation: none;
    transform: rotate(92deg);
    opacity: 0.9;
  }
  .sound-laser-right .sound-beam-b {
    animation: none;
    transform: rotate(82deg);
    opacity: 0.7;
  }
}

/* Speaker: center stack under title/copy, above OK */
.panel-sound .sound-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: #f4f4f7;
  border: 2.5px solid #111;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

.panel-sound .sound-icon {
  display: block;
  width: 36px;
  height: 36px;
}

.panel-sound #sound-ok-btn {
  position: relative;
  z-index: 2;
  min-width: 160px;
  margin: 0 auto 8px;
}

/* Pointing man: bottom-right, arm aims toward the centered icon */
.sound-pointer-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 118px;
  height: 128px;
  pointer-events: none;
  z-index: 1;
}

.sound-pointer {
  position: absolute;
  right: 0;
  bottom: -2px;
  width: 118px;
  height: auto;
  max-height: 128px;
  object-fit: contain;
  object-position: right bottom;
  display: block;
  /* Pure black line art — no fade / grey wash */
  opacity: 1;
  filter: none;
  image-rendering: auto;
}

@media (max-height: 500px) and (orientation: landscape) {
  /* Narrower card — also re-asserted after .panel in the landscape block below */
  .panel.panel-sound,
  .panel-sound {
    width: min(240px, 52vw) !important;
    max-width: 52vw !important;
    padding: 14px 10px 10px !important;
    max-height: min(94dvh, 94vh);
  }

  .panel-sound h1 {
    font-size: 1.1rem;
    margin-bottom: 4px;
  }

  .sound-blurb {
    font-size: 0.78rem;
    margin-bottom: 10px;
    max-width: 16em;
  }

  .panel-sound .sound-icon-wrap {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .panel-sound .sound-icon {
    width: 28px;
    height: 28px;
  }

  .sound-laser {
    top: 4px;
    height: 34px;
  }

  /* Pull towers in so beams sit nearer the title */
  .sound-laser-left {
    left: 8px;
  }

  .sound-laser-right {
    right: 8px;
  }

  .sound-laser-tower {
    height: 30px;
    width: 9px;
    margin-left: -4.5px;
  }

  .sound-laser-pivot {
    top: 30px; /* bottom of shorter landscape tower */
  }

  .sound-laser-beam {
    width: 72px;
    height: 7px;
    top: -4px;
  }

  .sound-laser-beam.sound-beam-b {
    width: 58px;
    height: 5px;
  }

  .sound-pointer-wrap {
    width: 80px;
    height: 88px;
  }

  .sound-pointer {
    width: 80px;
    max-height: 92px;
    bottom: -2px;
  }
}

/* Game-over corner mascot removed — YOU face lives in the center column */
.go-mascot {
  display: none !important;
}

@media (max-width: 560px) {
  .panel-gameover {
    width: min(100%, 480px);
    padding: 14px 12px 10px;
  }

  .go-layout {
    gap: 8px 12px;
  }

  .go-hit-wrap {
    width: 112px;
    max-width: 112px;
    padding: 6px 6px 8px;
  }

  .panel-gameover .go-detail {
    max-width: 12.8em;
    font-size: 0.6rem;
  }

  .go-year-progress-num {
    font-size: 1.95rem;
  }

  .go-mascot {
    width: 46px;
    max-height: 60px;
  }

  .go-mascot-left {
    left: 10px;
    bottom: 10px;
  }
}

/* Very narrow portrait: stack (game prefers landscape) */
@media (max-width: 420px) and (orientation: portrait) {
  .go-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .go-col-left,
  .go-col-you,
  .go-col-right {
    padding: 0;
  }

  .panel-gameover .go-detail {
    max-width: 13em;
    text-align: center;
    color: #333;
    font-size: 0.7rem;
  }

  .go-mascot {
    width: 44px;
    max-height: 56px;
  }

  .go-mascot-left {
    left: 10px;
    bottom: 10px;
  }
}

.panel-select {
  width: min(420px, 100%);
  max-height: min(92vh, 720px);
  overflow: auto;
  padding: 22px 20px 24px;
}

.panel-wizard {
  width: min(420px, 96%);
  position: relative;
  /* side pad so 3 center faces clear the card edge */
  padding-left: 18px;
  padding-right: 18px;
  /* room for bottom-left arrow without crowding the hint */
  padding-bottom: 28px;
  box-sizing: border-box;
}

.step-meta {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 4px;
}

.wizard-picks {
  margin: 0 auto 8px;
}

.wizard-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

.wizard-actions:empty,
.wizard-actions:not(:has(button:not([hidden]))) {
  display: none;
}

.wizard-actions button {
  min-width: 110px;
}

/* Small black left arrow — bottom-left of select panel (all 3 steps) */
.wizard-back-arrow {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent !important;
  color: #111 !important;
  cursor: pointer;
  line-height: 0;
  box-shadow: none !important;
}

.wizard-back-arrow:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  filter: none;
}

.wizard-back-arrow:active {
  transform: scale(0.94);
  background: rgba(0, 0, 0, 0.1) !important;
}

.wizard-back-arrow svg {
  display: block;
  width: 18px;
  height: 18px;
}

.wizard-back-arrow[hidden] {
  display: none !important;
}

.panel h1 {
  font-size: 1.55rem;
  margin-bottom: 6px;
}

.blurb {
  font-size: 0.95rem;
  line-height: 1.45;
  color: #333;
  margin-bottom: 14px;
}

.select-blurb {
  margin-bottom: 16px;
}

.controls {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #555;
  margin-bottom: 20px;
}

.select-hint {
  margin-top: 14px;
  margin-bottom: 16px;
  font-size: 0.78rem;
}

.result-year {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
}

/* Character select — two circular faces side by side, name under each */
.select-group {
  background: transparent;
  border-radius: 0;
  padding: 4px 0 0;
  border: none;
  text-align: center;
}

.select-heading {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 10px; /* more space under 1 / 3 step meta */
  margin-bottom: 16px;
  text-align: center;
  line-height: 1.15;
}

/* e.g. (YOU) under CENTERED */
.select-heading-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.72;
  text-transform: none; /* keep “(YOU)” as written */
}

.select-heading.left-h {
  color: #2f6bff;
}

.select-heading.center-h {
  color: #444;
}

.select-heading.right-h {
  color: #c41818;
}

.pick-grid {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: nowrap;
  padding: 0 4px;
  box-sizing: border-box;
  width: 100%;
}

.pick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: auto;
  min-width: 88px;
  max-width: 112px;
  padding: 6px 4px 2px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: transparent;
  color: #111;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: center;
  box-shadow: none;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
  flex: 0 1 auto;
}

.pick-card .pick-avatar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
  padding: 0;
}

/* Inner plate fills the circle so coloured ring stays thin (like start screen) */
.pick-card .pick-avatar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #f0f0f2;
  overflow: hidden;
}

.pick-card img {
  /* Face inset inside the plate — not part of the ring */
  width: 78%;
  height: 78%;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

/* Role rings — solid 2px (same as start-screen side faces) */
.select-group.role-left .pick-card .pick-avatar {
  border: 2px solid #2f6bff;
}

.select-group.role-right .pick-card .pick-avatar {
  border: 2px solid #c41818;
}

/* Centered: thin half-red / half-blue ring only (padding = ring thickness) */
.select-group.role-center .pick-card .pick-avatar {
  border: none;
  padding: 2px;
  background: linear-gradient(90deg, #c41818 0 50%, #2f6bff 50% 100%);
  overflow: hidden;
}

.select-group.role-center .pick-card .pick-avatar-inner {
  width: 100%;
  height: 100%;
}

.pick-card .pick-name {
  flex: none;
  line-height: 1.2;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap; /* e.g. "Far Right JD" stays one line */
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pick-card .pick-name-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.4);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Greyed-out future option (e.g. Your X) — not selectable */
.pick-card.is-coming-soon {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.35);
  pointer-events: none;
}

.pick-card.is-coming-soon .pick-avatar {
  border-color: rgba(0, 0, 0, 0.12) !important;
  background: #d8d8dc !important;
  box-shadow: none !important;
}

.pick-card.is-coming-soon .pick-avatar-inner {
  background: #e4e4e8;
}

.pick-card.is-coming-soon:hover .pick-avatar {
  transform: none;
}

.pick-card:hover .pick-avatar {
  transform: scale(1.03);
}

.pick-card:active {
  transform: scale(0.97);
}

.pick-card.is-coming-soon:active {
  transform: none;
}

/* Selected: soft glow in role colour (ring colour unchanged) */
.select-group.role-left .pick-card.is-selected .pick-avatar {
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.22), 0 6px 16px rgba(0, 0, 0, 0.1);
}

.select-group.role-right .pick-card.is-selected .pick-avatar {
  box-shadow: 0 0 0 3px rgba(196, 24, 24, 0.2), 0 6px 16px rgba(0, 0, 0, 0.1);
}

.select-group.role-center .pick-card.is-selected .pick-avatar {
  box-shadow: 0 0 0 3px rgba(100, 80, 160, 0.2), 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* (wizard secondary back pill removed — use .wizard-back-arrow) */

#start-btn[hidden] {
  display: none !important;
}

.btn-secondary {
  background: #e8e8ec;
  color: #111;
}

button {
  appearance: none;
  border: none;
  background: #111;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
}

button:active {
  transform: scale(0.98);
}

button.is-faded,
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

@media (max-width: 700px) {
  .panel-select {
    max-height: 92vh;
  }

  .pick-card .pick-avatar {
    width: 84px;
    height: 84px;
  }

  .pick-grid {
    gap: 20px;
  }
}

.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f1115;
  color: #fff;
  text-align: center;
  padding: 24px;
}

.rotate-hint[hidden] {
  display: none !important;
}

.rotate-hint-inner .phone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: tilt 1.4s ease-in-out infinite;
}

.rotate-hint p {
  font-size: 1.15rem;
  font-weight: 600;
}

.rotate-hint .sub {
  margin-top: 6px;
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.7;
}

@keyframes tilt {
  0%,
  100% {
    transform: rotate(0deg);
  }
  40% {
    transform: rotate(90deg);
  }
  60% {
    transform: rotate(90deg);
  }
}

/*
  Landscape gate — only after mobile name is collected (body.require-landscape).
  Portrait name entry / title stay usable until then.
*/
@media (orientation: portrait) and (max-width: 900px) {
  body.require-landscape .rotate-hint,
  body.require-landscape .rotate-hint[hidden] {
    display: flex !important;
  }

  body.require-landscape #game,
  body.require-landscape .hud,
  body.require-landscape .overlay,
  body.require-landscape .title-overlay,
  body.require-landscape .controls-bar,
  body.require-landscape #fs-overlay {
    visibility: hidden !important;
  }

  /* Before name is done: never force landscape */
  body:not(.require-landscape) .rotate-hint {
    display: none !important;
  }
}

/* ==========================================================================
   Landscape phone / short viewport — fit ALL popups without scrolling
   (mobile.html iframe + real devices)
   ========================================================================== */
@media (orientation: landscape) and (max-height: 500px) {
  .overlay {
    padding: 6px 8px;
    align-items: center;
    justify-content: center;
  }

  .panel,
  .panel-controls {
    width: min(92vw, 560px) !important;
    max-width: 92vw;
    max-height: min(96dvh, 96vh);
    overflow: hidden; /* no vertical scroll on popups */
    padding: 10px 14px 10px;
    border-radius: 12px;
    box-sizing: border-box;
  }

  /*
    Sound prompt: much narrower on mobile landscape.
    Must beat the general .panel width above (.panel.panel-sound).
  */
  .panel.panel-sound,
  .panel-sound {
    width: min(240px, 52vw) !important;
    max-width: 52vw !important;
    min-width: 0 !important;
    padding: 14px 10px 10px !important;
    max-height: min(94dvh, 94vh);
  }

  .panel-sound .sound-blurb,
  .panel-sound .sound-blurb.blurb {
    max-width: 14em !important;
    font-size: 0.74rem !important;
    margin-bottom: 8px !important;
  }

  .panel-sound h1 {
    font-size: 1.05rem !important;
  }

  .sound-laser-left {
    left: 6px !important;
  }

  .sound-laser-right {
    right: 6px !important;
  }

  .sound-laser-beam {
    width: 56px !important;
  }

  .sound-laser-beam.sound-beam-b {
    width: 46px !important;
  }

  /* Title: keep overflow visible so blue spectrum can reach the left screen edge */
  .title-panel {
    width: min(92vw, 560px) !important;
    max-width: 92vw;
    max-height: min(96dvh, 96vh);
    overflow: visible !important;
    padding: 10px 14px 10px;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .title-spectrum-blue {
    /* Force full extend on short landscape (mobile frame) */
    animation: title-blue-extend 5.6s ease-out 0.35s forwards;
  }

  /* Character select: tighter / more square — less side white space */
  .panel-select,
  .panel-wizard {
    width: min(52vw, 300px) !important;
    max-width: 52vw;
    max-height: min(96dvh, 96vh);
    overflow: hidden;
    padding: 10px 14px 10px !important;
    border-radius: 12px;
    box-sizing: border-box;
  }

  /* Game-over: short landscape phones */
  .panel-gameover {
    width: min(88vw, 500px) !important;
    max-width: 88vw;
    max-height: min(94dvh, 94vh);
    overflow: hidden !important; /* keep mascot inside rounded bevel */
    padding: 10px 12px 8px !important;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .go-layout {
    gap: 6px 12px !important;
    padding: 0 2px !important;
    align-items: center !important;
  }

  .panel-gameover .go-detail {
    font-size: 0.66rem !important;
    max-width: 12em !important;
    color: #333 !important;
    margin: 2px 0 0 !important;
  }

  .go-layout {
    gap: 4px 8px !important;
  }

  .go-hit-wrap {
    width: 100px !important;
    max-width: 100px !important;
    padding: 5px 5px 7px !important;
  }

  .go-hit-image {
    max-height: none !important;
  }

  .panel-gameover .go-detail {
    max-width: 12.5em !important;
    font-size: 0.58rem !important;
    line-height: 1.25 !important;
  }

  .go-rank {
    font-size: 0.62rem !important;
    white-space: nowrap !important;
  }

  .go-year-progress-num {
    font-size: 1.55rem !important;
    margin-bottom: 4px !important;
  }

  .go-year-bar {
    height: 8px !important;
    max-width: 140px !important;
  }

  .go-year-progress-sub {
    margin-top: 4px !important;
    font-size: 0.7rem !important;
  }

  .go-actions #retry-btn {
    padding: 7px 18px !important;
    font-size: 0.85rem !important;
    min-width: 110px !important;
  }

  .go-share {
    margin-top: 8px !important;
    gap: 5px !important;
  }

  .go-share-text,
  .go-share-hashtag {
    font-size: 0.65rem !important;
    white-space: nowrap !important;
  }

  .go-share-x {
    width: 12px !important;
    height: 12px !important;
  }

  .go-you-avatar {
    width: 52px !important;
    height: 52px !important;
  }

  .go-you-label {
    display: none !important;
  }

  .go-layout {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.05fr) !important;
    gap: 2px 8px !important;
  }

  .go-hit-wrap {
    width: 100px !important;
    max-width: 100px !important;
    padding: 5px 5px 7px !important;
  }

  .panel-gameover .go-detail {
    max-width: 12.5em !important;
    width: 100% !important;
    font-size: 0.58rem !important;
    line-height: 1.25 !important;
  }

  .title-panel {
    padding: 10px 16px 12px;
  }

  .title-cast {
    gap: 12px;
    margin-bottom: 10px;
  }

  .title-cast-left,
  .title-cast-right {
    width: 48px;
    height: 48px;
    border-width: 1.5px;
  }

  .title-cast-center {
    width: 68px;
    height: 68px;
    padding: 1.5px; /* match thinner side rings */
  }

  .title-cast-face img,
  .title-cast-center img {
    width: 78%;
    height: 78%;
  }

  .title-cast-left img {
    width: 96%;
    height: 96%;
    object-position: 38% 48%;
    transform: scale(1.08);
  }

  .game-title {
    font-size: 1.45rem;
    margin-bottom: 4px;
  }

  .mode-badge,
  .mode-blurb {
    display: none !important;
  }

  .game-subtitle {
    font-size: 0.9rem;
    margin-bottom: 18px; /* clear space above Play Game on short landscape */
  }

  .title-disclaimer-short {
    max-width: min(48em, 94vw);
    width: min(48em, 94vw);
    margin: 8px auto 1px;
    font-size: 0.58rem;
    line-height: 1.35;
  }

  /* Mobile only — a few notches smaller than desktop */
  .title-disclaimer-link {
    font-size: 0.52rem !important;
    padding: 1px 6px 3px !important;
    letter-spacing: 0.01em;
  }

  .panel-disclaimer {
    max-height: min(88dvh, 88vh);
    padding: 12px 14px 12px;
    overflow: auto;
  }

  .panel-disclaimer h1 {
    font-size: 1.05rem;
    margin-bottom: 6px;
  }

  .disclaimer-body {
    font-size: 0.72rem;
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .title-spectrum {
    margin: 6px auto 8px;
  }

  .panel h1,
  .panel-brand {
    font-size: 1.05rem;
    margin-bottom: 2px;
  }

  .step-meta {
    margin-bottom: 2px;
    font-size: 0.72rem;
  }

  .select-blurb,
  .panel .blurb {
    font-size: 0.88rem !important;
    max-width: 22em;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.3;
  }

  .panel-gameover .go-detail {
    max-width: 12em !important;
    font-size: 0.68rem !important;
    color: #333 !important;
  }

  .wizard-picks {
    margin: 2px 0 0;
  }

  .select-heading {
    font-size: 1.05rem;
    margin-top: 6px;
    margin-bottom: 8px;
  }

  .pick-card img {
    width: 78% !important;
    height: 78% !important;
  }

  .select-group.role-center .pick-card .pick-avatar {
    padding: 2px !important;
  }

  .pick-grid {
    gap: 12px;
    flex-wrap: nowrap;
  }

  .pick-card {
    min-width: 64px;
    max-width: 88px;
    padding: 2px;
    gap: 6px;
  }

  .pick-card .pick-avatar {
    width: 56px !important;
    height: 56px !important;
    border-width: 2px;
  }

  .pick-card .pick-name {
    font-size: 0.68rem;
    white-space: nowrap;
  }

  .pick-card .pick-name-sub {
    font-size: 0.55rem !important;
  }

  .select-hint,
  .controls {
    font-size: 0.7rem;
    margin: 4px 0 4px;
  }

  .wizard-actions {
    margin-top: 2px;
    gap: 8px;
  }

  .wizard-actions button,
  .panel button,
  .title-panel button {
    padding: 8px 18px;
    font-size: 0.9rem;
  }

  .panel-wizard {
    padding-bottom: 26px !important;
  }

  .wizard-back-arrow {
    left: 8px;
    bottom: 6px;
    width: 28px;
    height: 28px;
  }

  .wizard-back-arrow svg {
    width: 16px;
    height: 16px;
  }

  /* Don't apply pill button padding to the arrow */
  .panel .wizard-back-arrow {
    padding: 0 !important;
    min-width: 0 !important;
    background: transparent !important;
    color: #111 !important;
  }

  /* Controls explainer: single column (platform filtered by JS) */
  .controls-columns {
    display: block;
    text-align: left;
  }

  .controls-col h2 {
    font-size: 0.78rem;
    margin-bottom: 2px;
  }

  .controls-col ul {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .controls-note {
    margin: 6px 0 8px;
    font-size: 0.75rem;
  }

  /* Game-over landscape styles live in the main block above;
     short-landscape overrides are under .panel-gameover in this media query. */

  .hud {
    font-size: 12px;
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .hud-left,
  .hud-right {
    padding: 4px 8px;
  }

  /* Thumb layout: Jump left-ish; ← blue / → red cluster on the right.
     Taller + slightly higher for easier thumb reach (height only). */
  .controls-bar {
    justify-content: flex-start;
    align-items: flex-end;
    gap: 12px;
    /* Extra bottom pad lifts the bar; safe-area still respected */
    padding: 8px max(96px, 15vw) max(22px, calc(env(safe-area-inset-bottom) + 14px))
      max(52px, 11vw);
    background: linear-gradient(to top, rgba(15, 17, 21, 0.22), transparent);
  }

  .controls-bar .control-btn {
    min-width: 0;
    min-height: 62px;
    padding: 16px 16px;
    font-size: 0.92rem;
    border-radius: 14px;
    flex: 0 0 auto;
  }

  .controls-bar .jump-btn {
    order: 1;
    margin-right: auto;
    min-width: 138px;
    max-width: 180px;
    min-height: 64px;
    padding-left: 28px;
    padding-right: 28px;
    padding-top: 17px;
    padding-bottom: 17px;
  }

  .controls-bar .run-btn {
    order: 2;
    flex: 0 0 auto;
    min-width: 92px;
    max-width: 120px;
    min-height: 64px;
    padding-left: 18px;
    padding-right: 18px;
    padding-top: 17px;
    padding-bottom: 17px;
  }

  #run-btn {
    order: 2;
  }

  #right-btn {
    order: 3;
  }
}

/* Slightly taller landscape phones (e.g. 430px high) */
@media (orientation: landscape) and (min-height: 501px) and (max-height: 520px) and (max-width: 1000px) {
  .panel-select,
  .panel-wizard,
  .panel-gameover,
  .panel-controls,
  .title-panel {
    max-height: min(94dvh, 94vh);
    overflow: hidden;
  }

  .controls-bar {
    justify-content: flex-start;
  }

  .controls-bar .jump-btn {
    order: 1;
    margin-right: auto;
  }

  #run-btn {
    order: 2;
  }

  #right-btn {
    order: 3;
  }
}
