/* Venue Builder — one visual system: tokens, type scale, controls, panels, steps. */
:root{
  --bg:#0f1115; --panel:#161a20; --line:#2b3038; --line2:#3a414c;
  --ink:#dfe4ea; --muted:#8a93a0; --accent:#3b82f6; --accent2:#2f6fd6; --warn:#f0c869; --err:#e0776b;
  --aud:#2f5c8f; --stg:#8f4433; --avd:#4a4f57; --wall:#5a616b; --hard:#7a4b9c;
  --btn:#22262e; --btn2:#262b34; --field:#0e1116; --card:#1b2028; --card2:#1e2430; --canvas:#0b0d11; --hatch-bg:#14171c;
  --doc-ink:#cfd6de; --wm:#e9ebef; --sel:rgba(59,130,246,.35); --banner-bg:rgba(240,200,105,.10); --shadow:rgba(0,0,0,.35);
  --r:8px; --r-lg:10px; --h:30px; --hh:28px;   /* --h: fields and buttons in the panels; --hh: the header and view-bar controls */
  color-scheme:dark;
}
/* light appearance: System follows the OS, or forced from the header switch (data-theme) */
@media (prefers-color-scheme: light){ :root:not([data-theme="dark"]){
  --bg:#eef1f5; --panel:#ffffff; --line:#d5dae1; --line2:#b9c0c9; --ink:#1c2127; --muted:#5b6470; --accent:#2f6fd6; --accent2:#2559b3; --warn:#8a5a00; --err:#b8352a;
  --btn:#f3f5f8; --btn2:#e6eaef; --field:#ffffff; --card:#f6f8fa; --card2:#eaf0fa; --canvas:#e9edf2; --hatch-bg:#ffffff;
  --doc-ink:#2a313a; --wm:#1c2127; --sel:rgba(47,111,214,.25); --banner-bg:rgba(138,90,0,.08); --shadow:rgba(0,0,0,.12); color-scheme:light; } }
:root[data-theme="light"]{
  --bg:#eef1f5; --panel:#ffffff; --line:#d5dae1; --line2:#b9c0c9; --ink:#1c2127; --muted:#5b6470; --accent:#2f6fd6; --accent2:#2559b3; --warn:#8a5a00; --err:#b8352a;
  --btn:#f3f5f8; --btn2:#e6eaef; --field:#ffffff; --card:#f6f8fa; --card2:#eaf0fa; --canvas:#e9edf2; --hatch-bg:#ffffff;
  --doc-ink:#2a313a; --wm:#1c2127; --sel:rgba(47,111,214,.25); --banner-bg:rgba(138,90,0,.08); --shadow:rgba(0,0,0,.12); color-scheme:light; }
*{ box-sizing:border-box; }
html,body{ margin:0; background:var(--bg); color:var(--ink); font:13px/1.45 "Segoe UI",system-ui,sans-serif; }
body{ display:flex; flex-direction:column; height:100vh; height:100dvh; overflow:hidden; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
::selection{ background:var(--sel); }

/* ---- header + step pills ------------------------------------------------ */
/* installed on an iPad (iPadOS 27): the page starts below the status bar (inset 0), yet the system still smears a band
   ~35 pt deep across the top of the page (seen on iPadOS 27: title + undo/redo blurred, the step bar sharp).
   The inset does not report it, so the installed iPad app keeps its header below that band (html.touch: desktop and
   Safari tabs are untouched); if a top inset is ever reported again, the band sits below it, so it adds on */
header{ padding:calc(10px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 6px calc(16px + env(safe-area-inset-left, 0px)); display:flex; align-items:baseline; gap:10px; flex:0 0 auto; flex-wrap:wrap; }
@media (display-mode: standalone){ html.touch header{ padding-top:calc(48px + env(safe-area-inset-top, 0px)); } }
h1{ font-size:19px; margin:0; letter-spacing:.01em; }
h1 .ver{ font-size:12px; font-weight:500; color:var(--muted); margin-left:6px; letter-spacing:.02em; }
.sub{ color:var(--muted); font-size:12px; }
.tools{ margin-left:auto; display:flex; align-items:center; gap:8px; }
.tools .gap{ margin-left:10px; }
.tools select{ width:auto; height:var(--hh); padding:0 26px 0 10px; border-radius:var(--r); }
.btnlink{ display:inline-flex; align-items:center; gap:6px; height:var(--hh); padding:0 10px; border:1px solid var(--line); border-radius:var(--r); color:var(--ink); text-decoration:none; font-size:12px; }
.btnlink:hover{ border-color:var(--line2); background:var(--btn); }
/* ---- manual page ---- */
body.doc{ overflow:auto; height:auto; min-height:100vh; }
.manual{ max-width:820px; margin:0 auto; padding:8px 20px 40px; flex:1 1 auto; }
.manual h2{ font-size:14px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; color:var(--ink); margin:28px 0 8px; padding-top:14px; border-top:1px solid var(--line); }
.manual p, .manual li, .manual dd{ font-size:13.5px; line-height:1.55; color:var(--doc-ink); }
.manual ul, .manual ol{ padding-left:22px; } .manual li{ margin:4px 0; }
.manual code{ font:12px/1.4 Consolas, "Cascadia Mono", monospace; background:var(--field); border:1px solid var(--line); border-radius:4px; padding:0 4px; }
.manual dt{ font-weight:600; margin-top:8px; } .manual dd{ margin:2px 0 0 0; }
.manual a{ color:var(--accent); text-decoration:none; } .manual a:hover{ text-decoration:underline; }
.toc{ display:flex; flex-wrap:wrap; gap:6px 10px; margin:12px 0 4px; }
.toc a{ font-size:12px; padding:3px 10px; border:1px solid var(--line); border-radius:14px; color:var(--muted); }
.toc a:hover{ color:var(--ink); border-color:var(--line2); text-decoration:none; }
.steps{ display:flex; gap:8px; padding:0 16px 8px; font-size:12px; color:var(--muted); flex:0 0 auto; flex-wrap:wrap; }
.steps span{ padding:3px 12px; border:1px solid var(--line); border-radius:14px; cursor:pointer; user-select:none; }
.steps span:hover{ border-color:var(--line2); color:var(--ink); }
.steps span.done{ border-color:var(--accent); color:var(--ink); }
.steps span.cur{ background:var(--accent); border-color:var(--accent); color:#fff; }
.steps span.lock{ opacity:.4; pointer-events:none; }

/* ---- layout: ONE dynamic left column + the two views -------------------- */
.wrap{ display:grid; grid-template-columns:340px minmax(0,1fr); grid-template-rows:minmax(0,1fr);
  gap:10px; padding:0 10px 10px; flex:1 1 auto; min-height:0; }
@media (max-width:1080px){ .wrap{ grid-template-columns:300px minmax(0,1fr); gap:8px; } }
@media (max-width:820px){
  body{ overflow:auto; }
  .wrap{ grid-template-columns:1fr; grid-template-rows:auto auto; height:auto; min-height:0; }   /* stacked: each row sizes to its panel */
  .card{ max-height:420px; } .right{ min-height:560px; }
}
.card,.panel{ background:var(--panel); border:1px solid var(--line); border-radius:var(--r-lg); }
.card{ padding:12px 14px; overflow:auto; display:flex; flex-direction:column; }
.card .step{ display:none; }
.card .step.on{ display:block; }
.right{ display:grid; grid-template-rows:minmax(0,1fr) minmax(0,1fr); gap:10px; min-width:0; min-height:0; }
.panel{ display:flex; flex-direction:column; min-height:0; min-width:0; overflow:hidden; }
.panel .hd{ padding:10px 14px 0; display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
/* expand toggles: a view fills the whole work surface; the plan can fill its panel */
/* pop a view out to fill the right side: a real button (not a bare icon) so it is found, quiet until hovered */
button.expand{ margin-left:auto; height:28px; width:32px; padding:0; display:inline-flex; align-items:center; justify-content:center; line-height:1;
  color:var(--ink); background:var(--btn); border-color:var(--line); opacity:.85; }
button.expand:hover{ opacity:1; color:var(--accent); border-color:var(--accent); background:var(--btn2); }
.right.focus-sec{ grid-template-rows:minmax(0,1fr); } .right.focus-sec .panel:nth-child(2){ display:none; }
.right.focus-iso{ grid-template-rows:minmax(0,1fr); } .right.focus-iso .panel:nth-child(1){ display:none; }
.right.focus-sec .expand, .right.focus-iso .expand{ color:var(--accent); border-color:var(--accent); opacity:1; }   /* popped out: click again to restore */
.views.planfull #iso{ display:none; }
.panel canvas{ flex:1; width:100%; min-height:0; }
/* 3D view, optionally split with the satellite underlay */
.views{ flex:1; display:flex; min-height:0; gap:6px; padding:0 6px; }
.views canvas{ flex:1 1 0; width:0; min-width:0; height:auto; }
#satwrap{ flex:1 1 0; min-width:0; display:flex; flex-direction:column; min-height:0; }
#satwrap canvas{ flex:1; min-height:0; width:100%; min-width:0; background:var(--canvas); border-radius:6px; }
#map.draw{ cursor:crosshair; }
.satbar{ display:flex; gap:6px; align-items:center; padding:6px 0 0; }
.satbar input{ height:26px; } .satbar #rot{ width:58px; flex:0 0 auto; } .satbar label{ margin:0; flex:0 0 auto; }
.satbar button{ height:26px; flex:0 0 auto; }
.viewbar label.sat{ margin:0 0 0 8px; font-size:12px; color:var(--muted); }
.viewbar #planbtn.on, .viewbar #isobtn.on{ background:var(--accent); border-color:var(--accent); color:#fff; }

/* section titles: one style everywhere */
.card h2, .panel .hd b, .group h3{
  font-size:11px; font-weight:600; letter-spacing:.07em; text-transform:uppercase; color:var(--muted); }
.card h2{ margin:0 0 4px; }
.card p.sub{ margin:0 0 10px; }
.group{ border-top:1px solid var(--line); margin-top:12px; padding-top:10px; }
.group h3{ margin:0 0 4px; }

/* ---- icons: one inline sprite (index.html), drawn in the text colour ---- */
.sprite{ position:absolute; width:0; height:0; overflow:hidden; }
.ic{ width:14px; height:14px; flex:0 0 auto; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vertical-align:-2px; }
.bi{ display:inline-flex; align-items:center; justify-content:center; gap:6px; }
.tools > button.primary{ height:var(--hh); }
button.expand .ic{ width:16px; height:16px; }
button.del{ display:inline-flex; align-items:center; justify-content:center; } button.del .ic{ width:12px; height:12px; }

/* ---- controls ---------------------------------------------------------- */
label{ display:block; color:var(--muted); font-size:11.5px; margin:8px 0 3px; }
.cols2, .cols3{ display:grid; gap:6px; }
.sub.warn{ color:var(--warn); margin:6px 0 0; }
.status.more{ cursor:help; text-decoration:underline dotted; text-underline-offset:3px; }   /* hover for the detail */
.cols2{ grid-template-columns:1fr 1fr; }
.cols3{ grid-template-columns:1fr 1fr 1fr; }
.cols2 input, .cols3 input{ width:100%; min-width:0; }
label.cell{ margin:0; min-width:0; }
label.cell select{ padding:0 16px 0 6px; background-position:right 5px center; }   /* narrow cells: room for the word, not the arrow */
label.cell span{ display:block; font-size:10.5px; color:var(--muted); margin:0 0 2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
label.check{ display:flex; align-items:center; gap:8px; color:var(--ink); margin-top:10px; }
input,select{ background:var(--field); color:var(--ink); border:1px solid var(--line); border-radius:var(--r);
  padding:0 8px; height:var(--h); width:100%; font:inherit; }
select{ appearance:none; -webkit-appearance:none; padding-right:26px; cursor:pointer;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238a93a0' stroke-width='1.5'/></svg>");
  background-repeat:no-repeat; background-position:right 9px center; }
select option{ background:var(--panel); color:var(--ink); }
input:hover,select:hover{ border-color:var(--line2); }
input:focus,select:focus{ border-color:var(--accent); outline:none; }
input[type=checkbox]{ width:15px; height:15px; margin:0; accent-color:var(--accent); }
input:disabled{ opacity:.45; }
button{ background:var(--btn); color:var(--ink); border:1px solid var(--line); border-radius:var(--r);
  height:var(--h); padding:0 12px; cursor:pointer; font:inherit; }
button:hover{ border-color:var(--line2); background:var(--btn2); }
button:active{ transform:translateY(1px); }
button:disabled{ opacity:.4; pointer-events:none; }
button.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
button.primary:hover{ background:var(--accent2); border-color:var(--accent2); }
.seg{ display:inline-flex; border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
.seg button{ border:0; border-radius:0; background:transparent; height:calc(var(--hh) - 2px); padding:0 10px; }
.seg button:hover{ background:var(--btn2); }
.seg button.on{ background:var(--accent); color:#fff; }
.seg.sides{ display:flex; } .seg.sides button{ flex:1 1 auto; padding:0 6px; }
.seg.sides button.own::after{ content:" •"; }                           /* this side has its own section */
.btns{ display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.btns button{ flex:1 1 auto; }
#s-open, #s-resume, #s-restyle{ height:auto; min-height:30px; padding:6px 10px; line-height:1.3; }   /* Start links carry a sentence; let them wrap */
.btns.nav{ margin-top:14px; border-top:1px solid var(--line); padding-top:10px; }
.hidden{ display:none !important; }

/* choice cards (start sources, demo venues, extrusion styles) */
.cards{ display:grid; grid-template-columns:1fr; gap:8px; margin-top:8px; }
.tcard{ text-align:left; padding:10px 12px; height:auto; border-radius:var(--r-lg); background:var(--card); border:1px solid var(--line); }
.tcard:hover{ border-color:var(--accent); background:var(--card2); }
.tcard b{ display:block; margin-bottom:3px; font-size:13px; }
.tcard small{ color:var(--muted); display:block; line-height:1.4; font-size:11.5px; }
.tcard.sel{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent) inset; }

/* vertices table */
table{ width:100%; border-collapse:collapse; margin-top:6px; }
th{ color:var(--muted); font-weight:600; font-size:10.5px; letter-spacing:.05em; text-transform:uppercase; text-align:left; padding-bottom:2px; }
td{ padding:1px 2px 1px 0; } td input{ height:26px; padding:0 6px; }
td.lay select{ height:26px; padding:0 2px; font-size:11px; width:78px; } th.lay{ width:80px; }
.x{ width:26px; text-align:center; }
td.x button{ height:26px; width:26px; padding:0; font-size:12px; color:var(--muted); }
td.x button:hover{ color:var(--ink); }
.muted{ color:var(--muted); }

/* view bar + legend */
.viewbar{ padding:6px 12px 8px; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.viewbar > span{ color:var(--muted); margin-right:2px; font-size:12px; }
.viewbar button{ height:var(--hh); padding:0 10px; font-size:12px; }
.legend{ margin-left:auto; display:flex; gap:12px; font-size:11px; color:var(--muted); }
.sw{ display:inline-block; width:12px; height:12px; border-radius:2px; margin-right:4px; vertical-align:-2px; }
.sw-aud{ background:var(--aud); } .sw-stg{ background:var(--stg); } .sw-avd{ background:var(--avd); } .sw-wall{ background:var(--wall); }
.sw-hard{ background:repeating-linear-gradient(45deg, var(--hard) 0 3px, var(--hatch-bg) 3px 5px); }

/* messages */
.status{ color:var(--muted); font-size:12px; min-height:16px; }
.hint{ color:var(--warn); font-size:12px; margin-top:6px; }
.hint.info{ color:var(--muted); }
.banner{ flex:0 0 auto; margin:0 16px 6px; padding:6px 10px; border:1px solid var(--warn); border-radius:8px; background:var(--banner-bg); color:var(--ink); font-size:12px; line-height:1.5; }
.banner b{ color:var(--warn); } .banner .skipped{ color:var(--muted); }
.legend .legcap{ color:var(--muted); } .legend span.dim{ opacity:.4; }
header select#theme{ width:auto; }

/* ---- MuffStuff brand footer: wordmark (Archivo 800, self-hosted, SIL OFL) + coffee link ----
   Sticky so it stays on screen if the page ever scrolls (narrow layouts). */
@font-face{ font-family:"Archivo"; font-style:normal; font-weight:800; font-display:swap;
  src:url("fonts/archivo-800-latin.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
.wm{ font-family:"Archivo",system-ui,sans-serif; font-weight:800; letter-spacing:-.02em; color:var(--wm); text-decoration:none; }
.wm i{ font-style:normal; color:#d75249; }
.foot{ position:sticky; bottom:0; z-index:5; flex:0 0 auto; display:flex; align-items:center;
  gap:16px; padding:6px calc(16px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); font-size:12px; color:var(--muted); background:var(--bg); border-top:1px solid var(--line); }
.foot .wm{ font-size:13px; }
.foot .status{ flex:1 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.foot .status.open{ white-space:normal; }
.foot .stats{ flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-variant-numeric:tabular-nums; color:var(--muted); }
.foot .brand{ white-space:nowrap; }
.foot .stats{ margin-left:auto; }
.foot a.coffee{ white-space:nowrap; }
.foot a.vlink{ color:var(--muted); text-decoration:none; } .foot a.vlink:hover{ color:var(--ink); text-decoration:underline; }
.foot a.coffee{ color:var(--muted); text-decoration:none; font-weight:600; }   /* not the error red: the status line next to it uses that */
.foot a.coffee:hover{ color:var(--accent); }

/* ---- iPad (html.touch, set by device.js): the same design, finger-sized; the desktop is untouched ---- */
.touchonly{ display:none !important; }
html.touch .touchonly{ display:inline-flex !important; }
html.touch span.touchonly{ display:inline !important; }
html.touch .deskonly{ display:none !important; }
html.touch .touchonly.hidden{ display:none !important; }
@media (max-width:820px){ html.touch .card{ max-height:52vh; } }   /* iPad portrait: controls on top, views below */
html.touch{ --h:44px; --hh:40px; touch-action:manipulation; -webkit-text-size-adjust:100%; }
html.touch canvas{ touch-action:none; }
html.touch input, html.touch select{ font-size:16px; }          /* under 16 px, iPad Safari zooms the page on focus */
html.touch input[type=checkbox]{ width:22px; height:22px; }
html.touch #steps span{ padding:9px 14px; font-size:13px; }
html.touch #rows input, html.touch #rows select, html.touch table input, html.touch table select{ height:40px; }
html.touch table td{ padding:3px 2px; }
html.touch button.del{ width:40px; height:40px; }
html.touch .viewbar button{ height:38px; padding:0 14px; font-size:13px; }
html.touch button.expand{ width:40px; height:36px; font-size:16px; }
html.touch .seg button{ min-width:40px; }
.tbtn{ height:var(--hh); min-width:44px; justify-content:center; align-items:center; font-size:18px; padding:0 10px; }
.panel{ position:relative; }
.tdone{ position:absolute; right:52px; top:6px; height:36px; padding:0 16px; border-radius:18px; background:var(--accent); border-color:var(--accent); color:#fff; font-size:13px; align-items:center; z-index:5; }
#satwrap{ position:relative; }
#mapdone{ right:10px; top:40px; }
html.touch .status.more::after{ content:"  ⓘ"; }
html.touch .status.more.open{ text-decoration:none; }
html.touch .status.more.open::after{ content:"\A" attr(title); white-space:pre-wrap; display:block; margin-top:4px; color:var(--muted); }
.tiptoast{ position:fixed; left:50%; bottom:24px; transform:translateX(-50%); max-width:min(560px, 90vw); background:var(--card2); color:var(--ink); border:1px solid var(--line2); border-radius:var(--r-lg); padding:10px 14px; font-size:13px; line-height:1.45; z-index:60; box-shadow:0 6px 20px var(--shadow); }
/* phones: a clear screen instead of a broken tool */
.phonewall{ display:none; position:fixed; inset:0; z-index:100; background:var(--bg); align-items:center; justify-content:center; padding:28px; text-align:center; }
.phonewall > div{ max-width:420px; }
.phonewall h2{ font-size:20px; margin:0 0 12px; color:var(--ink); }
.phonewall p{ color:var(--muted); line-height:1.5; margin:0 0 10px; }
html.phone #phonewall{ display:flex; }
/* iPad held upright (or a Split View / Stage Manager window taller than wide): the layout is landscape-only; the app keeps
   running underneath, so turning the iPad back loses nothing. A web page cannot lock rotation — Control Center can */
@media (orientation: portrait){ html.touch #rotatewall{ display:flex; } }
.phonewall .pwlink{ display:inline-block; margin-top:18px; padding:12px 20px; border-radius:var(--r); background:var(--accent); color:#fff; text-decoration:none; font-weight:600; }
html.phone body > :not(#phonewall){ display:none !important; }   /* the app is wider than a phone: nothing behind the notice may widen the page */
/* iPad: one view at a time, full size; the View switch in the step bar replaces the desktop's Plan/3D toggles and expand buttons */
html.touch #steps{ align-items:center; }
html.touch .tview{ margin-left:auto; }
html.touch .tview button{ height:34px; padding:0 14px; font-size:13px; }
html.touch .tview button.on{ background:var(--accent); border-color:var(--accent); color:#fff; }
html.touch #planbtn, html.touch #isobtn, html.touch button.expand{ display:none !important; }


/* vom side: a button that opens a 3 x 3 compass (the arena from above, stage end at the bottom) */
button.vside{ width:100%; text-align:left; padding:0 22px 0 8px; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238a93a0' stroke-width='1.5'/></svg>");
  background-repeat:no-repeat; background-position:right 8px center; }
.compass{ position:fixed; z-index:60; display:grid; grid-template-columns:repeat(3, 82px); gap:4px; padding:6px;
  background:var(--panel); border:1px solid var(--line2); border-radius:var(--r-lg); box-shadow:0 10px 28px var(--shadow); }
.compass button{ height:30px; padding:0 4px; font-size:11.5px; }
.compass button:hover{ border-color:#f5c542; color:var(--ink); }
.compass button.on{ background:var(--accent); border-color:var(--accent); color:#fff; }
.compass .floor{ display:flex; align-items:center; justify-content:center; font-size:11px; color:var(--muted); border:1px dashed var(--line); border-radius:var(--r); }
html.touch .compass{ grid-template-columns:repeat(3, 104px); } html.touch .compass button{ height:44px; }
