:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --card: #fff;
  --text: #1c302a;
  --muted: #52655d;
  --border: #dfe7df;
  --soft: #f4f8f4;
  --accent: #17694f;
  --accent-soft: #e7f3e9;
  --accent-text: #fff;
  --ok: #17694f;
  --err: #9b392b;
  --warn: #875100;
  --heading: "Instrument Sans", "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 "DM Sans", system-ui, sans-serif; }
::selection { background: #c8e9d3; color: #15382e; }
a { color: var(--accent); text-underline-offset: 3px; }
.shell { width: min(1280px, calc(100% - 72px)); margin-inline: auto; }
main { padding: 24px 0 42px; }
h1, h2, h3 { font-family: var(--heading); }
h1 { margin: 0; }
h2 { font-size: 1.32rem; line-height: 1.2; letter-spacing: -.035em; margin: 0 0 14px; }
.lead { color: var(--muted); margin: 0 0 20px; }
section { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
label.check { display: flex; align-items: center; gap: 8px; margin: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]), select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--soft); border: 1px solid var(--border); border-radius: 8px;
}
input[type=range] { display: block; width: 100%; margin-top: 10px; }
input[type=color] { display: block; margin-top: 4px; width: 64px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.actions { align-items: center; justify-content: space-between; margin-top: 4px; }
button { font: inherit; font-size: .875rem; font-weight: 700; min-height: 42px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; }
button:hover:not(:disabled) { border-color: #8ab29d; background: var(--soft); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #12563f; color: #fff; }
button.secondary { color: var(--accent); }
button:disabled { opacity: .53; cursor: not-allowed; }
.text-button { min-height: 32px; padding: 3px 0; background: transparent; color: var(--accent); border: none; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.tabs { display: flex; gap: 6px; margin: 0 0 20px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.tabs button { min-height: 38px; padding: 6px 11px; }
.tabs button[aria-selected=true] { background: var(--accent-soft); color: #11533e; border-color: #9fc5ad; }
.pane[hidden] { display: none; }
#preview, #file-preview { display: block; width: 100%; max-width: 512px; image-rendering: pixelated; background: #000; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
#file-preview[hidden] { display: none; }
.status { margin: 6px 0 0; font-size: 14px; color: var(--muted); min-height: 1.4em; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; }
footer a { color: var(--accent); }
button.danger { color: var(--err); border-color: var(--err); }
.panel-item { border-top: 1px solid var(--border); padding: 10px 0; }
.panel-item:first-child { border-top: 0; }
.panel-item .row.actions > span { display: flex; gap: 6px; flex-wrap: wrap; }
[hidden] { display: none !important; }
.swatches { display: flex; gap: 4px; margin: -4px 0 12px; }
.swatches i { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------------------------------------------------------------- app shell (tabs, header, debug) */
.skip-link { position: fixed; inset: 8px auto auto 8px; z-index: 100; padding: 10px; background: var(--card); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.top { background: var(--card); border-bottom: 1px solid var(--border); }
.top-in { min-height: 74px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); white-space: nowrap; font: 700 1.2rem/1 var(--heading); letter-spacing: -.035em; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: #185a46; }
.brand-mark::before { content: ""; width: 21px; height: 15px; background: radial-gradient(circle, #c1f3d3 2px, transparent 2.3px) 0 0 / 7px 7px; }
.nav { display: flex; gap: 2px; justify-content: center; }
.nav button { white-space: nowrap; min-height: 38px; border: 0; padding: 7px clamp(7px, .8vw, 12px); background: none; color: var(--muted); }
.nav button[aria-selected=true] { color: #11533e; background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.studio-hero { position: relative; isolation: isolate; display: grid; align-items: center; min-height: 202px; margin-bottom: 16px; overflow: hidden; padding: 30px clamp(24px, 4.5vw, 62px); border-radius: 26px; background: radial-gradient(ellipse at 86% 14%, #397d60, transparent 55%), linear-gradient(112deg, #15382e, #1b5645); color: #fff; }
.studio-hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.7rem); font-weight: 700; letter-spacing: -.055em; line-height: 1; }
.studio-hero p { max-width: 32rem; color: #e2f2e9; margin: 12px 0 0; font-size: 1rem; }
.hero-art { z-index: -1; position: absolute; inset: -58% -4% -62% 55%; display: grid; place-items: center; transform: rotate(-12deg); }
.hero-art i, .hero-art span { grid-area: 1 / 1; }
.hero-art i { width: 100%; aspect-ratio: 1.45; border: 1px solid #b0f1c968; border-radius: 49% 42% 61% 36% / 58% 47% 44% 36%; }
.hero-art i:nth-child(2) { transform: scale(.85) rotate(5deg); }
.hero-art i:nth-child(3) { transform: scale(.71) rotate(10deg); }
.hero-art i:nth-child(4) { transform: scale(.56) rotate(14deg); }
.hero-art span { width: 54%; aspect-ratio: 4; border: 1px solid #96d6aa8c; border-radius: 12px; background: radial-gradient(circle, #90dca9 1.25px, transparent 1.6px) 4px 4px / 7px 7px, #102f26; box-shadow: 0 13px 28px #0d271f82, 0 0 36px #a1e2b02b; }
.workspace-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.workspace-toolbar label { margin: 0; font-weight: 700; }
.workspace-toolbar select { width: auto; min-width: 128px; max-width: 100%; margin: 0; background: var(--card); }
.workspace-toolbar a { margin-left: auto; font-weight: 700; font-size: .875rem; }
.card { min-width: 0; border-radius: 22px; padding: clamp(16px, 2vw, 24px); margin-bottom: 18px; box-shadow: 0 3px 9px #15382e06; }
#view-send { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); align-items: start; gap: 20px; margin-bottom: 18px; }
#view-send > .card { margin: 0; }
.editor-card { min-height: 335px; }
.editor-card .row > label { min-width: 0; }
.editor-card [type=file] { min-width: 0; }
#t-text { font-size: 1rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--soft); font-size: .79rem; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: var(--accent-soft); } .chip.err { color: var(--err); } .chip.warn { color: var(--warn); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 14px; }
.section-head h2 { margin: 0; }
.preview-jump { display: none; font-size: .83rem; font-weight: 700; white-space: nowrap; }
.screen-size { color: var(--muted); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.preview-stage { display: grid; place-items: center; position: relative; overflow: hidden; aspect-ratio: 4; border: 7px solid #192924; border-radius: 13px; background: radial-gradient(circle, #263730 1px, transparent 1.5px) 0 0 / 6px 6px, #0c1411; }
.preview-stage #preview, .preview-stage #file-preview { grid-area: 1 / 1; width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; max-width: none; min-width: 0; object-fit: contain; }
.preview-stage #preview { aspect-ratio: 4; }
#info { margin: 8px 0 12px; min-height: 0; }
#info:empty, #send-status:empty, #mirror-status:empty, #v-source:empty, #v-status:empty { display: none; }
.send-controls { display: grid; gap: 9px; padding-top: 14px; }
.send-controls .deploy-mode, .send-controls .status { max-width: none; margin: 0; }
.send-controls .btns > button { flex: 1 0 auto; }
.send-controls .text-button { justify-self: start; }
.file-drop { display: grid; justify-items: center; gap: 3px; min-width: 0; padding: 20px 12px 15px; background: var(--soft); border: 1px dashed #9db8a5; border-radius: 14px; text-align: center; cursor: pointer; }
.file-drop strong { color: var(--text); font-size: .95rem; }
.file-drop input[type=file] { max-width: 320px; margin-top: 8px; background: var(--card); }
.file-drop ::file-selector-button { margin-right: 8px; border: 0; border-radius: 6px; padding: 4px 8px; color: #11533e; background: var(--accent-soft); font: inherit; cursor: pointer; }
.file-drop:hover, .file-drop[data-dragging=true] { border-color: var(--accent); background: var(--accent-soft); }
#tab-video > .row { margin-top: 6px; }
.video-actions { align-items: center; margin: 12px 0 0; }
.video-actions a { color: var(--accent); }
#v-progress { display: block; width: 100%; margin-top: 12px; accent-color: var(--accent); }
.tech-flow { display: grid; gap: 10px; padding-inline-start: 24px; }
.tech-limits { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 12px 16px; margin: 0; }
.tech-limits dt { font-weight: 600; }
.tech-limits dd { margin: 0; }
.panel-dashboard { scroll-margin-top: 12px; }
.panel-dashboard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-dashboard-head { flex-wrap: wrap; }
#panel-setup {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
#panel-setup .hint { margin-bottom: 8px; }
#panel-setup-status { margin-bottom: 12px; }
.panel-dashboard-head h2 { margin: 0; }
.panel-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); gap: 12px; }
.panel-tile { display: grid; align-content: start; gap: 8px; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--soft); padding: 12px; }
.panel-tile[data-active="true"] { border-color: #8eb8a0; background: #ecf6ed; }
.panel-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.panel-tile-head strong { overflow-wrap: anywhere; }
.panel-tile-head button { min-height: 32px; padding: 4px 10px; font-size: .78rem; }
.panel-tile-head button[aria-pressed=true] { color: var(--accent); border-color: #a9c9b1; background: var(--accent-soft); opacity: 1; }
.panel-screen { margin: 0; display: grid; place-items: center; aspect-ratio: 4; background: radial-gradient(circle, #283a32 1px, transparent 1.5px) 0 0 / 6px 6px, #0c1411; color: #d7e5db; border-radius: 8px; overflow: hidden; }
.panel-screen > * { grid-area: 1 / 1; }
.panel-screen img { display: block; width: 100%; height: 100%; image-rendering: pixelated; object-fit: contain; }
.panel-screen figcaption { font-size: .8rem; }
.panel-state { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; }
.panel-dashboard-actions { margin-top: 14px; justify-content: start; }
.panel-dashboard-actions .status { margin: 0; }
label.bright { display: block; margin: 0; padding: 8px 0 2px; }
label.bright > span { display: flex; justify-content: space-between; font-weight: 700; }
#bright-val { font-variant-numeric: tabular-nums; }
input[type=range], input[type=checkbox] { accent-color: var(--accent); }
.row.head { margin: 0 0 8px; }
.row.head h2 { margin: 0; }
.btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.cards .card { margin: 0; }
.cards + .card { margin-top: 16px; }
dl.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.okc { color: var(--ok); } .errc { color: var(--err); } .warnc { color: #b7791f; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.dim { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
label.chip { margin: 0; cursor: pointer; }
.tablewrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
td.empty { color: var(--muted); text-align: center; padding: 16px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.err { color: var(--err); border-color: var(--err); }
.badge.info { color: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------------- departures picker */
.map { height: 260px; border: 1px solid var(--border); border-radius: 8px; margin: 0 0 12px; z-index: 0; }
.lbl { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.preview { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: 13px; }
.preview.warn { color: var(--err); border-color: var(--err); }
details.adv { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
details.adv summary { cursor: pointer; margin-bottom: 8px; }
.chip input { margin: 0; }

/* stop picker: direction cards, icons, map badges */
.sides { display: grid; gap: 8px; margin: 0 0 12px; }
.side { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; }
.side.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.side input { margin-top: 4px; }
.ico, .ico-wrap .ico { vertical-align: -3px; }
.ico-wrap { display: inline-flex; gap: 2px; margin-right: 4px; }
.mb-icon { background: none; border: 0; }
.mb { position: absolute; left: 0; display: flex; gap: 4px; transform: translateX(-50%); white-space: nowrap; }
.mb.above { bottom: 10px; }
.mb.below { top: 10px; }
.mb-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; font: 600 12px/1 system-ui, sans-serif; color: #222; background: #fff; border: 2px solid #666; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
.mb-badge .ico { width: 14px; height: 14px; vertical-align: 0; }
.mb.on .mb-badge { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.mb-badge:hover { transform: scale(1.06); }

/* stop search results as buttons, extras, board preview */
.results { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; max-height: 220px; overflow: auto; }
.results button { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 12px; border-radius: 8px; text-align: left; line-height: 1.25; }
.results button small { color: var(--muted); font-size: 12px; }
.results button[aria-selected=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.results button:hover { border-color: var(--accent); }
.results .hint { padding: 6px 0; }
fieldset.extras { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 2px; margin: 0 0 12px; }
fieldset.extras legend { font-size: 14px; color: var(--muted); padding: 0 4px; }
fieldset.extras > label.check { margin-bottom: 10px; color: var(--text); }
fieldset.extras:disabled { opacity: 0.55; }
.row.sub { padding-left: 26px; align-items: flex-end; }
.row.sub > label { flex: 1 1 110px; }
.row.sub > label.check { flex: 2 1 200px; margin-bottom: 12px; }
.board { margin: 0 0 12px; }
#m-board { display: block; width: 100%; max-width: 512px; image-rendering: pixelated; background: #000; border: 1px solid var(--border); border-radius: 8px; }

.wodo-head { align-items: center; justify-content: space-between; }
.wodo-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.wodo-ok { background: #103824; color: #34d399; border: 1px solid #1f6f47; }
.wodo-warn { background: #3b2300; color: #ffb000; border: 1px solid #8a5200; }
.wodo-crit { background: #3f0d0d; color: #ff5b5b; border: 1px solid #9b1c1c; }
.wodo-alerts { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
#w-board { display: block; width: 100%; max-width: 512px; image-rendering: pixelated; background: #000; border: 1px solid var(--border); border-radius: 8px; }

.top-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-stats { font-size: 12px; color: var(--muted, #8ea0b5); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border, #2a3340); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

@media (max-width: 1120px) {
  .top-in { grid-template-columns: 1fr auto; gap: 0 12px; padding-top: 12px; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding: 5px 0 7px; }
  .top-chips { justify-content: flex-end; }
}
@media (max-width: 780px) {
  .shell { width: calc(100% - 32px); }
  main { padding-top: 16px; }
  #view-send { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .editor-card { min-height: 0; }
  .preview-jump { display: inline; }
  .studio-hero { min-height: 154px; }
  .studio-hero p { max-width: 23rem; }
  .hero-art { opacity: .42; inset-inline: 62% -20%; }
}
@media (max-width: 460px) {
  .shell { width: calc(100% - 24px); }
  .studio-hero { border-radius: 19px; padding: 22px 18px; }
  .studio-hero p { font-size: .91rem; }
  .hero-art span { display: none; }
  .nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
  .nav button { min-height: 36px; padding-inline: 3px; font-size: .79rem; }
  .workspace-toolbar select { min-width: 94px; }
  .workspace-toolbar a { margin-left: 0; }
  .tech-limits { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .tech-limits dd { margin-bottom: 8px; }
  .top-chips { max-width: 190px; }
  .chip-stats { white-space: normal; }
}

#gallery-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
}
#gallery-list img {
  display: block;
  width: 100%;
  height: 6rem;
  object-fit: contain;
  image-rendering: pixelated;
  background: #101513;
  border-radius: .5rem;
}
.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
