:root {
  --bg: #000;
  --white: #fff;
  --red: #a0120b;
  --red-bright: #cf1d14;
  --yellow: #f8fb55;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  overflow: hidden;
}

body {
  min-height: 0;
  height: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.game-app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(44, 58, 76, 0.42), transparent 34%),
    radial-gradient(circle at 50% 120%, rgba(65, 10, 10, 0.28), transparent 36%),
    #000;
}

.screen {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.loader-screen {
  display: grid;
  place-items: center;
  padding: 20px;
}

.loader-card {
  width: min(92vw, 540px);
  padding: 30px 26px;
  text-align: center;
  border: 4px solid rgba(255,255,255,0.9);
  border-radius: 20px;
  background: rgba(7,7,7,0.94);
  box-shadow: 0 0 28px rgba(255,255,255,0.1);
}

.loader-title {
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.loader-subtitle {
  margin-top: 10px;
  font: 700 clamp(0.95rem, 2.6vw, 1.3rem)/1.4 Arial, sans-serif;
  color: rgba(255,255,255,0.8);
}

.loader-dots {
  margin-top: 18px;
  display: inline-flex;
  gap: 10px;
}

.loader-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red-bright);
  animation: pulseDot 0.9s infinite ease-in-out;
}

.loader-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loader-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.home-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(8px, 1.2vh, 14px);
  padding: calc(10px + var(--safe-top)) 16px calc(84px + var(--safe-bottom));
}

.home-top {
  position: relative;
  z-index: 2;
  width: min(96vw, 1300px);
  text-align: center;
}

.game-title {
  margin: 0;
  line-height: 0.82;
  letter-spacing: clamp(1px, 0.45vw, 8px);
  color: #fff;
  text-transform: uppercase;
  font-size: clamp(2.35rem, 9.5vw, 7.8rem);
  text-shadow: 0 5px 0 rgba(255,255,255,0.14), 0 0 18px rgba(255,255,255,0.11);
  transform: scaleX(1.04);
}

.title-tail {
  display: block;
  margin-top: clamp(4px, 1vh, 10px);
  font-size: clamp(1.1rem, 4vw, 3rem);
  letter-spacing: clamp(1px, 0.2vw, 4px);
}

.home-copy {
  max-width: min(1000px, 95vw);
  margin: clamp(8px, 1.1vh, 16px) auto 0;
  text-align: center;
  font-size: clamp(1rem, 3vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: clamp(0.4px, 0.12vw, 2px);
  color: #fff;
}

.home-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  place-items: center;
  width: min(96vw, 1100px);
  min-height: 0;
}

.home-ghost-selector {
  position: relative;
  width: min(60vw, 480px);
  min-width: 210px;
  aspect-ratio: 0.82 / 1;
  display: grid;
  place-items: center;
}

.home-ghost-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.home-ghost {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.16));
  animation: floatGhost 2.7s ease-in-out infinite;
}

.home-ghost-text {
  position: absolute;
  inset: 22% 12% 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 0.95;
  color: rgba(70,70,70,0.88);
  font-size: clamp(1.1rem, 4.2vmin, 3.1rem);
  letter-spacing: 1px;
  pointer-events: none;
}

.home-ghost-text .chosen-number {
  color: #000;
  font-size: clamp(3rem, 10vmin, 7rem);
  line-height: 0.82;
  margin-top: clamp(5px, 1.5vmin, 12px);
}

.arrow-btn {
  position: absolute;
  z-index: 6;
  top: 58%;
  transform: translateY(-50%);
  width: clamp(60px, 9.3vmin, 110px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: clamp(4px, 0.7vmin, 8px) solid #fff;
  background: rgba(0,0,0,0.8);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.05), 0 0 18px rgba(255,255,255,0.1);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.arrow-left {
  left: clamp(-54px, -4vw, -12px);
}

.arrow-right {
  right: clamp(-54px, -4vw, -12px);
}

.arrow-btn:active {
  transform: translateY(-48%) scale(0.97);
}

.play-big:active,
.red-menu-btn:active,
.end-btn:active {
  transform: scale(0.97);
}

.arrow-btn:hover,
.arrow-btn:focus-visible,
.play-big:hover,
.play-big:focus-visible,
.red-menu-btn:hover,
.red-menu-btn:focus-visible,
.end-btn:hover,
.end-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(248,251,85,0.22), 0 0 22px rgba(255,255,255,0.2);
}

.triangle {
  width: 0;
  height: 0;
  border-top: clamp(18px, 3.5vmin, 42px) solid transparent;
  border-bottom: clamp(18px, 3.5vmin, 42px) solid transparent;
}

.triangle.left {
  border-right: clamp(28px, 5.5vmin, 60px) solid var(--red);
  transform: translateX(-4px);
}

.triangle.right {
  border-left: clamp(28px, 5.5vmin, 60px) solid var(--red);
  transform: translateX(4px);
}

.home-actions {
  position: absolute;
  right: clamp(12px, 2vw, 36px);
  bottom: calc(16px + var(--safe-bottom));
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.play-big,
.red-menu-btn,
.end-btn {
  border: 4px solid #fff;
  border-radius: 10px;
  color: var(--red-bright);
  background: rgba(0,0,0,0.85);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

.play-big {
  min-width: clamp(160px, 15vw, 280px);
  padding: 10px 18px;
  font-size: clamp(2rem, 4.8vw, 4.7rem);
  line-height: 0.9;
}

.red-menu-btn,
.end-btn {
  min-width: clamp(140px, 14vw, 240px);
  padding: 9px 16px;
  font-size: clamp(1.65rem, 4vw, 4.1rem);
  line-height: 0.9;
}

.play-big[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.link-slot {
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 7;
  width: min(92vw, 560px);
  min-height: 30px;
  text-align: center;
}

.education-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 32px;
  padding: 6px 16px;
  border: 2px solid rgba(255,255,255,0.88);
  border-radius: 999px;
  background: rgba(10,10,10,0.84);
  color: #fff;
  font: 700 0.95rem/1.2 Arial, sans-serif;
  text-decoration: none;
}

.link-warning {
  position: absolute;
  left: 50%;
  bottom: calc(48px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 8;
  display: none;
  padding: 10px 16px;
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  background: rgba(120,0,0,0.84);
  color: #fff;
  font: 700 0.95rem/1.2 Arial, sans-serif;
  white-space: nowrap;
}

.game-app.link-blocked .link-warning {
  display: inline-flex;
}

.decor-ghost {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  opacity: 0.72;
}

.decor-ghost svg {
  width: 100%;
  height: auto;
}

.decor-ghost.one {
  width: clamp(90px, 15vw, 176px);
  left: 12%;
  top: 12%;
  transform: rotate(-9deg);
}

.decor-ghost.two {
  width: clamp(70px, 11vw, 132px);
  right: 35%;
  top: 10%;
  transform: rotate(18deg);
}

.crosshair {
  position: absolute;
  width: clamp(52px, 8vmin, 88px);
  aspect-ratio: 1;
  pointer-events: none;
  z-index: 2;
  border: 2px solid var(--yellow);
  border-radius: 50%;
  opacity: 0.92;
  filter: drop-shadow(0 0 4px rgba(248,251,85,0.35));
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: var(--yellow);
}

.crosshair::before {
  left: 50%;
  top: -18%;
  width: 2px;
  height: 136%;
  transform: translateX(-50%);
}

.crosshair::after {
  top: 50%;
  left: -18%;
  width: 136%;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair .ring {
  position: absolute;
  inset: 23%;
  border: 2px solid var(--yellow);
  border-radius: 50%;
}

.home-screen .crosshair {
  right: 26%;
  top: 35%;
}

.play-screen {
  padding: 0;
  cursor: none;
}

.hud {
  position: absolute;
  inset: calc(8px + var(--safe-top)) clamp(10px, 2vw, 28px) auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  pointer-events: none;
}

.target-pill {
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 9px 12px;
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 10px;
  background: rgba(0,0,0,0.72);
  pointer-events: none;
}

.target-pill span:first-child,
.hud-label {
  margin-bottom: 2px;
  color: rgba(255,255,255,0.7);
  font: 700 clamp(0.65rem, 1.25vw, 1.05rem) Arial, sans-serif;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.target-pill span:last-child {
  color: #fff;
  font-size: clamp(1.2rem, 3vw, 2.5rem);
  line-height: 1;
}

.hud-center {
  text-align: center;
  min-width: clamp(84px, 13vw, 220px);
}

.score-display {
  color: #ff1111;
  font-size: clamp(3.1rem, 9.4vw, 8rem);
  line-height: 0.9;
  text-shadow: 0 0 14px rgba(255,0,0,0.35);
}

.game-menu {
  justify-self: end;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.game-menu .red-menu-btn {
  min-width: clamp(104px, 14vw, 200px);
  font-size: clamp(1.28rem, 3vw, 3.2rem);
  padding: 7px 13px;
}

.timer {
  position: absolute;
  right: clamp(10px, 3.5vw, 56px);
  bottom: calc(16px + var(--safe-bottom));
  z-index: 15;
  color: #ff1515;
  font-size: clamp(1.9rem, 5vw, 4.7rem);
  line-height: 1;
  text-shadow: 0 0 13px rgba(255,0,0,0.32);
  pointer-events: none;
}

.timer .small {
  font-size: 0.55em;
  margin-inline: 0.14em 0.5em;
  color: #d81414;
}

.pointer-aim {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: clamp(42px, 6vmin, 70px);
  aspect-ratio: 1;
  border: 2px solid var(--yellow);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 4px rgba(248,251,85,0.35));
}

.pointer-aim.is-visible {
  opacity: 0.95;
}

.pointer-aim::before,
.pointer-aim::after {
  content: "";
  position: absolute;
  background: var(--yellow);
}

.pointer-aim::before {
  left: 50%;
  top: -18%;
  width: 2px;
  height: 136%;
  transform: translateX(-50%);
}

.pointer-aim::after {
  top: 50%;
  left: -18%;
  width: 136%;
  height: 2px;
  transform: translateY(-50%);
}

.pointer-aim .ring {
  position: absolute;
  inset: 25%;
  border: 2px solid var(--yellow);
  border-radius: 50%;
}

.ghost-layer {
  position: absolute;
  inset: 0;
}

.ghost-actor {
  position: absolute;
  z-index: 8;
  width: clamp(120px, 18vmin, 220px);
  aspect-ratio: 0.82 / 1;
  display: grid;
  place-items: center;
  cursor: none;
  touch-action: manipulation;
  transform-origin: 50% 78%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.14));
  background: none;
  border: 0;
  padding: 0;
}

.ghost-actor svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ghost-actor text {
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-weight: 900;
  fill: rgba(0,0,0,0.62);
  paint-order: stroke;
  stroke: rgba(255,255,255,0.12);
  stroke-width: 1px;
}

.ghost-actor.ghost-lifecycle {
  animation: ghostLife 2s linear forwards;
}

.ghost-actor.hit {
  pointer-events: none;
  animation: ghostPop 260ms ease-in forwards;
}

.ghost-actor.bad-hit {
  pointer-events: none;
  animation: ghostShake 260ms ease-in-out;
}

.ghost-actor.timed-out {
  pointer-events: none;
}

.flash-message {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  z-index: 18;
  color: #fff;
  text-shadow: 0 3px 0 #000, 0 0 13px rgba(255,255,255,0.35);
  font-size: clamp(1.6rem, 5vw, 5rem);
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  animation: flashText 680ms ease-out;
}

.end-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,0.88);
  text-align: center;
}

.end-card {
  width: min(92vw, 760px);
  border: 5px solid #fff;
  border-radius: 18px;
  padding: clamp(22px, 4vw, 44px);
  background: #020202;
  box-shadow: 0 0 36px rgba(255,255,255,0.14);
}

.end-title {
  margin: 0 0 12px;
  color: #fff;
  font-size: clamp(2.15rem, 8vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.end-title.win {
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,0.34);
}

.end-title.fail {
  color: var(--red-bright);
  text-shadow: 0 0 15px rgba(255,0,0,0.34);
}

.end-text {
  margin: 8px auto 22px;
  color: #fff;
  font: 800 clamp(1rem, 2.6vw, 1.65rem) Arial, sans-serif;
  line-height: 1.35;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

@keyframes pulseDot {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-6px); opacity: 1; }
}

@keyframes floatGhost {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}

@keyframes ghostLife {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.86) rotate(var(--tilt, 0deg)); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(0.98) rotate(var(--tilt, 0deg)); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1.24) rotate(calc(var(--tilt, 0deg) * -0.32)); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.48) rotate(calc(var(--tilt, 0deg) + 6deg)); }
}

@keyframes ghostPop {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(var(--tilt, 0deg)); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.3) rotate(calc(var(--tilt, 0deg) + 12deg)); }
}

@keyframes ghostShake {
  0%, 100% { transform: translate(-50%, -50%) scale(1.02) translateX(0) rotate(var(--tilt, 0deg)); }
  20% { transform: translate(-50%, -50%) scale(1.05) translateX(-12px) rotate(calc(var(--tilt, 0deg) - 5deg)); }
  45% { transform: translate(-50%, -50%) scale(1.05) translateX(12px) rotate(calc(var(--tilt, 0deg) + 5deg)); }
  70% { transform: translate(-50%, -50%) scale(1.04) translateX(-8px) rotate(calc(var(--tilt, 0deg) - 3deg)); }
}

@keyframes flashText {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.85); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-28px) scale(1.08); }
}

@media (max-width: 900px) {
  .home-ghost-selector {
    width: min(74vw, 420px);
  }

  .arrow-left {
    left: -8px;
  }

  .arrow-right {
    right: -8px;
  }

  .home-actions {
    right: 50%;
    transform: translateX(50%);
    flex-direction: row;
  }

  .decor-ghost.two {
    right: 10%;
  }

  .home-screen .crosshair {
    right: 8%;
    top: 33%;
  }

  .hud {
    grid-template-columns: auto 1fr auto;
  }

  .target-pill {
    max-width: 116px;
    padding: 7px 9px;
  }

  .score-display {
    font-size: clamp(3rem, 11vw, 5.2rem);
  }
}

@media (max-width: 520px), (max-height: 480px) {
  .home-screen {
    padding-top: calc(8px + var(--safe-top));
  }

  .game-title {
    font-size: clamp(2rem, 12vw, 3.9rem);
    letter-spacing: 1px;
  }

  .title-tail {
    font-size: clamp(1rem, 5.7vw, 1.8rem);
  }

  .home-copy {
    font-size: clamp(0.92rem, 4.5vw, 1.35rem);
    max-width: 96vw;
  }

  .home-ghost-selector {
    width: min(80vw, 310px);
    min-width: 170px;
  }

  .arrow-btn {
    width: clamp(50px, 15vw, 70px);
    border-width: 4px;
  }

  .triangle {
    border-top-width: clamp(16px, 5vw, 22px);
    border-bottom-width: clamp(16px, 5vw, 22px);
  }

  .triangle.left {
    border-right-width: clamp(24px, 7vw, 32px);
  }

  .triangle.right {
    border-left-width: clamp(24px, 7vw, 32px);
  }

  .home-actions {
    gap: 8px;
    bottom: calc(42px + var(--safe-bottom));
  }

  .play-big,
  .red-menu-btn,
  .end-btn {
    border-width: 3px;
    border-radius: 7px;
  }

  .play-big {
    min-width: 118px;
    font-size: clamp(1.6rem, 7.8vw, 2.2rem);
  }

  .red-menu-btn,
  .end-btn {
    min-width: 96px;
    font-size: clamp(1.1rem, 5.8vw, 1.7rem);
  }

  .link-slot {
    bottom: calc(6px + var(--safe-bottom));
    min-height: 24px;
  }

  .education-link {
    min-width: 170px;
    padding: 5px 12px;
    font-size: 0.84rem;
  }

  .link-warning {
    bottom: calc(34px + var(--safe-bottom));
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .decor-ghost.one {
    left: 3%;
    top: 14%;
    width: 88px;
  }

  .decor-ghost.two {
    display: none;
  }

  .crosshair {
    width: 50px;
  }

  .home-screen .crosshair {
    top: 42%;
    right: 4%;
  }

  .play-screen .crosshair {
    right: 10%;
    top: 50%;
  }

  .game-menu .red-menu-btn {
    min-width: 76px;
    padding: 6px 8px;
  }

  .timer {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
  }

  .ghost-actor {
    width: clamp(95px, 29vmin, 150px);
  }
}

@media (max-height: 420px) {
  .home-copy {
    display: none;
  }

  .home-ghost-selector {
    width: min(42vh, 240px);
  }

  .home-actions {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    transform: none;
    flex-direction: column;
  }

  .link-slot {
    left: 12px;
    right: auto;
    transform: none;
    width: auto;
    max-width: 52vw;
    text-align: left;
  }

  .education-link {
    min-width: 160px;
    font-size: 0.8rem;
  }
}

@media (hover: none), (pointer: coarse) {
  .play-screen {
    cursor: default;
  }

  .pointer-aim {
    display: none;
  }
}

.confirm-exit-overlay {
  position: absolute;
  inset: 0;
  z-index: 46;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,0.72);
  cursor: default;
}

.confirm-exit-card {
  width: min(92vw, 620px);
  padding: clamp(20px, 4vw, 34px);
  border: 4px solid #fff;
  border-radius: 18px;
  background: #050505;
  text-align: center;
  box-shadow: 0 0 30px rgba(255,255,255,0.14);
}

.confirm-exit-card h2 {
  margin: 0 0 10px;
  color: var(--red-bright);
  font-size: clamp(2.1rem, 7vw, 5.2rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.confirm-exit-card p {
  margin: 0 auto 20px;
  color: #fff;
  font: 800 clamp(1rem, 2.6vw, 1.35rem)/1.35 Arial, sans-serif;
  max-width: 480px;
}

.confirm-exit-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.confirm-btn {
  min-width: 170px;
  padding: 10px 14px;
  border: 3px solid #fff;
  border-radius: 10px;
  background: #000;
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.05rem, 3vw, 2rem);
  text-transform: uppercase;
  cursor: pointer;
}

.confirm-btn.yes {
  color: var(--red-bright);
}

.confirm-btn.no {
  color: #fff;
}

/* Home screen alignment pass: keeps the menu tidy when the embed height is squeezed. */
.game-title {
  font-size: clamp(2.35rem, min(9.5vw, 13vh), 7.8rem);
}

.title-tail {
  font-size: clamp(1.1rem, min(4vw, 5.4vh), 3rem);
}

.home-copy {
  font-size: clamp(1rem, min(3vw, 3.9vh), 2.35rem);
}

.home-stage {
  margin-top: clamp(0px, 0.6vh, 8px);
}

.home-ghost-selector {
  width: min(46vw, 49vh, 460px);
}

.arrow-btn {
  top: 70%;
}

.home-actions {
  top: 61%;
  bottom: auto;
  transform: translateY(-50%);
}

.link-slot {
  z-index: 10;
}

@media (max-height: 820px) {
  .home-screen {
    gap: 4px;
    padding-top: calc(6px + var(--safe-top));
    padding-bottom: calc(46px + var(--safe-bottom));
  }

  .game-title {
    font-size: clamp(2rem, min(8.8vw, 11.5vh), 6.4rem);
    line-height: 0.78;
  }

  .title-tail {
    margin-top: 2px;
    font-size: clamp(1rem, min(3.4vw, 4.5vh), 2.25rem);
  }

  .home-copy {
    margin-top: 3px;
    font-size: clamp(0.92rem, min(2.55vw, 3.25vh), 1.82rem);
    line-height: 1.02;
  }

  .home-stage {
    width: min(88vw, 900px);
  }

  .home-ghost-selector {
    width: min(40vw, 43vh, 350px);
    min-width: 175px;
  }

  .home-ghost-text {
    inset: 24% 15% 16%;
    font-size: clamp(0.86rem, 3.4vmin, 2rem);
  }

  .home-ghost-text .chosen-number {
    font-size: clamp(2.35rem, 8vmin, 4.8rem);
  }

  .arrow-btn {
    width: clamp(54px, 8vmin, 82px);
    top: 72%;
  }

  .triangle {
    border-top-width: clamp(16px, 3vmin, 30px);
    border-bottom-width: clamp(16px, 3vmin, 30px);
  }

  .triangle.left {
    border-right-width: clamp(24px, 4.8vmin, 45px);
  }

  .triangle.right {
    border-left-width: clamp(24px, 4.8vmin, 45px);
  }

  .home-actions {
    right: clamp(12px, 2vw, 30px);
    top: 62%;
    gap: 9px;
  }

  .play-big {
    min-width: clamp(134px, 14vw, 220px);
    padding: 8px 15px;
    font-size: clamp(1.75rem, min(4.1vw, 5.4vh), 3.4rem);
  }

  .red-menu-btn {
    min-width: clamp(118px, 13vw, 200px);
    padding: 8px 14px;
    font-size: clamp(1.38rem, min(3.4vw, 4.8vh), 3rem);
  }

  .decor-ghost.one {
    width: clamp(70px, 11vw, 128px);
    top: 13%;
    left: 9%;
    opacity: 0.42;
  }

  .decor-ghost.two {
    width: clamp(56px, 8vw, 92px);
    top: 12%;
    right: 34%;
    opacity: 0.34;
  }

  .home-screen .crosshair {
    width: clamp(42px, 6vmin, 62px);
    top: 36%;
    right: 24%;
    opacity: 0.72;
  }

  .education-link {
    min-height: 28px;
    padding: 5px 14px;
    font-size: 0.88rem;
  }
}

@media (max-height: 620px) {
  .home-screen {
    padding-bottom: calc(38px + var(--safe-bottom));
  }

  .game-title {
    font-size: clamp(1.8rem, min(8vw, 10.5vh), 4.8rem);
  }

  .title-tail {
    font-size: clamp(0.9rem, min(3vw, 4vh), 1.75rem);
  }

  .home-copy {
    font-size: clamp(0.78rem, min(2.2vw, 3vh), 1.25rem);
    line-height: 1;
  }

  .home-ghost-selector {
    width: min(34vw, 38vh, 265px);
    min-width: 145px;
  }

  .home-actions {
    top: 58%;
    right: 10px;
    gap: 7px;
  }

  .play-big {
    min-width: 118px;
    font-size: clamp(1.45rem, min(3.2vw, 4.7vh), 2.3rem);
  }

  .red-menu-btn {
    min-width: 104px;
    font-size: clamp(1.1rem, min(2.8vw, 4vh), 2rem);
  }

  .decor-ghost,
  .home-screen .crosshair {
    display: none;
  }

  .education-link {
    min-width: 190px;
    min-height: 25px;
    font-size: 0.78rem;
    padding: 4px 12px;
  }
}

@media (max-width: 900px) {
  .home-actions {
    top: auto;
    bottom: calc(42px + var(--safe-bottom));
    transform: translateX(50%);
  }
}

@media (max-width: 520px), (max-height: 480px) {
  .home-ghost-selector {
    width: min(74vw, 42vh, 285px);
  }

  .arrow-btn {
    top: 70%;
  }

  .home-actions {
    bottom: calc(36px + var(--safe-bottom));
  }
}

@media (max-height: 420px) {
  .home-stage {
    justify-items: center;
  }

  .home-ghost-selector {
    width: min(30vw, 48vh, 210px);
  }

  .home-actions {
    top: 54%;
    right: 10px;
    bottom: auto;
    transform: translateY(-50%);
    flex-direction: column;
  }
}


/* Width-safe home screen refinement: keep buttons visible and move copy into the ghost body. */
.home-ghost-selector {
  width: min(52vw, 50vh, 500px);
  aspect-ratio: 0.74 / 1;
}

.home-ghost-text {
  inset: 43% 14% 7%;
  justify-content: flex-start;
  line-height: 0.9;
  font-size: clamp(0.95rem, min(3vw, 2.7vh), 2.15rem);
}

.home-ghost-text .chosen-number {
  margin-top: clamp(5px, 1vh, 12px);
  font-size: clamp(2.9rem, min(7.6vw, 8.5vh), 6rem);
}

.arrow-btn {
  top: 77%;
}

.arrow-left {
  left: clamp(-18px, -1.5vw, -8px);
}

.arrow-right {
  right: clamp(-18px, -1.5vw, -8px);
}

@media (max-width: 1180px), (max-aspect-ratio: 4/3) {
  .home-stage {
    width: min(98vw, 980px);
    padding-bottom: clamp(112px, 16vh, 168px);
  }

  .home-ghost-selector {
    width: min(58vw, 48vh, 420px);
  }

  .home-actions {
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(52px + var(--safe-bottom));
    transform: translateX(-50%);
    flex-direction: row;
    gap: 10px;
  }

  .play-big {
    min-width: clamp(132px, 17vw, 220px);
    font-size: clamp(1.7rem, 4.2vw, 3.1rem);
  }

  .red-menu-btn {
    min-width: clamp(112px, 14vw, 180px);
    font-size: clamp(1.3rem, 3.4vw, 2.35rem);
  }

  .link-slot {
    bottom: calc(8px + var(--safe-bottom));
    width: min(96vw, 560px);
  }
}

@media (max-width: 860px) {
  .home-screen {
    padding-bottom: calc(96px + var(--safe-bottom));
  }

  .home-copy {
    max-width: 94vw;
  }

  .home-ghost-selector {
    width: min(70vw, 44vh, 360px);
  }

  .home-ghost-text {
    inset: 44% 13% 8%;
    font-size: clamp(0.88rem, min(3.3vw, 2.6vh), 1.55rem);
  }

  .home-ghost-text .chosen-number {
    font-size: clamp(2.6rem, min(8vw, 7.7vh), 4.8rem);
  }

  .home-actions {
    bottom: calc(46px + var(--safe-bottom));
  }
}

@media (max-width: 640px) {
  .home-stage {
    padding-bottom: 104px;
  }

  .home-ghost-selector {
    width: min(78vw, 42vh, 300px);
  }

  .home-actions {
    width: calc(100vw - 20px);
    max-width: 380px;
    justify-content: center;
    gap: 8px;
    bottom: calc(38px + var(--safe-bottom));
  }

  .play-big,
  .red-menu-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .play-big {
    font-size: clamp(1.45rem, 6.4vw, 2.2rem);
  }

  .red-menu-btn {
    font-size: clamp(1.05rem, 5vw, 1.7rem);
  }

  .link-slot {
    width: min(96vw, 420px);
  }
}

/* Final home selector layout: arrows and number sit together on the ghost body. */
.loader-error {
  border-color: var(--red-bright);
}

.home-stage {
  margin-top: 0;
}

.home-ghost-selector {
  width: min(48vw, 54vh, 500px);
  min-width: 260px;
  aspect-ratio: 0.77 / 1;
}

.home-ghost-wrap {
  pointer-events: none;
}

.home-ghost {
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.2)) drop-shadow(0 16px 18px rgba(0,0,0,0.52));
}

.home-ghost-text {
  inset: 37% 4% 11%;
  justify-content: flex-start;
  gap: clamp(8px, 1.4vh, 16px);
  line-height: 0.92;
  color: rgba(35,35,35,0.88);
  text-shadow: 0 1px 0 rgba(255,255,255,0.46);
  pointer-events: none;
}

.home-ghost-label {
  display: block;
  max-width: 78%;
  font-size: clamp(1.25rem, min(3.7vw, 3.9vh), 2.95rem);
  line-height: 0.92;
}

.home-number-row {
  --home-arrow-size: clamp(70px, min(8.6vw, 8.8vh), 112px);
  display: grid;
  grid-template-columns: var(--home-arrow-size) minmax(90px, 1fr) var(--home-arrow-size);
  align-items: center;
  justify-items: center;
  gap: clamp(10px, 1.2vw, 18px);
  width: min(96%, 460px);
  pointer-events: auto;
}

.home-number-row .chosen-number {
  min-width: clamp(88px, 10vw, 150px);
  margin: 0;
  color: #000;
  text-align: center;
  font-size: clamp(3.8rem, min(9vw, 10vh), 7.2rem);
  line-height: 0.82;
}

.home-number-row .arrow-btn {
  position: relative;
  inset: auto;
  top: auto;
  left: auto;
  right: auto;
  transform: none;
  width: var(--home-arrow-size);
  border-width: clamp(5px, 0.62vmin, 8px);
  background: rgba(0,0,0,0.88);
}

.home-number-row .arrow-btn:active {
  transform: scale(0.96);
}

.home-actions {
  right: clamp(18px, 4vw, 72px);
  top: 59%;
  bottom: auto;
  transform: translateY(-50%);
  gap: 0;
}

.home-actions .play-big {
  min-width: clamp(170px, 15vw, 280px);
}

@media (max-height: 820px) {
  .home-ghost-selector {
    width: min(44vw, 50vh, 420px);
    min-width: 230px;
  }

  .home-ghost-text {
    inset: 37% 4% 10%;
    gap: clamp(6px, 1vh, 12px);
  }

  .home-ghost-label {
    font-size: clamp(1.05rem, min(3.2vw, 3.35vh), 2.2rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(58px, min(7.8vw, 8.4vh), 88px);
  }

  .home-number-row .chosen-number {
    font-size: clamp(3rem, min(8vw, 8.7vh), 5.55rem);
  }

  .home-actions {
    right: clamp(12px, 2.4vw, 36px);
    top: 60%;
  }
}

@media (max-width: 1180px), (max-aspect-ratio: 4/3) {
  .home-stage {
    padding-bottom: clamp(96px, 13vh, 140px);
  }

  .home-ghost-selector {
    width: min(64vw, 48vh, 430px);
  }

  .home-actions {
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(48px + var(--safe-bottom));
    transform: translateX(-50%);
  }

  .home-actions .play-big {
    min-width: clamp(150px, 24vw, 240px);
  }
}

@media (max-width: 640px) {
  .home-stage {
    padding-bottom: 94px;
  }

  .home-ghost-selector {
    width: min(86vw, 43vh, 330px);
    min-width: 230px;
  }

  .home-ghost-label {
    max-width: 82%;
    font-size: clamp(1.05rem, min(5vw, 2.9vh), 1.65rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(54px, 16vw, 74px);
    gap: clamp(7px, 2vw, 10px);
    width: 98%;
  }

  .home-number-row .chosen-number {
    min-width: 76px;
    font-size: clamp(2.9rem, 16vw, 4.9rem);
  }

  .home-actions {
    width: auto;
    max-width: none;
    bottom: calc(36px + var(--safe-bottom));
  }

  .home-actions .play-big {
    flex: 0 0 auto;
    min-width: 160px;
  }
}

@media (max-height: 480px) {
  .home-ghost-selector {
    width: min(42vw, 56vh, 245px);
    min-width: 190px;
  }

  .home-ghost-text {
    inset: 36% 4% 9%;
  }

  .home-ghost-label {
    font-size: clamp(0.9rem, min(3.2vw, 4.4vh), 1.35rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(46px, 11vw, 62px);
  }

  .home-number-row .chosen-number {
    font-size: clamp(2.35rem, 12vw, 3.8rem);
  }

  .home-actions {
    right: 10px;
    top: 58%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .home-actions .play-big {
    min-width: 116px;
  }
}

/* Home screen requested refinements: larger selector, lower body copy, play fixed right. */
.home-ghost-text {
  inset: 40% -8% 5%;
  gap: clamp(12px, 1.8vh, 20px);
}

.home-ghost-label {
  max-width: 74%;
  font-size: clamp(1.55rem, min(4.4vw, 4.4vh), 3.45rem);
  line-height: 0.88;
}

.home-number-row {
  --home-arrow-size: clamp(88px, min(10.8vw, 11vh), 138px);
  grid-template-columns: var(--home-arrow-size) minmax(116px, 1fr) var(--home-arrow-size);
  width: min(112%, 570px);
  gap: clamp(12px, 1.6vw, 24px);
}

.home-number-row .chosen-number {
  min-width: clamp(116px, 12vw, 176px);
  font-size: clamp(4.65rem, min(11vw, 12vh), 9rem);
}

.home-number-row .triangle {
  border-top-width: calc(var(--home-arrow-size) * 0.34);
  border-bottom-width: calc(var(--home-arrow-size) * 0.34);
}

.home-number-row .triangle.left {
  border-right-width: calc(var(--home-arrow-size) * 0.54);
}

.home-number-row .triangle.right {
  border-left-width: calc(var(--home-arrow-size) * 0.54);
}

.home-actions {
  left: auto;
  right: clamp(18px, 4vw, 72px);
  top: 60%;
  bottom: auto;
  width: auto;
  max-width: none;
  transform: translateY(-50%);
  flex-direction: column;
}

.home-actions .play-big {
  flex: 0 0 auto;
  min-width: clamp(180px, 16vw, 290px);
}

@media (max-height: 820px) {
  .home-ghost-text {
    inset: 40% -8% 5%;
    gap: clamp(9px, 1.4vh, 16px);
  }

  .home-ghost-label {
    font-size: clamp(1.28rem, min(3.8vw, 3.7vh), 2.65rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(76px, min(9.6vw, 10.2vh), 112px);
  }

  .home-number-row .chosen-number {
    font-size: clamp(3.9rem, min(9.2vw, 10.3vh), 7.25rem);
  }
}

@media (max-width: 1180px), (max-aspect-ratio: 4/3) {
  .home-actions {
    left: auto;
    right: clamp(12px, 2.4vw, 28px);
    top: 61%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .home-actions .play-big {
    min-width: clamp(150px, 18vw, 240px);
  }
}

@media (max-width: 640px) {
  .home-ghost-text {
    inset: 40% -7% 5%;
  }

  .home-ghost-label {
    max-width: 76%;
    font-size: clamp(1.08rem, min(5.6vw, 3.2vh), 1.8rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(60px, 17vw, 82px);
    grid-template-columns: var(--home-arrow-size) minmax(84px, 1fr) var(--home-arrow-size);
    width: 108%;
    gap: 8px;
  }

  .home-number-row .chosen-number {
    min-width: 84px;
    font-size: clamp(3.25rem, 17vw, 5.3rem);
  }

  .home-actions {
    right: 10px;
    top: 62%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .home-actions .play-big {
    min-width: clamp(118px, 28vw, 150px);
  }
}

@media (max-height: 480px) {
  .home-ghost-text {
    inset: 38% -8% 4%;
    gap: 7px;
  }

  .home-ghost-label {
    font-size: clamp(0.92rem, min(3.8vw, 4.9vh), 1.45rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(54px, 12vw, 70px);
    grid-template-columns: var(--home-arrow-size) minmax(72px, 1fr) var(--home-arrow-size);
  }

  .home-number-row .chosen-number {
    min-width: 72px;
    font-size: clamp(2.75rem, 13vw, 4.25rem);
  }
}

/* Home polish pass: roomier title stack and tighter number selector on the ghost. */
.home-screen {
  gap: clamp(12px, 2vh, 24px);
  padding-top: calc(18px + var(--safe-top));
}

.home-top {
  width: min(94vw, 1260px);
}

.game-title {
  font-size: clamp(2.35rem, min(8.3vw, 11.2vh), 7rem);
  line-height: 0.88;
  letter-spacing: clamp(1px, 0.32vw, 6px);
  transform: scaleX(1.02);
}

.title-tail {
  margin-top: clamp(8px, 1.3vh, 16px);
  font-size: clamp(1.2rem, min(3.8vw, 5vh), 3rem);
  line-height: 0.95;
}

.home-copy {
  margin-top: clamp(13px, 1.8vh, 24px);
  font-size: clamp(1.05rem, min(2.8vw, 3.6vh), 2.3rem);
  line-height: 1.12;
  letter-spacing: 0.8px;
}

.home-ghost-text {
  inset: 38% -4% 7%;
  gap: clamp(6px, 1vh, 12px);
}

.home-ghost-label {
  max-width: 70%;
  font-size: clamp(1.45rem, min(4vw, 4vh), 3.1rem);
  line-height: 0.9;
}

.home-number-row {
  --home-arrow-size: clamp(98px, min(11.5vw, 11.8vh), 152px);
  grid-template-columns: var(--home-arrow-size) minmax(124px, 150px) var(--home-arrow-size);
  width: max-content;
  max-width: 100%;
  gap: clamp(4px, 0.55vw, 10px);
}

.home-number-row .chosen-number {
  min-width: clamp(124px, 10vw, 150px);
  font-size: clamp(5.15rem, min(12vw, 13vh), 9.8rem);
}

.home-number-row .arrow-btn {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06), 0 0 22px rgba(255,255,255,0.14);
}

@media (max-height: 820px) {
  .home-screen {
    gap: clamp(6px, 1.1vh, 12px);
    padding-top: calc(12px + var(--safe-top));
  }

  .game-title {
    font-size: clamp(2.05rem, min(7.7vw, 10.2vh), 5.95rem);
    line-height: 0.86;
  }

  .title-tail {
    margin-top: clamp(5px, 0.9vh, 10px);
    font-size: clamp(1.02rem, min(3.35vw, 4.35vh), 2.3rem);
  }

  .home-copy {
    margin-top: clamp(8px, 1.25vh, 14px);
    font-size: clamp(0.95rem, min(2.45vw, 3.05vh), 1.75rem);
    line-height: 1.08;
  }

  .home-ghost-text {
    inset: 38% -4% 6%;
  }

  .home-ghost-label {
    font-size: clamp(1.22rem, min(3.45vw, 3.4vh), 2.25rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(82px, min(10vw, 10.4vh), 118px);
    grid-template-columns: var(--home-arrow-size) minmax(106px, 130px) var(--home-arrow-size);
  }

  .home-number-row .chosen-number {
    min-width: clamp(106px, 9vw, 130px);
    font-size: clamp(4.2rem, min(10vw, 10.8vh), 7.45rem);
  }
}

@media (max-width: 640px) {
  .home-screen {
    padding-top: calc(12px + var(--safe-top));
  }

  .home-ghost-text {
    inset: 38% -3% 6%;
  }

  .home-ghost-label {
    max-width: 72%;
    font-size: clamp(1.08rem, min(5.2vw, 3vh), 1.62rem);
  }

  .home-number-row {
    --home-arrow-size: clamp(66px, 17vw, 84px);
    grid-template-columns: var(--home-arrow-size) minmax(84px, 102px) var(--home-arrow-size);
    gap: 4px;
  }

  .home-number-row .chosen-number {
    min-width: clamp(84px, 21vw, 102px);
    font-size: clamp(3.45rem, 17vw, 5.35rem);
  }
}

@media (max-height: 480px) {
  .home-screen {
    gap: 4px;
    padding-top: calc(6px + var(--safe-top));
  }

  .home-copy {
    display: block;
    font-size: clamp(0.72rem, min(2vw, 2.65vh), 1.1rem);
  }

  .home-ghost-text {
    inset: 36% -4% 4%;
    gap: 4px;
  }

  .home-number-row {
    --home-arrow-size: clamp(54px, 12vw, 72px);
    grid-template-columns: var(--home-arrow-size) minmax(72px, 88px) var(--home-arrow-size);
    gap: 3px;
  }

  .home-number-row .chosen-number {
    min-width: clamp(72px, 15vw, 88px);
    font-size: clamp(2.85rem, 13vw, 4.4rem);
  }
}

/* Final selector centering pass: nudge controls right and keep arrows tight to the number. */
.home-ghost-text {
  transform: translateX(clamp(12px, 1.7vw, 30px));
}

.home-number-row {
  --home-arrow-size: clamp(108px, min(12vw, 12.4vh), 164px);
  grid-template-columns: var(--home-arrow-size) minmax(128px, 154px) var(--home-arrow-size);
  gap: clamp(0px, 0.28vw, 6px);
}

.home-number-row .chosen-number {
  min-width: clamp(128px, 10vw, 154px);
  font-size: clamp(5.55rem, min(12.8vw, 13.8vh), 10.4rem);
}

.home-number-row .triangle.left {
  border-left-width: 0;
  border-right: calc(var(--home-arrow-size) * 0.54) solid var(--red);
  transform: translateX(-4px);
}

@media (max-height: 820px) {
  .home-ghost-text {
    transform: translateX(clamp(9px, 1.45vw, 24px));
  }

  .home-number-row {
    --home-arrow-size: clamp(88px, min(10.6vw, 10.9vh), 128px);
    grid-template-columns: var(--home-arrow-size) minmax(108px, 134px) var(--home-arrow-size);
  }

  .home-number-row .chosen-number {
    min-width: clamp(108px, 9vw, 134px);
    font-size: clamp(4.5rem, min(10.6vw, 11.4vh), 8rem);
  }
}

@media (max-width: 640px) {
  .home-ghost-text {
    transform: translateX(clamp(6px, 2.2vw, 14px));
  }

  .home-number-row {
    --home-arrow-size: clamp(70px, 18vw, 90px);
    grid-template-columns: var(--home-arrow-size) minmax(88px, 106px) var(--home-arrow-size);
    gap: 2px;
  }

  .home-number-row .chosen-number {
    min-width: clamp(88px, 21vw, 106px);
    font-size: clamp(3.65rem, 18vw, 5.65rem);
  }
}

@media (max-height: 480px) {
  .home-ghost-text {
    transform: translateX(clamp(5px, 1.7vw, 12px));
  }

  .home-number-row {
    --home-arrow-size: clamp(58px, 12.8vw, 76px);
    grid-template-columns: var(--home-arrow-size) minmax(74px, 90px) var(--home-arrow-size);
  }

  .home-number-row .chosen-number {
    min-width: clamp(74px, 15vw, 90px);
    font-size: clamp(3rem, 13.6vw, 4.6rem);
  }
}

/* Ghost Blastsers 2 layout and theme */
.game-app {
  background:
    radial-gradient(circle at 50% 2%, rgba(92, 30, 42, 0.34), transparent 33%),
    radial-gradient(circle at 82% 12%, rgba(255, 225, 140, 0.12), transparent 20%),
    linear-gradient(180deg, #10182a 0%, #05060b 48%, #020203 100%);
}

.spooky-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.spooky-screen > :not(.haunted-scene) {
  position: relative;
  z-index: 2;
}

.haunted-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.haunted-scene svg {
  width: 100%;
  height: 100%;
  display: block;
}

.house-shape {
  filter: drop-shadow(0 0 18px rgba(255, 183, 63, 0.14));
}

.home-screen.spooky-screen {
  justify-content: flex-start;
  gap: 24px;
  padding: calc(22px + var(--safe-top)) 18px calc(74px + var(--safe-bottom));
}

.home-screen .home-top {
  width: min(94vw, 1160px);
}

.home-screen .game-title {
  font-size: 6rem;
  line-height: 0.88;
  letter-spacing: 4px;
  text-shadow:
    0 5px 0 rgba(138, 12, 13, 0.72),
    0 0 22px rgba(255, 255, 255, 0.2),
    0 0 40px rgba(255, 28, 24, 0.18);
}

.home-screen .home-copy,
.home-instructions {
  font-family: Arial, sans-serif;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
}

.home-screen .home-copy {
  max-width: 860px;
  margin-top: 14px;
  font-size: 1.35rem;
  color: rgba(255, 255, 255, 0.92);
}

.target-selector {
  width: min(96vw, 1040px);
  display: grid;
  grid-template-columns: 150px 98px minmax(190px, 300px) 98px 150px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 2px;
}

.selector-side-ghost {
  width: 150px;
  opacity: 0.9;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.24));
  pointer-events: none;
}

.selector-side-ghost.left {
  transform: rotate(-7deg) translateY(10px);
}

.selector-side-ghost.right {
  transform: rotate(7deg) translateY(10px) scaleX(-1);
}

.target-selector .arrow-btn {
  position: relative;
  inset: auto;
  top: auto;
  left: auto;
  right: auto;
  transform: none;
  width: 98px;
  border-radius: 50%;
}

.target-selector .arrow-btn:active {
  transform: scale(0.96);
}

.target-number-panel {
  min-height: 178px;
  display: grid;
  place-items: center;
  padding: 18px 20px;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(18, 20, 25, 0.92), rgba(0, 0, 0, 0.9)),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 42%);
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.12), inset 0 0 18px rgba(207, 29, 20, 0.22);
}

.target-number-label {
  color: rgba(255, 255, 255, 0.72);
  font: 900 1.05rem/1 Arial, sans-serif;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.target-number-panel .chosen-number {
  color: #fff;
  font-size: 6.2rem;
  line-height: 0.86;
  text-shadow: 0 0 18px rgba(207, 29, 20, 0.52);
}

.home-start-actions {
  display: flex;
  justify-content: center;
}

.home-start-actions .play-big {
  min-width: 220px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 3.2rem;
}

.home-instructions {
  max-width: 820px;
  margin-top: -6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  text-align: center;
}

.home-screen .crosshair {
  right: 18%;
  top: 42%;
}

.mode-screen {
  display: grid;
  place-items: center;
  padding: calc(22px + var(--safe-top)) 18px calc(22px + var(--safe-bottom));
}

.setup-card {
  width: min(92vw, 680px);
  padding: 30px;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background: rgba(4, 4, 6, 0.9);
  box-shadow: 0 0 36px rgba(255, 255, 255, 0.12), inset 0 0 24px rgba(207, 29, 20, 0.16);
  text-align: center;
}

.setup-card h2 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 4rem;
  line-height: 0.92;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 4px 0 rgba(138, 12, 13, 0.7);
}

.setup-card p {
  margin: 0 auto 24px;
  max-width: 500px;
  color: rgba(255, 255, 255, 0.86);
  font: 900 1.05rem/1.35 Arial, sans-serif;
  letter-spacing: 0;
}

.mode-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.mode-btn {
  min-width: 190px;
  border-radius: 8px;
  font-size: 2.35rem;
}

.text-btn {
  margin-top: 18px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: 900 1rem/1 Arial, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
}

.text-btn:hover,
.text-btn:focus-visible {
  color: #fff;
  outline: none;
}

.name-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.name-fields label {
  display: grid;
  gap: 7px;
  text-align: left;
  color: rgba(255, 255, 255, 0.8);
  font: 900 0.95rem/1 Arial, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.name-input {
  width: 100%;
  min-height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  padding: 10px 12px;
  font: 900 1.1rem/1.2 Arial, sans-serif;
}

.name-input:focus {
  outline: 3px solid rgba(248, 251, 85, 0.3);
}

.turn-display {
  color: #fff;
  font-size: 2.35rem;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 3px 0 rgba(138, 12, 13, 0.8), 0 0 16px rgba(255, 255, 255, 0.18);
}

.question-progress {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.78);
  font: 900 0.92rem/1.2 Arial, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.scoreboard {
  position: absolute;
  left: 50%;
  top: calc(98px + var(--safe-top));
  z-index: 19;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: min(92vw, 760px);
  transform: translateX(-50%);
  pointer-events: none;
}

.player-score {
  min-width: 170px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 11px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
}

.player-score.active {
  border-color: var(--yellow);
  box-shadow: 0 0 18px rgba(248, 251, 85, 0.24);
}

.player-name,
.player-questions {
  font: 900 0.85rem/1.1 Arial, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.player-name {
  color: rgba(255, 255, 255, 0.9);
}

.player-score-value {
  grid-row: span 2;
  color: var(--red-bright);
  font-size: 2.3rem;
  line-height: 0.9;
}

.player-questions {
  color: rgba(255, 255, 255, 0.64);
}

.control-help {
  position: absolute;
  left: clamp(12px, 3vw, 44px);
  bottom: calc(16px + var(--safe-bottom));
  z-index: 18;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(86vw, 520px);
}

.control-help span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: 900 0.95rem/1 Arial, sans-serif;
}

.pair-ghost {
  top: 55%;
  width: clamp(140px, 23vmin, 260px);
}

.left-pair {
  left: 34%;
}

.right-pair {
  left: 66%;
}

.ghost-sum-symbol {
  position: absolute;
  left: 50%;
  top: 55%;
  z-index: 9;
  transform: translate(-50%, -50%);
  color: var(--yellow);
  font-size: 6rem;
  line-height: 1;
  text-shadow: 0 0 16px rgba(248, 251, 85, 0.4), 0 4px 0 #000;
  pointer-events: none;
}

.turn-banner {
  position: absolute;
  left: 50%;
  top: 28%;
  z-index: 30;
  transform: translateX(-50%);
  color: #fff;
  font-size: 4.5rem;
  line-height: 0.9;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 4px 0 #000, 0 0 24px rgba(255, 255, 255, 0.28);
  animation: turnBanner 950ms ease-out forwards;
}

.end-score-grid {
  display: grid;
  gap: 8px;
  width: min(100%, 430px);
  margin: 0 auto 22px;
}

.end-score-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: 900 1.1rem/1.1 Arial, sans-serif;
}

.end-score-row strong {
  color: var(--red-bright);
  font: inherit;
}

@keyframes turnBanner {
  0% { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.9); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  74% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(1.06); }
}

@media (max-width: 820px) {
  .home-screen.spooky-screen {
    gap: 18px;
    padding-top: calc(14px + var(--safe-top));
  }

  .home-screen .game-title {
    font-size: 4.2rem;
    letter-spacing: 2px;
  }

  .home-screen .home-copy {
    font-size: 1.05rem;
  }

  .target-selector {
    grid-template-columns: 72px minmax(150px, 230px) 72px;
    gap: 10px;
  }

  .selector-side-ghost {
    display: none;
  }

  .target-selector .arrow-btn {
    width: 72px;
  }

  .target-number-panel {
    min-height: 142px;
    padding: 14px 16px;
  }

  .target-number-panel .chosen-number {
    font-size: 4.25rem;
  }

  .home-start-actions .play-big {
    min-width: 170px;
    font-size: 2.35rem;
  }

  .setup-card h2 {
    font-size: 3rem;
  }

  .mode-btn {
    min-width: 160px;
    font-size: 1.8rem;
  }

  .name-fields {
    grid-template-columns: 1fr;
  }

  .hud {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .hud-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .game-menu {
    grid-column: 2;
    grid-row: 1;
  }

  .scoreboard {
    top: calc(138px + var(--safe-top));
  }

  .pair-ghost {
    width: clamp(115px, 30vmin, 190px);
  }

  .left-pair {
    left: 30%;
  }

  .right-pair {
    left: 70%;
  }

  .ghost-sum-symbol {
    font-size: 4.3rem;
  }

  .turn-banner {
    top: 34%;
    font-size: 3rem;
  }
}

@media (max-width: 520px), (max-height: 520px) {
  .home-screen.spooky-screen {
    padding-bottom: calc(58px + var(--safe-bottom));
  }

  .home-screen .game-title {
    font-size: 3rem;
  }

  .home-screen .home-copy {
    font-size: 0.92rem;
  }

  .home-instructions {
    font-size: 0.86rem;
  }

  .target-selector {
    grid-template-columns: 58px minmax(124px, 190px) 58px;
    gap: 7px;
  }

  .target-selector .arrow-btn {
    width: 58px;
    border-width: 3px;
  }

  .target-number-panel {
    min-height: 116px;
    border-width: 3px;
  }

  .target-number-label {
    font-size: 0.82rem;
  }

  .target-number-panel .chosen-number {
    font-size: 3.4rem;
  }

  .setup-card {
    padding: 22px 18px;
  }

  .setup-card h2 {
    font-size: 2.35rem;
  }

  .setup-card p {
    font-size: 0.92rem;
  }

  .mode-actions {
    gap: 9px;
  }

  .mode-btn {
    min-width: 132px;
    font-size: 1.45rem;
  }

  .turn-display {
    font-size: 1.8rem;
  }

  .scoreboard {
    top: calc(126px + var(--safe-top));
    gap: 6px;
  }

  .player-score {
    min-width: 136px;
    padding: 7px 9px;
  }

  .player-score-value {
    font-size: 1.75rem;
  }

  .pair-ghost {
    top: 56%;
    width: clamp(96px, 31vmin, 150px);
  }

  .left-pair {
    left: 29%;
  }

  .right-pair {
    left: 71%;
  }

  .ghost-sum-symbol {
    top: 56%;
    font-size: 3rem;
  }

  .control-help {
    bottom: calc(8px + var(--safe-bottom));
  }

  .control-help span {
    min-height: 28px;
    font-size: 0.8rem;
  }
}

/* Resize hardening: the fixed app shell fills the live viewport through inset: 0. */
body {
  overscroll-behavior: none;
}

.mode-screen {
  overflow: hidden;
}

.setup-card {
  max-height: calc(100vh - 34px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  overscroll-behavior: contain;
}

.play-screen {
  --playfield-top: calc(clamp(104px, 22vh, 168px) + var(--safe-top));
  --playfield-bottom: calc(clamp(48px, 10vh, 82px) + var(--safe-bottom));
  --ghost-width: clamp(100px, min(24vmin, 30vw, 42vh), 260px);
  --ghost-gap: clamp(92px, 18vw, 218px);
  cursor: none;
}

.play-screen .hud {
  inset: calc(clamp(6px, 1.5vh, 12px) + var(--safe-top)) clamp(8px, 2vw, 28px) auto;
  grid-template-columns: minmax(96px, 1fr) minmax(142px, auto) minmax(76px, 1fr);
  gap: clamp(6px, 1.2vw, 18px);
  align-items: start;
}

.play-screen .target-pill {
  max-width: min(32vw, 210px);
  padding: clamp(5px, 1.1vh, 9px) clamp(7px, 1.4vw, 12px);
  border-width: clamp(2px, 0.55vmin, 3px);
}

.play-screen .target-pill span:last-child {
  font-size: clamp(1.15rem, min(4vw, 5.6vh), 2.5rem);
}

.play-screen .game-menu .red-menu-btn {
  min-width: clamp(76px, 12vw, 168px);
  padding: clamp(5px, 1.1vh, 8px) clamp(8px, 1.5vw, 13px);
  font-size: clamp(1.05rem, min(3vw, 4.8vh), 2.85rem);
}

.turn-display {
  max-width: min(56vw, 520px);
  margin-inline: auto;
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, min(4.2vw, 6vh), 2.35rem);
}

.question-progress {
  font-size: clamp(0.72rem, min(1.8vw, 2.4vh), 0.92rem);
}

.scoreboard {
  top: calc(clamp(74px, 15vh, 120px) + var(--safe-top));
  max-width: min(94vw, 760px);
  max-height: 22vh;
  overflow: hidden;
}

.player-score {
  min-width: clamp(118px, 22vw, 170px);
  padding: clamp(5px, 1vh, 8px) clamp(7px, 1.4vw, 11px);
  border-width: clamp(2px, 0.52vmin, 3px);
}

.player-name,
.player-questions {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-score-value {
  font-size: clamp(1.45rem, min(5vw, 6vh), 2.3rem);
}

.play-screen .ghost-layer {
  inset: var(--playfield-top) 0 var(--playfield-bottom);
  min-height: 0;
}

.pair-ghost {
  top: 50%;
  width: var(--ghost-width);
  max-width: 42vw;
  max-height: 94%;
}

.pair-ghost svg {
  max-height: 100%;
}

.left-pair {
  left: calc(50% - var(--ghost-gap));
}

.right-pair {
  left: calc(50% + var(--ghost-gap));
}

.ghost-sum-symbol {
  top: 50%;
  font-size: clamp(2.5rem, min(9vw, 13vh), 6rem);
}

.timer {
  right: clamp(8px, 2.5vw, 42px);
  bottom: calc(clamp(8px, 2vh, 16px) + var(--safe-bottom));
  font-size: clamp(1.25rem, min(4vw, 6vh), 4.3rem);
}

.control-help {
  left: clamp(8px, 2vw, 34px);
  bottom: calc(clamp(8px, 2vh, 16px) + var(--safe-bottom));
  max-width: min(62vw, 520px);
}

.control-help span {
  min-height: clamp(26px, 5vh, 34px);
  padding: clamp(4px, 0.9vh, 6px) clamp(8px, 1.7vw, 12px);
  font-size: clamp(0.72rem, min(2vw, 2.8vh), 0.95rem);
}

.turn-banner {
  top: clamp(86px, 24vh, 220px);
  max-width: 94vw;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: clamp(2rem, min(8vw, 10vh), 4.5rem);
}

@media (max-width: 680px) {
  .play-screen {
    --playfield-top: calc(clamp(126px, 24vh, 166px) + var(--safe-top));
    --playfield-bottom: calc(clamp(48px, 9vh, 70px) + var(--safe-bottom));
    --ghost-width: clamp(88px, min(32vw, 27vh), 166px);
    --ghost-gap: clamp(64px, 20vw, 140px);
  }

  .play-screen .hud {
    grid-template-columns: minmax(82px, 1fr) auto;
  }

  .scoreboard {
    top: calc(clamp(116px, 21vh, 148px) + var(--safe-top));
  }

  .control-help {
    max-width: 58vw;
  }
}

@media (max-height: 460px) {
  .play-screen {
    --playfield-top: calc(clamp(78px, 21vh, 102px) + var(--safe-top));
    --playfield-bottom: calc(clamp(30px, 8vh, 46px) + var(--safe-bottom));
    --ghost-width: clamp(76px, min(24vw, 34vh), 138px);
    --ghost-gap: clamp(72px, 17vw, 158px);
  }

  .play-screen .hud {
    inset: calc(4px + var(--safe-top)) 8px auto;
    gap: 4px;
  }

  .play-screen .target-pill {
    max-width: 148px;
    padding: 4px 6px;
  }

  .target-pill span:first-child,
  .hud-label,
  .question-progress {
    font-size: 0.62rem;
    letter-spacing: 0.8px;
  }

  .turn-display {
    font-size: clamp(1rem, 4.8vh, 1.65rem);
  }

  .scoreboard {
    top: calc(clamp(54px, 15vh, 72px) + var(--safe-top));
    gap: 5px;
    max-height: 18vh;
  }

  .player-score {
    min-width: 112px;
    grid-template-columns: 1fr auto;
    gap: 2px 6px;
    padding: 4px 6px;
  }

  .player-name,
  .player-questions {
    font-size: 0.68rem;
  }

  .player-score-value {
    font-size: 1.3rem;
  }

  .control-help {
    display: none;
  }

  .timer {
    font-size: clamp(1rem, 5vh, 1.8rem);
  }
}

@media (max-width: 430px) {
  .play-screen {
    --ghost-width: clamp(76px, 35vw, 128px);
    --ghost-gap: clamp(58px, 22vw, 98px);
  }

  .scoreboard {
    width: min(98vw, 360px);
  }

  .player-score {
    min-width: clamp(104px, 45vw, 142px);
  }
}

@media (max-width: 430px) and (max-height: 460px) {
  .play-screen {
    --playfield-top: calc(72px + var(--safe-top));
    --playfield-bottom: calc(24px + var(--safe-bottom));
    --ghost-width: clamp(64px, 29vw, 104px);
    --ghost-gap: clamp(48px, 21vw, 82px);
  }

  .scoreboard {
    display: none;
  }
}

/* Final screen layout authority: keep setup/play screens full-size and centered. */
.game-app {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.screen,
.spooky-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.haunted-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.haunted-scene svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mode-screen {
  display: grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}

.mode-screen .setup-card {
  position: relative;
  z-index: 3;
  width: min(92vw, 680px);
  max-height: calc(100vh - 40px - var(--safe-top) - var(--safe-bottom));
  margin: 0;
}

.target-number-panel .chosen-number {
  width: min(100%, 190px);
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 0;
  text-align: center;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4.5rem, min(11vw, 12vh), 9.6rem);
  line-height: 0.86;
  text-shadow: 0 0 18px rgba(207, 29, 20, 0.52);
  appearance: textfield;
}

.target-number-panel .chosen-number:focus {
  outline: 3px solid rgba(248, 251, 85, 0.32);
  outline-offset: 4px;
}

.target-number-panel .chosen-number::-webkit-outer-spin-button,
.target-number-panel .chosen-number::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.play-screen {
  --play-top-space: clamp(190px, 31vh, 260px);
  --play-bottom-space: clamp(74px, 14vh, 118px);
  --play-ghost-width: clamp(110px, min(23vw, 28vh), 236px);
  --play-ghost-gap: clamp(92px, 18vw, 210px);
  position: absolute;
  inset: 0;
  cursor: none;
}

.play-screen .hud {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: clamp(8px, 2vw, 28px);
  right: clamp(8px, 2vw, 28px);
  bottom: auto;
  z-index: 30;
  height: clamp(92px, 17vh, 138px);
  display: block;
  pointer-events: none;
}

.play-screen .target-pill {
  position: absolute;
  top: 0;
  left: 0;
  max-width: min(30vw, 210px);
  padding: clamp(5px, 1vh, 9px) clamp(8px, 1.3vw, 12px);
}

.play-screen .target-pill span:last-child {
  font-size: clamp(1.25rem, min(3.4vw, 5vh), 2.35rem);
}

.play-screen .hud-center {
  position: absolute;
  top: clamp(72px, 12vh, 112px);
  left: 50%;
  width: min(38vw, 460px);
  min-width: 0;
  max-width: calc(100vw - 360px);
  transform: translateX(-50%);
  text-align: center;
}

.play-screen .turn-display {
  font-size: clamp(1.3rem, min(3.6vw, 5vh), 2.2rem);
  overflow-wrap: anywhere;
}

.play-screen .question-progress {
  font-size: clamp(0.68rem, min(1.55vw, 2.15vh), 0.86rem);
}

.play-screen .game-menu {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  justify-items: end;
  gap: clamp(4px, 0.9vh, 8px);
  pointer-events: auto;
}

.play-screen .game-menu .red-menu-btn {
  min-width: clamp(74px, 11vw, 158px);
  padding: clamp(5px, 0.9vh, 8px) clamp(8px, 1.4vw, 13px);
  font-size: clamp(1rem, min(2.7vw, 4.1vh), 2.5rem);
}

.play-screen .game-menu .timer {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  z-index: auto;
  padding: 3px 8px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.68);
  color: #ff1515;
  font-size: clamp(0.92rem, min(2.25vw, 3.4vh), 1.9rem);
  line-height: 1;
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
}

.play-screen .scoreboard {
  position: absolute;
  left: clamp(8px, 2vw, 28px);
  right: clamp(8px, 2vw, 28px);
  top: calc(clamp(148px, 20vh, 210px) + var(--safe-top));
  z-index: 26;
  display: block;
  width: auto;
  height: clamp(58px, 8vh, 86px);
  max-width: none;
  max-height: 22vh;
  overflow: hidden;
  pointer-events: none;
  transform: none;
}

.play-screen .player-score {
  position: absolute;
  top: 0;
  width: min(25vw, 230px);
  min-width: clamp(118px, 17vw, 170px);
  max-width: 230px;
  padding: clamp(5px, 0.85vh, 8px) clamp(7px, 1.2vw, 11px);
}

.play-screen .player-slot-1 {
  left: 0;
}

.play-screen .player-slot-2 {
  right: 0;
}

.play-screen .ghost-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--play-top-space) + var(--safe-top));
  bottom: calc(var(--play-bottom-space) + var(--safe-bottom));
  z-index: 10;
  min-height: 0;
}

.play-screen .pair-ghost {
  top: 50%;
  width: var(--play-ghost-width);
  max-width: 42vw;
  max-height: 96%;
}

.play-screen .left-pair {
  left: calc(50% - var(--play-ghost-gap));
}

.play-screen .right-pair {
  left: calc(50% + var(--play-ghost-gap));
}

.play-screen .ghost-sum-symbol {
  top: 50%;
  font-size: clamp(2.4rem, min(9vw, 13vh), 6rem);
}

.play-screen .answer-controls {
  position: absolute;
  left: 50%;
  bottom: calc(clamp(64px, 12vh, 104px) + var(--safe-bottom));
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 28px);
  transform: translateX(-50%);
  pointer-events: auto;
}

.play-screen .answer-btn {
  width: clamp(58px, min(8vw, 11vh), 90px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: clamp(2.1rem, min(5vw, 7vh), 4.3rem);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.14);
}

.play-screen .answer-btn.correct {
  color: #7dff81;
  text-shadow: 0 0 14px rgba(90, 255, 112, 0.5);
}

.play-screen .answer-btn.wrong {
  color: #ff4a3f;
  text-shadow: 0 0 14px rgba(255, 50, 42, 0.5);
}

.play-screen .answer-btn:hover,
.play-screen .answer-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(248, 251, 85, 0.22), 0 0 22px rgba(255, 255, 255, 0.24);
}

.play-screen .answer-btn:disabled {
  opacity: 0.46;
  cursor: default;
}

.play-screen .play-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.play-screen .play-bottom .control-help {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  z-index: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: min(92vw, 620px);
  pointer-events: none;
}

@media (max-width: 680px) {
  .play-screen {
    --play-top-space: clamp(204px, 36vh, 254px);
    --play-bottom-space: clamp(64px, 13vh, 96px);
    --play-ghost-width: clamp(88px, min(31vw, 25vh), 158px);
    --play-ghost-gap: clamp(66px, 20vw, 138px);
  }

  .play-screen .hud-center {
    top: clamp(70px, 13vh, 100px);
    width: min(62vw, 420px);
    max-width: calc(100vw - 190px);
  }

  .play-screen .scoreboard {
    top: calc(clamp(150px, 28vh, 186px) + var(--safe-top));
  }

  .play-screen .player-score {
    width: min(44vw, 150px);
    min-width: clamp(104px, 42vw, 150px);
  }
}

@media (max-height: 560px) {
  .mode-screen .setup-card {
    transform: scale(0.86);
    transform-origin: center;
  }

  .play-screen {
    --play-top-space: clamp(150px, 32vh, 186px);
    --play-bottom-space: clamp(54px, 13vh, 76px);
    --play-ghost-width: clamp(76px, min(24vw, 29vh), 146px);
    --play-ghost-gap: clamp(70px, 17vw, 154px);
  }

  .play-screen .hud {
    top: calc(4px + var(--safe-top));
    height: clamp(70px, 18vh, 94px);
  }

  .play-screen .target-pill {
    max-width: 150px;
    padding: 4px 6px;
  }

  .play-screen .target-pill span:first-child {
    font-size: 0.6rem;
    letter-spacing: 0.8px;
  }

  .play-screen .target-pill span:last-child {
    font-size: clamp(1.1rem, 5vh, 1.75rem);
  }

  .play-screen .turn-display {
    font-size: clamp(1rem, min(3.2vw, 4.3vh), 1.55rem);
  }

  .play-screen .hud-center {
    top: clamp(54px, 12vh, 76px);
    width: min(40vw, 360px);
    max-width: calc(100vw - 260px);
  }

  .play-screen .question-progress {
    margin-top: 2px;
    font-size: clamp(0.58rem, 2.3vh, 0.7rem);
    letter-spacing: 0.7px;
  }

  .play-screen .game-menu .red-menu-btn {
    min-width: 72px;
    padding: 4px 7px;
    font-size: clamp(0.95rem, 4vh, 1.55rem);
  }

  .play-screen .game-menu .timer {
    padding: 2px 6px;
    font-size: clamp(0.85rem, 3.3vh, 1.35rem);
  }

  .play-screen .scoreboard {
    top: calc(clamp(100px, 23vh, 128px) + var(--safe-top));
    height: clamp(46px, 10vh, 60px);
    max-height: 20vh;
  }

  .play-screen .player-score {
    min-width: clamp(106px, 19vw, 140px);
    gap: 2px 6px;
    padding: 4px 6px;
  }

  .play-screen .player-name,
  .play-screen .player-questions {
    font-size: 0.68rem;
  }

  .play-screen .player-score-value {
    font-size: 1.3rem;
  }

  .play-screen .answer-controls {
    bottom: calc(clamp(46px, 12vh, 64px) + var(--safe-bottom));
  }

  .play-screen .answer-btn {
    width: clamp(44px, 11vh, 60px);
    border-width: 3px;
    font-size: clamp(1.55rem, 7vh, 2.4rem);
  }

  .play-screen .play-bottom .control-help span {
    min-height: 24px;
    padding: 4px 8px;
    font-size: 0.72rem;
  }
}

@media (max-width: 430px) {
  .play-screen {
    --play-top-space: clamp(202px, 38vh, 236px);
    --play-bottom-space: clamp(60px, 12vh, 82px);
    --play-ghost-width: clamp(72px, 35vw, 128px);
    --play-ghost-gap: clamp(54px, 22vw, 96px);
  }

  .play-screen .hud-center {
    top: clamp(82px, 15vh, 104px);
    width: min(88vw, 360px);
    max-width: min(88vw, 360px);
  }

  .play-screen .scoreboard {
    top: calc(clamp(154px, 30vh, 184px) + var(--safe-top));
  }

  .play-screen .player-score {
    width: min(46vw, 138px);
    min-width: clamp(96px, 45vw, 138px);
  }
}

@media (max-height: 430px), (max-width: 430px) and (max-height: 540px) {
  .play-screen {
    --play-top-space: 92px;
    --play-bottom-space: 42px;
    --play-ghost-width: clamp(64px, min(29vw, 30vh), 112px);
  }

  .play-screen .scoreboard,
  .play-screen .play-bottom .control-help {
    display: none;
  }

  .play-screen .question-progress {
    display: none;
  }

  .play-screen .answer-controls {
    bottom: calc(8px + var(--safe-bottom));
  }
}
