/* Base, layers and colours. */
:root {
  --bg: #111318;
  --panel: #1b1e26;
  --panel-2: #242833;
  --line: #343a48;
  --text: #f1f3f7;
  --muted: #9aa3b5;
  --accent: #ff8a1e;     /* gains orange */
  --accent-2: #3dd6ff;   /* watch cyan */
  --pink: #ff3df0;
  --good: #3ddc84;
  --bad: #ff4d5e;
  --warn: #ffcc33;
  --protein: #ff5a5f;
  --carbs: #ffcc33;
  --fat: #3dd6ff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: Impact, "Arial Black", "Haettenschweiler", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }
body { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
input { -webkit-user-select: text; user-select: text; touch-action: auto; }

#scene, #hud, #touch, #screens { position: fixed; inset: 0; }
#scene { z-index: 0; }
#scene canvas { display: block; width: 100%; height: 100%; }
#hud { z-index: 10; pointer-events: none; }
#hud.hidden { display: none; }
#touch { z-index: 20; pointer-events: none; display: none; }
#screens { z-index: 30; pointer-events: none; }
#screens:not(:empty) { pointer-events: auto; }
#screens.menu { background: radial-gradient(ellipse at top, rgba(255, 61, 240, .18), transparent 60%), rgba(10, 11, 15, .72); }
#screens.dialog { background: rgba(10, 11, 15, .45); }
#screens.minigame { background: rgba(10, 11, 15, .82); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; color: var(--muted); }
.noscript { padding: 2rem; text-align: center; }

.fatal {
  position: absolute; inset: auto 16px 16px 16px; z-index: 99; padding: 16px; border-radius: var(--radius);
  background: #3a1016; border: 2px solid var(--bad); color: #fff;
}
.fatal code { display: block; margin-top: 6px; font-size: 12px; opacity: .7; word-break: break-word; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.shake { animation: shake .35s; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .shake, .pop { animation: none !important; }
}
