/* V2pn's font: beside the built guide (tools/partner-docs.py copies it to fonts/), else from the app's assets in the repo. */
@font-face { font-family: Geist; font-weight: 400; src: url(../../assets/fonts/Geist-Regular.woff2) format("woff2"); }
@font-face { font-family: Geist; font-weight: 500; src: url(../../assets/fonts/Geist-Medium.woff2) format("woff2"); }
@font-face { font-family: Geist; font-weight: 600; src: url(../../assets/fonts/Geist-SemiBold.woff2) format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #F3F4F7; --panel: #FFFFFF; --field: #FFFFFF; --ink: #16161B; --soft: #34343F; --muted: #5E5E6B; --line: #DCDEE5;
  --chip: #E8EAF0; --accent: #C8381F; --onAccent: #FFFFFF; --focus: #2F6FE0; --bad: #B42318; --badBg: #FDECEA; --warn: #8A5A00; --warnBg: #FFF4DE;
  --okInk: #16804F; --stage: #D9DCE3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E12; --panel: #17171D; --field: #1E1E25; --ink: #ECECF1; --soft: #C9C9D3; --muted: #9B9BA8; --line: #2A2A33;
    --chip: #26262F; --accent: #FF5A3D; --onAccent: #0B0B0D; --focus: #7AB2FF; --bad: #FF8A7A; --badBg: #3A1A16; --warn: #F2B84B; --warnBg: #33270F;
    --okInk: #3DD68C; --stage: #08080B;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 Geist, "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand svg { width: 17px; height: 18px; }
.brand .sub { color: var(--muted); font-weight: 400; }
.sp { flex: 1; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--chip); }
.seg button { border: 0; background: none; color: var(--muted); height: 30px; padding: 0 11px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg .dim { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }

.layout { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); gap: 0; min-height: calc(100vh - 56px); }
.form { padding: 24px 24px 64px; border-right: 1px solid var(--line); }
.form h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; margin: 4px 0 8px; }
.lead { color: var(--soft); margin: 0 0 18px; }
fieldset { border: 0; margin: 0 0 14px; padding: 16px; background: var(--panel); border-radius: 14px; box-shadow: 0 0 0 1px var(--line); display: grid; gap: 12px; min-width: 0; }
legend { float: left; width: 100%; padding: 0; font-weight: 600; font-size: 16px; margin-bottom: 2px; }
legend + * { clear: both; }
.field { display: grid; gap: 5px; }
.field > span { font-weight: 500; font-size: 14px; }
.field small, .hint { color: var(--muted); font-size: 13px; margin: 0; }
input:not([type]), input[type=text], input[type=url], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--field); border-radius: 9px; padding: 8px 10px; min-height: 38px; }
textarea { resize: vertical; font-family: Geist, Consolas, monospace; }
input.bad, textarea.bad { border-color: var(--bad); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check.small { font-size: 13px; font-weight: 500; color: var(--soft); }
.radios { display: grid; gap: 6px; }
.radios label { display: flex; gap: 8px; align-items: center; }
button.ghost, button.primary, .file span { border: 0; border-radius: 9px; height: 36px; padding: 0 14px; cursor: pointer; font-weight: 500; font-size: 14px; }
button.ghost { background: var(--chip); justify-self: start; }
button.primary { background: var(--accent); color: var(--onAccent); font-weight: 600; }
button.primary:disabled, button.ghost:disabled { opacity: .5; cursor: not-allowed; }
.file { position: relative; display: inline-flex; flex: none; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file span { display: inline-flex; align-items: center; background: var(--chip); }
.file:focus-within span { outline: 2px solid var(--focus); outline-offset: 2px; }

.pic { display: grid; gap: 6px; }
.pic-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 500; font-size: 14px; }
.pic-body { min-height: 72px; border-radius: 10px; display: grid; place-items: center; padding: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.pic-body.dark { background: #16161B; color: #C9C9D3; }
.pic-body.light { background: #F6F7FA; color: #34343F; }
.pic-body.checker { background: conic-gradient(var(--chip) 25%, transparent 0 50%, var(--chip) 0 75%, transparent 0) 0 0 / 16px 16px, var(--panel); }
.pic-body img { max-width: 100%; max-height: 96px; display: block; }
.pic-empty { font-size: 12.5px; text-align: center; max-width: 34em; }
.pic-note { font-size: 13px; }
.pic-note.ok { color: var(--okInk); }
.pic-note.bad { color: var(--bad); }

.colours { display: grid; gap: 8px; }
.colour { display: flex; align-items: center; gap: 8px; }
.colour input[type=color] { width: 40px; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--field); flex: none; }
.colour input:not([type]) { width: 120px; font-family: Geist, Consolas, monospace; text-transform: uppercase; }
.colour .role { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; }
.x { border: 0; background: var(--chip); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none; display: grid; place-items: center; }
.x svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

.actions { display: grid; gap: 10px; }
.action { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.action .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action .grid .wide { grid-column: 1 / -1; }
.action .field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.action .count { font-variant-numeric: tabular-nums; }

.export .row { display: flex; gap: 8px; flex-wrap: wrap; }
.export h2 { font-size: 15px; margin: 6px 0 0; }
.problems { display: grid; gap: 6px; }
.problems:empty { display: none; }
.problem { font-size: 13px; padding: 7px 10px; border-radius: 8px; background: var(--badBg); color: var(--bad); }
.send { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--soft); font-size: 14px; }
.send code, .pv-notes code { font-family: Geist, Consolas, monospace; background: var(--chip); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.send a { color: var(--ink); }

.preview { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; }
.pv-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 14px 20px; }
.pv-stage { position: relative; background: var(--stage); margin: 0 20px; border-radius: 16px; overflow: hidden; min-height: 300px; }
/* Out of the flow, so the window's own size never stretches the stage; fit() scales it into the stage's middle. */
#pv-frame { position: absolute; left: 50%; top: 50%; transform-origin: center center; }
.pv-notes { padding: 12px 20px 18px; display: grid; gap: 5px; align-content: start; font-size: 13px; color: var(--soft); max-height: 34vh; overflow: auto; }
.pv-notes .n { display: flex; gap: 8px; }
.pv-notes .n::before { content: ""; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.pv-notes .n.ok::before { background: var(--okInk); }
.pv-notes .n.warn::before { background: var(--warn); }
.pv-notes .n.bad::before { background: var(--bad); }
.pv-notes h3 { font-size: 13px; margin: 4px 0 0; color: var(--ink); }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .form { border-right: 0; padding: 20px 16px 32px; }
  .preview { position: static; height: auto; grid-template-rows: auto auto auto; }
  .pv-bar { padding: 8px 16px 12px; }
  .pv-stage { margin: 0 16px; height: 70vh; }
  .pv-notes { padding: 12px 16px 40px; max-height: none; }
  .preview { order: -1; }
}
@media (max-width: 560px) {
  .top { padding: 0 16px; }
  .brand .sub { display: none; }
  .pv-stage { height: 560px; }
  .action .grid { grid-template-columns: 1fr; }
  .seg button { padding: 0 8px; }
  .seg .dim { display: none; }
}

/* ---------------- the window: V2pn's look, from the approved prototype (Accent and Scene) ---------------- */
.win { position: relative; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; background: var(--winBg); color: var(--ink);
  font: 14px/1.4 Geist, "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.12), 0 24px 60px -18px rgba(0,0,0,.45); }
.win button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.win button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.win .press { transition: transform 140ms cubic-bezier(.23,1,.32,1), background-color 150ms ease, color 150ms ease; }
.win .press:active { transform: scale(.97); }
.win .i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.win .flag { width: 22px; height: 16px; border-radius: 4px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.14); }
.win .num { font-variant-numeric: tabular-nums; }
.win .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.win .tb { height: 44px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 10px; font-weight: 500; font-size: 14px; }
.win .tb .sp { flex: 1; }
.win .tb .ib { width: 36px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.win .tb .lock { display: flex; align-items: center; gap: 8px; min-width: 0; }
.win .tb .x { color: var(--faint); font-size: 12px; background: none; width: auto; height: auto; }
.win .v2mark { width: 18px; height: 18px; flex: none; }
.win .plogo { height: var(--lh, 16px); width: auto; max-width: 100%; display: block; object-fit: contain; object-position: left center; }
.win .pname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; font-size: calc(var(--lh, 16px) * .9); line-height: var(--lh, 16px); }
.win .pmark { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; overflow: hidden; }
.win .pmark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.win .pmark.fill img { object-fit: cover; }
.win .pmark.letter { background: var(--accent); color: var(--onAccent); font-weight: 600; font-size: 13px; box-shadow: none; }
.win .pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 11px; font-weight: 600; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.win .pill:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.win .pill.bad { color: var(--unsafe); background: var(--unsafeSoft); }
.win .pill.ok { color: var(--safe); background: var(--safeSoft); }
.win .pill.wait { color: var(--warn); background: var(--warnSoft); }
.win .btnC { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 999px; width: 100%; font-weight: 600; font-size: 15px;
  background: var(--accent); color: var(--onAccent); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 1px 2px rgba(0,0,0,.25), 0 8px 20px -8px var(--accentGlow); }
.win .btnC.off { background: var(--neutral); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.win .seg2 { display: flex; background: var(--cardMuted); border-radius: 10px; padding: 3px; gap: 2px; }
.win .seg2 button { flex: 1; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-weight: 500; font-size: 13px; }
.win .seg2 button[aria-pressed=true] { background: var(--segOn); color: var(--ink); box-shadow: var(--segShadow); }
.win .seg2 button.tabb { flex-direction: column; gap: 4px; height: 50px; font-size: 12px; }
.win .route { min-width: 0; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px; font-weight: 500; font-size: 13px; color: var(--inkSoft); }
.win .lbl { font-size: 12px; color: var(--muted); }
.win .row { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; width: 100%; text-align: left; }
.win .row[aria-current=true] { background: var(--rowSel); box-shadow: inset 0 0 0 1px var(--rowSelBorder); }
.win .row .t { font-weight: 500; font-size: 13.5px; }
.win .row .s { font-size: 12px; color: var(--muted); }
.win .ping { font-size: 12px; font-weight: 500; border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums; flex: none; }
.win .ping.g { color: var(--safe); background: var(--safeSoft); } .win .ping.m { color: var(--warn); background: var(--warnSoft); }
.win .ping.b { color: var(--unsafe); background: var(--unsafeSoft); } .win .ping.n { color: var(--faint); }
.win .gh { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 6px; font-size: 12px; color: var(--muted); }
.win .card { background: var(--card); border-radius: 14px; box-shadow: var(--cardShadow); }
.win .glass { background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); border-radius: 16px; box-shadow: var(--raisedShadow); }
.win .chipA { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.win .bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.win .bar i { display: block; height: 100%; border-radius: 999px; background: var(--fillBar); }
.win .lnk { font-size: 12.5px; font-weight: 500; color: var(--brandText); border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.win .stack { display: flex; flex-direction: column; } .win .stack > * { flex: none; }
.win .scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; min-height: 0; }
/* The map, drawn light: an ocean with dots where the land is (the app's world map is 590 KB of outlines). */
.win .map { position: absolute; inset: 0; background: var(--mapOcean); }
.win .map::before { content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle, var(--mapDot) 1.3px, transparent 1.8px) 0 0 / 11px 11px;
  -webkit-mask: radial-gradient(18% 22% at 22% 32%, #000 60%, transparent 62%), radial-gradient(9% 20% at 30% 68%, #000 60%, transparent 62%),
    radial-gradient(10% 12% at 50% 30%, #000 60%, transparent 62%), radial-gradient(9% 18% at 53% 58%, #000 60%, transparent 62%),
    radial-gradient(24% 18% at 72% 32%, #000 60%, transparent 62%), radial-gradient(7% 8% at 82% 72%, #000 60%, transparent 62%);
  mask: radial-gradient(18% 22% at 22% 32%, #000 60%, transparent 62%), radial-gradient(9% 20% at 30% 68%, #000 60%, transparent 62%),
    radial-gradient(10% 12% at 50% 30%, #000 60%, transparent 62%), radial-gradient(9% 18% at 53% 58%, #000 60%, transparent 62%),
    radial-gradient(24% 18% at 72% 32%, #000 60%, transparent 62%), radial-gradient(7% 8% at 82% 72%, #000 60%, transparent 62%); }
.win .wash { position: absolute; left: 0; right: 0; top: 0; height: 55%; pointer-events: none; }
.win .area { position: relative; overflow: hidden; }
.win .area > .scrim { position: absolute; inset: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .win .press { transition: none; } .win .press:active { transform: none; } }
