:root {
  --bg: #07111f;
  --panel: rgba(11, 24, 45, 0.82);
  --panel2: rgba(18, 40, 74, 0.7);
  --line: rgba(100, 220, 255, 0.35);
  --text: #e7f8ff;
  --muted: #91b6ca;
  --accent: #52e5ff;
  --good: #60f28f;
  --warn: #ffcf5a;
  --bad: #ff5e7d;
  --violet: #b17cff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(82,229,255,.2), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(177,124,255,.16), transparent 28%),
    radial-gradient(circle at 40% 100%, rgba(96,242,143,.09), transparent 25%),
    #030912;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(#ffffff99 1px, transparent 1px),
    radial-gradient(#52e5ff55 1px, transparent 1px);
  background-size: 90px 90px, 160px 160px;
  background-position: 0 0, 40px 80px;
  opacity: .28;
}
#app { width: min(1720px, 96vw); margin: 0 auto; padding: 18px 0 24px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(120deg, rgba(9,18,35,.92), rgba(15,40,76,.78));
  box-shadow: 0 20px 60px rgba(0,0,0,.35), inset 0 0 44px rgba(82,229,255,.08);
}
h1 { margin: 0; font-size: clamp(26px, 3vw, 44px); letter-spacing: .5px; }
h2 { margin: 0 0 12px; font-size: 18px; color: #c8f3ff; }
p { margin: 6px 0 0; color: var(--muted); }
button, select, input {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(8, 18, 35, .88);
  padding: 10px 12px;
  font: inherit;
  outline: none;
}
button {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(82,229,255,.28), rgba(177,124,255,.18));
  box-shadow: inset 0 0 18px rgba(82,229,255,.08);
  transition: transform .1s, border-color .2s, box-shadow .2s;
}
button:hover { transform: translateY(-1px); border-color: rgba(82,229,255,.8); box-shadow: 0 0 22px rgba(82,229,255,.16); }
button:active { transform: translateY(0); }
.top-actions { display: flex; gap: 10px; }
.layout { display: grid; grid-template-columns: 1.55fr .8fr; gap: 18px; margin-top: 18px; }
.glass {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0,0,0,.28), inset 0 0 35px rgba(82,229,255,.05);
  backdrop-filter: blur(10px);
  padding: 16px;
}
.left-panel canvas {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(82,229,255,.22);
  background: #050d19;
}
.legend { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 10px; color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.healthy { background: var(--good); }.infected { background: var(--bad); }.immune { background: var(--accent); }.critical { background: var(--warn); }
.right-panel { display: grid; gap: 18px; }
.hud-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hud-grid div {
  padding: 12px;
  border: 1px solid rgba(82,229,255,.18);
  border-radius: 16px;
  background: rgba(3,10,20,.48);
}
small { color: var(--muted); font-size: 12px; }
strong { display: block; font-size: 22px; margin-top: 3px; }
.cards { display: grid; gap: 10px; }
.card {
  border: 1px solid rgba(82,229,255,.18);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(3,10,20,.62), rgba(25,52,94,.34));
}
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.badge { border-radius: 999px; padding: 4px 8px; font-size: 12px; color: #06111f; background: var(--accent); font-weight: 700; }
.bar { height: 8px; background: rgba(255,255,255,.09); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.fill { height: 100%; width: 50%; background: linear-gradient(90deg, var(--good), var(--warn), var(--bad)); }
.bottom-panel { display: grid; grid-template-columns: 1.15fr .8fr .9fr; gap: 18px; margin-top: 18px; }
.contract-row { display: grid; grid-template-columns: 1fr 1fr 1fr .7fr auto; gap: 10px; align-items: end; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.hint { margin-bottom: 12px; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button-grid button { min-height: 66px; }
#log { height: 180px; overflow: auto; padding-right: 6px; }
.log-entry { border-left: 3px solid var(--accent); padding: 6px 9px; margin-bottom: 8px; background: rgba(255,255,255,.04); border-radius: 8px; color: #cdeefa; }
.log-entry.warn { border-color: var(--warn); }.log-entry.bad { border-color: var(--bad); }.log-entry.good { border-color: var(--good); }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.68); z-index: 5; }
.hidden { display: none; }
.modal { width: min(560px, 92vw); text-align: center; padding: 30px; }
@media (max-width: 1100px) {
  .layout, .bottom-panel { grid-template-columns: 1fr; }
  .contract-row { grid-template-columns: 1fr 1fr; }
  .hud-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .contract-row, .button-grid { grid-template-columns: 1fr; }
}
