*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0F1117;
  --surface: #161925;
  --border: #262a3e;
  --text: #e8e8f0;
  --subtext: #7777a0;
  --accent: #ff6b35;
  --blue: #4ecdc4;
  --radius: 16px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

/* ── START ── */
.start-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 20px 24px;
  max-width: 480px;
}

.office-emoji { font-size: 4rem; }

h1 {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 900;
  line-height: 1.15;
  background: linear-gradient(135deg, #ff6b35, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--subtext);
  font-size: 0.9rem;
}

.instructions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  width: 100%;
}

.inst-item {
  font-size: 0.88rem;
  color: var(--text);
}

.hi-display {
  background: #ffd70018;
  border: 1px solid #ffd70040;
  color: #ffd700;
  padding: 7px 20px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 700;
}

.btn-start {
  background: linear-gradient(135deg, #ff6b35, #ff4500);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 36px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 4px 24px #ff6b3555;
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 8px 32px #ff6b3577; }
.btn-start:active { transform: scale(0.96); }

.btn-secondary {
  background: var(--surface);
  color: var(--subtext);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── GAME HUD ── */
#gameScreen {
  padding: 0;
  justify-content: flex-start;
  position: relative;
}

.game-hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0a0b14;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
  z-index: 10;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 110px;
}

.score-display {
  font-size: 1.5rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 14px #ffd70066;
  min-width: 60px;
  display: inline-block;
}

.combo-display {
  font-size: 0.78rem;
  font-weight: 800;
  color: #ff6b35;
  min-width: 60px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud-center {
  flex: 1;
  max-width: 220px;
}

.chaos-meter-container { width: 100%; }
.chaos-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--subtext);
  text-align: center;
  margin-bottom: 3px;
}

.chaos-track {
  background: #0a0b14;
  border: 1px solid var(--border);
  border-radius: 50px;
  height: 14px;
  position: relative;
  overflow: visible;
}

.chaos-fill {
  height: 100%;
  width: 0%;
  border-radius: 50px;
  background: linear-gradient(90deg, #ff6b35, #ff0000);
  transition: width 0.3s ease;
}

.chaos-fire {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.chaos-fire.visible { opacity: 1; animation: fireWiggle 0.5s ease infinite alternate; }

@keyframes fireWiggle {
  from { transform: translateY(-50%) rotate(-10deg); }
  to   { transform: translateY(-50%) rotate(10deg); }
}

.hud-right { min-width: 50px; text-align: right; }

.timer-display {
  font-size: 1.5rem;
  font-weight: 900;
  color: #4ecdc4;
  text-shadow: 0 0 14px #4ecdc466;
  transition: color 0.3s;
}

.timer-display.urgent { color: #ff4757; text-shadow: 0 0 14px #ff475766; animation: timerPulse 0.5s ease infinite alternate; }

@keyframes timerPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.1); }
}

/* Canvas */
#gameCanvas {
  width: 100%;
  flex: 1;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Fire Drill Banner */
.fire-drill-banner {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, #ff0000, #ff6b00);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 12px 28px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 32px #ff000088;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  letter-spacing: 2px;
  transition: opacity 0.3s, transform 0.3s;
}

.fire-drill-banner.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: bannerPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bannerPop {
  from { transform: translateX(-50%) scale(0.6); }
  to   { transform: translateX(-50%) scale(1); }
}

/* ── GAME OVER ── */
.gameover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 20px 24px;
  max-width: 440px;
}

.go-icon { font-size: 4rem; }

h2 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  color: #ffd700;
}

.final-score-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.final-score-box {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.fs-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--subtext);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.fs-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
}

.fs-value.hi { color: #ffd700; }

.go-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  width: 100%;
  font-size: 0.85rem;
  color: var(--subtext);
  line-height: 1.8;
  text-align: left;
}
