:root {
  color-scheme: dark;
  --ink: #fff5d6;
  --muted: #bad2e8;
  --panel: rgba(4, 9, 24, 0.86);
  --line: rgba(79, 205, 255, 0.34);
  --gold: #ffd63d;
  --pink: #ff4fb8;
  --cyan: #5df0ff;
  --orange: #ff7a22;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 79, 184, 0.2), transparent 26rem),
    radial-gradient(circle at 78% 14%, rgba(93, 240, 255, 0.16), transparent 28rem),
    linear-gradient(180deg, #030718 0%, #0a1230 55%, #150817 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: grid;
  place-items: center;
}

.cabinet {
  width: min(100%, 1040px);
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 10px;
  user-select: none;
}

.scorebar,
.controls,
.touchpad,
.splash {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow:
    0 0 0 1px rgba(255, 79, 184, 0.12),
    0 20px 54px rgba(0, 0, 0, 0.34);
}

.scorebar {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(92px, 0.6fr) minmax(180px, 1fr) minmax(92px, 0.6fr);
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

strong {
  display: block;
  color: var(--gold);
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.9;
  text-shadow:
    0 3px 0 #1a347b,
    0 6px 0 #74124c;
}

.title {
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(2.1rem, 8vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow:
    0 4px 0 #1c2f8b,
    0 8px 0 #6c1c84,
    0 0 18px rgba(93, 240, 255, 0.55);
}

.title small {
  display: block;
  min-height: 1.25em;
  margin-top: 7px;
  color: var(--cyan);
  font-weight: 950;
}

.splash {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.splash img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.splash p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.3;
}

canvas {
  width: 100%;
  max-width: 760px;
  height: auto;
  max-height: none;
  aspect-ratio: 19 / 21;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #020617;
  touch-action: none;
  box-shadow:
    inset 0 0 40px rgba(93, 240, 255, 0.08),
    0 28px 70px rgba(0, 0, 0, 0.42);
}

.controls,
.touchpad {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls b,
.touchpad button {
  min-width: 44px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font: inherit;
  font-weight: 950;
}

.controls b {
  display: inline-grid;
  place-items: center;
  margin-right: 5px;
  padding: 0 8px;
}

.touchpad {
  display: none;
}

.touchpad > div {
  display: flex;
  gap: 8px;
}

.touchpad button {
  padding: 0 12px;
  touch-action: none;
}

.touchpad button:active {
  transform: translateY(1px);
  background: rgba(255, 122, 34, 0.24);
}

@media (max-width: 760px) {
  .cabinet {
    min-height: auto;
    grid-template-rows: auto auto auto auto;
    padding: 8px;
    gap: 8px;
  }

  .scorebar {
    min-height: 72px;
    padding: 8px;
  }

  .splash {
    display: none;
  }

  .controls {
    display: none;
  }

  .touchpad {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: rgba(3, 7, 20, 0.94);
    backdrop-filter: blur(8px);
  }

  .touchpad > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .touchpad button {
    min-height: 54px;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 2rem;
  }

  strong {
    font-size: 1.8rem;
  }

  .title small {
    font-size: 0.76rem;
  }
}
