/* SOHO Router Lab — app shell & simulator views */
:root {
  --bg: #0d141c; --bg2: #111b25; --panel: #162231; --panel2: #1c2b3c; --line: #2a3d52;
  --text: #e7eef6; --muted: #8ea3b8; --accent: #2bb3ff; --hot: #ffb400; --ok: #3ddc84; --warn: #ffcc33; --bad: #ff5d6c; --purple: #b48cff;
  --radius: 12px; --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(1200px 600px at 70% -10%, #17324a 0%, transparent 60%), var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; overflow-x: hidden; }
a { color: var(--accent); cursor: pointer; }
code { font-family: var(--mono); background: #0a1018; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: .92em; }
.mono { font-family: var(--mono); }
.small { font-size: 12px; color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.center { text-align: center; }
.row { display: flex; } .gap { gap: 8px; }

/* buttons & inputs */
.btn { appearance: none; border: 1px solid #3a536c; background: linear-gradient(#25425e, #1b3249); color: #fff; padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.hot { background: linear-gradient(#ffc93c, #f29d00); border-color: #ffcf55; color: #241600; }
.btn.danger { background: linear-gradient(#e2475a, #b52b3d); border-color: #ff7585; }
.btn.block { width: 100%; }
.btn.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,180,0,.55); } 50% { box-shadow: 0 0 0 10px rgba(255,180,0,0); } }
.in { background: #0b131c; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 10px; font: inherit; min-width: 0; }
.in:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* HUD */
.hud { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: rgba(10,16,24,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 28px; filter: drop-shadow(0 0 8px rgba(43,179,255,.5)); }
.brand b { display: block; font-size: 16px; letter-spacing: .3px; }
.brand small { color: var(--muted); font-size: 11px; }
.hud-mode { flex: 1; min-width: 120px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--panel); }
.chip.cp { border-color: #2c6d99; } .chip.tk { border-color: #9a6b10; color: #ffd27a; } .chip.sb { border-color: #6b4fa8; color: #d3bfff; }
.hud-clock { display: flex; align-items: center; gap: 6px; }
.clk { font-family: var(--mono); font-weight: 700; background: #0a1018; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; min-width: 112px; text-align: center; }
.hud-xp { min-width: 190px; }
.lvlrow { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.lvl { font-weight: 700; color: var(--hot); }
.who { color: var(--muted); }
.xpbar { height: 8px; background: #0a1018; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: 3px 0 1px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb400, #ff7a00); transition: width .6s; }
.hud-xp small { color: var(--muted); font-size: 11px; }
.hud-btns { display: flex; gap: 6px; }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 16px; padding: 14px 16px 24px; align-items: start; }
.stage { min-width: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 9px 14px; border-radius: 10px 10px 4px 4px; font: inherit; font-weight: 600; cursor: pointer; }
.tab span { margin-right: 2px; }
.tab.on { background: linear-gradient(#24486a, #1a3550); border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent) inset; }
.view { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 560px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; }
.tbl tr.ours td { color: var(--accent); font-weight: 600; }
.tbl.kv td:first-child { color: var(--muted); width: 40%; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; background: #0d1824; border: 1px solid var(--line); font-size: 12px; margin: 2px 4px 2px 0; }
.pill.ok { border-color: #2a7a4f; color: var(--ok); } .pill.bad { border-color: #8a2f3a; color: var(--bad); } .pill.info { border-color: #2c6d99; color: var(--accent); }

/* ---------- office ---------- */
.matbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.office-host { width: 100%; overflow: hidden; border-radius: 10px; }
.office-svg { width: 100%; height: auto; display: block; user-select: none; }
.office-tip { margin-top: 8px; font-size: 13px; color: var(--muted); }
.room { fill: #13212e; }
.desk { fill: #3a2b20; }
.wifizone { fill: rgba(43,179,255,.06); stroke: rgba(43,179,255,.35); stroke-dasharray: 6 5; }
.zlbl { fill: #a9c4dc; font-size: 13px; font-weight: 600; text-anchor: middle; }
.zlbl.dim { fill: #6d8296; font-size: 12px; }
.neighborwall { stroke: #8a6a4a; stroke-width: 6; stroke-dasharray: 18 6; }
.cloud path { fill: #dfe9f3; }
.clbl { font-size: 14px; font-weight: 700; fill: #234; text-anchor: middle; }
.ispl { fill: #8ea3b8; font-size: 11px; text-anchor: middle; }
.isp { stroke: #555; stroke-width: 4; stroke-dasharray: 8 6; }
.isp.live { stroke: var(--accent); animation: flow 1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.wall { fill: #e9e4da; stroke: #b9b1a3; }
.plbl { font-size: 11px; fill: #cfe2f3; text-anchor: middle; font-weight: 700; pointer-events: none; }
.plbl.dark { fill: #4a5560; font-weight: 600; }
.port { cursor: pointer; }
.port rect, .port circle { fill: #1c1f22; stroke: #888; stroke-width: 1.5; transition: stroke .15s; }
.port .pin { fill: #666; stroke: none; }
.port.wanp rect:first-child { stroke: #2b8cff; stroke-width: 3; }
.port.lanp rect:first-child { stroke: #e7c321; stroke-width: 3; }
.port.coaxp circle:first-child, [data-port="wall.coax"] circle:first-child { stroke: #c9a86a; stroke-width: 3; fill: #c9a86a33; }
.port:hover rect:first-child, .port:hover circle:first-child { stroke: #fff; }
.port.plugged .pin { fill: var(--ok); }
.port.sel rect:first-child, .port.sel circle:first-child { stroke: var(--hot); stroke-width: 4; filter: drop-shadow(0 0 6px var(--hot)); }
.port.cand rect:first-child, .port.cand circle:first-child { animation: cand 1s infinite; }
@keyframes cand { 50% { stroke: var(--hot); stroke-width: 3.5; } }
.modem { stroke: #9aa7b1; }
.mlbl { font-size: 13px; font-weight: 700; fill: #2b3640; text-anchor: middle; }
.msub { font-size: 10px; fill: #6b7884; text-anchor: middle; }
.led { stroke: rgba(0,0,0,.4); }
.led.off { fill: #39424a; }
.led.on { fill: #3dff8a; filter: drop-shadow(0 0 4px #3dff8a); }
.led.red { fill: #ff4d4d; filter: drop-shadow(0 0 4px #ff4d4d); }
.led.blink { fill: #3dff8a; animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { fill: #39424a; filter: none; } }
.ledlbl { font-size: 8px; fill: #7b8a96; text-anchor: middle; }
.router + text, .rlbl { font-size: 18px; font-weight: 800; letter-spacing: 3px; fill: #e9eef2; font-style: italic; }
.rsub { font-size: 10px; fill: #93a1ac; }
.router { stroke: #3c464e; stroke-width: 2; }
.ant line { stroke: #22282d; stroke-width: 9; stroke-linecap: round; }
.waves circle { fill: none; stroke: rgba(43,179,255,.6); stroke-width: 2; animation: wave 2.4s ease-out infinite; transform-origin: 612px 150px; transform-box: view-box; }
.waves circle.d2 { animation-delay: 1.2s; }
@keyframes wave { from { transform: scale(.4); opacity: 1; } to { transform: scale(4); opacity: 0; } }
.pwr { cursor: pointer; }
.pwr circle { fill: #2a2f34; stroke: #555; stroke-width: 2; }
.pwr path { fill: none; stroke: #aaa; stroke-width: 2.5; stroke-linecap: round; }
.pwr.on circle { stroke: var(--ok); }
.pwr.on path { stroke: var(--ok); }
.pwr:hover circle { stroke: #fff; }
.status { font-size: 13px; font-weight: 700; text-anchor: middle; }
.status.ok { fill: var(--ok); } .status.warn { fill: var(--warn); } .status.bad { fill: var(--bad); }
.cable { fill: none; stroke-width: 6; stroke-linecap: round; pointer-events: none; opacity: .95; }
.cable.coax { stroke: #111; stroke-width: 7; }
.cable.wan { stroke: #2b8cff; }
.cable.eth { stroke: #e9c22b; }
.pkt { fill: #fff; filter: drop-shadow(0 0 3px #fff); pointer-events: none; }
.pkt.lan { fill: #7cf5ff; }
.wl { stroke-width: 2.5; stroke-dasharray: 3 7; animation: flow 1.2s linear infinite; pointer-events: none; }
.wl.b24 { stroke: #ff9f43; } .wl.b5 { stroke: #2bb3ff; } .wl.guest { stroke: var(--purple); }
.wl.noinet { opacity: .4; }
.dev { cursor: pointer; }
.devbox { fill: #1d2d3d; stroke: #2f4659; }
.dev:hover .devbox { stroke: var(--accent); }
.emo { font-size: 40px; text-anchor: middle; dominant-baseline: middle; }
.emo.sm { font-size: 30px; }
.emo.faded { opacity: .35; }
.dlbl { font-size: 12px; fill: #e7eef6; text-anchor: middle; font-weight: 600; }
.dlbl.sm { font-size: 11px; }
.dsub { font-size: 10px; fill: #8ea3b8; text-anchor: middle; font-family: var(--mono); }
.dot.ok { fill: var(--ok); } .dot.warn { fill: var(--warn); } .dot.bad { fill: var(--bad); }
.dev.intruder text.emo { animation: shake .6s infinite; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* paperwork */
.paper { background: #fbf8f1; color: #222; border-radius: 6px; padding: 16px 18px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.paper .small { color: #666; }
.paper-head { font-weight: 800; letter-spacing: 1px; color: #0b5ea8; margin-bottom: 8px; font-size: 16px; }
.paper.label { background: #f2f2f2; border: 2px dashed #999; }
.paper-t { border-collapse: collapse; margin: 8px 0; }
.paper-t td { border: 1px solid #ccc; padding: 4px 10px; }
.barcode { font-family: var(--mono); letter-spacing: -1px; font-size: 22px; margin-top: 6px; }
.cfgpre { background: #0b131c; color: #bfe3ff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12px/1.4 var(--mono); white-space: pre-wrap; word-break: break-all; }
.paper .cfgpre { margin-top: 8px; }

/* ---------- devices ---------- */
.devs { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; }
.devlist { display: flex; flex-direction: column; gap: 6px; }
.devitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); cursor: pointer; }
.devitem:hover { border-color: #3d5b78; }
.devitem.on { border-color: var(--accent); background: #1a3550; }
.devitem .emo { font-size: 24px; }
.devitem .dn { flex: 1; min-width: 0; }
.devitem .dn b { display: block; font-size: 13px; }
.devitem .dn small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
i.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
i.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); } i.dot.warn { background: var(--warn); } i.dot.bad { background: var(--bad); }
.devdetail { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.devhead { display: flex; gap: 14px; align-items: flex-start; }
.dh-emo { font-size: 46px; line-height: 1; }
.dh-main { flex: 1; min-width: 0; }
.dh-main h2 { margin: 0 0 2px; font-size: 18px; }
.dh-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; align-items: center; }
.dh-reason { margin-top: 8px; padding: 6px 10px; background: rgba(255,204,51,.08); border: 1px solid rgba(255,204,51,.35); border-radius: 8px; color: #ffe08a; font-size: 13px; }
.dh-acts { display: flex; flex-direction: column; gap: 6px; }
.devcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; vertical-align: middle; }
.bars i { width: 3px; background: #3a4b5c; border-radius: 1px; }
.bars i:nth-child(1) { height: 25%; } .bars i:nth-child(2) { height: 50%; } .bars i:nth-child(3) { height: 75%; } .bars i:nth-child(4) { height: 100%; }
.bars.b1 i:nth-child(-n+1), .bars.b2 i:nth-child(-n+2), .bars.b3 i:nth-child(-n+3), .bars.b4 i:nth-child(-n+4) { background: var(--ok); }
.wl-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.wl-item { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; background: #142130; }
.wl-item:hover { border-color: #3d5b78; }
.wl-item.cur { border-color: var(--ok); }
.wl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wl-ssid { flex: 1; font-weight: 600; min-width: 100px; }
.wl-form { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.wl-form .in { flex: 1; min-width: 120px; }
.wl-foot { margin-top: 8px; font-size: 12px; }
.rad { display: block; margin: 4px 0; font-size: 13px; }
.ipgrid { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 8px; margin: 8px 0; align-items: center; font-size: 13px; }
.vpn-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.vpn-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; flex-wrap: wrap; }
.vpn-item.on { border-color: var(--ok); }
.vpn-creds { display: flex; gap: 6px; flex-wrap: wrap; }
.vpn-creds .in { flex: 1; min-width: 110px; }
.del { color: var(--bad); text-decoration: none; cursor: pointer; }
.term { background: #05080c; border: 1px solid #23313f; border-radius: 10px; overflow: hidden; }
.term.disabled { opacity: .6; }
.term-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #1a2430; padding: 6px 10px; font-size: 12px; color: #b9c8d6; }
.term-btns { display: flex; gap: 4px; }
#termOut { margin: 0; padding: 10px 12px; height: 280px; overflow: auto; color: #cfe6d6; font: 13px/1.35 var(--mono); white-space: pre-wrap; word-break: break-word; }
.term-in { display: flex; align-items: center; gap: 6px; border-top: 1px solid #1a2430; padding: 6px 12px; font: 13px var(--mono); color: #9fd0ff; }
.term-in input { flex: 1; background: transparent; border: 0; color: #e7f7ea; font: inherit; outline: none; min-width: 0; }

/* ---------- browser ---------- */
.br { border: 1px solid #2c3a48; border-radius: 10px; overflow: hidden; background: #dfe3e8; }
.br-top { display: flex; justify-content: space-between; align-items: flex-end; background: #1f2a35; padding: 6px 8px 0; gap: 10px; flex-wrap: wrap; }
.br-tab { background: #dfe3e8; color: #222; border-radius: 9px 9px 0 0; padding: 7px 14px; font-size: 12px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-from { color: #c6d3df; font-size: 12px; padding-bottom: 6px; }
.br-from select { background: #0e1720; color: #fff; border: 1px solid #39506a; border-radius: 6px; padding: 3px 6px; font: inherit; }
.br-bar { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: #dfe3e8; border-bottom: 1px solid #c3c9d0; }
.br-nb { border: 0; background: transparent; font-size: 16px; cursor: pointer; color: #333; border-radius: 50%; width: 30px; height: 30px; }
.br-nb:hover { background: #cdd3da; }
.br-url { flex: 1; display: flex; align-items: center; background: #fff; border-radius: 99px; padding: 0 12px; border: 1px solid #c3c9d0; min-width: 0; }
.br-url input { flex: 1; border: 0; outline: none; padding: 8px 6px; font: 14px "Segoe UI", system-ui, sans-serif; color: #111; min-width: 0; background: transparent; }
.br-lock { font-size: 12px; color: #555; white-space: nowrap; }
.br-lock.insec { color: #b3261e; font-weight: 600; }
.br-content { background: #fff; color: #222; min-height: 560px; position: relative; }
.newtab { padding: 50px 20px; text-align: center; }
.nt-logo { font-size: 60px; }
.nt-tip { max-width: 560px; margin: 16px auto; background: #eef6ff; border: 1px solid #b6d6f5; border-radius: 10px; padding: 12px; color: #1a3d5c; }
.nt-tip code { background: #fff; border-color: #b6d6f5; color: #1a3d5c; }
.nt-tiles { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.nt-tile { width: 120px; padding: 14px 8px; border-radius: 12px; background: #f1f3f5; cursor: pointer; font-size: 12px; color: #333; }
.nt-tile:hover { background: #e3e7eb; }
.nt-tile span { display: block; font-size: 28px; margin-bottom: 6px; }
.errpage { max-width: 600px; margin: 0 auto; padding: 70px 24px; color: #333; }
.errpage h2 { font-weight: 500; }
.ep-ic { font-size: 54px; }
.errpage .code { color: #777; font-family: var(--mono); font-size: 12px; margin-top: 20px; }
.errpage code { background: #f1f3f5; color: #333; border-color: #ddd; }
.blockpage { color: #8a1c1c; } .blockpage h2 { color: #b3261e; }
.warnpage h2 { color: #b26a00; }
.site { padding: 70px 20px; text-align: center; color: #222; }
.site-hero { font-size: 80px; }
.site.evil { background: repeating-linear-gradient(45deg, #fff6d6 0 20px, #ffe6e6 20px 40px); }
.campage { padding: 24px; text-align: center; color: #222; }
.cam-feed { position: relative; margin: 0 auto; max-width: 560px; aspect-ratio: 16/9; background: #222 radial-gradient(circle at 40% 40%, #4a4a4a, #151515); border-radius: 8px; overflow: hidden; filter: grayscale(.7) contrast(1.1); }
.cam-feed.sm { max-width: 100%; }
.cam-scene { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-around; padding: 0 6% 10%; font-size: 46px; }
.cam-feed.sm .cam-scene { font-size: 30px; }
.cam-scene span:nth-child(odd) { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.rec { position: absolute; top: 8px; left: 10px; color: #ff4040; font: 700 13px var(--mono); animation: blink 1s steps(2) infinite; z-index: 2; }
.cam-ts { position: absolute; top: 8px; right: 10px; color: #fff; font: 12px var(--mono); z-index: 2; }
.cam-noise { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 2px, transparent 2px 4px); pointer-events: none; }
.rt-host { min-height: 560px; }

/* ---------- analyzer ---------- */
.an-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 10px; }
.an-top h2 { margin: 0; font-size: 18px; }
.an-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.an-empty { padding: 80px 20px; text-align: center; color: var(--muted); font-size: 16px; }
.an-chart { background: #08111a; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.anchart { width: 100%; height: auto; display: block; }
.anchart .grid { stroke: #1b2a39; }
.anchart .ax { fill: #7f95aa; font-size: 11px; text-anchor: middle; }
.anchart .ax.r { text-anchor: end; }
.anchart .ax.dfs { fill: #c99a40; }
.anchart .dfszone { fill: rgba(201,154,64,.06); }
.anchart .curve { stroke-width: 2; fill-opacity: .12; }
.anchart .curve.ours { stroke-width: 3.5; fill-opacity: .25; }
.anchart .clabel { font-size: 11px; text-anchor: middle; font-weight: 600; }
.an-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.rating { display: flex; gap: 3px; align-items: flex-end; height: 130px; padding-bottom: 18px; overflow-x: auto; }
.rt-bar { flex: 1; min-width: 14px; height: 100%; position: relative; display: flex; align-items: flex-end; }
.rt-bar i { display: block; width: 100%; border-radius: 3px 3px 0 0; }
.rt-bar i.g { background: var(--ok); } .rt-bar i.y { background: var(--warn); } .rt-bar i.r { background: var(--bad); }
.rt-bar span { position: absolute; bottom: -17px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--muted); }
.rt-bar.cur i { outline: 2px solid #fff; }
.rt-bar.cur span { color: #fff; font-weight: 700; }

/* ---------- outside ---------- */
.out { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.out .scan-card { grid-column: 1 / -1; }
.ps { padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.ps.open { background: rgba(255,93,108,.15); color: var(--bad); }
.ps.stealth { background: rgba(61,220,132,.12); color: var(--ok); }
.ps.closed { background: rgba(255,204,51,.12); color: var(--warn); }
.ps.offline { color: var(--muted); }
.phone { max-width: 330px; margin: 8px auto 0; border: 10px solid #000; border-radius: 30px; background: #fff; color: #222; overflow: hidden; position: relative; }
.phone-notch { width: 110px; height: 18px; background: #000; border-radius: 0 0 12px 12px; margin: 0 auto; }
.phone .br-bar { background: #f1f3f5; }
.phone .br-bar input { flex: 1; border: 1px solid #ccc; border-radius: 99px; padding: 6px 10px; font: 13px system-ui, sans-serif; min-width: 0; }
.phone-body { min-height: 230px; padding: 14px; }
.phone-body .small { color: #666; }
.phone-body code { background: #f1f3f5; color: #333; border-color: #ddd; }
.big { font-size: 46px; }

/* ---------- mission panel ---------- */
.mission { position: sticky; top: 80px; background: linear-gradient(180deg, #1a2a3c, #142231); border: 1px solid #2f4a66; border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 100px); overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.mp-head { display: flex; align-items: center; gap: 10px; }
.mp-icon { font-size: 34px; }
.mp-head small { color: var(--muted); font-size: 12px; }
.mp-head h2 { margin: 0; font-size: 18px; }
.mp-head > div { flex: 1; }
.mp-collapse { background: transparent; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; display: none; }
.mp-story { margin: 10px 0; font-size: 13.5px; color: #d1deea; }
.mp-creds { background: #0d1824; border: 1px dashed #4a6a8a; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; margin-bottom: 8px; }
.mp-objh { display: flex; justify-content: space-between; align-items: center; }
.mp-count { font-weight: 700; color: var(--hot); }
.mp-prog { height: 6px; background: #0a1018; border-radius: 99px; margin: 6px 0 8px; overflow: hidden; }
.mp-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #9cffc8); transition: width .4s; }
.mp-obj ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mp-obj li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: rgba(0,0,0,.18); border: 1px solid transparent; }
.mp-obj li.done { border-color: rgba(61,220,132,.35); background: rgba(61,220,132,.07); }
.mp-obj li.done > div > span { color: #a5e9c3; }
.ck { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid #4a6580; display: grid; place-items: center; font-size: 12px; color: #04140b; margin-top: 1px; }
li.done .ck { background: var(--ok); border-color: var(--ok); }
.hintbtn { font-size: 12px; text-decoration: none; white-space: nowrap; }
.hint { margin-top: 4px; font-size: 12.5px; color: #ffe08a; }
.mp-actions { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 6px; }
.mp-done { color: var(--ok); font-weight: 700; }
.mp-notes { margin-top: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.mp-notes summary { cursor: pointer; font-weight: 700; }
.mp-notes ul { padding-left: 18px; margin: 8px 0 0; }
.mp-notes li { margin-bottom: 4px; }
.ntbl { border-collapse: collapse; margin: 6px 0; font-size: 12px; }
.ntbl td, .ntbl th { border: 1px solid var(--line); padding: 3px 8px; }
.mp-instr { margin-top: 10px; padding: 8px 10px; border: 1px dashed #8a6bd0; border-radius: 10px; background: rgba(180,140,255,.07); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.mp-ideas { font-size: 13px; } .mp-ideas ul { padding-left: 18px; }
.prio { font-weight: 700; padding: 0 6px; border-radius: 4px; font-size: 11px; }
.prio.critical { background: #5c1620; color: #ff9aa5; } .prio.high { background: #5a3a08; color: #ffcf73; } .prio.medium { background: #173a5a; color: #9fd3ff; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(3,8,14,.7); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: #172535; border: 1px solid #36506a; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .18s; }
.modal.wide { width: min(860px, 100%); }
@keyframes pop { from { transform: scale(.96); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-x { background: transparent; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 14px 16px; overflow: auto; }
.modal-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-body ul { padding-left: 20px; }
.resl { list-style: none; padding: 0 !important; } .resl li { margin: 4px 0; }
.sec { margin: 14px 0 4px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.mcard { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--panel2); cursor: pointer; text-align: center; transition: transform .1s; }
.mcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.mcard.done { border-color: rgba(61,220,132,.5); }
.mcard.cur { box-shadow: 0 0 0 2px var(--hot); }
.mcard.locked { opacity: .5; }
.mc-ic { font-size: 28px; }
.mc-n { font-size: 11px; color: var(--muted); }
.mc-t { font-weight: 700; font-size: 13px; margin: 2px 0; }
.mc-s { font-size: 12px; color: var(--hot); }
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bcard { border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; opacity: .45; }
.bcard.on { opacity: 1; border-color: var(--hot); background: rgba(255,180,0,.06); }
.b-ic { font-size: 34px; }
.bcard b { display: block; font-size: 13px; } .bcard small { color: var(--muted); font-size: 11px; }
.set label { display: block; margin-top: 8px; font-size: 13px; }
.set .in { width: 100%; }
.set .chk { display: flex; gap: 8px; align-items: center; }
.set-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.welcome { font-size: 14px; }
.wl-hero { font-size: 50px; text-align: center; }
.wl-feat { list-style: none; padding: 0 !important; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wl-feat li { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.welcome label { display: block; margin: 10px 0 4px; font-weight: 600; }
.welcome .in { width: 100%; }
.ticket-card .prio { display: inline-block; margin-bottom: 6px; }
.quiz .qprog { color: var(--muted); font-size: 12px; }
.qq { font-size: 16px; font-weight: 600; margin: 6px 0 12px; }
.qa { display: flex; flex-direction: column; gap: 8px; }
.qopt { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; cursor: pointer; }
.qopt:hover { border-color: var(--accent); }
.qopt.right { border-color: var(--ok); background: rgba(61,220,132,.15); }
.qopt.wrong { border-color: var(--bad); background: rgba(255,93,108,.15); }
.qopt.dim { opacity: .55; }
.qwhy { margin-top: 10px; font-size: 13.5px; }
.qnext { margin-top: 10px; text-align: right; }
.win { text-align: center; }
.win-ic { font-size: 64px; animation: bob 1.5s ease-in-out infinite; }
.xpgain { font-size: 26px; font-weight: 800; color: var(--hot); }

/* toasts & confetti */
#toasts { position: fixed; bottom: 16px; left: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #1d2d40; border: 1px solid #3a5a7a; border-left: 4px solid var(--accent); border-radius: 10px; padding: 9px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 13.5px; animation: slide .25s; transition: opacity .4s, transform .4s; }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast.badge { border-left-color: var(--hot); background: linear-gradient(90deg, #3a2a05, #1d2d40); }
.toast.out { opacity: 0; transform: translateX(-20px); }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.badge-toast { display: flex; gap: 10px; align-items: center; }
.badge-toast span { font-size: 30px; }
.badge-toast small { display: block; color: var(--muted); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; }

/* certificate (print only) */
#cert { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(#cert) { display: none !important; }
  #cert { display: block; }
  .cert { width: 100%; padding: 20px; color: #111; font-family: Georgia, "Times New Roman", serif; }
  .cert-in { border: 10px double #0b5ea8; padding: 40px; text-align: center; }
  .cert-top { font-family: "Segoe UI", sans-serif; letter-spacing: 3px; color: #0b5ea8; font-weight: 700; }
  .cert h1 { font-size: 40px; margin: 10px 0; }
  .cert h2 { font-size: 34px; border-bottom: 1px solid #999; display: inline-block; padding: 0 40px 4px; }
  .cert-course { margin-top: 20px; font-style: italic; }
  .cert-badges { font-size: 26px; margin: 16px 0; }
  .cert-sig { display: flex; justify-content: space-around; margin-top: 40px; }
  .cert-sig div { border-top: 1px solid #333; padding-top: 4px; width: 220px; font-size: 13px; }
  .cert-sig span { display: block; font-size: 16px; margin-top: -28px; margin-bottom: 10px; min-height: 18px; }
}

/* responsive */
@media (max-width: 1150px) {
  .layout { grid-template-columns: 1fr; }
  .mission { position: static; max-height: none; order: -1; }
  .mp-collapse { display: block; }
  .mission.collapsed .mp-body { display: none; }
}
@media (max-width: 760px) {
  .hud { gap: 8px; padding: 8px 16px; }
  .brand small, .hud-mode { display: none; }
  .hud-xp { min-width: 0; flex: 1; }
  .layout { padding: 10px 16px 20px; }
  .view { padding: 10px; }
  .devs, .devcols, .an-grid, .out { grid-template-columns: 1fr; }
  .devlist { flex-direction: row; overflow-x: auto; }
  .devitem { min-width: 180px; }
  .wl-feat { grid-template-columns: 1fr; }
  .tab { padding: 7px 10px; font-size: 13px; }
}
