:root {
  color-scheme: dark;
  --bg: #0b1016;
  --panel: #121b24;
  --line: #2e4356;
  --text: #edf4fb;
  --muted: #9fb0bf;
  --mint: #42e2b8;
  --sky: #78d7ff;
  --rose: #ff7b8f;
  --gold: #ffd166;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 100% 30px,
    linear-gradient(135deg, #0b1016 0%, #151c24 50%, #171923 100%);
  color: var(--text);
  font-family: Consolas, "Noto Sans KR", Arial, sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.shell {
  width: min(1030px, 100%);
  display: grid;
  grid-template-columns: minmax(300px, 520px) minmax(260px, 360px);
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.hud div {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(18, 27, 36, 0.92);
}

.hud span {
  display: block;
  margin-bottom: 4px;
  color: var(--sky);
  font-size: 11px;
  text-transform: uppercase;
}

.hud strong {
  font-size: 26px;
  color: #fff8df;
  line-height: 1;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #060a10;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.side-panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(18, 27, 36, 0.92);
}

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.key-grid {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px 12px;
  margin: 24px 0;
  align-items: center;
}

.key-grid span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3a4d62;
  border-radius: 5px;
  background: #182532;
  color: #fff8df;
  font-weight: 700;
}

.key-grid p {
  margin: 0;
  font-size: 14px;
}

.start-button,
.touch-controls button {
  border: 1px solid rgba(66, 226, 184, 0.72);
  border-radius: 5px;
  background: var(--mint);
  color: #071014;
  font: inherit;
  font-weight: 800;
}

.start-button {
  width: 100%;
  min-height: 48px;
}

.touch-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.touch-controls button {
  min-height: 44px;
  background: var(--panel);
  color: var(--text);
  touch-action: none;
}

.touch-controls button:active,
.touch-controls button.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 209, 102, 0.14);
}

@media (max-width: 820px) {
  body {
    align-items: start;
    padding: 10px;
  }

  .shell {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .side-panel {
    padding: 18px;
  }

  h1 {
    font-size: 30px;
  }
}

@media (max-width: 430px) {
  .hud strong {
    font-size: 21px;
  }

  .hud div {
    padding: 9px;
  }
}
