:root {
  color-scheme: dark;
  --ink: #f6f4ee;
  --muted: #b7c1ba;
  --panel: rgba(15, 20, 19, 0.76);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #ff7847;
  --cool: #4ac7d9;
  --good: #b8f25f;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100%;
  overflow: hidden;
  background: #090d0c;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 120, 71, 0.22), transparent 32%),
    radial-gradient(circle at 76% 36%, rgba(74, 199, 217, 0.18), transparent 34%),
    linear-gradient(145deg, #0d1110 0%, #101816 46%, #070909 100%);
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(238px, 300px);
  gap: 12px;
  align-items: start;
  pointer-events: none;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.objective {
  padding: 16px 17px 17px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 18rem;
  font-size: 1.28rem;
  line-height: 1.18;
  font-weight: 800;
}

.mechanic {
  margin: 10px 0 0;
  max-width: 24rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.42;
}

.status-panel {
  justify-self: end;
  width: 100%;
  padding: 13px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 7px 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-row strong {
  color: var(--ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

.meter {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cool), var(--good));
  transition: width 120ms linear;
}

.heat-meter span {
  width: 100%;
  background: linear-gradient(90deg, #cc3f3d, var(--accent), #ffe47a);
}

#restartButton {
  width: 100%;
  min-height: 42px;
  margin-top: 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #f4efe4;
  color: #111614;
  font-weight: 800;
  cursor: pointer;
}

#restartButton:hover {
  background: #ffffff;
}

#restartButton:focus-visible {
  outline: 3px solid var(--cool);
  outline-offset: 2px;
}

.toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 18px;
  max-width: min(560px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(8, 11, 10, 0.72);
  color: var(--ink);
  box-shadow: 0 14px 40px var(--shadow);
  font-size: 0.92rem;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 760px) {
  .game-shell {
    min-height: 620px;
  }

  .hud {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .objective {
    padding: 13px 14px 14px;
  }

  .status-panel {
    justify-self: stretch;
    padding: 12px;
  }

  h1 {
    max-width: none;
    font-size: 1.08rem;
  }

  .mechanic {
    max-width: none;
    font-size: 0.88rem;
  }

  .stat-row {
    font-size: 0.8rem;
  }

  .toast {
    bottom: 12px;
    font-size: 0.86rem;
  }
}
