:root {
  --bg: #0b1325;
  --surface: #131f3b;
  --surface-2: #1a2a52;
  --line: rgba(148, 163, 184, 0.26);
  --text: #e2e8f0;
  --muted: #94a3b8;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #17284d, #0b1325 60%);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
}

.wrap {
  width: min(760px, 100vw);
  margin: 0 auto;
  padding: 12px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.top h1 {
  margin: 0;
  font-size: 1.35rem;
}

.top p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#restartBtn {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

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

.chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.chip span { color: var(--muted); }

.board {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1732;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stack {
  min-height: 240px;
  border: 1px dashed rgba(148,163,184,0.35);
  border-radius: 12px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
  padding: 10px 6px;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.stack.selected {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56,189,248,0.3) inset;
}

.hex {
  width: 74%;
  max-width: 78px;
  aspect-ratio: 1 / 0.86;
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
  border: 2px solid rgba(255,255,255,0.18);
}

.tip {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 640px) {
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
