:root {
  --bg: #080b14;
  --panel: rgba(15, 20, 36, 0.88);
  --text: #eef2ff;
  --accent: #5ae8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, rgba(75, 95, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(255, 105, 180, 0.16), transparent 28%),
    linear-gradient(180deg, #071024 0%, #03060d 100%);
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
}

.app-shell {
  width: min(100%, 1040px);
  max-width: 1040px;
}

.title-screen,
.game-screen {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.title-screen {
  padding: 48px 36px;
  text-align: center;
}

.title-screen h1 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0.04em;
}

.title-screen p {
  margin: 0 auto 28px;
  max-width: 680px;
  color: #cdd4ff;
  line-height: 1.7;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
  button:hover {
    transform: translateY(-1px);
  }
}

.main-button {
  background: linear-gradient(135deg, #5ad7ff, #6e77ff);
  color: #071124;
  box-shadow: 0 16px 32px rgba(90, 215, 255, 0.22);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: #eef2ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hidden {
  display: none;
}

.game-screen {
  padding: 18px;
}

.hud-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.status-box {
  flex: 1 1 160px;
  min-width: 150px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.98rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.color-indicator {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
}

.canvas-wrap {
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: radial-gradient(circle at top, rgba(51, 105, 255, 0.12), transparent 40%),
    linear-gradient(180deg, rgba(10, 14, 35, 0.95), rgba(7, 11, 20, 0.96));
  padding: 16px;
}

canvas {
  display: block;
  width: 100%;
  max-width: 900px;
  border-radius: 20px;
  background: #050914;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.24), 0 0 50px rgba(90, 215, 255, 0.12);
}

.mobile-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 18px;
}

.mobile-controls button {
  min-height: 56px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #eef2ff;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 16, 0.88);
  z-index: 10000;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.gameover-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 28px 32px;
  border-radius: 28px;
  background: rgba(12, 18, 36, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  text-align: center;
  pointer-events: auto;
  touch-action: manipulation;
}

.gameover-card h2 {
  margin-top: 0;
  font-size: 2rem;
}

.gameover-card p {
  margin: 16px 0;
  line-height: 1.6;
}

.gameover-card ul {
  text-align: left;
  padding-left: 18px;
}

.gameover-card li {
  margin-bottom: 10px;
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .title-screen,
  .game-screen {
    border-radius: 22px;
  }

  .hud-bar {
    flex-direction: column;
  }

  canvas {
    max-width: 100%;
    height: 60vw;
  }

  .mobile-controls {
    grid-template-columns: repeat(3, 1fr);
  }
}
