:root {
  --bg-1: #090412;
  --bg-2: #170a2d;
  --bg-3: #091528;
  --panel: rgba(15, 8, 32, 0.72);
  --panel-edge: rgba(74, 241, 255, 0.24);
  --text: #f7f2ff;
  --muted: #cabde9;
  --accent: #5ef4ff;
  --accent-2: #ff4fd8;
  --accent-3: #8f55ff;
  --accent-4: #ffd26e;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  --neon-shadow: 0 0 22px rgba(94, 244, 255, 0.26), 0 0 36px rgba(255, 79, 216, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: var(--app-height, 100vh);
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at top, rgba(255, 79, 216, 0.22), transparent 34%),
    radial-gradient(circle at 18% 24%, rgba(94, 244, 255, 0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(143, 85, 255, 0.25), transparent 34%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1) 58%, #05020b);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.24;
}

.scene-shell {
  position: relative;
  width: 100vw;
  height: var(--app-height, 100vh);
  min-height: 100dvh;
  touch-action: none;
}

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

.hud {
  position: absolute;
  z-index: 2;
  backdrop-filter: blur(20px);
  background:
    linear-gradient(180deg, rgba(23, 10, 45, 0.84), rgba(7, 8, 24, 0.7)),
    rgba(12, 5, 25, 0.7);
  border: 1px solid var(--panel-edge);
  border-radius: 24px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 79, 216, 0.1);
}

.top-left,
.top-right {
  top: 18px;
  width: min(360px, calc(100vw - 32px));
  padding: 18px 18px 16px;
}

.top-left {
  left: 18px;
}

.top-right {
  right: 18px;
}

.bottom-left,
.bottom-right {
  bottom: 18px;
  width: min(250px, calc(50vw - 24px));
  padding: 16px 18px;
}

.bottom-left {
  left: 18px;
}

.bottom-right {
  right: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.32rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.5), 0 0 18px rgba(94, 244, 255, 0.2);
}

.eyebrow-small {
  font-size: 0.92rem;
  margin-bottom: 6px;
  letter-spacing: 0.16em;
}

.headline {
  display: block;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 0 18px rgba(143, 85, 255, 0.16);
}

.subline,
.instructions p,
.tips p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.brand-subline {
  margin: -2px 0 14px;
  font: 700 0.95rem "Trebuchet MS", "Segoe UI", sans-serif;
  color: #ffffff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(255, 79, 216, 0.3);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.score-grid div {
  padding: 12px 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 79, 216, 0.1), rgba(94, 244, 255, 0.04)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 18px rgba(94, 244, 255, 0.06);
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.score-grid strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.event-title {
  font-size: clamp(1.12rem, 1.5vw, 1.44rem);
  line-height: 1.12;
}

.event-intro {
  margin-bottom: 14px;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.event-chip {
  padding: 11px 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(94, 244, 255, 0.1), rgba(255, 79, 216, 0.08)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(94, 244, 255, 0.18);
  box-shadow: inset 0 0 14px rgba(255, 79, 216, 0.08);
}

.event-chip span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  margin-bottom: 6px;
}

.event-chip strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.18;
}

.event-chip-wide {
  grid-column: 1 / -1;
}

.event-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.26), rgba(94, 244, 255, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--neon-shadow);
  color: #ffffff;
  font: 700 0.85rem "Trebuchet MS", "Segoe UI", sans-serif;
  text-align: center;
}

.match-callout {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(15, 24, 50, 0.88), rgba(16, 8, 31, 0.74)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 18px rgba(94, 244, 255, 0.06);
}

.promo-copy {
  margin-top: 10px;
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 0 14px rgba(255, 79, 216, 0.2);
}

.boot {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 240px;
  max-width: min(92vw, 420px);
  padding: 18px 22px;
  text-align: center;
  font-size: 1rem;
  z-index: 5;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.boot.is-hidden {
  opacity: 0;
  transform: translate(-50%, -56%);
  pointer-events: none;
}

.boot.is-error {
  border-color: rgba(255, 93, 115, 0.42);
  color: #ffe6eb;
}

.lobby-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, rgba(3, 10, 16, 0.62), rgba(3, 10, 16, 0.78));
  backdrop-filter: blur(18px);
}

.lobby-overlay.is-hidden {
  display: none;
}

.lobby-card {
  width: min(900px, 100%);
  padding: 24px;
  border-radius: 26px;
  background:
    radial-gradient(circle at top, rgba(255, 79, 216, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(23, 10, 45, 0.95), rgba(7, 8, 24, 0.96));
  border: 1px solid rgba(94, 244, 255, 0.24);
  box-shadow: var(--shadow), inset 0 0 24px rgba(255, 79, 216, 0.08);
}

.lobby-showcase {
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1.2fr);
  gap: 22px;
  align-items: stretch;
}

.poster-preview {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(94, 244, 255, 0.28);
  background:
    radial-gradient(circle at top, rgba(255, 79, 216, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(19, 8, 38, 0.96), rgba(5, 8, 24, 0.98));
  box-shadow: var(--shadow), inset 0 0 26px rgba(94, 244, 255, 0.08);
}

.poster-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 8, 24, 0) 32%, rgba(7, 8, 24, 0.52)),
    radial-gradient(circle at top, rgba(94, 244, 255, 0.18), transparent 42%);
}

.poster-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-preview-tag {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(9, 7, 24, 0.74);
  border: 1px solid rgba(94, 244, 255, 0.26);
  color: #ffffff;
  font: 700 0.78rem "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--neon-shadow);
}

.lobby-main {
  display: grid;
  align-content: start;
}

.lobby-promo {
  display: grid;
  gap: 6px;
  margin: 14px 0 4px;
}

.lobby-promo span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(94, 244, 255, 0.14);
  color: #ffffff;
  font: 700 0.82rem "Trebuchet MS", "Segoe UI", sans-serif;
}

.lobby-contact {
  margin: 14px 0 2px;
  color: #ffffff;
  font: 700 0.9rem "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.45;
  text-shadow: 0 0 16px rgba(255, 79, 216, 0.2);
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.field span {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 16px;
  font: 600 1rem "Trebuchet MS", "Segoe UI", sans-serif;
}

.field input:focus {
  outline: 2px solid rgba(255, 183, 3, 0.45);
  outline-offset: 1px;
}

.lobby-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.lobby-actions button {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(107, 47, 255, 0.82), rgba(15, 18, 44, 0.92));
  color: var(--text);
  font: 700 0.92rem "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.lobby-actions button:hover,
.lobby-actions button:focus-visible {
  outline: none;
  background: linear-gradient(180deg, rgba(255, 79, 216, 0.96), rgba(94, 244, 255, 0.84));
}

.lobby-tip {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.orientation-lock {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 6;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(255, 183, 3, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(4, 11, 17, 0.92), rgba(3, 8, 13, 0.98));
  text-align: center;
}

.orientation-lock-card {
  width: min(360px, 100%);
  padding: 24px 22px;
  border-radius: 28px;
  border: 1px solid rgba(172, 223, 255, 0.18);
  background: linear-gradient(180deg, rgba(8, 23, 34, 0.94), rgba(6, 16, 24, 0.96));
  box-shadow: var(--shadow);
}

.phone-icon {
  width: 72px;
  height: 112px;
  margin: 0 auto 14px;
  border-radius: 22px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  position: relative;
  transform: rotate(90deg);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.phone-icon::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 183, 3, 0.2), rgba(74, 227, 181, 0.12)),
    rgba(255, 255, 255, 0.06);
}

.phone-icon::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 4px;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.meters {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.meter span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 7px;
}

.track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ae3b5, #97f1d4);
  box-shadow: 0 0 24px rgba(74, 227, 181, 0.45);
  transform-origin: left center;
}

.track.accent i {
  background: linear-gradient(90deg, #ffb703, #ff5d73);
  box-shadow: 0 0 24px rgba(255, 93, 115, 0.45);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2ch;
  padding: 0.25rem 0.45rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
}

.mobile-ui {
  display: none;
  position: absolute;
  inset: auto 0 0 0;
  z-index: 3;
  padding: 0 18px 18px;
  pointer-events: none;
  justify-content: space-between;
  align-items: flex-end;
}

.joystick,
.action-stack {
  pointer-events: auto;
}

.joystick-ring {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.12));
  position: relative;
  touch-action: none;
  box-shadow: var(--shadow);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin-left: -29px;
  margin-top: -29px;
  background: linear-gradient(180deg, rgba(255, 183, 3, 0.92), rgba(255, 93, 115, 0.92));
  box-shadow: 0 12px 30px rgba(255, 93, 115, 0.3);
}

.action-stack {
  display: grid;
  grid-template-columns: repeat(3, 82px);
  gap: 10px;
}

.action-stack button {
  width: 82px;
  height: 62px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16, 36, 51, 0.95), rgba(9, 20, 28, 0.88));
  color: var(--text);
  font: 700 0.8rem "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.05em;
  line-height: 1.05;
  text-align: center;
  padding: 0 6px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: manipulation;
}

.action-stack button:active,
.action-stack button.is-active {
  background: linear-gradient(180deg, rgba(255, 183, 3, 0.94), rgba(255, 93, 115, 0.92));
}

.voice-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.voice-controls button {
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 36, 51, 0.95), rgba(9, 20, 28, 0.88));
  color: var(--text);
  font: 700 0.76rem "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.voice-controls p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.voice-controls button:hover,
.voice-controls button:focus-visible {
  outline: none;
  background: linear-gradient(180deg, rgba(255, 183, 3, 0.94), rgba(255, 93, 115, 0.92));
}

@media (max-width: 1040px) {
  .top-left,
  .top-right {
    width: min(320px, calc(100vw - 32px));
  }

  .bottom-left,
  .bottom-right {
    width: min(220px, calc(50vw - 24px));
  }
}

@media (max-width: 860px) {
  .top-left,
  .top-right,
  .bottom-left,
  .bottom-right {
    position: static;
    width: auto;
  }

  .scene-shell {
    display: grid;
  }

  #game {
    grid-area: 1 / 1;
  }

  .hud {
    margin: 12px;
    max-width: calc(100vw - 24px);
  }

  .top-left {
    justify-self: start;
    align-self: start;
  }

  .top-right {
    justify-self: end;
    align-self: start;
  }

  .bottom-left {
    justify-self: start;
    align-self: end;
  }

  .bottom-right {
    justify-self: end;
    align-self: end;
  }

  .lobby-showcase {
    grid-template-columns: 1fr;
  }

  .poster-preview {
    min-height: 220px;
    max-height: 320px;
  }
}

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

  .instructions {
    max-width: 220px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .orientation-lock {
    display: flex;
  }

  .mobile-ui,
  .hud,
  .lobby-overlay {
    visibility: hidden;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .scene-shell {
    min-height: 100dvh;
  }

  .top-left,
  .top-right {
    top: max(10px, env(safe-area-inset-top));
    width: min(288px, 34vw);
    padding: 12px 14px;
  }

  .top-left {
    left: max(10px, env(safe-area-inset-left));
  }

  .top-right {
    right: max(10px, env(safe-area-inset-right));
  }

  .bottom-left {
    display: none;
  }

  .bottom-right {
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(96px + env(safe-area-inset-bottom));
    width: min(244px, 34vw);
    padding: 12px 14px;
  }

  .bottom-right .eyebrow {
    margin-bottom: 8px;
    font-size: 1rem;
  }

  .bottom-right p,
  .voice-controls p,
  .voice-controls button {
    font-size: 0.72rem;
  }

  .event-grid {
    gap: 8px;
  }

  .event-chip {
    padding: 9px 10px;
  }

  .event-chip span {
    font-size: 0.62rem;
  }

  .event-chip strong,
  .event-banner {
    font-size: 0.78rem;
  }

  .score-grid strong {
    font-size: 1.55rem;
  }

  .headline {
    font-size: 1.1rem;
  }

  .mobile-ui {
    padding:
      0
      max(12px, env(safe-area-inset-right))
      calc(12px + env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .joystick-ring {
    width: 110px;
    height: 110px;
  }

  .joystick-knob {
    width: 48px;
    height: 48px;
    margin-left: -24px;
    margin-top: -24px;
  }

  .action-stack {
    grid-template-columns: repeat(4, 62px);
    gap: 7px;
  }

  .action-stack button {
    width: 62px;
    height: 48px;
    border-radius: 14px;
    font-size: 0.58rem;
  }
}

@media (max-width: 680px) {
  .hud {
    padding: 14px;
    border-radius: 18px;
  }

  .top-left,
  .top-right {
    max-width: calc(100vw - 20px);
    margin: 10px;
  }

  .bottom-left {
    margin: 10px;
    max-width: 180px;
  }

  .bottom-right {
    display: none;
  }

  .score-grid strong {
    font-size: 1.65rem;
  }

  .headline {
    font-size: 1.2rem;
  }

  .lobby-card {
    padding: 18px;
  }

  .poster-preview {
    min-height: 210px;
    max-height: 260px;
  }

  .joystick-ring {
    width: 118px;
    height: 118px;
  }

  .joystick-knob {
    width: 52px;
    height: 52px;
    margin-left: -26px;
    margin-top: -26px;
  }

  .action-stack {
    grid-template-columns: repeat(3, 64px);
    gap: 7px;
  }

  .action-stack button {
    width: 64px;
    height: 52px;
    border-radius: 16px;
    font-size: 0.62rem;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-width: 680px) {
  .bottom-right {
    display: block;
  }

  .top-left,
  .top-right,
  .bottom-right {
    margin: 0;
  }
}
