:root {
  --danger: #ff2a2a;
  --warning: #ffcc00;
  --safe: #00ff73;
  --cherenkov: #00f0ff;
  --bg-dark: #05070a;
  --bg-panel: rgba(20, 25, 35, 0.9);
  --border-dim: rgba(255, 255, 255, 0.1);
  --font-tech: 'Orbitron', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: #fff;
  font-family: var(--font-mono);
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#alarm-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255, 0, 0, 0.3); pointer-events: none; opacity: 0;
  z-index: 1000; animation: alarm-pulse 1s infinite alternate;
  display: none;
}

@keyframes alarm-pulse { from { opacity: 0; } to { opacity: 0.6; } }

.control-room {
  width: 98vw; height: 95vh; max-width: 1600px;
  background: #111; border: 4px solid #333;
  display: flex; flex-direction: column;
  box-shadow: 0 0 50px rgba(0,0,0,1);
}

header {
  height: 60px; background: #000; display: flex; justify-content: space-between;
  align-items: center; padding: 0 30px; border-bottom: 2px solid #222;
}

.logo-box { display: flex; align-items: center; gap: 15px; color: var(--warning); }
h1 { font-family: var(--font-tech); font-size: 1.2rem; letter-spacing: 2px; }

.back-link {
  color: #666; text-decoration: none; font-family: var(--font-tech);
  font-size: 0.7rem; padding: 5px 15px; border: 1px solid #333;
}
.back-link:hover { color: #fff; border-color: #666; }

main { flex: 1; display: flex; padding: 20px; gap: 20px; overflow: hidden; }

.glass-panel {
  background: var(--bg-panel); border: 1px solid var(--border-dim);
  border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Reator View */
.reactor-view {
  flex: 0.8; position: relative; display: flex; flex-direction: column;
  background: radial-gradient(circle at center, #00152a 0%, #000 100%);
  overflow: hidden;
}

.glow-container {
  position: absolute; width: 100%; height: 100%;
}

#cherenkov-glow {
  width: 100%; height: 100%; opacity: 0.3;
  background: radial-gradient(circle, var(--cherenkov) 0%, transparent 70%);
  transition: opacity 0.5s;
}

#reactor-core {
  flex: 1; display: flex; justify-content: center; align-items: center;
  position: relative; z-index: 5;
}

.control-rod-system {
  display: flex; gap: 40px; height: 80%; width: 60%;
  border-bottom: 10px solid #222; border-top: 10px solid #222;
}

.rod {
  flex: 1; background: linear-gradient(to bottom, #111, #444, #111);
  border: 2px solid #000; position: relative; transform: translateY(0%);
  transition: transform 0.1s linear;
}
.rod::after {
  content: ""; position: absolute; top:0; left:0; width: 100%; height: 100%;
  background: repeating-linear-gradient(0deg, transparent, transparent 10px, rgba(0,240,255,0.1) 10px, rgba(0,240,255,0.1) 20px);
}

.view-label {
  padding: 10px; text-align: center; color: var(--text-dim); font-size: 0.7rem;
  background: rgba(0,0,0,0.5); border-top: 1px solid #222;
}

/* Dashboard */
.dashboard { flex: 1.2; display: flex; flex-direction: column; gap: 20px; }

.gauge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.gauge-card { padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.gauge-header { font-size: 0.8rem; color: var(--text-dim); }
.gauge-value { font-family: var(--font-tech); font-size: 1.5rem; }

.gauge-bar-container { height: 8px; background: #000; border-radius: 4px; overflow: hidden; }
.gauge-bar { height: 100%; width: 50%; background: var(--safe); transition: 0.3s; }

#temp-card.critical { border-color: var(--danger); background: rgba(255,0,0,0.1); }
#temp-card.critical .gauge-value { color: var(--danger); animation: blink 0.5s infinite; }

.status-tag {
  display: inline-block; padding: 5px 15px; border-radius: 2px;
  font-weight: bold; font-family: var(--font-tech); font-size: 0.9rem;
}
.status-tag.stable { background: rgba(0,255,115,0.1); color: var(--safe); border: 1px solid var(--safe); }
.status-tag.critical { background: rgba(255,42,42,0.1); color: var(--danger); border: 1px solid var(--danger); }

/* Control Panel */
.control-panel { padding: 20px; }
.control-panel h3 { font-family: var(--font-tech); font-size: 1rem; color: var(--warning); margin-bottom: 20px; }

.slider-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: #666; margin-bottom: 5px; }

.reactor-slider {
  -webkit-appearance: none; width: 100%; height: 30px; background: #000;
  border: 1px solid #333; outline: none; border-radius: 4px;
}
.reactor-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 60px; height: 30px; background: #666;
  border: 2px solid #888; border-radius: 2px; cursor: pointer;
  box-shadow: 0 0 10px rgba(0,0,0,1);
}

.rod-percent { text-align: center; margin-top: 10px; font-size: 1.2rem; color: var(--warning); }

.instruction { font-size: 0.75rem; color: #555; margin-top: 10px; font-style: italic; }

/* Log */
.operation-log { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 10px;}
.log-header { font-size: 0.7rem; color: #444; margin-bottom: 5px; border-bottom: 1px solid #222;}
#log-content { flex: 1; overflow-y: auto; font-size: 0.8rem; line-height: 1.5; color: #00ff73;}
.log-entry.warn { color: var(--warning); }
.log-entry.crit { color: var(--danger); }

@keyframes blink { 50% { opacity: 0; } }

/* Meltdown screen */
.meltdown { transform: scale(1.05); filter: hue-rotate(300deg) contrast(2); transition: 2s ease-in; }

@media (max-width: 1000px) {
  main { flex-direction: column; overflow-y: auto; }
  .reactor-view { height: 300px; flex: none; }
}
