:root {
  --bg: #11131a;
  --panel: #1a1f2b;
  --text: #f8f9ff;
  --accent: #53d8fb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1d2a3d, var(--bg));
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  display: grid;
  place-items: center;
}

.app {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  width: min(92vw, 860px);
}

.board-panel {
  position: relative;
  flex: 0 0 auto;
}

canvas {
  display: block;
  border-radius: 8px;
  background: #0d0f14;
  box-shadow: 0 0 24px rgba(83, 216, 251, 0.15);
}

#game {
  width: min(58vw, 300px);
  height: calc(min(58vw, 300px) * 2);
  max-height: 80vh;
  touch-action: manipulation;
}

.hud {
  background: rgba(26, 31, 43, 0.86);
  padding: 1rem;
  border-radius: 10px;
  min-width: 220px;
}

.hud h1 { margin-top: 0; }
.stat {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0;
}

#hold, #next {
  width: 100%;
  height: auto;
  margin-bottom: 0.5rem;
}

.controls {
  font-size: 0.8rem;
  opacity: 0.8;
  line-height: 1.4;
}

.touch-controls {
  display: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.7rem;
  background: rgba(5, 7, 10, 0.8);
  backdrop-filter: blur(2px);
}
.hidden { display: none; }

button {
  border: none;
  background: var(--accent);
  color: #091317;
  font-weight: 700;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  body {
    display: block;
  }

  .app {
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .touch-controls {
    display: grid;
    width: min(95vw, 420px);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .touch-btn {
    min-height: 52px;
    border-radius: 10px;
    font-size: 1rem;
    padding: 0.5rem;
    touch-action: manipulation;
    user-select: none;
  }

  .hud {
    width: min(95vw, 420px);
    max-width: 420px;
  }
}
