:root {
  color-scheme: dark;
  --paper: #fff8df;
  --muted: #cabf9f;
  --panel: rgba(24, 21, 16, 0.82);
  --panel-strong: rgba(44, 34, 25, 0.9);
  --edge: rgba(255, 248, 221, 0.18);
  --accent: #2fceb1;
  --heat: #ff7c4d;
  --bright: #f5e36d;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  background: #16120f;
  color: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(47, 206, 177, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(255, 124, 77, 0.1), transparent 38%),
    #16120f;
}

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

.hud,
.controls,
.status {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--edge);
  box-shadow: 0 18px 48px var(--shadow);
  backdrop-filter: blur(16px);
}

.hud {
  top: 18px;
  left: 18px;
  width: min(620px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
}

.title {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.05;
}

.objective,
.mechanic {
  margin: 0;
  color: var(--paper);
  font-size: 15px;
  line-height: 1.35;
}

.mechanic {
  margin-top: 7px;
  color: var(--muted);
}

.readouts {
  display: grid;
  grid-template-columns: repeat(3, 78px);
  gap: 8px;
}

.readout {
  min-height: 62px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 248, 221, 0.13);
  border-radius: 8px;
  background: rgba(10, 9, 8, 0.34);
}

.readout span,
.reservoir span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.readout strong {
  display: block;
  margin-top: 5px;
  color: var(--paper);
  font-size: 24px;
  line-height: 1;
}

.reservoir {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: center;
}

.reservoir-track {
  height: 13px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 248, 221, 0.11);
}

.reservoir-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--heat), var(--bright), var(--accent));
  transform-origin: left center;
}

.controls {
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-strong);
}

.controls button {
  min-width: 118px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 248, 221, 0.18);
  border-radius: 8px;
  background: rgba(255, 248, 221, 0.08);
  color: var(--paper);
  font-weight: 800;
}

.controls button:hover,
.controls button:focus-visible {
  border-color: rgba(47, 206, 177, 0.85);
  outline: none;
  background: rgba(47, 206, 177, 0.16);
}

.control-symbol {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 248, 221, 0.12);
  color: var(--bright);
  line-height: 1;
}

.status {
  left: 18px;
  bottom: 18px;
  max-width: min(520px, calc(100vw - 36px));
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(23, 18, 14, 0.78);
  color: var(--paper);
  font-size: 15px;
  line-height: 1.35;
}

@media (max-width: 780px) {
  .hud {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .readouts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .readout {
    min-width: 0;
  }

  .controls {
    top: auto;
    right: 18px;
    bottom: 18px;
  }

  .controls button {
    min-width: 98px;
  }

  .status {
    bottom: 82px;
  }
}

@media (max-width: 520px) {
  .hud {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    padding: 12px;
  }

  .objective,
  .mechanic,
  .status {
    font-size: 14px;
  }

  .readout strong {
    font-size: 21px;
  }

  .reservoir {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .controls {
    right: 10px;
    bottom: 10px;
    left: 10px;
    justify-content: stretch;
  }

  .controls button {
    flex: 1 1 0;
  }

  .status {
    left: 10px;
    bottom: 76px;
    max-width: calc(100vw - 20px);
  }
}
