/* Dual-voltage neon: void + cyan signal + magenta threat. Glow is the juice. */

:root {
  --bg: #050510;
  --cyan: #00f0ff;
  --magenta: #ff2bd6;
  --ice: #e8f7ff;
  --ice-dim: rgba(232, 247, 255, 0.52);
  --ice-mute: rgba(232, 247, 255, 0.34);
  --gold: #ffe66d;
  --fs-xs: 0.65rem;
  --fs-sm: 0.78rem;
  --fs-base: 0.88rem;
  --display: 'Oxanium', 'Segoe UI', sans-serif;
  --ui: 'Chakra Petch', 'Segoe UI', sans-serif;
  --pad: max(12px, env(safe-area-inset-left));
  --pad-r: max(12px, env(safe-area-inset-right));
  --pad-t: max(10px, env(safe-area-inset-top));
  --pad-b: max(16px, env(safe-area-inset-bottom));
  --touch: 44px;
}

html {
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: #000;
  color: var(--ice);
  font-family: 'Chakra Petch', 'Segoe UI', sans-serif;
  font-weight: 500;
  text-align: center;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  height: 100dvh;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
}

/* Thin top — challenge banner only when a dare link is open. Brand lives
   on the canvas so we don't double-stack CROSSWIRED above the playfield. */
.app-bar {
  padding: 0;
  flex: none;
  min-height: 0;
  position: relative;
  z-index: 15;
}

.app-bar:has(.challenge-banner:not([hidden])) {
  padding: var(--pad-t) var(--pad-r) 0 var(--pad);
}

.challenge-banner {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 43, 214, 0.75);
  background: rgba(255, 43, 214, 0.12);
  color: #ffe8fb;
  font-family: var(--display);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
}

.challenge-banner[hidden] {
  display: none;
}

.play-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Pause + gear — absolute top-right, inside safe-area. */
.hud-corner {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 40;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.hud-corner > * {
  pointer-events: auto;
}

.hud-chip {
  position: relative;
  z-index: 6;
  width: 36px;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 50%;
  background: rgba(5, 5, 16, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--cyan);
  font-family: var(--display);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 0 10px rgba(0, 240, 255, 0.14);
}

/* Invisible extra hit pad without bloating the chrome. */
.hud-chip::before {
  content: '';
  position: absolute;
  inset: -6px;
}

.pause-chip[hidden] {
  display: none;
}

.settings-menu {
  position: relative;
  z-index: 7;
  text-align: left;
}

/* Collapsed while paused — overlay owns the screen. */
body.is-paused .settings-menu {
  display: none;
}

.settings-chip {
  position: static;
  list-style: none;
  user-select: none;
}

.settings-chip::-webkit-details-marker {
  display: none;
}

.settings-gear-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.settings-menu[open] .settings-chip {
  border-color: rgba(255, 43, 214, 0.75);
  color: var(--magenta);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 14px rgba(255, 43, 214, 0.28);
}

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(78vw, 220px);
  max-height: min(70dvh, 480px);
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  background:
    linear-gradient(165deg, rgba(12, 18, 36, 0.98), rgba(5, 5, 16, 0.97));
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(0, 240, 255, 0.12),
    0 0 20px rgba(0, 240, 255, 0.08);
}

/* Full-shell pause veil — covers playfield + pads + collapses settings. */
.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  touch-action: manipulation;
}

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

.pause-overlay-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.55);
}

.pause-overlay-hint {
  margin: 0;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ice-dim);
  animation: pauseHintPulse 1.4s ease-in-out infinite;
}

@keyframes pauseHintPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.settings-title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--cyan);
  text-align: left;
}

.settings-section {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.16);
}

.settings-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-actions .tool-btn,
.settings-actions .tool-toggle {
  flex: 1 1 calc(50% - 8px);
  min-width: 88px;
}

/* Game takes most of the shell; compact control strip below (v27 pad size). */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050510;
  border: none;
  box-shadow: none;
  overflow: hidden;
  container-type: size;
}

/* Pins death UI to the canvas box (not the taller stage letterbox). */
.stage-playfield {
  position: relative;
  flex: none;
  width: min(100cqw, calc(100cqh * 5 / 6));
  height: min(100cqh, calc(100cqw * 6 / 5));
  max-width: 100%;
  max-height: 100%;
}

/* Two independent pads — left / right. Hidden when half-screen controls are on. */
.control-deck {
  flex: none;
  height: auto;
  min-height: 0;
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  align-items: center;
  gap: 10px;
  padding: 8px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(5, 5, 16, 0.15) 0%, rgba(0, 0, 0, 0.94) 45%, #000 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

html.half-screen-controls .control-deck {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: auto;
  min-height: 0;
  padding: 0 max(0px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left));
  background: #050510;
  border-top: 1px solid rgba(232, 247, 255, 0.12);
}

html.half-screen-controls .joystick {
  width: 100%;
  min-height: 64px;
  justify-content: center;
  gap: 0;
}

html.half-screen-controls .joystick-base {
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-width: none;
  border-radius: 0;
  aspect-ratio: auto;
  box-shadow: none;
  filter: none;
  transform: none;
}

html.half-screen-controls .joystick-left .joystick-base {
  border: none;
  border-right: 1px solid rgba(232, 247, 255, 0.1);
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.16), rgba(4, 18, 28, 0.95));
}

html.half-screen-controls .joystick-right .joystick-base {
  border: none;
  background: linear-gradient(180deg, rgba(255, 43, 214, 0.14), rgba(28, 4, 24, 0.95));
}

html.half-screen-controls .joystick.is-active .joystick-base {
  filter: brightness(1.2);
  transform: none;
}

html.half-screen-controls .joystick-stick,
html.half-screen-controls .joy-chev {
  display: none;
}

html.half-screen-controls .joystick-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  pointer-events: none;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
}

html.native-app.half-screen-controls .joystick-base {
  width: 100%;
  height: max(64px, calc(52px + env(safe-area-inset-bottom) * 0.35));
  min-height: 64px;
}

html.half-screen-controls .play-shell {
  padding-bottom: 0;
}

.joystick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 0;
  padding: 0;
  touch-action: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.joystick-base {
  position: relative;
  flex: none;
  flex-shrink: 0;
  width: min(32vw, 96px);
  height: min(32vw, 96px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.1), transparent 55%),
    radial-gradient(circle at center, rgba(20, 24, 36, 0.55) 0%, rgba(5, 5, 16, 0.75) 70%);
  box-shadow:
    inset 0 0 0 10px rgba(0, 0, 0, 0.22),
    inset 0 0 28px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  transition: filter 80ms ease, transform 80ms ease;
}

.joystick-left .joystick-base {
  border-color: rgba(0, 240, 255, 0.55);
  box-shadow:
    inset 0 0 0 10px rgba(0, 240, 255, 0.08),
    inset 0 0 28px rgba(0, 0, 0, 0.4),
    0 0 28px rgba(0, 240, 255, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.45);
}

.joystick-right .joystick-base {
  border-color: rgba(255, 43, 214, 0.55);
  box-shadow:
    inset 0 0 0 10px rgba(255, 43, 214, 0.08),
    inset 0 0 28px rgba(0, 0, 0, 0.4),
    0 0 28px rgba(255, 43, 214, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.45);
}

.joystick-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.35);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.55), transparent 42%),
    radial-gradient(circle at 50% 55%, #3a455c, #151922);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.08s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  pointer-events: none;
}

.joystick-left .joystick-stick {
  border-color: rgba(156, 255, 255, 0.65);
  box-shadow:
    0 0 16px rgba(0, 240, 255, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.joystick-right .joystick-stick {
  border-color: rgba(255, 122, 232, 0.65);
  box-shadow:
    0 0 16px rgba(255, 43, 214, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.joy-chev {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0.55;
  pointer-events: none;
}

.joy-chev-l {
  left: 14%;
  top: 50%;
  transform: translateY(-50%);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 10px solid currentColor;
}

.joy-chev-r {
  right: 14%;
  top: 50%;
  transform: translateY(-50%);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid currentColor;
}

.joy-chev-u {
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid currentColor;
}

.joy-chev-d {
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid currentColor;
}

.joystick-left .joy-chev {
  color: var(--cyan);
}

.joystick-right .joy-chev {
  color: var(--magenta);
}

.joystick.is-active .joystick-base {
  filter: brightness(1.25);
  transform: scale(0.96);
}

.joystick-label {
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.joystick-left .joystick-label {
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

.joystick-right .joystick-label {
  color: var(--magenta);
  text-shadow: 0 0 12px rgba(255, 43, 214, 0.5);
}

/* Death action bar — dual-voltage gradients, no glow (glow was the flash). */
.death-bar {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 14px;
  z-index: 4;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0;
  pointer-events: auto;
  border: 1px solid rgba(232, 247, 255, 0.16);
  background: #050510;
}

.death-bar[hidden] {
  display: none;
}

.death-bar-main,
.death-bar-side {
  min-height: 56px;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.death-bar-main {
  border-left: 1px solid rgba(0, 240, 255, 0.35);
  background:
    linear-gradient(180deg, rgba(0, 240, 255, 0.22), rgba(4, 18, 28, 0.98) 55%, rgba(2, 10, 18, 0.99));
  color: #e8f7ff;
  font-size: 0.92rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.death-bar-main:active {
  background:
    linear-gradient(180deg, rgba(0, 240, 255, 0.34), rgba(0, 180, 210, 0.22));
  color: #fff;
}

.death-bar-side {
  background:
    linear-gradient(180deg, rgba(255, 43, 214, 0.2), rgba(28, 4, 24, 0.98) 55%, rgba(14, 2, 12, 0.99));
  color: #ff7ae8;
  font-size: 0.72rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.death-bar-side:active {
  background:
    linear-gradient(180deg, rgba(255, 43, 214, 0.34), rgba(255, 43, 214, 0.16));
  color: #ffe8fb;
}

.death-bar-hint {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 78px;
  z-index: 4;
  margin: 0;
  text-align: center;
  pointer-events: none;
  color: #ffe66d;
  font-family: var(--ui);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.death-bar-hint[hidden] {
  display: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  background: #050510;
  touch-action: none;
  object-fit: contain;
}

.meta {
  flex: none;
  padding: 10px 0 0;
}

.daily-badge,
.streak-badge,
.rivalry-badge {
  margin: 0 0 6px;
  font-size: var(--fs-xs);
  line-height: 1.4;
  color: var(--ice-mute);
  opacity: 0.9;
  text-align: left;
}

.settings-panel .settings-actions {
  margin-top: 0;
}

.settings-panel .board {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 240, 255, 0.16);
}

.daily-badge {
  color: var(--gold, #ffe66d);
  opacity: 1;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.streak-badge {
  font-family: var(--ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rivalry-badge {
  color: var(--gold);
  opacity: 0.85;
}

.rivalry-badge[hidden] {
  display: none;
}

.controls {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 240, 255, 0.28);
  font-size: var(--fs-xs);
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--ice-dim);
}

.hand-left {
  color: var(--cyan);
  font-weight: 600;
}

.hand-right {
  color: var(--magenta);
  font-weight: 600;
}

.sep {
  opacity: 0.45;
  margin: 0 0.15em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.tool-btn {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 14px;
  border: 1px solid rgba(0, 240, 255, 0.65);
  background: rgba(0, 240, 255, 0.06);
  color: var(--ice);
  font-family: var(--display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.12);
}

.tool-btn:active {
  background: var(--cyan);
  color: #050510;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.45);
}

.tool-btn[hidden] {
  display: none;
}

.tool-btn.is-muted {
  opacity: 0.35;
}

.tool-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 12px;
  border: 1px solid var(--cyan);
  font-size: var(--fs-xs);
  color: var(--cyan);
  cursor: pointer;
}

.tool-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.board {
  flex: none;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 240, 255, 0.22);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  list-style: none;
  cursor: pointer;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ice-dim);
  user-select: none;
}

.leaderboard-header::-webkit-details-marker {
  display: none;
}

.leaderboard-header::before {
  content: '▸ ';
  color: var(--cyan);
  opacity: 0.7;
}

.board[open] .leaderboard-header::before {
  content: '▾ ';
}

.leaderboard-panel h2,
.leaderboard-header span {
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

.text-link-btn {
  position: absolute;
  right: 0;
  min-height: var(--touch);
  background: none;
  border: none;
  color: var(--cyan);
  font-family: var(--ui);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
}

.leaderboard-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  text-align: left;
  font-size: var(--fs-xs);
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 36px;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.22);
  color: var(--ice-dim);
}

.leaderboard-list li.leaderboard-you {
  background: var(--cyan);
  color: #000;
  padding-left: 6px;
  padding-right: 6px;
}

.leaderboard-list .lb-rank {
  width: 28px;
  flex: none;
}

.leaderboard-list .lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px;
}

.leaderboard-list .lb-score {
  flex: none;
}

.leaderboard-status {
  color: var(--cyan);
  text-align: center;
  padding: 10px 0;
  opacity: 0.55;
  justify-content: center;
}

.name-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: var(--pad);
  box-sizing: border-box;
}

.name-modal-overlay[hidden] {
  display: none;
}

.name-modal {
  background: #000;
  border: 1px solid var(--cyan);
  padding: 24px 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.name-modal h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ice);
}

.name-modal p {
  color: var(--cyan);
  font-size: var(--fs-xs);
  line-height: 1.55;
  margin: 0 0 16px;
  opacity: 0.8;
}

.name-modal input {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--touch);
  padding: 12px;
  border: 1px solid var(--cyan);
  background: #000;
  color: var(--cyan);
  font-family: inherit;
  font-size: var(--fs-sm);
  margin-bottom: 12px;
  text-align: center;
}

.name-modal input:focus {
  outline: 1px solid var(--cyan);
}

.name-modal button {
  width: 100%;
  min-height: var(--touch);
  padding: 12px;
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: #000;
  font-family: inherit;
  font-size: var(--fs-sm);
  letter-spacing: 0.1em;
  cursor: pointer;
}

.name-modal button:active {
  background: transparent;
  color: var(--cyan);
}

.achievements-modal {
  text-align: left;
}

.achievements-modal h2 {
  text-align: center;
}

.achievements-count {
  text-align: center;
  color: var(--cyan);
  font-size: var(--fs-xs);
  margin: -4px 0 12px;
  opacity: 0.7;
}

.achievements-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  max-height: 45dvh;
  overflow-y: auto;
}

.achievements-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.35);
}

.achievements-list .ach-icon {
  font-size: 1rem;
  flex: none;
  width: 22px;
  text-align: center;
  color: var(--cyan);
}

.achievements-list .ach-text {
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--cyan);
  opacity: 0.55;
}

.achievements-list .ach-text strong {
  font-weight: 600;
  opacity: 1;
}

.achievements-list li.is-unlocked .ach-text {
  opacity: 1;
}

.achievements-list li.is-locked {
  opacity: 0.4;
}

@media (min-width: 520px) {
  .app-bar h1 {
    font-size: 1.4rem;
  }
}

/* Capacitor / installed PWA — maximize playfield, kill browser chrome habits */
html.native-app,
html.native-app body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

html.native-app .app {
  max-width: 560px;
  margin: 0 auto;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
}

html.native-app .stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

html.native-app .stage-playfield {
  width: min(100cqw, calc(100cqh * 5 / 6));
  height: min(100cqh, calc(100cqw * 6 / 5));
  max-width: 100%;
  max-height: 100%;
}

html.native-app canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  object-fit: contain;
}

html.native-app .death-bar {
  left: max(9%, env(safe-area-inset-left));
  right: max(9%, env(safe-area-inset-right));
  bottom: max(12px, calc(env(safe-area-inset-bottom) * 0.15));
}

html.native-app .death-bar-hint {
  left: max(9%, env(safe-area-inset-left));
  right: max(9%, env(safe-area-inset-right));
  bottom: max(76px, calc(64px + env(safe-area-inset-bottom) * 0.15));
}

html.native-app .control-deck {
  flex: none;
  height: auto;
  min-height: 0;
  max-width: 560px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

html.native-app .hud-corner {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
}

html.native-app .joystick {
  min-height: 0;
}

html.native-app .joystick-base {
  flex-shrink: 0;
  width: min(32vw, 96px);
  height: min(32vw, 96px);
  aspect-ratio: 1 / 1;
}

/* Landscape: playfield left, compact stacked pads on the right. */
@media (orientation: landscape) and (max-height: 520px) {
  .play-shell {
    flex-direction: row;
  }

  .stage {
    flex: 1 1 auto;
    height: 100%;
  }

  .control-deck {
    position: relative;
    flex: none;
    width: min(26vw, 140px);
    height: 100%;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
    gap: 6px;
    padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 8px;
    background:
      linear-gradient(90deg, rgba(5, 5, 16, 0.15) 0%, rgba(0, 0, 0, 0.94) 45%, #000 100%);
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: auto;
  }

  .joystick-base {
    flex-shrink: 0;
    width: min(20vw, 80px);
    height: min(20vw, 80px);
    aspect-ratio: 1 / 1;
  }

  .hud-corner {
    top: max(6px, env(safe-area-inset-top));
    right: calc(min(26vw, 140px) + max(6px, env(safe-area-inset-right)));
  }
}

html.native-app #installBtn {
  display: none !important;
}
