/* Tumbleyard — plan33.io. Slate/amber industrial "yard" theme, harness conventions from docs/game-template.md. */

:root {
  --bg: #12151b;
  --fg: #e9ecf2;
  --muted: #8a93a3;
  --accent: #f2a93b;
  --accent-ink: #241503;
  --scrim: rgba(8, 10, 14, 0.80);
  --panel: rgba(24, 28, 36, 0.95);
  --slate: #2b3240;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: var(--bg);
}

/* ---------- corner chrome ---------- */
.chrome {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  z-index: 20;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: 600 16px/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* ---------- bottom toolbar: shape / material / wind / clear ---------- */
.toolbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 15;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 calc(10px + env(safe-area-inset-left)) 0 calc(10px + env(safe-area-inset-right));
}

body.state-playing .toolbar,
body.state-paused   .toolbar { display: flex; }

.tb-group {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(20, 24, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(4px);
}

.tb-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--slate);
  color: var(--fg);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.tb-btn:hover { filter: brightness(1.15); }
.tb-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
#btn-wind[aria-pressed="true"] {
  background: #4d8ef2;
  color: #041225;
  border-color: #4d8ef2;
}
#btn-clear { background: #4a2530; border-color: rgba(255,255,255,0.12); }
#btn-clear:hover { background: #63303e; }

@media (max-width: 560px) {
  .tb-btn { padding: 6px 9px; font-size: 12px; }
}

/* ---------- overlays: visibility driven purely by body state class ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  z-index: 30;
}

body.state-menu   .overlay-menu,
body.state-paused .overlay-paused { display: grid; }

.panel {
  width: min(440px, 100%);
  padding: 28px 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: var(--panel);
  text-align: center;
  animation: pop 180ms ease-out;
}

@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }

.panel h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: 0.5px; }
.panel h2 { margin: 0 0 14px; font-size: 24px; }
.tagline  { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.hint     { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.btn {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 16px/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
