:root {
  --sky: #55c6f5;
  --ink: #2e3650;
  --ink2: #5a6480;
  --card: #ffffff;
  --line: #e3e9f2;
  --soft: #f3f7fc;
  --yellow: #ffc94d;
  --blue: #58c7ff;
  --green: #3ecf8e;
  --red: #ff5a67;
  --orange: #ff9f43;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(30, 60, 110, .18), 0 2px 6px rgba(30, 60, 110, .08);
  font-family: Nunito, "Arial Rounded MT Bold", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
.hidden { display: none !important; }
#app { position: fixed; inset: 0; }
#app canvas { display: block; }

/* ---- floating labels ---- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; font-weight: 800; line-height: 1.25;
  padding: 4px 9px; border-radius: 10px; background: rgba(255,255,255,.95); box-shadow: 0 3px 10px rgba(30,60,110,.2); }
.label small { font-weight: 600; color: var(--ink2); }
.label.bubble { border-radius: 999px; }
.label.alert { background: var(--red); color: #fff; animation: bob 1s ease-in-out infinite; }
.label.name { background: var(--ink); color: #fff; text-align: center; }
.label.name small { color: #b9c3dc; }
.label.ov { background: #fff; border: 2px solid var(--green); text-align: center; }
.label.ov.warn { border-color: var(--yellow); }
.label.ov.bad { border-color: var(--red); background: #fff1f2; }
.label.ov.off { border-color: #b9c3dc; color: var(--ink2); }
.label.ov.cool { border-color: var(--blue); }
.label.ov.net { border-color: var(--blue); text-align: left; font-size: 11px; }
.k-server { color: #8fa3c0; } .k-switch { color: #3a4660; } .k-router { color: #35b5a2; } .k-firewall { color: #ff7a59; }
.bar { display: inline-block; width: 46px; height: 7px; border-radius: 9px; background: #e3e9f2; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 9px; }
@keyframes bob { 50% { margin-top: -4px; } }

/* ---- HUD ---- */
.hud { position: fixed; z-index: 5; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.pill { background: #fff; border-radius: 999px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; padding: 8px 18px; }
#topbar { top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.logo { font-weight: 900; letter-spacing: .5px; font-size: 17px; gap: 8px; }
.logo i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); display: inline-block; }
.logo .y { color: #f0a500; } .logo .b { color: #1ea7ea; }
.stat { display: flex; flex-direction: column; line-height: 1.05; min-width: 58px; }
.stat small { font-size: 11px; color: var(--ink2); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.stat b { font-size: 17px; font-weight: 900; }
.speed { display: flex; gap: 4px; }
.speed button { border: 0; background: var(--soft); border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 900; }
.speed button.on { background: var(--ink); color: #fff; }
.saved { font-size: 11px; font-weight: 800; color: var(--ink2); white-space: nowrap; transition: color .3s; }
.saved.flash { color: #1b9e63; }
.mode { font-weight: 900; padding: 6px 12px; border-radius: 999px; background: var(--yellow); }
.mode.hacker { background: var(--ink); color: #5dff9c; font-family: "JetBrains Mono", monospace; }
.neg { color: var(--red); }

#dock { left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 6px; background: #fff; padding: 8px; border-radius: 24px; box-shadow: var(--shadow); align-items: center; max-width: calc(100vw - 32px); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
#dock::-webkit-scrollbar { display: none; }
#dock button { flex: 0 0 auto; border: 0; background: transparent; border-radius: 16px; padding: 6px 12px; font-weight: 800; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
#dock button span { font-size: 22px; line-height: 1.1; }
/* an RJ-45 plug: no emoji for a network cable, and 🔌 reads as mains power */
.ico-rj45 { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M13 23h6v8.5a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 13 31.5z' fill='%233a8dde'/%3E%3Cpath d='M10.5 18h11l-1.8 5.5h-7.4z' fill='%232f7bd0'/%3E%3Crect x='6.5' y='4.5' width='19' height='14.5' rx='2.2' fill='%23eaf5ff' stroke='%236f9fd4' stroke-width='1.3'/%3E%3Cg fill='%23f2b134'%3E%3Crect x='8.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='10.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='12.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='14.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='16.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='18.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='20.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3Crect x='22.6' y='5.6' width='1.2' height='4.6' rx='.4'/%3E%3C/g%3E%3Cg stroke-width='1.1' stroke-linecap='round'%3E%3Cpath d='M10.2 12v5' stroke='%23ff9f43'/%3E%3Cpath d='M13.4 12v5' stroke='%233ecf8e'/%3E%3Cpath d='M16.6 12v5' stroke='%2358a6ff'/%3E%3Cpath d='M19.8 12v5' stroke='%23a0703c'/%3E%3C/g%3E%3Crect x='12' y='13.5' width='8' height='4' rx='1' fill='%23cfe6ff' stroke='%236f9fd4' stroke-width='.8'/%3E%3C/svg%3E") center / contain no-repeat; }
#dock button:hover { background: var(--soft); }
#dock button.on { background: var(--ink); color: #fff; }
#dock button.has-badge { position: relative; }
#dock .badge { position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; line-height: 18px; padding: 0 5px; animation: bob 1s ease-in-out infinite; }
#dock .sep { flex: 0 0 auto; width: 2px; height: 40px; background: var(--line); border-radius: 2px; margin: 0 4px; }

#hint { left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 13px; box-shadow: var(--shadow); }
#catalog { left: 50%; bottom: 100px; transform: translateX(-50%); display: flex; gap: 10px; padding: 12px; max-width: calc(100vw - 32px); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
#catalog::-webkit-scrollbar { display: none; }
/* more to see: a fade and an arrow on whichever side has it */
#catalog.more-r, #dock.more-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
#catalog.more-l, #dock.more-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px); mask-image: linear-gradient(90deg, transparent, #000 56px); }
#catalog.more-l.more-r, #dock.more-l.more-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent); }
.row-scroll { position: fixed; bottom: 100px; z-index: 6; width: 34px; height: 34px; margin-bottom: 0; border: 0; border-radius: 50%; background: var(--ink); color: #fff; font-size: 22px; font-weight: 900; line-height: 1; box-shadow: 0 4px 14px rgba(20,30,60,.25); display: none; }
.row-scroll.on { display: block; }
.row-scroll:hover { background: var(--blue); }
#catalog:not(.hidden) + #hint { bottom: 262px; }
.cat-sep { width: 2px; align-self: stretch; background: var(--line); border-radius: 2px; }
.cat-item.office { background: #fffaf0; border-color: #f3dcae; }
.cat-item:disabled { opacity: .6; cursor: default; }
.cat-item { width: 150px; flex: 0 0 auto; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 10px; text-align: left; }
.cat-item:hover { border-color: var(--blue); }
.cat-item.on { border-color: var(--ink); background: var(--soft); }
.cat-item b { display: block; font-size: 14px; }
.cat-item .price { font-weight: 900; color: #1b9e63; }
.cat-item small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; color: var(--ink2); font-size: 11px; line-height: 1.3; margin-top: 4px; }
.cat-item .ico { font-size: 26px; }

#objectives { left: 14px; top: 86px; width: 290px; padding: 14px 16px; font-size: 13px; max-height: calc(100vh - 330px); overflow: auto; }
#objectives h3 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
#objectives h3 button { border: 0; background: var(--soft); border-radius: 999px; font-size: 11px; padding: 2px 8px; }
#objectives ol { margin: 0; padding: 0; list-style: none; }
#objectives li { display: flex; gap: 8px; padding: 4px 0; line-height: 1.3; color: var(--ink2); font-weight: 700; }
#objectives li .ck { flex: 0 0 18px; height: 18px; border-radius: 50%; border: 2px solid #c9d3e3; display: grid; place-items: center; font-size: 11px; }
#objectives li.done { color: #9aa6ba; text-decoration: line-through; }
#objectives li.done .ck { background: var(--green); border-color: var(--green); color: #fff; }
#objectives li.cur { color: var(--ink); }
#objectives li.cur .ck { border-color: var(--blue); background: #e7f7ff; }
#objectives .tip { margin-top: 8px; background: #fff8e6; padding: 8px 10px; border-radius: 12px; font-size: 12px; color: #6b5310; font-weight: 700; }
#objectives.min ol, #objectives.min .tip { display: none; }

#log { left: 14px; bottom: 16px; width: 360px; display: flex; flex-direction: column-reverse; gap: 6px; pointer-events: none; }
#log div { background: rgba(255,255,255,.93); border-radius: 12px; padding: 6px 10px; font-size: 12px; font-weight: 700; box-shadow: 0 3px 10px rgba(30,60,110,.14); }
#log div.bad { background: #fff1f2; color: #b3182a; }
#log div.good { background: #effcf5; color: #146c43; }
#log div small { color: var(--ink2); margin-right: 6px; }

/* the card clips, #side-body scrolls: a rounded scroller over the WebGL canvas can blank it on mobile compositors */
#side { right: 14px; top: 86px; bottom: 16px; width: 400px; overflow: hidden; display: flex; flex-direction: column; padding: 0; font-size: 13px; }
#side-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; }
#side h2 { margin: 0; font-size: 19px; font-weight: 900; }
#side h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink2); }
#side .close { position: sticky; top: 0; float: right; border: 0; background: var(--soft); border-radius: 999px; width: 30px; height: 30px; font-weight: 900; }
.sub { color: var(--ink2); font-weight: 700; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 11px; background: var(--soft); }
.chip.ok { background: #e2f8ec; color: #146c43; }
.chip.bad { background: #ffe5e8; color: #b3182a; }
.chip.warn { background: #fff4d6; color: #8a6200; }
.btn { border: 0; background: var(--ink); color: #fff; border-radius: 12px; padding: 7px 12px; font-weight: 800; font-size: 12px; }
.btn.alt { background: var(--soft); color: var(--ink); }
.btn.go { background: var(--green); }
.btn.warn { background: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 11px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.row label { font-weight: 800; min-width: 74px; }
.row input, .row select { border: 2px solid var(--line); border-radius: 10px; padding: 5px 8px; font-size: 12px; font-weight: 700; background: #fff; min-width: 0; }
.row input { width: 140px; }
.mono { font-family: "JetBrains Mono", monospace; font-size: 11.5px; }
.box { background: var(--soft); border-radius: 12px; padding: 10px; margin-top: 6px; }
.muted { color: var(--ink2); }

/* rack elevation */
.elev { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: repeat(42, 13px); gap: 1px 6px; background: #1b2236; border-radius: 12px; padding: 10px 10px; margin-top: 8px; }
.elev .u { color: #6d7a99; font-size: 9px; font-weight: 800; text-align: right; line-height: 13px; font-family: "JetBrains Mono", monospace; }
.elev .slot { border-radius: 3px; background: #262f48; border: 0; padding: 0; }
.elev .slot { color: transparent; font-size: 9px; font-weight: 800; text-align: left; padding: 0 6px; }
.elev .slot i { font-style: normal; }
.elev .slot:hover { background: #3a4a70; color: #cfe3ff; }
.elev .slot.sel { color: var(--ink); }
.elev .slot.sel { background: var(--yellow); }
.elev .dev { border-radius: 4px; border: 0; font-size: 10px; font-weight: 800; text-align: left; padding: 0 6px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.elev .dev .dot { width: 6px; height: 6px; border-radius: 50%; background: #5dff9c; box-shadow: 0 0 6px #5dff9c; flex: 0 0 auto; }
.elev .dev .dot.off { background: #6d7a99; box-shadow: none; }
.elev .dev .dot.hot { background: #ff4d5e; box-shadow: 0 0 6px #ff4d5e; }
.elev .dev.server { background: #e6ebf2; color: var(--ink); }
.elev .dev.gpu { background: #262b36; color: #3ecf8e; outline: 1px solid #3ecf8e; }
.elev .dev.switch { background: #4a5878; color: #fff; }
.elev .dev.router { background: #35b5a2; color: #fff; }
.elev .dev.firewall { background: #ff7a59; color: #fff; }
.elev .dev.pending { opacity: .5; outline: 1px dashed #9ad8ff; }
.installs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.installs button { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 7px 9px; text-align: left; font-size: 12px; font-weight: 800; }
.installs button:hover { border-color: var(--blue); }
.installs button small { display: block; color: var(--ink2); font-weight: 700; }

/* ports */
.ports { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 5px; margin-top: 6px; }
.port { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 5px; font-size: 10.5px; font-weight: 800; text-align: center; line-height: 1.2; }
.port small { display: block; font-weight: 700; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.port.up { border-color: var(--green); background: #effcf5; }
.port.pend { border-color: #9ad8ff; border-style: dashed; }
.port.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--yellow); }

.trace { list-style: none; padding: 0; margin: 6px 0 0; }
.trace li { padding: 4px 0 4px 22px; position: relative; font-size: 12px; font-weight: 700; }
.trace li::before { content: '✓'; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--green); color: #fff; font-size: 10px; display: grid; place-items: center; }
.trace li.bad::before { content: '✕'; background: var(--red); }
.trace .hint { color: #8a6200; background: #fff4d6; border-radius: 8px; padding: 4px 8px; margin-top: 4px; display: inline-block; }

table.rules { width: 100%; border-collapse: collapse; font-size: 11px; }
table.rules td, table.rules th { padding: 3px 4px; border-bottom: 1px solid var(--line); text-align: left; }
details { margin: 6px 0; } details summary { cursor: pointer; padding: 4px 0; }
table.rules th { color: var(--ink2); font-size: 10px; text-transform: uppercase; }

/* staff + contracts */
.people { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.person { display: flex; gap: 10px; align-items: center; background: var(--soft); border-radius: 14px; padding: 6px 10px 6px 6px; }
.person img { width: 58px; height: 58px; border-radius: 14px; background: linear-gradient(#8fdcff, #55c6f5); flex: 0 0 auto; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 14px; }
.person .who small { color: var(--ink2); font-weight: 700; display: block; }
.stars { color: #f0a500; letter-spacing: 1px; }
.contract { background: var(--soft); border-radius: 14px; padding: 10px 12px; margin-top: 8px; border-left: 6px solid var(--blue); }
.contract.ok { border-left-color: var(--green); }
.contract.bad { border-left-color: var(--red); }
.contract .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.contract .pay { font-weight: 900; color: #1b9e63; }
.reqs { list-style: none; padding: 0; margin: 6px 0; }
.reqs li { font-size: 12px; font-weight: 700; padding: 2px 0; }
.reqs li small { display: block; color: var(--ink2); font-weight: 600; padding-left: 20px; }
.alert-row { border-top: 2px solid var(--line); padding: 7px 0; font-size: 12px; }
.alert-row small { display: block; margin-top: 2px; }
.alert-row.done { opacity: .7; }
.loglines { background: var(--soft); border-radius: 10px; padding: 6px 8px; font-size: 10.5px; line-height: 1.5; max-height: 180px; overflow: auto; word-break: break-all; }
details.contract summary { cursor: pointer; }
.assign { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.assign button { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; }
.assign button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.assign button:disabled { opacity: .35; }
.assign button.vm { border-style: dashed; border-color: #9ec5fe; }
.assign button.vm.on { background: #3b6fd4; border-color: #3b6fd4; border-style: solid; }
.vm-slots { display: flex; gap: 4px; margin: 8px 0 6px; }
.vm-slots i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.vm-slots i.on { background: #58a6ff; }
.happy { height: 6px; border-radius: 6px; background: #e3e9f2; overflow: hidden; margin-top: 4px; }
.happy i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--yellow), var(--green)); }
.contract .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.contract .tags span { font-size: 10px; font-weight: 800; background: #fff; border-radius: 999px; padding: 2px 7px; color: var(--ink2); }
.pipe { background: var(--soft); border-radius: 12px; padding: 8px 10px; margin-top: 6px; display: grid; gap: 2px; }
.pipe .happy i { background: var(--blue); }
.rep { background: #fff8e1; border-radius: 14px; padding: 10px 12px; margin-top: 10px; }
.rep b { color: #e0a100; letter-spacing: 1px; font-size: 15px; }
.rep .bar { display: block; width: auto; overflow: visible; position: relative; height: 8px; border-radius: 8px; background: #f1e3b8; margin: 6px 0 4px; }
.rep .bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #ffd24d, #ffb020); }
.rep .bar em { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); opacity: .45; }
.fin-top { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 8px; }
.fin-top div { background: var(--soft); border-radius: 12px; padding: 8px; }
.fin-top small { display: block; font-size: 10px; font-weight: 800; color: var(--ink2); text-transform: uppercase; letter-spacing: .4px; }
.fin-top b { font-size: 14px; font-weight: 900; }
.fin-chart { display: flex; gap: 6px; align-items: stretch; height: 150px; background: var(--soft); border-radius: 12px; padding: 8px; }
.fin-chart .col { flex: 1; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.fin-chart .up, .fin-chart .down { flex: 1; display: flex; }
.fin-chart .up { align-items: flex-end; border-bottom: 2px solid #c9d3e3; }
.fin-chart .down { align-items: flex-start; }
.fin-chart i { display: block; width: 100%; border-radius: 4px; }
.fin-chart .up i { background: var(--green); border-radius: 4px 4px 0 0; }
.fin-chart .down i { background: #ff8a8a; border-radius: 0 0 4px 4px; }
.fin-chart small { text-align: center; font-size: 9px; font-weight: 800; color: var(--ink2); white-space: nowrap; overflow: hidden; }
.fin-chart small.neg, table.fin .neg { color: #d6334a; }
table.fin .pos { color: #1b9e63; }
table.fin td:last-child { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
table.fin tr.total td { border-top: 2px solid #c9d3e3; font-weight: 900; }

/* toasts */
#toasts { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 13px; box-shadow: var(--shadow); animation: pop .25s ease-out; }
.toast.bad { background: var(--red); }
.toast.good { background: #1b9e63; }
/* a deck of alike toasts: every card in one grid cell, the ones behind peeking out below */
.toast-stack { display: grid; justify-items: center; position: relative; transition: opacity .3s; }
.toast-stack.out { opacity: 0; }
.toast-stack > .toast { grid-area: 1 / 1; z-index: calc(40 - var(--d, 0)); transform: translateY(calc(min(var(--d, 0), 3) * 7px)) scale(calc(1 - min(var(--d, 0), 3) * .045)); transition: transform .2s, opacity .2s; }
.toast-stack > .toast:not(:last-child) { animation: none; }
.toast-stack.many { pointer-events: auto; margin-bottom: 18px; }
.toast-stack.many > .toast:not(:last-child) { opacity: calc(1 - min(var(--d, 0), 3) * .22); color: transparent; }
.toast-stack.many::after { content: attr(data-n); position: absolute; z-index: 41; top: -8px; right: -10px; background: #fff; color: var(--ink); font-weight: 900; font-size: 11px; padding: 2px 7px; border-radius: 999px; box-shadow: var(--shadow); }
.toast-stack.many:hover { display: flex; flex-direction: column; align-items: center; gap: 6px; max-height: 60vh; overflow-y: auto; margin-bottom: 0; }
.toast-stack.many:hover > .toast { order: var(--d, 0); transform: none; opacity: 1; color: #fff; }
.toast-stack.many:hover::after { display: none; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

/* terminal */
#terminal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(20, 30, 60, .35); }
.term-win { width: min(1080px, 96vw); height: min(560px, 80vh); background: #0f1424; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.45); display: flex; flex-direction: column; overflow: hidden; font-family: "JetBrains Mono", monospace; }
.term-bar { background: #1c2340; color: #b9c3dc; padding: 8px 12px; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.term-bar b { flex: 1; text-align: center; }
.term-bar button { border: 0; background: transparent; color: #b9c3dc; font-size: 14px; }
.dots i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; } .dots i:nth-child(3) { background: #28c840; }
.term-body { flex: 1; display: flex; min-height: 0; }
#term-help { width: 300px; flex: 0 0 auto; overflow: auto; background: #151b30; border-left: 1px solid #232c4a; padding: 10px 12px; color: #9fb0d6; font-size: 11.5px; }
#term-help b { color: #fff; display: block; font-family: Nunito, sans-serif; font-size: 13px; }
#term-help small { display: block; color: #6d7a99; margin-bottom: 6px; }
#term-help h5 { margin: 10px 0 4px; color: #5dff9c; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-family: Nunito, sans-serif; }
#term-help button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 6px; padding: 4px 6px; color: inherit; font: inherit; }
#term-help button:hover { background: #232c4a; }
#term-help button code { display: block; color: #cfe3ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#term-help span { display: block; color: #6d7a99; font-size: 10.5px; font-family: Nunito, sans-serif; }
#term-help .warn { color: #ffc14d; }
#term-out { flex: 1; margin: 0; padding: 12px 14px; color: #cfe3ff; font-size: 12.5px; overflow: auto; white-space: pre-wrap; line-height: 1.45; font-family: inherit; }
#term-out .cmd { color: #5dff9c; }
#term-out .err { color: #ff8f9a; }
.term-in { display: flex; padding: 8px 14px 12px; color: #5dff9c; font-size: 12.5px; align-items: center; }
#term-prompt { margin-right: 0.7ch; white-space: pre; }
.term-in input { flex: 1; background: transparent; border: 0; outline: 0; color: #fff; font-family: inherit; font-size: 12.5px; }

/* start screen */
#start { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #8fdcff, #55c6f5 60%); }
.start-card { text-align: center; padding: 20px; }
.logo.big { font-size: 58px; display: flex; gap: 18px; justify-content: center; align-items: center; color: #fff; text-shadow: 0 6px 0 rgba(30,60,110,.18); }
.logo.big i { width: 14px; height: 14px; background: #fff; }
.logo.big .y { color: var(--yellow); } .logo.big .b { color: var(--ink); }
.tag { color: #fff; font-weight: 800; font-size: 18px; margin: 6px 0 30px; }
.keys { color: #fff; font-weight: 700; margin-top: 26px; font-size: 13px; opacity: .9; }
kbd { background: rgba(255,255,255,.25); border-radius: 6px; padding: 1px 6px; font-family: inherit; }

/* ---------------------------------------------------------------------------------------
   Touch + small screens. Portrait phones get a bottom sheet; landscape phones get a narrow
   side panel. Everything respects the notch and home bar via safe-area insets.
   --------------------------------------------------------------------------------------- */
html, body { height: 100dvh; overscroll-behavior: none; }
body.touch { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.touch input, body.touch select, body.touch #term-out { -webkit-user-select: text; user-select: text; }
body.touch button, body.touch a { touch-action: manipulation; }
body.touch .row input, body.touch .row select, body.touch .term-in input { font-size: 16px; } /* < 16px makes iOS zoom on focus */

#touchbar { left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; gap: 8px; z-index: 7; }
#touchbar button { border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 900; font-size: 15px; background: #fff; color: var(--ink); box-shadow: var(--shadow); }
#touchbar button.go { background: var(--green); color: #fff; }
#touchbar button.go:disabled { background: #b9c3d3; }
#sheet-grip { display: none; }
#term-help-btn { display: none; }

@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  #topbar { top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); gap: 6px; flex-wrap: nowrap; }
  #topbar .logo { display: none; }
  #topbar .pill { padding: 5px 12px; gap: 9px; }
  .stat { min-width: 0; }
  .stat small { font-size: 9px; }
  .stat b { font-size: 13px; }
  .speed button { padding: 5px 8px; font-size: 10px; }
  .mode { padding: 4px 9px; font-size: 12px; }
  #st-saved { display: none; }
  #objectives { display: block !important; top: calc(60px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); width: min(290px, 70vw); max-height: 40vh; padding: 10px 12px; font-size: 12px; }
  #log { display: none !important; }
  #toasts { top: calc(58px + env(safe-area-inset-top)); width: 92vw; }
  .toast { font-size: 12px; text-align: center; }

  #dock { left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); bottom: calc(8px + env(safe-area-inset-bottom)); transform: none; overflow-x: auto; justify-content: flex-start; gap: 2px; padding: 6px; border-radius: 20px; scrollbar-width: none; }
  #dock::-webkit-scrollbar { display: none; }
  #dock button { min-width: 50px; padding: 4px 6px; font-size: 9px; flex: 0 0 auto; }
  #dock button span { font-size: 20px; }
  #dock .sep { height: 30px; margin: 0 2px; flex: 0 0 2px; }

  #catalog { left: 8px; right: 8px; transform: none; bottom: calc(80px + env(safe-area-inset-bottom)); overflow-x: auto; padding: 8px; gap: 8px; scrollbar-width: none; }
  #catalog::-webkit-scrollbar { display: none; }
  .cat-item { width: 124px; flex: 0 0 auto; padding: 8px; }
  .cat-item small { display: none; }
  #hint { bottom: calc(80px + env(safe-area-inset-bottom)); max-width: 92vw; font-size: 12px; text-align: center; }
  #catalog:not(.hidden) + #hint { bottom: calc(178px + env(safe-area-inset-bottom)); }
  body.touch #catalog:not(.hidden) ~ #touchbar { bottom: calc(178px + env(safe-area-inset-bottom)); }

  .label { font-size: 10px; padding: 3px 7px; }

  /* console fills the screen; commands slide over it */
  .term-win { width: 100vw; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .term-body { position: relative; }
  #term-help { display: none; position: absolute; inset: 0 0 0 auto; width: min(320px, 86vw); z-index: 2; box-shadow: -10px 0 30px rgba(0,0,0,.4); }
  #terminal.help-open #term-help { display: block; }
  #term-help-btn { display: inline-block; font-size: 16px !important; }

  /* title screen scrolls instead of clipping */
  #start { place-items: start center; overflow-y: auto; padding: calc(16px + env(safe-area-inset-top)) 0 24px; }
  .logo.big { font-size: 34px; gap: 10px; flex-wrap: wrap; }
  .logo.big i { width: 9px; height: 9px; }
  .tag { font-size: 14px; margin-bottom: 18px; }
  .keys { display: none; }
  .pets { flex-wrap: wrap; gap: 6px; padding: 0 12px; }
  .pets span { flex: 1 0 100%; font-size: 13px; }
  .pets button { font-size: 13px; padding: 7px 12px; }
}

/* portrait phones: the inspector is a bottom sheet above the dock */
@media (max-width: 760px) and (orientation: portrait) {
  #side { left: 0; right: 0; top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); width: auto; height: 46dvh; border-radius: 22px 22px 0 0; padding-top: 16px; }
  #side-body { padding: 4px 16px 16px; }
  #side.expanded { height: calc(100dvh - 130px - env(safe-area-inset-top)); }
  #sheet-grip { display: block; position: fixed; left: 50%; transform: translateX(-50%); z-index: 6; width: 70px; height: 22px; border: 0; background: transparent; }
  #sheet-grip i { display: block; width: 44px; height: 5px; border-radius: 3px; background: #c9d3e3; margin: 0 auto; }
  #sheet-grip.hidden { display: none; }
  #objectives.sheet-open { display: none !important; }
  #touchbar { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* landscape phones: a narrow side panel, full height between HUD and dock */
@media (max-height: 540px) and (orientation: landscape) {
  #side { top: calc(52px + env(safe-area-inset-top)); bottom: calc(76px + env(safe-area-inset-bottom)); right: calc(8px + env(safe-area-inset-right)); width: min(380px, 44vw); }
  #side-body { padding: 12px 14px; }
  #objectives { max-height: 52vh; width: min(260px, 36vw); }
  #objectives.sheet-open { display: none !important; }
  #touchbar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) and (orientation: portrait) {
  #sheet-grip { bottom: calc(70px + env(safe-area-inset-bottom) + 46dvh - 22px); }
  #sheet-grip.expanded { bottom: calc(100dvh - 60px - env(safe-area-inset-top) + env(safe-area-inset-bottom) - 22px); }
}

/* next-steps card at the top of rack/device/infra panels */
.next { background: linear-gradient(135deg, #eef9ff, #f6fbff); border: 2px solid #cfeeff; border-radius: 16px; padding: 10px 12px; margin: 12px 0 4px; }
.next-h { font-weight: 900; font-size: 13px; margin-bottom: 4px; }
.next ol { list-style: none; margin: 0; padding: 0; }
.next li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 4px 0; font-weight: 700; color: var(--ink2); }
.next li .ck { flex: 0 0 18px; height: 18px; border-radius: 50%; border: 2px solid #c9d3e3; display: grid; place-items: center; font-size: 10px; background: #fff; }
.next li.done { color: #9aa6ba; text-decoration: line-through; }
.next li.done .ck { background: var(--green); border-color: var(--green); color: #fff; }
.next li.cur { color: var(--ink); }
.next li.cur .ck { border-color: var(--blue); background: #e7f7ff; }
.next li .t { flex: 1 1 auto; min-width: 0; }
.next li .btn { margin-left: 26px; }
.showme { margin-top: 6px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 800; font-size: 12px; padding: 5px 12px; }

/* collapsible dock */
#dock .dock-toggle { color: var(--ink2); }
#dock.collapsed { padding: 6px; }
#dock.collapsed > :not(.dock-toggle) { display: none; }
#dock.collapsed .dock-toggle { flex-direction: row; gap: 6px; font-size: 13px; padding: 6px 14px; }
#dock.collapsed .dock-toggle span { font-size: 18px; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  #dock.collapsed { left: 50%; right: auto; transform: translateX(-50%); }
}
/* portrait phones: two stacked HUD rows so nothing is clipped */
@media (max-width: 760px) and (orientation: portrait) {
  #topbar { flex-wrap: wrap; row-gap: 6px; }
  #topbar .pill.stats { flex: 1 1 100%; justify-content: space-between; gap: 6px; padding: 5px 12px; }
  #topbar .stat b { font-size: 14px; }
  #objectives { top: calc(112px + env(safe-area-inset-top)); }
  #toasts { top: calc(112px + env(safe-area-inset-top)); }
}

/* ---- dashboard ------------------------------------------------------------------------ */
.pill.stats .stat[data-act] { cursor: pointer; border-radius: 10px; padding: 2px 6px; margin: -2px -6px; transition: background .15s; }
.pill.stats .stat[data-act]:hover { background: var(--soft); }
#dash { position: fixed; inset: 0; z-index: 40; background: rgba(20, 30, 50, .35); display: flex; align-items: center; justify-content: center; padding: 20px; }
#dash.hidden { display: none; }
.dash-win { background: #fff; border-radius: 22px; box-shadow: 0 20px 60px rgba(20, 40, 80, .3); width: min(1240px, 100%); max-height: 100%; overflow: auto; padding: 16px 20px 20px; }
.dash-top { display: flex; align-items: center; gap: 12px; }
.dash-top h2 { margin: 0; font-size: 20px; font-weight: 900; flex: 1; }
.dash-top .close { border: 0; background: var(--soft); border-radius: 999px; width: 32px; height: 32px; font-weight: 900; cursor: pointer; }
.dash-range { display: flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.dash-range button { border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-weight: 800; color: var(--ink2); cursor: pointer; font-family: inherit; }
.dash-range button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(30, 60, 110, .15); }
.dash-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0 6px; }
.kpi { background: var(--soft); border-radius: 14px; padding: 10px 12px; border-left: 5px solid #d5dce8; min-width: 0; }
.kpi.good { border-left-color: var(--green); } .kpi.warn { border-left-color: var(--yellow); } .kpi.bad { border-left-color: var(--red); }
.kpi small { display: block; font-size: 10px; font-weight: 800; color: var(--ink2); text-transform: uppercase; letter-spacing: .4px; }
.kpi b { display: block; font-size: 20px; font-weight: 900; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi em { display: block; font-style: normal; font-size: 11px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.dchart { background: #fbfcfe; border: 1px solid #e8edf5; border-radius: 16px; padding: 10px 12px 8px; min-width: 0; }
.dchart-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dchart-h b { font-size: 13px; font-weight: 900; white-space: nowrap; }
.dchart-h span { font-size: 11px; color: var(--ink2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dchart canvas { display: block; width: 100%; height: 150px; margin-top: 4px; cursor: crosshair; }
.dlegend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; font-weight: 700; color: var(--ink2); }
.dlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (min-width: 1500px) { .dash-charts { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  #dash { padding: 0; align-items: stretch; }
  .dash-win { border-radius: 0; padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)); }
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-charts { grid-template-columns: 1fr; }
  .kpi b { font-size: 17px; }
}

/* ---- compliance ------------------------------------------------------------------------ */
.cert { background: var(--soft); border-radius: 14px; padding: 10px 12px; margin-top: 10px; border-left: 6px solid #d5dce8; }
.cert.certified { border-left-color: var(--green); }
.cert.auditing { border-left-color: var(--yellow); }
.cert.revoked { border-left-color: var(--red); }
.cert .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cert .top b { font-size: 16px; font-weight: 900; }
.cert .reqs li { position: relative; }
.cert .go-fix { display: inline-block; margin: 4px 0 2px 22px; }
.cert .row small { margin-left: 6px; }

/* ---- bank ------------------------------------------------------------------------------ */
.credit { background: var(--soft); border-radius: 14px; padding: 10px 12px; border-left: 6px solid var(--green); }
.credit.warn { border-left-color: var(--yellow); } .credit.bad { border-left-color: var(--red); }
.credit-top { display: flex; align-items: center; gap: 14px; }
.credit-top small { display: block; font-size: 10px; font-weight: 800; color: var(--ink2); text-transform: uppercase; letter-spacing: .4px; }
.credit-top b { font-size: 28px; font-weight: 900; line-height: 1; }
.credit-top em { display: block; font-style: normal; font-size: 12px; font-weight: 800; color: var(--ink2); }
.credit-bar { flex: 1; position: relative; height: 10px; border-radius: 10px; background: linear-gradient(90deg, #ff5a5f 0%, #ffb020 38%, #ffd84d 55%, #3ecf8e 80%, #1b9e63 100%); }
.credit-bar i { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 2px #fff; }
.credit-factors { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; }
.credit-factors li { display: flex; justify-content: space-between; padding: 2px 0; border-top: 1px dashed #dde3ec; }
.credit-factors b.pos { color: #1b9e63; } .credit-factors b.neg { color: #d6334a; }
.loan { background: var(--soft); border-radius: 14px; padding: 10px 12px; margin-top: 8px; border-left: 6px solid var(--blue); }
.loan.default { border-left-color: var(--red); }
.loan .top { display: flex; justify-content: space-between; font-size: 13px; }
.loan .happy i { background: var(--green); }
.loan-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; }
.loan-pick small { width: 56px; font-size: 11px; font-weight: 800; color: var(--ink2); text-transform: uppercase; }
.loan-pick button { border: 2px solid #dde3ec; background: #fff; border-radius: 999px; padding: 4px 10px; font-weight: 800; font-family: inherit; font-size: 12px; cursor: pointer; }
.loan-pick button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.loan-pick button:disabled { opacity: .4; cursor: default; }
.loan-quote { margin: 8px 0 4px; font-weight: 800; }

/* ---- sound ----------------------------------------------------------------------------- */
.pill.stats .snd { border: 0; background: transparent; font-size: 18px; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.pill.stats .snd:hover { background: var(--soft); }
.vols { display: grid; gap: 6px; }
.vols label { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; font-weight: 700; font-size: 13px; }
.vols input[type=range] { width: 100%; accent-color: var(--ink); }

/* ---- IP plan ---------------------------------------------------------------------------- */
.flow { background: var(--soft); border-radius: 14px; padding: 10px; margin-top: 10px; display: grid; gap: 8px; }
.flow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; }
.flow-row i { font-style: normal; color: var(--ink2); font-weight: 900; }
.flow-row .node { background: #fff; border-radius: 10px; padding: 4px 7px; font-weight: 800; box-shadow: 0 1px 3px rgba(30, 60, 110, .1); }
.flow-row .node b { display: block; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; color: #1b6fb8; font-weight: 700; }
.flow-row .dnat { background: #e7f7ee; } .flow-row .snat { background: #fff4d6; }
.flow-row.back { opacity: .9; }
.probs { margin: 4px 0; padding-left: 18px; color: #b3182a; font-size: 12.5px; }
.probs a, .type-next a { font-weight: 800; }
.ipblock { background: var(--soft); border-radius: 12px; padding: 8px 10px; margin-top: 8px; }
.ipblock .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ipblock .top span { font-size: 11.5px; color: var(--ink2); font-weight: 700; }
table.ipt { margin: 4px 0; font-size: 12px; }
table.ipt tr.free td { color: var(--ink2); }
table.ipt tr.nat td:last-child { color: #146c43; font-weight: 700; }
table.ipt tr.fw td:last-child { color: #1b6fb8; font-weight: 700; }
table.ipt .neg { color: #d6334a; font-weight: 800; } table.ipt .pos { color: #1b9e63; }
/* the IP plan: a wider panel, a summary strip, and tables with an action column */
@media (min-width: 901px) { #side.wide { width: min(580px, calc(100vw - 28px)); } } /* phones keep their bottom sheet */
.ip-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 2px; }
.ip-sum span { background: var(--soft); border-radius: 12px; padding: 7px 8px; font-size: 11px; font-weight: 700; color: var(--ink2); line-height: 1.25; }
.ip-sum b { display: block; font-size: 18px; font-weight: 900; color: var(--ink); }
.ip-sum .warn { background: #fff4d6; } .ip-sum .bad { background: #ffe3e7; } .ip-sum .bad b { color: #c0233a; } .ip-sum .ok b { color: #1b9e63; }
table.iptool { width: 100%; }
table.iptool td { vertical-align: middle; }
table.iptool td:last-child { text-align: right; white-space: nowrap; }
table.iptool td:last-child .btn + .btn { margin-left: 4px; }
table.iptool a { font-weight: 800; }
table.iptool .btn code { font-size: 10.5px; }
@media (max-width: 700px) { .ip-sum { grid-template-columns: repeat(2, 1fr); } table.iptool td:last-child { white-space: normal; } }
.glossary { margin-top: 12px; font-size: 12.5px; }
.glossary summary { cursor: pointer; font-weight: 800; }
.glossary dt { font-weight: 900; margin-top: 6px; } .glossary dd { margin: 2px 0 0 0; color: var(--ink2); }
.type-next { background: #f4f0ff; border: 2px solid #e2d9ff; border-radius: 14px; padding: 10px 12px; margin-top: 10px; }
.type-next .cmd-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; margin-top: 6px; }
.type-next .cmd-row code { background: #1d2233; color: #cfe3ff; border-radius: 8px; padding: 4px 8px; font-size: 12px; overflow-x: auto; white-space: nowrap; }
.type-next .cmd-row small { grid-column: 1 / -1; color: var(--ink2); font-size: 11.5px; }
#term-help h5.suggest { color: #ffd84d; }
#term-help button.suggest { border-left: 3px solid #ffd84d; }

/* ---- performance ------------------------------------------------------------------------ */
.perf { background: var(--soft); border-radius: 14px; padding: 10px 12px; }
.perf-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.perf-top b.stars { font-size: 20px; color: #e0a100; letter-spacing: 1px; }
.who .stars { color: #e0a100; letter-spacing: .5px; }
.events { display: grid; gap: 6px; }
.event { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--soft); border-radius: 12px; padding: 8px 10px; }
.event small { display: block; font-size: 11.5px; }
.event button { flex: none; white-space: nowrap; }
.mood-why b.muted { color: var(--ink2); font-weight: 700; }
.stages { margin: 8px 0; padding-left: 20px; display: grid; gap: 6px; }
.stages li.done { color: var(--ink2); }
.stages li.now { font-weight: 800; }
.stages .bar { width: 80px; margin-left: 6px; }
/* title screen: campaign or sandbox */
/* campaign: locked things */
#dock button.locked { opacity: .45; position: relative; }
#dock button.locked::after { content: '🔒 ' attr(data-lock); position: absolute; top: 0; right: 2px; font-size: 9px; font-weight: 900; color: var(--ink2); }
.cat-item.locked .price { color: var(--ink2); }
.box.locked { background: #f4f1ff; color: #4b3f8a; }
/* chapter intro / outro */
#chapter-card { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(20, 28, 54, .45); backdrop-filter: blur(2px); padding: 16px; }
#chapter-card .cc { background: #fff; border-radius: 24px; box-shadow: var(--shadow); max-width: 460px; width: 100%; padding: 26px 26px 22px; text-align: left; }
#chapter-card small { font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); font-size: 11px; }
#chapter-card h2 { margin: 4px 0 10px; font-size: 26px; }
#chapter-card p { line-height: 1.5; margin: 8px 0; }
#chapter-card ul { margin: 10px 0; padding-left: 20px; line-height: 1.6; font-weight: 700; }
#chapter-card .stars { font-size: 34px; letter-spacing: 4px; margin: 6px 0; }
#chapter-card .btn { margin-top: 10px; width: 100%; }
.box.growth { background: #eafbf1; color: #1e6b45; margin-top: 8px; }
.contract .tags span.warn { background: #fff0e6; color: #b5541a; }

/* achievements */
.ach-toast { pointer-events: auto; cursor: pointer; display: flex; gap: 12px; align-items: center; text-align: left; font: inherit; color: #fff; border: 2px solid #ffd35c; background: linear-gradient(135deg, #2b2340, #3d2f5c); padding: 10px 18px 10px 12px; border-radius: 16px; box-shadow: 0 8px 28px rgba(40, 20, 80, .35); animation: ach-in .45s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .45s, transform .45s; max-width: min(420px, 92vw); }
.ach-toast.out { opacity: 0; transform: translateY(-10px); }
.ach-toast .ach-ico { font-size: 30px; filter: drop-shadow(0 0 8px rgba(255, 211, 92, .6)); }
.ach-toast small { display: block; color: #ffd35c; font-weight: 800; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.ach-toast b { display: block; font-size: 15px; }
.ach-toast i { display: block; font-style: normal; font-size: 12px; opacity: .8; }
@keyframes ach-in { from { opacity: 0; transform: translateY(-16px) scale(.9); } to { opacity: 1; transform: none; } }
.ach-bar { height: 8px; border-radius: 99px; background: var(--line, #e5e0d8); overflow: hidden; margin: 8px 0 4px; }
.ach-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb13b, #ffd35c); }
.ach-grid { display: grid; gap: 6px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 12px; background: rgba(127, 127, 127, .08); opacity: .55; }
.ach.got { opacity: 1; background: rgba(255, 196, 60, .16); box-shadow: inset 0 0 0 1px rgba(255, 180, 40, .45); }
.ach .ach-ico { font-size: 22px; width: 28px; text-align: center; filter: grayscale(1); }
.ach.got .ach-ico { filter: none; }
.ach b { display: block; font-size: 13px; }
.ach small { display: block; font-size: 11.5px; opacity: .8; }
.ach-toast .ach-ico.multi { font-size: 20px; white-space: nowrap; }

/* the developer's desk: website editor */
#editor { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(20, 30, 60, .35); }
.ed-win { width: min(1240px, 97vw); height: min(700px, 90vh); background: #0f1424; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.45); display: flex; flex-direction: column; overflow: hidden; }
.ed-win .term-bar select { background: #0f1424; color: #dfe6f5; border: 1px solid #36406a; border-radius: 8px; font: inherit; padding: 3px 6px; max-width: 220px; }
#ed-toggle { display: none; }
.ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr 1fr; }
#ed-side { padding: 12px; overflow: auto; color: #dfe6f5; font-size: 12.5px; border-right: 1px solid #1f2847; display: flex; flex-direction: column; gap: 10px; }
.ed-ticket { background: #1a2240; border-radius: 12px; padding: 10px 12px; }
.ed-ask { font-weight: 800; line-height: 1.35; }
.ed-ticket ul { list-style: none; margin: 8px 0 6px; padding: 0; }
.ed-ticket li { color: #8f9bb8; margin: 3px 0; }
.ed-ticket li.ok { color: #5dff9c; }
.ed-ticket li em { font-style: normal; font-size: 10px; background: #1b9e63; color: #fff; border-radius: 6px; padding: 1px 5px; margin-left: 4px; }
.ed-ticket small, .ed-none { color: #8f9bb8; }
.ed-live { margin-top: auto; background: #141b33; border-radius: 10px; padding: 8px 10px; color: #b9c3dc; line-height: 1.4; }
.ed-live .bad { color: #ff8a8a; }
.ed-code { position: relative; min-width: 0; background: #0b1020; }
.ed-code pre, .ed-code textarea { position: absolute; inset: 0; margin: 0; padding: 12px 14px; border: 0; font: 12.5px/1.55 "JetBrains Mono", ui-monospace, monospace; white-space: pre; overflow: auto; tab-size: 2; letter-spacing: 0; }
.ed-code pre { color: #dfe6f5; pointer-events: none; }
.ed-code textarea { background: transparent; color: transparent; caret-color: #fff; resize: none; outline: none; }
.ed-code textarea::selection { background: rgba(120, 160, 255, .35); }
.hl-t { color: #ff8fab; } .hl-a { color: #ffc94d; } .hl-s { color: #5dff9c; } .hl-p { color: #6b7699; } .hl-c { color: #6b7699; font-style: italic; }
#ed-preview { width: 100%; height: 100%; border: 0; background: #fff; }
.ed-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #1c2340; flex-wrap: wrap; }
.ed-foot button { border: 1px solid #36406a; background: #141b33; color: #dfe6f5; border-radius: 10px; padding: 6px 10px; font: 800 12px Nunito, sans-serif; }
.ed-foot button.go { background: #1b9e63; border-color: #1b9e63; color: #fff; font-size: 13px; padding: 7px 16px; }
.ed-foot button:disabled { opacity: .6; }
#ed-snippets { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
#ed-snippets.hidden { display: none; }
#ed-size { color: #8f9bb8; font: 11px "JetBrains Mono", monospace; margin-left: auto; }
#ed-size.over { color: #ff8a8a; }
@media (max-width: 860px) {
  .ed-win { width: 100vw; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .ed-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #ed-side { max-height: 30vh; border-right: 0; border-bottom: 1px solid #1f2847; }
  #ed-preview { display: none; }
  #ed-toggle { display: inline-block; }
  #editor.show-preview #ed-preview { display: block; }
  #editor.show-preview .ed-code { display: none; }
  .ed-code textarea, .ed-code pre { font-size: 16px; } /* < 16px makes iOS zoom on focus */
  .ed-win .term-bar .dots { display: none; }
  #ed-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-align: left; }
  #ed-snippets { flex-wrap: nowrap; overflow-x: auto; flex-basis: 100%; }
  #ed-snippets button { flex: none; }
  #ed-size { margin-left: 0; }
}
.box.web { margin: 8px 0; }
.box.web .ticket { margin-top: 6px; padding: 6px 8px; background: rgba(255,255,255,.55); border-radius: 8px; font-size: 12.5px; line-height: 1.35; }
.box.web .ticket small { display: block; margin-top: 2px; }

/* ↑↑↓↓←→←→BA */
#cheats { position: fixed; inset: 0; z-index: 31; display: grid; place-items: center; background: rgba(10, 6, 30, .55); }
.cheat-win { position: relative; width: min(860px, 96vw); max-height: 88vh; overflow: auto; background: radial-gradient(circle at 20% 0%, #3b1f6e, #160d33 60%); color: #fff; border-radius: 20px; border: 3px solid #ff5ad1; box-shadow: 0 0 0 3px #160d33, 0 0 40px rgba(255, 90, 209, .45), 0 30px 80px rgba(0,0,0,.5); padding: 22px 24px 24px; }
.cheat-win h2 { margin: 0; text-align: center; font: 900 34px/1 Nunito, sans-serif; letter-spacing: .12em; color: #ffe066; text-shadow: 3px 3px 0 #ff5ad1, 6px 6px 0 rgba(0,0,0,.35); }
.cheat-code { text-align: center; font: 800 14px "JetBrains Mono", monospace; color: #7cf9ff; letter-spacing: .25em; margin: 8px 0 16px; }
.cheat-win h4 { color: #b8a6ff; margin: 18px 0 8px; }
#cheat-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; color: #b8a6ff; font-size: 18px; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cheat { position: relative; text-align: left; border: 2px solid #4b3a8f; background: rgba(255,255,255,.06); color: #fff; border-radius: 14px; padding: 10px 12px 12px; font: inherit; cursor: pointer; transition: transform .1s, border-color .1s; }
.cheat:hover { transform: translateY(-2px); border-color: #ff5ad1; }
.cheat .ico { font-size: 26px; display: block; }
.cheat b { display: block; font-size: 14px; margin-top: 4px; }
.cheat small { display: block; font-size: 11.5px; color: #cfc4ff; margin-top: 3px; line-height: 1.3; }
.cheat i { position: absolute; top: 10px; right: 10px; font: 900 10px "JetBrains Mono", monospace; font-style: normal; padding: 2px 6px; border-radius: 6px; background: #2a2055; color: #8f83c2; }
.cheat.on { border-color: #5dff9c; background: rgba(93, 255, 156, .12); box-shadow: 0 0 18px rgba(93, 255, 156, .25); }
.cheat.on i { background: #5dff9c; color: #0b2a17; }
.cheat-grid.once .cheat { border-style: dashed; }
.box.web .pods { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; flex-wrap: wrap; }
.box.web .pods .poddots { display: flex; gap: 3px; flex: 1; flex-wrap: wrap; }
.box.web .pods .scale { display: flex; align-items: center; gap: 4px; }
.box.web .pods .scale .btn { padding: 1px 8px; min-width: 0; }
.pod { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: #9aa7c7; }
.pod.running { background: #1b9e63; }
.pod.starting { background: #ffc94d; animation: podblink 1s ease-in-out infinite; }
.pod.pending { background: transparent; box-shadow: inset 0 0 0 2px #ff6b7a; }
.pod.terminating { background: #c3cad9; opacity: .6; }
@keyframes podblink { 50% { opacity: .35; } }
.box.web .rollout { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.box.web .rollout .bar { flex: 1; height: 6px; background: rgba(0,0,0,.1); border-radius: 4px; overflow: hidden; }
.box.web .rollout .bar i { display: block; height: 100%; background: #1b9e63; }
.box.web small.warn { display: block; color: #c2410c; margin-top: 4px; }
.box.web .pods { display: grid; grid-template-columns: 1fr auto; row-gap: 4px; }
.box.web .pods .poddots { grid-column: 1 / -1; grid-row: 2; }
.pod.crashloop { background: #ff6b7a; animation: podblink .6s ease-in-out infinite; }
.box.web .web-ops { margin-top: 6px; gap: 6px; flex-wrap: wrap; }

/* ---- title screen ------------------------------------------------------------------------- */
#start { place-items: start center; overflow-y: auto; background: radial-gradient(circle at 50% 0%, #b4ebff, #62cbf6 50%, #3aa9e0); }
.start-wrap { min-width: 0; max-width: 100vw; width: min(980px, 100%); padding: 34px 16px 22px; display: flex; flex-direction: column; gap: 20px; }
.hero { text-align: center; }
.hero .tag { margin: 10px 0 8px; font-size: 21px; text-shadow: 0 2px 0 rgba(30, 60, 110, .2); }
.pitch { color: #fff; max-width: 650px; margin: 0 auto; font-size: 15.5px; line-height: 1.55; font-weight: 700; text-shadow: 0 1px 0 rgba(20, 60, 110, .25); }
/* three little racks with blinking lights */
.rack-art { display: flex; gap: 10px; justify-content: center; align-items: flex-end; margin-bottom: 14px; }
.mini-rack { width: 46px; padding: 6px 5px; background: #2f3c63; border-radius: 9px; box-shadow: inset 0 0 0 3px #4a5c90, 0 8px 0 rgba(30, 60, 110, .2); display: flex; flex-direction: column; gap: 4px; }
.mini-rack.tall { width: 54px; }
.mini-rack i { position: relative; height: 9px; border-radius: 3px; background: #e6ebf2; }
.mini-rack i::after { content: ''; position: absolute; right: 4px; top: 2.5px; width: 4px; height: 4px; border-radius: 50%; background: #5dff9c; box-shadow: 0 0 6px #5dff9c; animation: rackled 1.7s infinite; }
.mini-rack i:nth-child(2n)::after { animation-delay: .45s; }
.mini-rack i:nth-child(3n)::after { animation-delay: .9s; background: #58c7ff; box-shadow: 0 0 6px #58c7ff; }
.mini-rack.tall i:nth-child(4)::after { background: #ffc94d; box-shadow: 0 0 6px #ffc94d; animation-duration: .9s; }
@keyframes rackled { 0%, 68% { opacity: 1; } 72%, 84% { opacity: .15; } 100% { opacity: 1; } }

/* continue: the first thing you see when there's a save */
.continue.hidden { display: none; }
.continue-card { width: 100%; display: flex; align-items: center; gap: 16px; border: 3px solid #fff; background: #fff; border-radius: 24px; padding: 16px 20px; text-align: left; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s; font: inherit; color: var(--ink); }
.continue-card:hover { transform: translateY(-3px); border-color: var(--yellow); }
.continue-card .play { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: #1b9e63; color: #fff; font-size: 22px; box-shadow: 0 4px 0 #13734a; }
.continue-card b { display: block; font-size: 20px; font-weight: 900; }
.continue-card small { display: block; color: var(--ink2); font-weight: 700; margin-top: 2px; }

/* what you'll do */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.feat { background: rgba(255, 255, 255, .88); border-radius: 18px; padding: 14px 14px 12px; box-shadow: 0 6px 18px rgba(30, 60, 110, .12); }
.feat span { font-size: 26px; display: block; }
.feat b { display: block; font-size: 15.5px; font-weight: 900; margin-top: 4px; color: var(--ink); }
.feat small { display: block; font-size: 12.5px; line-height: 1.4; color: var(--ink2); font-weight: 700; margin-top: 3px; }

/* new game: three numbered picks, then one big button */
.newgame { background: #fff; border-radius: 28px; padding: 22px 22px 18px; box-shadow: var(--shadow); }
.newgame h2 { margin: 0 0 6px; font-size: 22px; font-weight: 900; color: var(--ink); }
.step { margin-top: 14px; }
.step h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 15px; font-weight: 900; color: var(--ink); }
.step .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 13px; }
.choices { display: grid; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choice { position: relative; text-align: left; border: 3px solid transparent; background: #f2f6fb; border-radius: 18px; padding: 12px 14px; font: inherit; color: var(--ink); cursor: pointer; transition: transform .12s, border-color .12s, background .12s; }
.choice:hover { transform: translateY(-2px); }
.choice .ico { font-size: 28px; display: block; line-height: 1.1; }
.choice b { display: block; font-size: 17px; font-weight: 900; margin-top: 4px; }
.choice small { display: block; font-size: 12.5px; line-height: 1.4; color: var(--ink2); font-weight: 700; margin-top: 2px; }
.choice.on { border-color: #1b9e63; background: #eafbf2; }
.choice.on::after { content: '✓'; position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #1b9e63; color: #fff; font-size: 13px; font-weight: 900; }
.choice.hacker { background: #0f1424; color: #cfe3ff; }
.choice.hacker b { color: #5dff9c; font-family: "JetBrains Mono", monospace; }
.choice.hacker small { color: #8a96b8; }
.choice.hacker.on { background: #10261b; }
.choice .badge { position: absolute; top: -11px; left: 14px; font-style: normal; font-size: 11px; font-weight: 900; background: var(--yellow); color: var(--ink); padding: 2px 9px; border-radius: 999px; box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.go-btn { position: sticky; bottom: 12px; width: 100%; margin-top: 18px; border: 0; border-radius: 999px; padding: 14px 20px 12px; background: linear-gradient(180deg, #24c07a, #1b9e63); color: #fff; box-shadow: 0 6px 0 #13734a, 0 12px 30px rgba(27, 158, 99, .35); cursor: pointer; font: inherit; animation: gopulse 2.4s ease-in-out infinite; }
.go-btn span { display: block; font-size: 22px; font-weight: 900; letter-spacing: .02em; }
.go-btn small { display: block; font-size: 13px; font-weight: 800; opacity: .9; margin-top: 2px; }
.go-btn:hover { filter: brightness(1.06); }
.go-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #13734a; }
@keyframes gopulse { 50% { box-shadow: 0 6px 0 #13734a, 0 12px 40px rgba(27, 158, 99, .6); } }
.start-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; color: rgba(255, 255, 255, .9); font-size: 13px; font-weight: 800; }
.start-foot a, .start-foot .linkish { color: #fff; text-decoration: none; }
.start-foot a:hover, .start-foot .linkish:hover { text-decoration: underline; }
.start-foot .linkish { border: 0; background: transparent; font: inherit; cursor: pointer; padding: 0; }
.start-wrap .keys { text-align: center; margin: 0; }
@media (max-width: 760px) {
  .start-wrap { padding-top: calc(18px + env(safe-area-inset-top)); gap: 16px; }
  .features { grid-template-columns: 1fr 1fr; }
  .choices.two { grid-template-columns: 1fr; }
  .choices.three .choice small { display: none; }
  .choices.three .choice { text-align: center; padding: 10px 8px; }
  #gametype.choices.three { grid-template-columns: 1fr; } /* the game types need their descriptions */
  #gametype.choices.three .choice small { display: block; }
  #gametype.choices.three .choice { text-align: left; padding: 12px 14px; }
  .hero .tag { font-size: 17px; }
  .pitch { font-size: 14px; }
  .newgame { padding: 18px 14px 14px; }
}
/* wide screens: a launcher. The pitch on the left, your choices on the right, all in one view */
@media (min-width: 1000px) {
  #start { align-content: safe center; }
  .start-wrap { width: min(1200px, 100%); display: grid; grid-template-columns: 1fr 1.05fr; grid-template-areas: "cont cont" "hero new" "feat new" "foot foot" "keys keys"; column-gap: 28px; row-gap: 16px; align-items: start; padding-top: 30px; }
  .hero { grid-area: hero; text-align: left; align-self: end; }
  .hero .rack-art { justify-content: flex-start; }
  .hero .logo.big { justify-content: flex-start; }
  .pitch { margin: 0; }
  .continue { grid-area: cont; }
  .features { grid-area: feat; grid-template-columns: 1fr 1fr; }
  .newgame { grid-area: new; }
  .start-foot { grid-area: foot; }
  .start-wrap .keys { grid-area: keys; }
  .go-btn { position: static; }
  .step { margin-top: 10px; }
  .choice { padding: 10px 12px; }
  .choice .ico { font-size: 24px; }
}
/* phones: pitch, continue, choose, start; the feature tiles come after as "more about the game" */
@media (max-width: 760px) {
  .start-wrap .hero { order: 1; }
  .start-wrap .continue { order: 2; }
  .start-wrap .newgame { order: 3; }
  .start-wrap .features { order: 4; }
  .start-wrap .start-foot { order: 5; }
  .start-wrap .keys { order: 6; display: none; } /* mouse controls mean nothing on a phone */
  .go-btn { position: static; }
  .hero .logo.big { font-size: clamp(22px, 7.4vw, 44px); gap: 8px; flex-wrap: nowrap; } /* the wordmark is ~12x its font size wide */
  .hero .logo.big i { width: 8px; height: 8px; }
  .mini-rack { width: 32px; padding: 4px 4px; gap: 3px; }
  .mini-rack.tall { width: 38px; }
  .mini-rack i { height: 7px; }
  .mini-rack i::after { width: 3px; height: 3px; top: 2px; right: 3px; }
  .continue-card { padding: 12px 14px; gap: 12px; }
  .continue-card .play { width: 44px; height: 44px; font-size: 18px; }
  .continue-card b { font-size: 17px; }
}
@media (max-width: 760px) { .hero .logo.big { text-shadow: 0 3px 0 rgba(30, 60, 110, .18); } }

/* audit log */
.audit-bar { display: flex; gap: 6px; margin: 10px 0 6px; }
.audit-bar input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: 7px 10px; font: inherit; }
.audit-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.audit-filters button { border: 0; background: var(--soft); border-radius: 999px; padding: 5px 10px; font-weight: 800; font-size: 12px; }
.audit-filters button.on { background: var(--ink); color: #fff; }
.audit-filters small { opacity: .65; font-weight: 700; }
.audit-day { margin: 12px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink2); }
.audit-row { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 4px 6px; border-radius: 8px; font-size: 12.5px; line-height: 1.35; }
.audit-row:nth-of-type(even) { background: var(--soft); }
.audit-row time { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--ink2); padding-top: 1px; }
.audit-row.bad span { color: #b3182a; } .audit-row.good span { color: #146c43; } .audit-row.you span { color: #1b4f9e; }
