:root {
  --bg: #140404;
  --panel: #1f0909;
  --panel-2: #2c0f0f;
  --line: #4a1a1a;
  --text: #fbecd9;
  --muted: #c9a99a;
  --accent: #ffcf3f;
  --red: #e0322a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Patrick Hand', 'Comic Sans MS', system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  height: 100vh;
  height: 100dvh;
}

button { font: inherit; color: inherit; }

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 3px solid #000;
}

.logo {
  margin: 0;
  font-family: 'Bangers', Impact, sans-serif;
  font-weight: 400;
  font-size: clamp(20px, 4vw, 30px);
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
}
.logo span { color: var(--accent); }

/* scene switch: Regular Style / GiBi Style */
.scene-switch {
  margin-left: auto;
  display: flex;
  padding: 3px;
  gap: 3px;
  background: var(--panel-2);
  border: 2px solid #000;
  border-radius: 999px;
}
.scene-btn {
  padding: 4px 12px;
  font-size: 16px;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.scene-btn:hover { background: var(--line); }
.scene-btn.active { background: var(--accent); color: #1a0606; }

.hud-actions { display: flex; gap: 8px; }

/* GiBi Style is a vacant scene for now: no tools, no gameplay HUD */
body[data-scene="gibi"] .toolbar,
body[data-scene="gibi"] .hint,
body[data-scene="gibi"] #reset { visibility: hidden; }
body[data-scene="gibi"] #stage { cursor: default; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--panel-2);
  border: 2px solid #000;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--line); }

/* ---------- Stage ---------- */
.stage-wrap { position: relative; min-height: 0; }
#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#stage.grabbing { cursor: grabbing; }
#stage.no-cursor { cursor: none; }

.hint {
  position: absolute;
  left: 50%; top: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 6px 14px;
  background: rgba(0, 0, 0, .55);
  border-radius: 999px;
  font-size: 17px;
  text-align: center;
  pointer-events: none;
  transition: opacity .6s;
}
.hint.gone { opacity: 0; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 170px));
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--panel);
  border-top: 3px solid #000;
}

/* text-only tool buttons (no icons) */
.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  min-width: 0;
  background: var(--panel-2);
  border: 2px solid #000;
  border-radius: 12px;
  box-shadow: 0 3px 0 #000;
  cursor: pointer;
  transition: transform .06s, background .1s;
}
.tool:hover { background: var(--line); }
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.tool.active {
  background: var(--accent);
  color: #1a0606;
}
.tool .name { font-size: 19px; line-height: 1.05; text-align: center; }

.footer {
  padding: 4px 16px 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .hud { gap: 8px; flex-wrap: wrap; }
  .icon-btn { width: 36px; height: 36px; font-size: 18px; }
  .scene-switch { order: 5; margin-left: 0; width: 100%; }
  .scene-btn { flex: 1; font-size: 15px; }
  .hud-actions { margin-left: auto; }
  .toolbar { gap: 4px; padding: 6px 8px; }
  .tool { padding: 8px 4px; border-radius: 10px; }
  .tool .name { font-size: 15px; }
  .hint { font-size: 14px; }
  .footer { font-size: 11px; }
}
