/* ==========================================================================
   style.css — Playful Storybook Toy-Box HUD Overlay for WebGL2 World
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --glass-bg: rgba(20, 26, 42, 0.68);
  --glass-border: rgba(255, 255, 255, 0.18);
  --mint: #4de8d0;
  --pink: #ff6b9d;
  --gold: #ffd15c;
  --cream: #fff9ec;
  --text-dim: rgba(255, 249, 236, 0.75);
  --font-round: ui-rounded, 'SF Pro Rounded', 'Avenir Next Rounded', 'Trebuchet MS', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #141b2d;
  font-family: var(--font-round);
  color: var(--cream);
  user-select: none;
  -webkit-user-select: none;
}

#world-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
}

#world-canvas:active {
  cursor: grabbing;
}

/* Top HUD Bar */
.hud-top {
  position: fixed;
  top: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  pointer-events: none;
  z-index: 10;
}

.brand-card {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--glass-border);
  border-radius: 20px;
  padding: 12px 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  max-width: 420px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--pink), #ff9a62);
  box-shadow: 0 3px 10px rgba(255, 107, 157, 0.45);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
  background: linear-gradient(90deg, #ffffff, #ffe39f, #9ef9ea);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.status-ticker {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.80rem;
}

.weasel-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gold);
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: dotPulse 1.1s infinite ease-in-out;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.75; }
  50% { transform: scale(1.25); opacity: 1; }
}

.cone-score {
  background: rgba(255, 107, 157, 0.22);
  border: 1px solid rgba(255, 107, 157, 0.45);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #ffc4d9;
  white-space: nowrap;
}

/* Chiptune Radio Box (Top Right) */
.music-dock {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.music-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--glass-border);
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.music-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--cream);
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.music-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.18);
}

.music-btn.is-playing {
  background: linear-gradient(135deg, #21b89f, #3b82f6);
  border-color: rgba(158, 249, 234, 0.6);
  box-shadow: 0 0 16px rgba(77, 232, 208, 0.4);
}

#wave-canvas {
  width: 78px;
  height: 26px;
  border-radius: 8px;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.music-hint {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--mint);
  background: rgba(16, 24, 38, 0.78);
  border: 1px solid rgba(77, 232, 208, 0.4);
  padding: 4px 11px;
  border-radius: 999px;
  animation: floatHint 1.8s infinite ease-in-out;
}

.music-hint.hidden {
  display: none;
}

@keyframes floatHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Bottom Controls Dock */
.hud-bottom {
  position: fixed;
  bottom: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
}

.control-group {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--glass-border);
  border-radius: 18px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.group-label {
  font-size: 0.70rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 249, 236, 0.52);
  padding: 0 6px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 0.80rem;
  padding: 7px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.pill-btn.active {
  background: rgba(255, 255, 255, 0.92);
  color: #172033;
  border-color: #fff;
  box-shadow: 0 3px 10px rgba(255, 255, 255, 0.24);
}

/* Juicy Action Toy Buttons (Center Bottom) */
.toy-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 0.86rem;
  color: #1b1e2b;
  padding: 10px 16px;
  border-radius: 15px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.toy-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.toy-btn:active {
  transform: translateY(2px);
}

.toy-btn--pink {
  background: linear-gradient(180deg, #ff8eb5, #ff5d94);
  box-shadow: 0 4px 0 #b82d5e, 0 8px 20px rgba(255, 93, 148, 0.38);
  color: #fff;
}

.toy-btn--gold {
  background: linear-gradient(180deg, #ffe074, #ffb72b);
  box-shadow: 0 4px 0 #b57409, 0 8px 20px rgba(255, 183, 43, 0.35);
}

.toy-btn--mint {
  background: linear-gradient(180deg, #7df9e6, #3ad6be);
  box-shadow: 0 4px 0 #1b8c7b, 0 8px 20px rgba(58, 214, 190, 0.35);
}

.kbd-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
}

/* Error Banner Fallback */
.webgl-error {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #141b2d;
  color: #fff;
  font-size: 1.1rem;
  z-index: 100;
}

.webgl-error[hidden] {
  display: none;
}

@media (max-width: 920px) {
  .hud-bottom {
    justify-content: center;
  }
  .group-label, .kbd-tag {
    display: none;
  }
  .brand-card {
    max-width: 280px;
    padding: 10px 14px;
  }
}
