:root {
  --bg1: #0b1220;
  --bg2: #131c31;
  --card: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e8eef7;
  --muted: #93a1b8;
  --acc: #f97316;
  --acc2: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #1b2a4a 0%, var(--bg1) 45%, #070b14 100%) fixed;
  color: var(--text);
  min-height: 100vh;
}

.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header { text-align: center; padding: 10px 0 16px; }
header h1 { font-size: clamp(1.5rem, 3.5vw, 2.3rem); letter-spacing: 0.5px; }
.sub { color: var(--muted); margin-top: 6px; font-size: 0.98rem; }

.stage-wrap { position: relative; }

#stage {
  width: 100%;
  height: auto;
  display: block;
  background: linear-gradient(#1a2f52 0%, #26395c 45%, #2f4a6b 70%, #3a5f74 100%);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  cursor: crosshair;
  touch-action: manipulation;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10, 16, 28, 0.92);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  z-index: 5;
}
.tooltip.hidden { display: none; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  backdrop-filter: blur(6px);
}

.controls { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 22px; }
.control-group { flex: 1 1 300px; }
.control-group h3 { font-size: 0.95rem; margin-bottom: 10px; color: #c9d6ea; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }

.pill {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill.lv1 { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.5); color: #7ce8a5; }
.pill.lv2 { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.5); color: #ffd28a; }
.pill.lv3 { background: rgba(249, 115, 22, 0.2); border-color: rgba(249, 115, 22, 0.55); color: #ffb37d; }
.pill.lv4 { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.7); color: #ff9d9d; }
.pill.muted { color: var(--muted); font-weight: 600; }
.pill.blink { animation: blink 0.8s step-end infinite; }

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

.meter-wrap { margin-top: 4px; }
.meter-label { font-size: 0.8rem; color: var(--muted); }
.meter {
  height: 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 5px;
}
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--amber) 60%, var(--acc2));
  transition: width 0.25s ease;
}

button {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
}
button:hover { background: rgba(255, 255, 255, 0.16); }
button:active { transform: scale(0.97); }
#btnHeat { background: rgba(249, 115, 22, 0.25); border-color: rgba(249, 115, 22, 0.6); }
#btnErupt { background: rgba(239, 68, 68, 0.28); border-color: rgba(239, 68, 68, 0.65); }
#btnReset { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.5); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-link {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn-link:hover { background: rgba(251, 191, 36, 0.22); }
.btn-link:active { transform: scale(0.97); }

.hint { font-size: 0.82rem; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.hint b { color: #c9d6ea; }

.info { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.info .card { flex: 1 1 340px; }
.info h3 { font-size: 0.98rem; margin-bottom: 10px; }
.info ol, .info ul { padding-left: 20px; font-size: 0.9rem; line-height: 1.7; color: #c9d6ea; }
.info li { margin-bottom: 6px; }
.info b { color: var(--text); }

footer { margin-top: 24px; text-align: center; }
footer p { font-size: 0.78rem; color: var(--muted); }
