:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
  color: #f2f7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(49, 99, 255, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(0, 214, 160, 0.18), transparent 28%),
    #07111f;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  position: relative;
}

.menu-panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(420px, 100vw);
  max-width: 100%;
  padding: 32px;
  border-right: 1px solid rgba(154, 171, 197, 0.18);
  background: rgba(4, 11, 22, 0.86);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  z-index: 2;
}

.menu-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7fd8ff;
}

.description {
  margin: 0;
  color: #bdd0e8;
  line-height: 1.5;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field span {
  color: #dce8f7;
  font-size: 0.95rem;
}

.field input {
  border: 1px solid rgba(154, 171, 197, 0.24);
  background: rgba(8, 18, 32, 0.94);
  color: #f4f8ff;
  border-radius: 8px;
  padding: 14px 16px;
  outline: none;
}

.field input:focus {
  border-color: #4cc9f0;
  box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.18);
}

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

.swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.swatch:hover {
  transform: translateY(-1px);
}

.swatch.selected {
  border-color: #f6fbff;
  box-shadow: 0 0 0 3px rgba(246, 251, 255, 0.18);
}

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

.primary-button,
.secondary-button,
.tool-button {
  border-radius: 8px;
  border: 0;
  min-height: 46px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.tool-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #4cc9f0, #7b61ff);
  color: #05101d;
  font-weight: 700;
}

.secondary-button,
.tool-button {
  background: rgba(12, 25, 42, 0.94);
  color: #f3f7ff;
  border: 1px solid rgba(154, 171, 197, 0.24);
}

.status-line {
  min-height: 1.5em;
  margin: 0;
  color: #9ab2cf;
}

.game-panel {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

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

.hud,
.scoreboard,
.controls-card {
  position: absolute;
  z-index: 1;
}

.hud {
  display: flex;
  gap: 12px;
}

.top-left {
  top: 20px;
  left: 20px;
}

.top-right {
  top: 20px;
  right: 20px;
  align-items: start;
}

.bottom-left {
  left: 20px;
  bottom: 20px;
}

.hud-card,
.boost-card,
.scoreboard,
.controls-card {
  background: rgba(6, 13, 24, 0.78);
  border: 1px solid rgba(154, 171, 197, 0.18);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.hud-card {
  min-width: 110px;
  padding: 12px 14px;
}

.hud-card.wide {
  min-width: 260px;
}

.hud-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: #8fa8c6;
  margin-bottom: 6px;
}

.hud-value {
  font-weight: 700;
}

.scoreboard {
  top: 20px;
  right: 20px;
  width: min(280px, calc(100vw - 40px));
  padding: 14px;
  margin-top: 74px;
}

.scoreboard h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.score-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(154, 171, 197, 0.12);
}

.score-row:first-of-type {
  border-top: 0;
}

.score-chip {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.score-name {
  min-width: 0;
}

.score-name strong,
.score-name span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-name span {
  color: #91a8c5;
  font-size: 0.86rem;
}

.score-points {
  text-align: right;
  font-size: 0.88rem;
  color: #dfe8f5;
}

.boost-card {
  width: 220px;
  padding: 12px 14px;
}

.boost-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.boost-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #06d6a0, #4cc9f0);
}

.controls-card {
  left: 20px;
  top: 20px;
  margin-top: 84px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #bcd1e8;
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .menu-panel {
    width: min(100%, 440px);
  }

  .scoreboard {
    top: auto;
    bottom: 20px;
    right: 20px;
    margin-top: 0;
  }

  .controls-card {
    top: auto;
    bottom: 112px;
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .menu-panel {
    width: 100%;
    padding: 24px;
  }

  .hud {
    flex-wrap: wrap;
  }

  .top-left,
  .top-right,
  .bottom-left {
    left: 12px;
    right: 12px;
  }

  .top-right {
    top: auto;
    bottom: 12px;
    justify-content: end;
  }

  .scoreboard {
    width: calc(100vw - 24px);
    right: 12px;
    left: 12px;
    bottom: 82px;
  }

  .controls-card {
    display: none;
  }
}
