/* Reactor Crisis: 反应堆危机 Stylesheet */
:root {
  --bg-color: #06070a;
  --hazard-yellow: #ffb703;
  --alarm-red: #ff0055;
  --cool-cyan: #00f0ff;
  --pure-white: #f8fafc;
  --glass-bg: rgba(14, 18, 28, 0.82);
  --glass-border: rgba(255, 183, 3, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--pure-white);
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center, #111726 0%, #06080e 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* Emergency Alert Red Border Vignette */
#alarm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  box-shadow: inset 0 0 50px rgba(255, 0, 85, 0);
  transition: box-shadow 0.2s ease;
}

#alarm-overlay.critical {
  animation: alarm-flash 0.6s infinite alternate;
}

@keyframes alarm-flash {
  from { box-shadow: inset 0 0 30px rgba(255, 0, 85, 0.3); }
  to { box-shadow: inset 0 0 90px rgba(255, 0, 85, 0.8); }
}

/* --- Top HUD --- */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 14px) 14px env(safe-area-inset-bottom, 14px) 14px;
}

.top-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.phase-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 130px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.phase-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--hazard-yellow);
}

.phase-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.score-card {
  text-align: right;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.score-val {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
}

.score-sub {
  font-size: 11px;
  color: var(--cool-cyan);
}

/* Dual Thermodynamic Meters */
.meters-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}

.gauge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(380px, 92vw);
}

.gauge-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  width: 60px;
  text-align: right;
}

.gauge-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

.gauge-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.1s linear;
}

.gauge-fill.energy {
  background: linear-gradient(90deg, #00f0ff, #00ff88);
  box-shadow: 0 0 10px #00f0ff;
}

.gauge-fill.heat {
  background: linear-gradient(90deg, #ffb703, #ff0055);
  box-shadow: 0 0 10px #ff0055;
}

.gauge-val {
  font-size: 11px;
  font-weight: 700;
  width: 38px;
  text-align: left;
}

/* Mobile Vent Button */
.bottom-controls {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 14px;
  pointer-events: auto;
  margin-bottom: 12px;
}

.btn-vent {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff5500, #b3002d);
  border: 3px solid rgba(255, 200, 0, 0.6);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(255, 50, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-vent:active {
  transform: scale(0.92);
  filter: brightness(1.2);
  box-shadow: 0 0 35px rgba(255, 200, 0, 0.8);
}

.btn-vent .vent-sub {
  font-size: 9px;
  opacity: 0.8;
  margin-top: 2px;
}

/* Quick Corner Utility Buttons */
.utility-btns {
  position: absolute;
  top: 96px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  z-index: 15;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--pure-white);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-icon:active {
  transform: scale(0.92);
}

/* --- Modals --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  width: min(440px, 92vw);
  background: linear-gradient(135deg, rgba(20, 26, 42, 0.95), rgba(8, 10, 18, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 183, 3, 0.15);
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--hazard-yellow);
  margin-bottom: 8px;
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff, var(--hazard-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
}

.stat-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
}

.stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--hazard-yellow);
  margin-top: 2px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--hazard-yellow), #ff5500);
  border: none;
  border-radius: 14px;
  color: #06070a;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 183, 3, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(1.15);
}

.btn-secondary {
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: var(--pure-white);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

.controls-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 14px;
}
