/* Hub – cyberpunk theme. Every neon has one meaning:
   magenta = node AI / main action, cyan = network and frames, acid green = mine / online,
   amber = services, violet = AI stack, steel grey = offline. */
:root {
  --bg: #05060a;
  --panel: #070a12;
  --line: #00f0ff33;
  --line-strong: #00f0ff77;
  --text: #d7f7ff;
  --muted: #5f7a8c;
  --core: #ff2a6d;
  --cyan: #00f0ff;
  --vault: #00f0ff;
  --mine: #39ff88;
  --ai: #b26bff;
  --game: #ffb000;
  --off: #3a4458;
  --mono: "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, ui-monospace, monospace;
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  --cut: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  --cut-sm: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  --cut-lg: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--mono); }
::selection { background: var(--core); color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { font-family: var(--mono); font-size: 12px; color: var(--cyan); }

/* ---- background: perspective floor grid, sweep, scanlines, vignette ---- */
#stage { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 45%, #1a061055, transparent 60%), var(--bg); }
.floor { position: absolute; left: -50%; right: -50%; bottom: -30%; height: 70%; pointer-events: none;
  transform: perspective(520px) rotateX(63deg);
  background-image: linear-gradient(#00f0ff1c 1px, transparent 1px), linear-gradient(90deg, #00f0ff1c 1px, transparent 1px);
  background-size: 52px 52px; animation: floor 7s linear infinite;
  -webkit-mask-image: linear-gradient(transparent, #000 65%); mask-image: linear-gradient(transparent, #000 65%); }
@keyframes floor { to { background-position: 0 52px; } }
.sweep { position: absolute; left: 0; right: 0; height: 140px; pointer-events: none; z-index: 1;
  background: linear-gradient(transparent, #00f0ff0c, transparent); animation: sweep 8s linear infinite; }
@keyframes sweep { from { top: -140px; } to { top: 100%; } }
.scan { position: fixed; inset: 0; pointer-events: none; z-index: 30; background: repeating-linear-gradient(transparent 0 2px, #0000002c 2px 3px); }
.scan::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, #000000b8 100%); }

/* glitch: rare, short jolt with colour split */
@keyframes glitch {
  0%, 93%, 100% { transform: none; }
  94% { transform: translate(2px, -1px); text-shadow: -2px 0 var(--core), 2px 0 var(--cyan); }
  96% { transform: translate(-2px, 1px); text-shadow: 2px 0 var(--core), -2px 0 var(--cyan); }
  98% { transform: translate(1px, 0); }
}
@keyframes blink { 50% { opacity: .15; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- HUD header ---- */
.bar { position: fixed; inset: 0 0 auto 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 11px 18px;
  border-bottom: 1px solid var(--line); background: linear-gradient(#05060af2, #05060aa8); }
.brand { font-weight: 700; font-size: 15px; letter-spacing: .22em; color: var(--cyan); text-shadow: 0 0 8px var(--cyan);
  display: flex; align-items: center; gap: 9px; white-space: nowrap; animation: glitch 6s steps(1) infinite; }
.brand .muted { color: var(--core); text-shadow: 0 0 8px var(--core); letter-spacing: .12em; }
.brand .dot { width: 10px; height: 10px; background: var(--core); box-shadow: 0 0 10px var(--core); clip-path: var(--hex); }
.chips { display: flex; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.chip { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 11px; color: var(--muted); white-space: nowrap;
  border: 1px solid #00f0ff44; background: #00f0ff0a; clip-path: var(--cut-sm); }
.chip b { color: var(--cyan); }
.actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.badge.live { color: var(--mine); text-shadow: 0 0 6px var(--mine); }
.badge.warn { color: var(--game); text-shadow: 0 0 6px var(--game); }
.live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; background: var(--mine); clip-path: var(--hex);
  box-shadow: 0 0 8px var(--mine); animation: blink 1s steps(2) infinite; }

.btn { font: 700 11.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); background: transparent; border: 0;
  box-shadow: inset 0 0 0 1px var(--line-strong); padding: 9px 15px; cursor: pointer; clip-path: var(--cut); transition: background .2s, box-shadow .2s; }
.btn:hover { background: #00f0ff14; box-shadow: inset 0 0 0 1px var(--cyan), inset 0 0 14px #00f0ff33; }
.btn.primary { background: var(--core); color: #05060a; box-shadow: none; }
.btn.primary:hover { background: #ff5288; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn { white-space: nowrap; }
.small-btn { font-size: 10.5px; padding: 4px 10px; pointer-events: auto; }

/* ---- map ---- */
#map { position: relative; z-index: 2; width: 100%; height: 100%; display: block; cursor: grab; user-select: none; }
#map.dragging { cursor: grabbing; }

/* circuit edges (colour per edge in --ec) */
.edge { fill: none; stroke-linejoin: miter; transition: stroke-width .3s, opacity .3s; }
.edge.guest.live { stroke: var(--ec); stroke-width: 1.4; opacity: .6; }
.edge.guest.idle { stroke: var(--off); stroke-width: 1; stroke-dasharray: 3 6; opacity: .75; }
.edge.ext { stroke: var(--cyan); stroke-width: 1.5; opacity: .6; }
.edge.hl { opacity: 1 !important; stroke-width: 2.4 !important; }
.edge-label { font: 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; fill: var(--cyan); opacity: .75; text-anchor: middle; }
.packet { transition: opacity .3s; }

#map.focus .edge:not(.hl), #map.focus .packet:not(.hl) { opacity: .1; }
#map.focus .node:not(.near):not(.core) { opacity: .3; }
#map.focus .group { opacity: .3; }

/* hexagon nodes (colour per node in --c) */
.node { cursor: pointer; transition: opacity .4s; }
.node .hit { fill: transparent; }
.node .ring { fill: #070a10; stroke: var(--c); stroke-width: 1.8; transition: stroke-width .25s; }
.node.run .ring { fill: color-mix(in srgb, var(--c) 10%, #05060a); }
.node .letter { font: 700 13px var(--mono); text-anchor: middle; dominant-baseline: central; fill: var(--c); }
.node .name { font: 700 11.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; fill: var(--text); text-anchor: middle; }
.node .sub { font: 10px var(--mono); letter-spacing: .04em; fill: var(--muted); text-anchor: middle; }
.node .halo { fill: var(--c); opacity: .18; }
.node:hover .ring, .node.sel .ring { stroke-width: 3; }
.node:hover .name { animation: glitch .5s steps(1) 1; }
.node .pulse { fill: none; stroke: var(--c); stroke-width: 1; opacity: 0; animation: pulse var(--pd, 3.2s) cubic-bezier(.2,.6,.3,1) infinite;
  transform-box: fill-box; transform-origin: center; }
.node .pulse.late { animation-delay: calc(var(--pd, 3.2s) / 2); }
@keyframes pulse { 0% { opacity: .6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
.node .orbit { fill: none; stroke: var(--c); stroke-width: 1; stroke-dasharray: 2 5; opacity: .6; animation: spin 10s linear infinite;
  transform-box: fill-box; transform-origin: center; }
.node.off .ring { stroke: var(--off); stroke-dasharray: 4 4; fill: #06070b; }
.node.off .letter { fill: var(--off); }
.node.off .name { fill: #6c7a90; }
.node.off .sleep { fill: none; stroke: #3a445840; animation: sleep 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sleep { 50% { transform: scale(1.15); stroke: #3a445870; } }
.node.ext .bracket { fill: none; stroke: var(--cyan); stroke-width: 2; }
.node.ext .ring { fill: #05060a; stroke: none; }
.node.ext .letter { fill: var(--cyan); }
.node.ext .name { fill: var(--cyan); }
.node.mine .name { fill: #c8ffe0; }
.node.changed .ring { animation: flash 1s steps(2) 4; }
@keyframes flash { 50% { stroke-width: 6; } }
.node.born > * { animation: born 1.1s cubic-bezier(.2,1.4,.4,1) both; transform-box: fill-box; transform-origin: center; }
@keyframes born { from { transform: scale(0); opacity: 0; } }
.node.build .ring { stroke-dasharray: 4 4; }
.node .build-ring { fill: none; stroke: var(--c); stroke-width: 2; stroke-dasharray: 14 60; animation: spin 1.4s linear infinite;
  transform-box: fill-box; transform-origin: center; }
.node.build .letter { animation: blink 1s steps(2) infinite; }
.node.spot .ring { animation: spot .7s ease-out 3; }
@keyframes spot { 0% { stroke-width: 9; } 100% { stroke-width: 1.8; } }
.node.dragging { cursor: grabbing; }
.node.dragging .ring { stroke-width: 3.4; }

/* core: reactor with turning HUD rings */
.core-ticks { fill: none; stroke: var(--core); stroke-width: 1.2; stroke-dasharray: 1 7; opacity: .85; animation: spin 16s linear infinite;
  transform-box: fill-box; transform-origin: center; }
.core-hud { fill: none; stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 40 14 6 14; animation: spin 24s linear infinite reverse;
  transform-box: fill-box; transform-origin: center; }
.core-ring { fill: #0a0610; stroke: var(--core); stroke-width: 1.6; }
.core-hex { fill: var(--core); }
.core-name { font: 700 19px var(--mono); letter-spacing: .24em; fill: var(--core); text-anchor: middle; }
.core-sub { font: 10.5px var(--mono); letter-spacing: .08em; fill: var(--muted); text-anchor: middle; text-transform: uppercase; }

/* HUD group arcs */
.group-band { fill: var(--gc); fill-opacity: .05; stroke: var(--gc); stroke-width: 1; stroke-opacity: .45; stroke-dasharray: 2 4; }
.group-line { fill: none; stroke: none; }
.group-ticks { fill: none; stroke: var(--gc); stroke-width: 2; opacity: .9; }
.group-label { font: 700 10.5px var(--mono); letter-spacing: .3em; fill: var(--gc); text-anchor: middle; }
.group { transition: opacity .4s; }

/* start animation: flicker on like an old tube */
#map.intro .edges, #map.intro .packets, #map.intro .groups, #map.intro .edge-label { animation: introFlicker 1.6s ease-out both; }
#map.intro .packets { animation-delay: .6s; }
@keyframes introFlicker { 0% { opacity: 0; } 30% { opacity: .9; } 40% { opacity: .15; } 55% { opacity: 1; } }

/* legend */
.legend { position: fixed; left: 18px; bottom: 14px; z-index: 5; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; display: inline-block; clip-path: var(--hex); }
.lg.run { background: var(--ai); }
.lg.off { background: var(--off); }
.lg.mine { background: var(--mine); }

/* tooltip */
.tooltip { position: fixed; z-index: 8; pointer-events: none; background: #070a12f2; border: 1px solid var(--line-strong);
  padding: 8px 11px; font-size: 11.5px; max-width: 290px; clip-path: var(--cut); }
.tooltip b { color: var(--cyan); letter-spacing: .1em; text-transform: uppercase; }

/* side panel */
.panel { position: fixed; right: 14px; top: 66px; bottom: 14px; width: min(340px, calc(100vw - 28px)); z-index: 7; padding: 20px;
  background: #070a12ee; border: 1px solid var(--line-strong); overflow: auto; clip-path: var(--cut-lg); box-shadow: inset 0 0 30px #00f0ff0d; }
.panel .close { position: absolute; right: 12px; top: 8px; background: none; border: 0; color: var(--cyan); font: 20px var(--mono); cursor: pointer; }
.panel h2 { margin: 2px 0 4px; font-size: 19px; letter-spacing: .2em; text-transform: uppercase; color: var(--mine); text-shadow: 0 0 10px var(--mine);
  animation: glitch 5s steps(1) infinite; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 16px 0; }
.panel dt { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; padding-top: 1px; }
.panel dd { margin: 0; font-size: 12.5px; word-break: break-word; }
.bar-meter { height: 7px; margin-top: 5px; background: repeating-linear-gradient(90deg, #1a2a24 0 6px, transparent 6px 8px); }
.bar-meter i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--mine) 0 6px, transparent 6px 8px); }
.tag { display: inline-block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding: 2px 8px; margin: 0 5px 5px 0;
  color: var(--cyan); border: 1px solid #00f0ff55; clip-path: var(--cut-sm); }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; }
.status i { width: 9px; height: 9px; clip-path: var(--hex); }

/* links to a guest's website / sign-in page */
.panel-links { margin-top: 16px; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { text-decoration: none; display: inline-flex; align-items: center; padding: 9px 14px; }
.link-btn:not(.primary) { box-shadow: inset 0 0 0 1px var(--cyan); }
.link-host { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; margin-top: 6px; }
.link-edit-btn { margin-top: 8px; background: none; border: 0; padding: 0; color: var(--cyan); font: 10.5px var(--mono); letter-spacing: .12em;
  text-transform: uppercase; cursor: pointer; opacity: .8; }
.link-edit-btn:hover { opacity: 1; text-shadow: 0 0 6px #00f0ff88; }
.link-edit-btn[hidden], .link-form[hidden] { display: none; }
.link-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px; background: #05060a; box-shadow: inset 0 0 0 1px var(--line); clip-path: var(--cut-sm); }
.link-form input { width: 100%; font-size: 12px; }
.link-form .row { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.link-err { color: var(--core); font-size: 11px; min-height: 0; }
.link-err:empty { display: none; }

/* VMs made by the hub: switch, edit, delete */
.mg { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-strong); display: flex; flex-direction: column; gap: 10px; }
.mg-note { margin-top: 14px; }
.mg-sw { display: flex; flex-direction: row; align-items: center; gap: 9px; cursor: pointer; text-transform: none; letter-spacing: .04em; font-size: 12px; color: var(--text); }
.mg-sw.small { font-size: 11px; color: var(--muted); align-items: flex-start; }
.mg-sw input { width: 16px; height: 16px; margin: 0; padding: 0; box-shadow: none; accent-color: var(--game); flex: none; }
.mg-btns { display: flex; gap: 8px; }
.mg-btns[hidden], .mg-form[hidden] { display: none; }
.mg-del { color: var(--core); box-shadow: inset 0 0 0 1px #ff2a6d88; }
.mg-del.primary { background: var(--core); color: #05060a; box-shadow: none; }
.mg-form { display: flex; flex-direction: column; gap: 9px; padding: 10px; background: #05060a; box-shadow: inset 0 0 0 1px var(--line); clip-path: var(--cut-sm); }
.mg-form input:not([type=checkbox]) { width: 100%; font-size: 12px; }
.mg-form .row { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.mg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mg-danger { box-shadow: inset 0 0 0 1px #ff2a6d88; background: #ff2a6d0d; }
.mg-danger b { color: var(--core); letter-spacing: .12em; text-transform: uppercase; font-size: 11px; }
.mg-danger u { color: var(--text); }
.mg-plan { font-size: 11.5px; }
.mg-plan:empty { display: none; }
.mg-plan ol { margin: 6px 0; padding-left: 18px; }
.mg-plan .err { color: var(--core); }
.mg-plan .note { color: var(--game); }

/* hide / show devices */
.panel-actions { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
#btn-hide { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
#btn-hide:hover { color: var(--cyan); }
#btn-hidden { color: var(--game); box-shadow: inset 0 0 0 1px #ffb00066; }
.hid-list { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; }
.hid-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; background: #0a0f1a;
  box-shadow: inset 0 0 0 1px var(--line); clip-path: var(--cut-sm); }
.hid-row i { width: 10px; height: 10px; clip-path: var(--hex); }
.hid-row b { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.hid-row small { display: block; font-size: 10.5px; color: var(--muted); }
.toast { pointer-events: none; }
.toast-btn { pointer-events: auto; margin-left: 10px; font: 700 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--cyan);
  background: transparent; border: 0; box-shadow: inset 0 0 0 1px #00f0ff66; padding: 3px 8px; cursor: pointer; }
.toast-btn:hover { background: #00f0ff1f; }
.list tbody tr.hid { opacity: .5; }

/* dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); padding: 24px; width: min(640px, calc(100vw - 32px));
  clip-path: var(--cut-lg); }
dialog::backdrop { background: #000000c4; }
dialog h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: .2em; text-transform: uppercase; color: var(--core); text-shadow: 0 0 10px var(--core); }
.tpls { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 16px 0; }
.tpl { text-align: left; background: #0a0e18; border: 0; box-shadow: inset 0 0 0 1px #00f0ff33; padding: 12px; cursor: pointer; color: var(--text);
  font: inherit; clip-path: var(--cut); transition: box-shadow .2s; }
.tpl b { display: block; margin-bottom: 4px; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.tpl span { font-size: 11.5px; color: var(--muted); }
.tpl.on { box-shadow: inset 0 0 0 2px var(--core), inset 0 0 20px #ff2a6d33; }
.tpl.on b { color: var(--core); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
input { font: 13px var(--mono); color: var(--text); background: #04060c; border: 0; box-shadow: inset 0 0 0 1px #00f0ff44; padding: 9px 10px;
  caret-color: var(--core); clip-path: var(--cut-sm); }
input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--core), inset 0 0 12px #ff2a6d33; }
.plan { margin: 16px 0; font-size: 12.5px; min-height: 20px; }

/* live checks in the new-VM dialog */
.fhint { min-height: 13px; font-size: 10px; letter-spacing: .06em; text-transform: none; color: var(--muted); }
.fhint.bad { color: var(--core); }
input.bad, input.bad:focus { box-shadow: inset 0 0 0 1px var(--core), inset 0 0 12px #ff2a6d44; color: #ff9bb8; }
input.ok { box-shadow: inset 0 0 0 1px #39ff8866; }
.modpack { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-top: 10px; padding: 10px; background: #ffb0000a;
  box-shadow: inset 0 0 0 1px #ffb00044; clip-path: var(--cut-sm); }
.modpack[hidden] { display: none; }
.modpack label { color: var(--game); }
.idmap-wrap { margin-top: 12px; }
.idmap-h { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.idmap-h span { display: inline-flex; gap: 6px; align-items: center; }
.idmap-h i { width: 9px; height: 9px; display: inline-block; clip-path: var(--hex); margin-left: 8px; }
.idmap-h i.free { background: #39ff8855; } .idmap-h i.used { background: var(--core); }
.idmap { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.idmap .id { font: 700 10px var(--mono); height: 22px; display: flex; align-items: center; justify-content: center; border: 0; padding: 0;
  clip-path: var(--cut-sm); }
.idmap .id.free { background: #39ff8812; color: #39ff88aa; cursor: pointer; }
.idmap .id.free:hover { background: #39ff8833; color: var(--mine); }
.idmap .id.used { background: #ff2a6d33; color: #ff6b93; cursor: not-allowed; box-shadow: inset 0 0 0 1px #ff2a6d66; }
.idmap .id.cur { outline: 2px solid var(--cyan); outline-offset: -2px; color: var(--text); }
.idmap .id.used.cur { outline-color: var(--core); background: var(--core); color: #05060a; animation: blink 1s steps(2) infinite; }
.plan ol { margin: 6px 0; padding-left: 20px; }
.plan .err { color: var(--core); }
.plan .note { color: var(--game); font-size: 12px; }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* toasts: terminal lines */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 9; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; pointer-events: none; }
.toast { font-size: 12px; letter-spacing: .04em; background: #070a12f2; color: var(--cyan); border-left: 3px solid var(--cyan); padding: 9px 14px;
  animation: toastIn .35s steps(4); transition: opacity .5s, transform .5s; max-width: min(380px, calc(100vw - 32px)); }
.toast::before { content: "> "; color: var(--muted); }
.toast b { color: var(--text); text-transform: uppercase; letter-spacing: .1em; }
.toast.good { color: var(--mine); border-left-color: var(--mine); }
.toast.off { color: #8a97ad; border-left-color: var(--off); }
.toast.warn { color: var(--game); border-left-color: var(--game); }
.toast.out { opacity: 0; transform: translateX(24px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

/* search */
.search { position: relative; }
.search input { width: 160px; padding: 8px 10px; font-size: 12px; transition: width .25s; }
.search input:focus { width: 220px; }
.hits { position: absolute; right: 0; top: calc(100% + 6px); width: 290px; background: #070a12f5; border: 1px solid var(--line-strong);
  padding: 6px; z-index: 9; clip-path: var(--cut); }
.hit-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text); font: inherit; padding: 7px 8px; cursor: pointer; }
.hit-row i { width: 9px; height: 9px; clip-path: var(--hex); }
.hit-row b { letter-spacing: .1em; text-transform: uppercase; }
.hit-row span { font-size: 11px; color: var(--muted); }
.hit-row.on, .hit-row:hover { background: #00f0ff14; box-shadow: inset 2px 0 0 var(--cyan); }
.hit-none { padding: 8px; color: var(--muted); font-size: 12px; }

/* list view */
.list { position: fixed; inset: 66px 14px 14px 14px; z-index: 4; overflow: auto; background: #05070ef2; border: 1px solid var(--line-strong);
  clip-path: var(--cut-lg); animation: introFlicker .5s ease-out; }
.list table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.list th { position: sticky; top: 0; background: #0a0e18; text-align: left; font-weight: 700; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--cyan); padding: 11px 12px; cursor: pointer; user-select: none; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
.list th[data-sort="asc"]::after { content: " ▲"; color: var(--core); }
.list th[data-sort="desc"]::after { content: " ▼"; color: var(--core); }
.list td { padding: 10px 12px; border-bottom: 1px solid #00f0ff14; white-space: nowrap; }
.list td b { letter-spacing: .1em; text-transform: uppercase; }
.list .num { text-align: right; }
.list tbody tr { cursor: pointer; transition: background .15s; }
.list tbody tr:hover, .list tbody tr:focus { background: #00f0ff0f; box-shadow: inset 3px 0 0 var(--cyan); outline: none; }

/* login */
/* the page grows with its content and scrolls (first-login setup is taller than a phone screen); centred while it fits */
.login-page { display: grid; place-items: start center; height: auto; min-height: 100%; padding: 16px 16px 40px; overflow-x: hidden; overflow-y: auto;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 38%, #ff2a6d22, transparent 40%), var(--bg); }
.login-page::before { content: ""; position: fixed; left: -50%; right: -50%; bottom: -30%; height: 60%; transform: perspective(520px) rotateX(63deg);
  background-image: linear-gradient(#00f0ff1c 1px, transparent 1px), linear-gradient(90deg, #00f0ff1c 1px, transparent 1px);
  background-size: 52px 52px; animation: floor 7s linear infinite;
  -webkit-mask-image: linear-gradient(transparent, #000 65%); mask-image: linear-gradient(transparent, #000 65%); }
.login-page::after { content: ""; position: fixed; inset: 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, #0000002c 2px 3px); }
.login { position: relative; z-index: 1; width: min(340px, 100%); text-align: center; margin-block: auto; }
.login h1 { margin: 20px 0 2px; font-size: 26px; letter-spacing: .4em; color: var(--cyan); text-shadow: 0 0 12px var(--cyan); animation: glitch 4s steps(1) infinite; }
.login .muted { letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.login form { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login .btn { padding: 11px; }
.login-msg { min-height: 18px; color: var(--core); font-size: 12px; text-align: center; letter-spacing: .06em; }
.login-msg.good { color: var(--mine); }
/* erste Anmeldung: App verbinden, Notfallcodes */
.setup-app { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #05060a; box-shadow: inset 0 0 0 1px var(--line); clip-path: var(--cut-sm);
  font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.setup-app b, .setup-codes b { color: var(--cyan); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.setup-app img { width: 200px; height: 200px; align-self: center; background: #fff; padding: 6px; image-rendering: pixelated; }
.setup-app img[hidden] { display: none; }
.setup-app code, .setup-codes code { color: var(--cyan); word-break: break-all; }
.setup-codes { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; text-align: left; font-size: 12px; line-height: 1.5; color: var(--muted); }
.setup-codes[hidden] { display: none; }
.setup-codes ol { margin: 0; padding: 12px 12px 12px 36px; columns: 2; background: #05060a; box-shadow: inset 0 0 0 1px #39ff8855;
  font: 700 13px var(--mono); color: var(--mine); letter-spacing: .08em; }
.setup-codes u { color: var(--text); }
/* Konto-Fenster im Hub */
.acc-btn::before { content: "◉"; margin-right: 6px; }
.acc-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.acc-form input { width: 100%; }
.acc-msg { font-size: 11.5px; min-height: 0; }
.acc-msg:empty { display: none; }
.acc-msg.bad { color: var(--core); } .acc-msg.good { color: var(--mine); }
.login form[hidden] { display: none; }
.login-steps { list-style: none; display: flex; justify-content: center; gap: 18px; margin: 18px 0 0; padding: 0; font-size: 10.5px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.login-steps li { padding-bottom: 4px; border-bottom: 2px solid transparent; }
.login-steps li.on { color: var(--cyan); border-bottom-color: var(--cyan); text-shadow: 0 0 6px #00f0ff88; }
#code input[name=code] { font-size: 22px; letter-spacing: .4em; text-align: center; padding: 12px 10px; }
#code input[name=code]::placeholder { font-size: 13px; letter-spacing: .14em; }
.login-hint { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted); text-align: center; }
.login-hint code { color: var(--cyan); }
.login-back { background: none; border: 0; color: var(--cyan); font: 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; align-self: center; }
.login-core { width: 88px; height: 88px; margin: 0 auto; display: grid; place-items: center; position: relative; }
.login-core::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px dashed var(--cyan); opacity: .8;
  animation: spin 14s linear infinite reverse; }
.login-core::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; border: 1.5px solid var(--core);
  box-shadow: 0 0 24px #ff2a6d66, inset 0 0 18px #ff2a6d44; }
.login-core span { width: 28px; height: 28px; background: var(--core); box-shadow: 0 0 18px var(--core); clip-path: var(--hex); animation: beat 1s ease-in-out infinite; }
@keyframes beat { 10% { transform: scale(1.15); } 25% { transform: scale(1); } 35% { transform: scale(1.08); } 50% { transform: scale(1); } }

/* narrow screens and phones */
@media (max-width: 1560px) { .bar .chips .chip:nth-child(n+3) { display: none; } }
@media (max-width: 1280px) { .bar .chips { display: none; } }
/* mid widths: the top bar must not grow wider than the screen */
@media (max-width: 1180px) { .brand .muted { display: none; } .search input { width: 120px; } .search input:focus { width: 180px; } }
@media (max-width: 1000px) { .bar .badge { max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
@media (max-width: 880px) { .bar .badge { display: none; } }
@media (max-width: 760px) {
  .bar { gap: 8px; padding: 10px 12px; }
  .brand .muted, .badge { display: none; }
  .btn { padding: 7px 10px; }
  .search input, .search input:focus { width: 110px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 62vh;
    clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%, 0 22px); animation: sheet .35s cubic-bezier(.2,1,.3,1); }
  .panel::before { content: ""; display: block; width: 42px; height: 3px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); margin: -8px auto 12px; }
  .legend { left: 12px; bottom: 12px; }
  .legend > :not(#btn-hidden) { display: none; }
  .list { inset: 56px 8px 8px 8px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .idmap { grid-template-columns: repeat(10, 1fr); }
  .modpack { grid-template-columns: 1fr; }
  #map { touch-action: none; }
}
@keyframes sheet { from { transform: translateY(100%); } }
@media (max-width: 680px) { .search { display: none; } .nv-label, .acc-label { display: none; } .acc-btn::before { margin-right: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
