:root {
  color-scheme: dark;
  --bg: #161718;
  --panel: #24272a;
  --panel-strong: #30343a;
  --line: #454a50;
  --text: #f4f1e8;
  --muted: #aaa69d;
  --accent: #ffd166;
  --accent-2: #2ec4b6;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(46, 196, 182, 0.14), transparent 34rem),
    linear-gradient(135deg, #161718 0%, #22201d 46%, #171a1d 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #1c1914;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: #ffe09a;
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid rgba(46, 196, 182, 0.72);
  outline-offset: 3px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(220px, 280px);
  gap: 18px;
  width: min(94vw, 760px);
  min-height: min(92vh, 760px);
  align-items: center;
}

.play-area,
.side-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(36, 39, 42, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.play-area {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.status-bar > div,
.preview-block {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(48, 52, 58, 0.82);
}

.status-bar > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
}

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

strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.2rem, 4vw, 1.95rem);
  line-height: 1;
}

.board-frame {
  position: relative;
  width: 100%;
  max-width: 390px;
  aspect-ratio: 1 / 2;
  justify-self: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111315;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  padding: 22px;
  background: rgba(17, 19, 21, 0.78);
  text-align: center;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(2.5rem, 13vw, 5rem);
  line-height: 0.9;
}

.overlay button {
  width: min(220px, 70vw);
}

.side-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.preview-block {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 164px;
  padding: 12px;
}

.preview-block canvas {
  width: 128px;
  height: 128px;
}

.actions,
.touch-pad {
  display: grid;
  gap: 8px;
}

.actions {
  grid-template-columns: 1fr 1fr;
}

.actions button {
  background: var(--panel-strong);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
}

.actions button:hover {
  background: #3b4148;
}

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

.touch-pad button {
  background: #2ec4b6;
  color: #06231f;
}

@media (max-width: 720px) {
  body {
    place-items: start center;
  }

  .shell {
    grid-template-columns: 1fr;
    width: min(100vw, 430px);
    min-height: auto;
    padding: 10px;
  }

  .play-area,
  .side-panel {
    box-shadow: none;
  }

  .side-panel {
    grid-template-columns: 1fr 1fr;
  }

  .actions,
  .touch-pad {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {
  .side-panel {
    grid-template-columns: 1fr;
  }

  .touch-pad {
    grid-template-columns: repeat(2, 1fr);
  }
}
