* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  min-height: 100dvh;
}
button, select, a { font: inherit; }
button {
  border: 0;
  border-radius: 12px;
  background: #0e7490;
  color: #fff;
  min-height: 48px;
  padding: 10px 16px;
  cursor: pointer;
}
button:disabled { background: #334155; color: #94a3b8; cursor: default; }
button.ghost { background: #1e293b; color: #e5e7eb; }
button.danger { background: #9f1239; }
.screen { min-height: 100dvh; }
.menu-inner, .sheet {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand svg { width: 72px; height: 72px; flex: 0 0 auto; }
h1 { font-size: 1.7rem; margin: 0; }
.score, .hint, .taken { color: #cbd5e1; margin: 8px 0 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
.links a { color: #67e8f9; }
label.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-weight: 600; }
select, input[type="range"] { width: 100%; min-height: 44px; }
.choices, .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button[aria-pressed="true"], .swatches button[aria-pressed="true"] { outline: 3px solid #facc15; }
.swatches button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.check { flex-direction: row; align-items: center; gap: 10px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.form-actions button { flex: 1; }
.save-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #1e293b;
  border-radius: 12px;
  padding: 8px;
  margin-top: 10px;
}
.save-row button.open { flex: 1; text-align: start; background: transparent; color: #e5e7eb; }
.game-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #2c3340;
}
.stage { min-height: 0; background: #2c3340; }
.stage canvas { width: 100%; height: 100%; display: block; touch-action: none; }
aside {
  background: #0f172a;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#status { margin: 0; font-size: 1.05rem; font-weight: 700; }
#time, #taken { margin: 0; color: #cbd5e1; }
.actions, .orbit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.orbit { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.actions button, .orbit button { flex: 1; min-width: 0; }
.orbit button { background: #1e293b; min-height: 44px; padding: 8px; }
.orbit svg { width: 22px; height: 22px; display: block; margin: 0 auto; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  z-index: 5;
}
.dialog {
  width: min(420px, 100%);
  background: #111827;
  border-radius: 16px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.dialog h2 { margin: 0 0 8px; }
.dialog p { margin: 0 0 14px; color: #e5e7eb; }
.dialog .actions { display: flex; flex-direction: column; gap: 8px; }
[hidden] { display: none !important; }
@media (min-width: 960px) {
  .modal { align-items: center; }
  .game-shell {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: minmax(0, 1fr);
  }
  aside {
    padding: 20px 16px;
    justify-content: center;
  }
  .actions { flex-direction: column; }
}
