/* Lighthouse — neon "command centre" theme. Status colours are set at runtime from config theme.status_colors. */
:root {
  --bg: #05080f; --panel: #0a1020; --panel-2: #0d1528; --line: #1a2540; --line-2: #23314f;
  --text: #e2e8f0; --muted: #8b9bb4; --accent: #22d3ee; --map-bg: #070c18; --pulse: #d9f99d;
  --st-up: #22c55e; --st-degraded: #f59e0b; --st-down: #ef4444; --st-unknown: #64748b;
  --hud: 'Orbitron', system-ui, sans-serif; --body: 'Rajdhani', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--hud); letter-spacing: 1.5px; margin: 0 0 8px; }
h1 { font-size: 18px; } h2 { font-size: 13px; text-transform: uppercase; color: #cbd5e1; margin-top: 12px; } h3 { font-size: 12px; color: var(--muted); margin-top: 10px; }
.muted, small { color: var(--muted); }
.mono, code, pre { font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace; font-size: 13px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--panel); padding: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* top bar / HUD */
.topbar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--hud); font-weight: 700; letter-spacing: 2px; color: var(--text); text-decoration: none; }
.switcher { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); flex-wrap: wrap; }
.switcher a { padding: 6px 12px; border-radius: 6px; color: #94a3b8; font-weight: 700; text-decoration: none; }
.switcher a[aria-current] { background: #0c2430; color: #a5f3fc; }
.hud { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.hud .hp, .hud .level, .device-head .hp { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; min-width: 200px; }
.chip { padding: 4px 10px; border: 1px solid #1f3a2a; background: #0b1a14; border-radius: 8px; text-align: center; }
.chip b { display: block; font-family: var(--hud); color: var(--st-up); font-size: 14px; } .chip span { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.chip.bad { border-color: #3a1f24; background: #1a0b0f; } .chip.bad b { color: var(--st-down); }
meter { width: 100%; height: 10px; }
.user { display: flex; gap: 8px; align-items: center; }
.badge.readonly, .status-pill { padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 1px; background: #0c2430; border: 1px solid #155e75; color: #a5f3fc; }

/* layout */
main { padding: 12px 16px; }
.layout-3 { display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 12px; }
.layout-2 { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; }
.layout-2r { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 1100px) { .layout-3, .layout-2, .layout-2r, .grid-2 { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: #0f1830; color: #cbd5e1; font: 700 14px var(--body); cursor: pointer; text-decoration: none; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.primary { background: var(--accent); color: #04131a; border-color: var(--accent); }
.btn.danger { background: var(--st-down); color: #fff; border-color: var(--st-down); }
.btn.wide { width: 100%; justify-content: center; margin-top: 8px; }
.btn[aria-pressed='true'] { border-color: var(--accent); background: #0c2430; color: #e0f2fe; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.sdp-btn { border-color: #9a3412; color: #fdba74; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .5px; }
.field-check label { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
input, select, textarea { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; font: 600 14px var(--body); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input[aria-invalid], select[aria-invalid] { border-color: var(--st-down); }
.help { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.35; }
.req { color: var(--st-down); }
.purpose { color: var(--muted); margin-top: 0; }
.form-error { color: #fca5a5; min-height: 1em; }
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; max-width: 640px; width: 92vw; max-height: 90vh; padding: 20px; }
.dialog::backdrop { background: rgba(2, 6, 12, .7); }
.dialog .form { max-height: 62vh; overflow: auto; padding-right: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* device list and alert feed */
.device-list { max-height: calc(100vh - 220px); overflow: auto; }
.dev-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); margin: 4px 0; color: var(--text); text-decoration: none; }
.dev-row.st-down { background: #1a0b0f; border: 1px solid #7f1d1d; }
.dev-name { flex: 1; display: flex; flex-direction: column; } .dev-name small { font-size: 11px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.hp-num { font-family: var(--hud); font-size: 11px; color: var(--muted); }
.feed { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 200px); overflow: auto; }
.alert-card { padding: 10px 12px; border-radius: 10px; border: 1px solid #78350f; background: #1a150a; }
.alert-card.sev-critical { border-color: var(--st-down); background: #1a0a10; box-shadow: 0 0 16px rgba(239, 68, 68, .25); }
.alert-card.st-acknowledged { opacity: .85; }
.alert-head { display: flex; justify-content: space-between; font: 700 11px var(--hud); letter-spacing: 1.5px; color: #fca5a5; }
.alert-card.sev-warning .alert-head { color: #fcd34d; }
.alert-msg { font-weight: 700; margin: 4px 0; }
.alert-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ticket-chip { font-size: 12px; font-weight: 700; color: #fdba74; } .sdp { background: #f97316; color: #1a0a02; padding: 0 4px; border-radius: 3px; font: 900 9px var(--hud); }

/* map */
.map-wrap { position: relative; }
.map-box { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--map-bg); min-height: 520px; }
.zone-map { width: 100%; height: auto; display: block; }
.grid-line { stroke: #111a2e; }
.device-body { fill: #0f1a2e; }
.device-label { fill: #cbd5e1; font: 700 12px var(--body); }
.hp-track { fill: #16213a; }
.device { cursor: pointer; } .editing .device { cursor: grab; }
.link { cursor: pointer; }
.link-core { stroke: var(--map-bg); }
.link-flow { stroke: var(--pulse); stroke-dasharray: 10 10; animation: flow 1s linear infinite; }
.anim-packets .link-line { stroke-dasharray: 6 10; animation: flow 2s linear infinite; }
.anim-dots .link-line { animation: flow 1.2s linear infinite; }
.anim-dash .link-line { animation: flow 1.6s linear infinite; }
.link-down .link-line { animation: blink .8s steps(2) infinite; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes flow { to { stroke-dashoffset: -40; } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .link-flow, .link-line, .pulse { animation: none !important; } }
.popup { position: absolute; top: 12px; left: 12px; width: 260px; background: rgba(10, 18, 34, .97); border: 1px solid var(--accent); border-radius: 10px; padding: 12px; box-shadow: 0 0 20px rgba(34, 211, 238, .25); }
.popup .close { position: absolute; right: 8px; top: 6px; background: none; border: 0; color: var(--text); font-size: 18px; cursor: pointer; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; } .facts dt { color: var(--muted); font-size: 12px; } .facts dd { margin: 0; font-weight: 700; }
.facts.grid3 { grid-template-columns: repeat(3, auto 1fr); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; font-weight: 600; color: #cbd5e1; align-items: center; }
.lg { display: inline-flex; gap: 6px; align-items: center; }
.st-text-up { color: var(--st-up); } .st-text-degraded { color: var(--st-degraded); } .st-text-down { color: var(--st-down); } .st-text-unknown { color: var(--st-unknown); }
.tools { display: flex; flex-direction: column; gap: 6px; }
.unplaced { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-btn { background: var(--panel-2); color: var(--text); border: 1px dashed var(--line-2); border-radius: 6px; padding: 4px 8px; cursor: pointer; font: 600 13px var(--body); }
.hint { color: #a5f3fc; margin: 0; }

/* device page */
.device-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: #94a3b8; font-weight: 700; text-decoration: none; }
.tabs a[aria-current] { color: #a5f3fc; border-bottom: 3px solid var(--accent); }
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.sensor { padding: 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.sensor.st-warning { background: #1a150a; border-color: #a16207; } .sensor.st-critical { background: #1a0a10; border-color: var(--st-down); }
.sensor-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #94a3b8; }
.sensor-value { font: 700 22px var(--hud); }
.spark { stroke: var(--accent); stroke-width: 2; } .warn-line { stroke: var(--st-degraded); stroke-dasharray: 3 3; }
.ports { display: flex; flex-wrap: wrap; gap: 4px; }
.port { min-width: 34px; padding: 3px 4px; text-align: center; border-radius: 4px; font-size: 11px; font-weight: 700; border: 1px solid var(--st-unknown); background: #111a2e; }
.port.st-up { border-color: var(--st-up); background: #11291c; } .port.st-degraded { border-color: var(--st-degraded); background: #2a1f08; } .port.st-down { border-color: var(--st-down); background: #2a0b12; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; letter-spacing: 1px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 6px 8px; border-bottom: 1px solid #121c33; font-weight: 600; font-size: 14px; }
.table tr.st-down td { background: #1a0a10; }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { display: flex; gap: 10px; padding: 4px 0; } .timeline time { width: 90px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.timeline .sev-critical span { color: #fca5a5; } .timeline .sev-warning span { color: #fcd34d; }
.config-view { background: #060a14; border: 1px solid var(--line); border-radius: 8px; padding: 8px 0; max-height: 70vh; overflow: auto; white-space: pre; }
.cfg-line { display: block; padding: 0 10px; } .cfg-line .ln { display: inline-block; width: 40px; color: #3b4a66; text-align: right; margin-right: 12px; }
.cfg-line.added { background: rgba(34, 197, 94, .14); color: #86efac; } .cfg-line.removed { background: rgba(239, 68, 68, .14); color: #fca5a5; }
.readonly-panel { border-color: #155e75; background: #08161c; }
.list { list-style: none; padding: 0; } .list li { padding: 4px 0; }

/* data center */
.racks { display: flex; gap: 24px; flex-wrap: wrap; }
.rack { width: 230px; }
.rack-frame { position: relative; border: 2px solid var(--line-2); border-radius: 6px; background: repeating-linear-gradient(#0b1222 0 13px, #0e1629 13px 14px); }
.rack-dev { position: absolute; left: 4px; right: 4px; display: flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; color: var(--text); text-decoration: none; border: 1px solid; border-radius: 3px; background: #11291c; overflow: hidden; white-space: nowrap; }
.rack-dev.st-down { background: #2a0b12; } .rack-dev.st-unknown { background: #111a2e; }
.led { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.env-row { display: grid; grid-template-columns: 50px 1fr 50px; gap: 6px; align-items: center; padding: 4px 0; } .env-row small { grid-column: 1 / -1; }

/* sites */
.site-map { height: 70vh; border-radius: 12px; border: 1px solid var(--line); }
.offline-grid { background: var(--map-bg) repeating-linear-gradient(0deg, transparent 0 39px, #111a2e 39px 40px), repeating-linear-gradient(90deg, transparent 0 39px, #111a2e 39px 40px); }
.site-tip { font-weight: 700; }
.map-note { position: absolute; z-index: 500; margin: 12px; color: var(--muted); }

/* ipam */
.subnet-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.subnet { display: grid; grid-template-columns: 40px 1fr auto; gap: 2px 8px; text-align: left; padding: 8px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; font: 600 14px var(--body); }
.subnet.selected { border-color: var(--accent); background: #0c2430; } .subnet meter { grid-column: 1 / 3; } .subnet.full small { color: var(--st-degraded); }
.vlan { font: 700 11px var(--hud); color: #a5f3fc; }
.ip-grid { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 3px; margin: 10px 0; }
.ip { display: inline-block; height: 16px; min-width: 12px; border-radius: 3px; border: 1px solid #23314f; background: #0d1528; cursor: pointer; padding: 0; }
.ip-dhcp { background: #166534; border-color: #4ade80; } .ip-static { background: #1e3a8a; border-color: #60a5fa; } .ip-reserved { background: #3b2f6b; border-color: #a78bfa; }
.ip-unknown { background: #713f12; border-color: #fbbf24; } .ip-conflict { background: #7f1d1d; border-color: #f87171; }
.ip-row-conflict td { background: #1a0a10; } .ip-row-unknown td { background: #1a150a; }

/* settings */
.setting-row { display: grid; grid-template-columns: 280px 1fr 120px 150px; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid #121c33; }
.setting-row input, .setting-row textarea, .setting-row select { width: 100%; }
.src { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: #16213a; color: #94a3b8; justify-self: start; }
.src-ui { background: #2a1f05; color: #fcd34d; } .src-site { background: #0c2430; color: #a5f3fc; } .src-env { background: #120d24; color: #c4b5fd; }
.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.cert-row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
@media (max-width: 1100px) { .setting-row { grid-template-columns: 1fr; } }

/* toasts */
.toasts { position: fixed; right: 16px; top: 72px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; width: 320px; }
.toast { position: relative; padding: 10px 30px 10px 12px; border-radius: 10px; background: rgba(10, 18, 34, .97); border: 1px solid var(--line-2); cursor: pointer; }
.toast-critical { border-color: var(--st-down); background: rgba(40, 8, 14, .97); box-shadow: 0 0 24px rgba(239, 68, 68, .45); }
.toast-warning { border-color: var(--st-degraded); } .toast-good { border-color: var(--st-up); } .toast-error { border-color: var(--st-down); }
.toast-title { font: 700 12px var(--hud); letter-spacing: 1px; } .toast-body { font-weight: 600; }
.toast-close { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: var(--text); font-size: 18px; cursor: pointer; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 28px; text-align: center; }
.login-card form { text-align: left; margin-top: 16px; }
.login-card .field input, .login-card .field select { width: 100%; }

/* Port Map: device dots on the street map */
.dev-pin { background: none; border: 0; }
.dev-dot { display: block; width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%; background: var(--c); border: 2px solid #0b1220; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15), 0 0 12px var(--c); }
.dev-dot.is-down { animation: pulse 1s infinite; }
.dev-tip { font-weight: 700; }
.port-map.hide-dev-labels .dev-tip { display: none; }
.port-map.editing .dev-dot { outline: 2px dashed var(--accent); outline-offset: 2px; cursor: move; }
.port-map.placing, .port-map.placing .leaflet-interactive { cursor: crosshair; }
.map-hint { min-height: 1.4em; margin: 0 0 8px; color: var(--accent); }
.side .list .btn.small { margin-left: 8px; }
.map-wrap .popup { z-index: 1100; }
.site-dot { display: block; width: 100%; height: 100%; box-sizing: border-box; border-radius: 4px; background: rgba(34, 211, 238, .25); border: 2px solid var(--accent); cursor: move; }
.map-box .site-map { height: 70vh; border: 0; border-radius: 0; }

/* ---- Campus: gamified, map-first layout ------------------------------------------------------ */
.campus-game { display: grid; gap: 10px; }
.mission-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.m-tile { position: relative; display: grid; gap: 4px; padding: 10px 14px; border-radius: 12px; background: linear-gradient(160deg, #0d1830, #080e1c); border: 1px solid var(--line-2); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .06); overflow: hidden; }
.m-tile::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.m-tile.good::before { background: var(--st-up); } .m-tile.warn::before { background: var(--st-degraded); } .m-tile.bad::before { background: var(--st-down); }
.m-label { font: 700 11px var(--hud); letter-spacing: 1.5px; color: var(--muted); }
.m-value { font: 700 26px var(--hud); color: #e0f2fe; text-shadow: 0 0 12px rgba(34, 211, 238, .45); }
.m-tile.bad .m-value { color: #fecaca; text-shadow: 0 0 12px rgba(239, 68, 68, .6); }
.m-tile small { color: var(--muted); font-size: 12px; }
.m-bar { display: block; height: 8px; border-radius: 4px; background: #111b30; overflow: hidden; }
.m-fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #a5f3fc); box-shadow: 0 0 10px var(--accent); transition: width .6s ease; }
.hp-bar .m-fill { background: linear-gradient(90deg, var(--st-down), var(--st-degraded) 45%, var(--st-up) 80%); background-size: 200% 100%; box-shadow: 0 0 10px rgba(34, 197, 94, .5); }
.m-tile.bad .hp-bar .m-fill { background: var(--st-down); }
.xp-bar .m-fill { background: linear-gradient(90deg, #a855f7, #22d3ee); box-shadow: 0 0 10px #a855f7; }
.m-tile.boss.bad { animation: boss-glow 1.4s ease-in-out infinite; }
@keyframes boss-glow { 50% { box-shadow: 0 0 18px rgba(239, 68, 68, .55), inset 0 0 0 1px rgba(239, 68, 68, .5); } }

.squad { display: flex; gap: 8px; flex-wrap: wrap; }
.unit { display: grid; grid-template-columns: 30px auto; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; padding: 8px 12px; min-width: 130px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2); }
.unit-icon { grid-row: 1 / 4; width: 30px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.8; }
.unit.has-down { border-color: var(--st-down); box-shadow: 0 0 12px rgba(239, 68, 68, .35); }
.unit.has-down .unit-icon { stroke: var(--st-down); animation: blink 1s infinite; }
.unit-name { font-size: 12px; color: var(--muted); }
.unit-count { font: 700 16px var(--hud); }
.unit-pips { display: flex; gap: 3px; } .unit-pips i { width: 8px; height: 8px; border-radius: 2px; box-shadow: 0 0 4px currentColor; }

.arena { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; align-items: start; }
.arena.quests-closed { grid-template-columns: minmax(0, 1fr); }
.map-panel { margin-bottom: 0; }
.map-panel .toolbar { flex-wrap: wrap; }
.campus-game .map-box { min-height: calc(100vh - 330px); }
.campus-game .map-box .site-map { height: calc(100vh - 330px); min-height: 520px; }
.game-frame { border-radius: 12px; box-shadow: 0 0 0 1px rgba(34, 211, 238, .35), 0 0 28px rgba(34, 211, 238, .15); }
.game-frame::before, .game-frame::after { content: ''; position: absolute; z-index: 1050; width: 26px; height: 26px; border: 3px solid var(--accent); pointer-events: none; }
.game-frame::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.game-frame::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.live-badge { font: 700 11px var(--hud); letter-spacing: 2px; color: #04131a; background: var(--st-up); padding: 2px 8px; border-radius: 4px; box-shadow: 0 0 10px var(--st-up); animation: blink 2s infinite; }
.quest-log { max-height: calc(100vh - 230px); overflow-y: auto; margin-bottom: 0; }
.crew-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.medal { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 700 12px var(--hud); color: #04131a; background: #94a3b8; }
.rank-1 .medal { background: #facc15; box-shadow: 0 0 10px #facc15; } .rank-2 .medal { background: #e2e8f0; } .rank-3 .medal { background: #f59e0b; }
@media (max-width: 1100px) { .arena { grid-template-columns: 1fr; } .campus-game .map-box .site-map { height: 70vh; } }
@media (prefers-reduced-motion: reduce) { .live-badge, .m-tile.boss.bad, .unit.has-down .unit-icon { animation: none; } }
.map-hint:empty { display: none; }

/* ---- Campus TV mode (NOC wall display): exactly one screen, nothing scrolls ------------------- */
body.tv-mode { overflow: hidden; }
body.tv-mode .topbar { display: none; }
body.tv-mode main { height: 100vh; padding: 0.6vh 0.6vw; box-sizing: border-box; overflow: hidden; }
body.tv-mode .arena { height: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr) clamp(260px, 21vw, 520px); gap: 0.6vw; }
body.tv-mode .arena.quests-closed { grid-template-columns: minmax(0, 1fr); }
body.tv-mode .map-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; box-sizing: border-box; padding: 0.8vh 0.7vw; }
body.tv-mode .map-panel .toolbar { flex-wrap: nowrap; gap: 0.6vw; margin-bottom: 0.6vh; }
body.tv-mode .map-panel .toolbar h1 { font-size: clamp(16px, 1.3vw, 34px); white-space: nowrap; margin: 0; }
body.tv-mode .map-wrap { flex: 1 1 auto; min-height: 0; }
body.tv-mode .campus-game .map-box { height: 100%; min-height: 0; }
body.tv-mode .campus-game .map-box .site-map { height: 100%; min-height: 0; }
body.tv-mode .zone-map { width: 100%; height: 100%; }
.tv-clock { margin-left: auto; white-space: nowrap; font: 700 clamp(14px, 1.2vw, 32px) var(--hud); color: #e0f2fe; text-shadow: 0 0 10px rgba(34, 211, 238, .5); }
body.tv-mode .toolbar-actions .btn { opacity: .35; } body.tv-mode .toolbar-actions .btn:hover, body.tv-mode .toolbar-actions .btn:focus-visible { opacity: 1; }
body.tv-idle, body.tv-idle * { cursor: none !important; }

/* Campus alignment fixes */
.squad .unit { flex: 1 1 140px; }
.toolbar-actions { display: inline-flex; gap: 8px; margin-left: auto; }
.tv-clock + .toolbar-actions { margin-left: 0; }
.toolbar-actions .btn { white-space: nowrap; }
.legend-overlay { position: absolute; left: 12px; bottom: 12px; z-index: 1000; padding: 6px 12px; border-radius: 8px; background: rgba(5, 8, 15, .82); border: 1px solid var(--line-2); pointer-events: none; }
body.tv-mode .map-panel .toolbar { align-items: center; }
body.tv-mode .map-panel .toolbar select { max-width: 22vw; }
body.tv-mode .toolbar-actions .btn { min-height: 28px; padding: 0 10px; font-size: clamp(12px, 0.7vw, 18px); }
.dev-tip.tip-hidden { display: none; }

/* ---- Campus layout v2: compact status strip; map and alert pane fill the rest of the screen -------- */
body.on-campus .topbar .hud { display: none; }               /* the status strip shows the same numbers */
.campus-game { height: var(--campus-h, auto); grid-template-rows: auto minmax(0, 1fr); gap: 8px; }
.status-strip { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 8px; align-items: stretch; }
.status-strip .mission-bar { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.status-strip .m-tile { padding: 6px 10px 6px 12px; gap: 2px; border-radius: 10px; }
.status-strip .m-label { font-size: clamp(9px, .55vw, 14px); letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-strip .m-value { font-size: clamp(16px, 1.15vw, 30px); line-height: 1.1; }
.status-strip .m-tile small { font-size: clamp(10px, .55vw, 14px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-strip .m-bar { height: 5px; }
.status-strip .squad { flex-wrap: nowrap; gap: 6px; overflow: hidden; }
.status-strip .unit { flex: 1 1 0; min-width: 0; padding: 6px 8px; column-gap: 6px; grid-template-columns: 24px minmax(0, 1fr); border-radius: 10px; }
.status-strip .unit-icon { width: 24px; height: 20px; }
.status-strip .unit-name { font-size: clamp(10px, .6vw, 15px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-strip .unit-count { font-size: clamp(13px, .9vw, 24px); }
.campus-game .arena { height: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr) clamp(300px, 22vw, 560px); gap: 8px; align-items: stretch; }
.campus-game .arena.quests-closed { grid-template-columns: minmax(0, 1fr); }
.campus-game .map-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; box-sizing: border-box; padding: 10px 12px; }
.campus-game .map-panel .toolbar { flex-wrap: nowrap; margin-bottom: 8px; gap: 10px; }
.campus-game .map-panel .toolbar h1 { margin: 0; white-space: nowrap; font-size: clamp(16px, 1.1vw, 30px); }
.campus-game .map-wrap { flex: 1 1 auto; min-height: 0; }
.campus-game .map-box { height: 100%; min-height: 0; }
.campus-game .map-box .site-map { height: 100%; min-height: 0; }
.campus-game .zone-map { width: 100%; height: 100%; }
.legend-overlay .legend { flex-wrap: wrap; font-size: clamp(11px, .65vw, 16px); }
.campus-game .quest-log { display: flex; flex-direction: column; height: 100%; max-height: none; min-height: 0; box-sizing: border-box; padding: 12px 14px; overflow: hidden; }
.quest-log h2 { margin: 0 0 8px; font-size: clamp(14px, 1vw, 26px); }
.quest-log.has-alerts h2 { color: #fecaca; text-shadow: 0 0 10px rgba(239, 68, 68, .6); }
.quest-log .feed { flex: 1 1 auto; min-height: 0; overflow-y: auto; font-size: clamp(13px, .8vw, 20px); padding-right: 4px; }
.quest-log .crew-box { flex: 0 0 auto; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.quest-log .crew-box h3 { margin: 0 0 4px; font: 700 clamp(11px, .65vw, 16px) var(--hud); letter-spacing: 1.5px; color: var(--muted); }
.quest-log .crew-row { padding: 4px 0; }
@media (max-width: 1500px) { .status-strip { grid-template-columns: 1fr; } }
@media (max-width: 1100px), (max-height: 600px) {
  .campus-game { height: auto; }
  .campus-game .arena { grid-template-columns: 1fr; height: auto; }
  .campus-game .map-box, .campus-game .map-box .site-map { height: 65vh; }
  .campus-game .quest-log { height: auto; max-height: 60vh; }
}
body.tv-mode .campus-game { height: 100%; }
body.tv-mode .campus-game { grid-template-rows: auto minmax(0, 1fr); }
.unit.is-empty { opacity: .55; }

/* Port Map routing */
.route-pin { background: none; border: 0; }
.route-dot { display: block; width: 100%; height: 100%; box-sizing: border-box; transform: rotate(45deg); background: #04131a; border: 2px solid var(--accent); box-shadow: 0 0 8px var(--accent); cursor: move; }
.port-map.routing, .port-map.routing .leaflet-interactive.route-hit { cursor: crosshair; }
.route-box { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: #0c2430; }
.route-box h2 { margin-top: 0; }
.rotate-box { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.rotate-box h2 { margin-top: 0; }
.leaflet-control-rotate a { background: #0f1830; color: var(--accent); }

/* Port Map: small game-style nodes and names (no white label box; text in the status colour) */
.dev-dot { border-width: 1.5px; box-shadow: 0 0 6px var(--c), 0 0 2px var(--c); }
.leaflet-tooltip.dev-tip, .leaflet-tooltip.site-tip {
  background: transparent; border: 0; box-shadow: none; padding: 0 2px; margin: 0;
  font: 700 12px var(--hud); letter-spacing: .5px; white-space: nowrap;
  color: var(--c, var(--st-up));
  text-shadow: 0 0 3px #000, 0 0 3px #000, 1px 1px 0 #000, -1px -1px 0 #000, 0 0 8px var(--c, var(--st-up));
}
.leaflet-tooltip.site-tip { --c: var(--accent); font-size: 13px; }
.leaflet-tooltip.dev-tip::before, .leaflet-tooltip.site-tip::before { display: none; }
body.tv-mode .leaflet-tooltip.dev-tip { font-size: clamp(11px, .65vw, 18px); }
.home-btn { font-size: 18px; line-height: 30px; text-align: center; text-decoration: none; }

/* Campus: rotate maps */
.map-panel { position: relative; }
.cycle-panel { position: absolute; z-index: 1200; top: 52px; right: 12px; width: min(420px, 90%); max-height: 70%; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); border-color: var(--accent); }
.checklist { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; margin: 0; display: grid; gap: 4px; max-height: 240px; overflow-y: auto; }
.checklist legend { font-weight: 700; padding: 0 4px; }
.check-item { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.cycle-status { font: 600 clamp(11px, .65vw, 16px) var(--hud); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cycle-bar { height: 3px; background: #111b30; border-radius: 2px; margin: -4px 0 6px; overflow: hidden; }
.cycle-bar span { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent); transition: width .25s linear; }
.btn.is-on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px rgba(34, 211, 238, .35); }
