/* The model viewer - the look of the site («Майстерня»), with a dark theme of its own. */
:root {
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --bg: #FBF7F1; --surface: #FFFFFF; --surface-2: #F6F0E6; --ink: #221E1A; --muted: #6B6257;
  --line: #E7DDCD; --line-strong: #CFC2AE; --accent: #F2B01E; --accent-ink: #2A1E03; --accent-soft: #FBEFD6;
  --view-a: #F7F2EA; --view-b: #E9E0D2; --glass: rgba(255, 255, 255, 0.86);
  --shadow: 0 2px 4px rgba(60, 45, 20, .06), 0 12px 32px rgba(60, 45, 20, .12);
  --bad-bg: #FBE7E2; --bad-ink: #A8331F; --floor: rgba(0, 0, 0, .14);
  --note-bg: #FFF3D6; --note-ink: #7A5100; --dim-ink: #7A4D0A;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #12100E; --surface: #1E1B18; --surface-2: #27231F; --ink: #EFE8DC; --muted: #A69B8B;
  --line: #36302A; --line-strong: #4A423A; --accent: #F2B01E; --accent-ink: #231802; --accent-soft: #3A2E12;
  --view-a: #2A2622; --view-b: #161412; --glass: rgba(30, 27, 24, 0.86);
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
  --bad-bg: #3A1D17; --bad-ink: #F2A08F; --floor: rgba(0, 0, 0, .5);
  --note-bg: #3A2E12; --note-ink: #F5D58A; --dim-ink: #F5C86A;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
button, input, label { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[data-theme="dark"] .moon, [data-theme="light"] .sun { display: none; }
.app[data-mode="client"] .work-only, .app[data-mode="work"] .client-only { display: none !important; }

/* ---------- top bar */
.app { height: 100%; display: grid; grid-template-rows: 52px 1fr; position: relative; }
.top { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); border: 1px solid var(--line); white-space: nowrap; }
.spacer { flex: 1; }
.sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.ibtn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; }
.ibtn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.ibtn.on { background: var(--accent-soft); color: var(--ink); border-color: var(--line); }
.ibtn:disabled { opacity: .4; cursor: default; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 6px 11px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- layout */
.body { position: relative; display: grid; grid-template-columns: 1fr; min-height: 0; --left-w: 300px; --right-w: 330px; --sheet-h: 50%; }
.body.has-left { grid-template-columns: var(--left-w) minmax(0, 1fr); }
.body.has-right { grid-template-columns: minmax(0, 1fr) var(--right-w); }
.body.has-left.has-right { grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); }
/* the thin grips that resize the side panels (and, on a phone, the bottom sheet) */
.split { position: absolute; top: 0; bottom: 0; width: 12px; cursor: col-resize; z-index: 4; touch-action: none; display: none; }
.split::after, .sheetgrip::after { content: ''; position: absolute; border-radius: 4px; background: var(--line-strong); transition: background .15s; }
.split::after { left: 4px; top: 50%; width: 4px; height: 36px; margin-top: -18px; }
.split:hover::after, .split.on::after, .sheetgrip:hover::after, .sheetgrip.on::after { background: var(--accent); }
.body.has-left #splitLeft { display: block; left: calc(var(--left-w) - 6px); }
.body.has-right #splitRight { display: block; right: calc(var(--right-w) - 6px); }
.sheetgrip { display: none; }
.panel { background: var(--surface); min-height: 0; display: flex; flex-direction: column; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); overflow: auto; }
.pad { padding: 12px 14px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; background: var(--bg); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; outline: none; color: var(--ink); font-size: 14px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 10px; }
.tabs button { border: 0; background: transparent; padding: 9px 10px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.found { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; background: var(--surface-2); }
.found b { margin-right: auto; }
.scroll { overflow: auto; min-height: 0; flex: 1; padding: 6px 0; }

/* ---------- tree rows */
.row { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 0; font-size: 14px; border-radius: 8px; margin: 0 6px; cursor: pointer; user-select: none; }
.row:hover { background: var(--surface-2); }
.row.sel { background: var(--accent-soft); }
.row.holds-sel { box-shadow: inset 3px 0 0 var(--accent); }
.row.off .nm { color: var(--muted); text-decoration: line-through; }
.row .tw { width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted); border-radius: 4px; flex: none; }
.row .tw svg { width: 14px; height: 14px; }
.row .ic { color: var(--muted); display: grid; }
.row .ic svg { width: 16px; height: 16px; }
.row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .nm small { color: var(--muted); margin-left: 6px; }
.row .hv { display: none; gap: 1px; }
.row:hover .hv, .row.sel .hv { display: flex; }
.row .hv button { width: 24px; height: 24px; border: 0; background: transparent; border-radius: 6px; display: grid; place-items: center; color: var(--muted); cursor: pointer; padding: 0; }
.row .hv button:hover { background: var(--surface); color: var(--ink); }
.row .hv svg { width: 15px; height: 15px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.has-note { background: var(--note-bg); color: var(--note-ink); border-color: transparent; }
.more { color: var(--muted); font-size: 12px; padding: 6px 14px; }

/* ---------- materials list */
.mrow { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.mrow:hover { background: var(--surface-2); }
.mrow.sel { background: var(--accent-soft); }
.mrow .t { flex: 1; min-width: 0; }
.mrow .t b { display: block; font-weight: 550; }
.mrow .t span { color: var(--muted); font-size: 12px; }
.swatch { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); flex: none; background-size: cover; background-position: center; display: block; }
canvas.swatch { width: 34px; height: 34px; }

/* ---------- the card on the right */
.card { padding: 14px 16px; }
.card .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.card .big { font-size: 22px; font-weight: 650; margin: 14px 0 2px; }
.card .big small { font-size: 13px; color: var(--muted); font-weight: 400; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 8px 10px; font-size: 13px; margin-top: 14px; }
.kv .k { color: var(--muted); }
.kv .v { overflow-wrap: anywhere; }
.matline { display: flex; gap: 8px; align-items: center; }
.note { margin-top: 14px; background: var(--note-bg); color: var(--note-ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }

/* ---------- the specification of an isolated group, under the card */
.spec { border-top: 1px solid var(--line); }
.spec-head { display: flex; align-items: baseline; gap: 8px; padding: 11px 16px 9px; position: sticky; top: 0; z-index: 1;
  background: var(--surface); border-bottom: 2px solid var(--accent); font-size: 14px; }
.spec-head b, .spec-head .who { font-weight: 650; }
.spec-head .who { overflow-wrap: anywhere; }
.spec-head .cnt { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.spec-mat { display: flex; gap: 10px; align-items: center; padding: 14px 16px 6px; }
.spec-mat canvas.swatch { width: 28px; height: 28px; }
.spec-mat b { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.spec-mat span { color: var(--muted); font-size: 12px; }
.spec-sec { padding: 18px 16px 6px; font-size: 14px; font-weight: 650; }
table.spec-t { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.spec-t .c-pos { width: 52px; }
.spec-t .c-sz { width: 92px; }
.spec-t .c-n { width: 56px; }
.spec-t .c-art { width: 74px; }
.spec-t th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.spec-t td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.spec-t th:first-child, .spec-t td:first-child { padding-left: 16px; }
.spec-t th:last-child, .spec-t td:last-child { padding-right: 16px; }
.spec-t .n { text-align: right; white-space: nowrap; }
.spec-t .pos, .spec-t .art { color: var(--muted); }
.spec-t .sz { white-space: nowrap; }
.spec-t tbody tr { cursor: pointer; }
.spec-t tbody tr:hover td { background: var(--surface-2); }
.spec-t tbody tr.sel td { background: var(--accent-soft); }
.spec-t .c-no { width: 40px; }
.spec-t .c-v { width: 50px; }
.spec-t .c-d { width: 38px; }
.spec-t .c-gl { width: 62px; }
.spec-t .c-v2 { width: 84px; }
.spec-t td { white-space: pre-line; }
.spec-t td.pos, .spec-t td.n { white-space: nowrap; }
.spec-t td.red { color: #C0392B; font-weight: 600; }

/* ---------- a part's drawing: the side switcher, the labels laid over the part, the legend */
.sidesw { display: flex; margin: 12px 16px 6px; width: fit-content; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.sidesw button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sidesw button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.sno { position: absolute; left: 0; top: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; border: 1px solid var(--muted);
  background: var(--surface); color: var(--ink); font: 600 9.5px/13px var(--font); text-align: center; white-space: nowrap; }
.sno.sel { background: #D9480F; border-color: #D9480F; color: #fff; }
.sop { position: absolute; left: 0; top: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 3px; background: #F2B01E; color: #2A1E03;
  font: 700 9.5px/15px var(--font); text-align: center; }
.saxis { position: absolute; left: 0; top: 0; color: #D9480F; font: 700 11px var(--font); }
.sdim { position: absolute; left: 0; top: 0; color: var(--dim-ink); font: 600 10px var(--font); white-space: nowrap; background: var(--glass); padding: 0 2px; border-radius: 3px; }
.sdim.x { writing-mode: vertical-rl; padding: 2px 0; }
.sdim.sel { background: #D9480F; color: #fff; font-size: 11px; padding: 0 4px; }
/* ---------- a unit pulled apart, and its positions on leaders */
.modbar .explode { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; font-size: 13px; color: var(--muted); }
.modbar input[type=range] { width: 140px; accent-color: var(--accent); }
.pball { position: absolute; left: 0; top: 0; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; border: 1.5px solid var(--ink);
  background: var(--surface); color: var(--ink); font: 700 11px/19px var(--font); text-align: center; white-space: nowrap; }
.pball.sel { background: #D9480F; border-color: #D9480F; color: #fff; }
svg.leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; }
svg.leaders line { stroke: var(--ink); stroke-width: 1; opacity: .7; }
.legend { position: absolute; right: 14px; bottom: 12px; font-size: 11.5px; color: var(--muted); background: var(--glass); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; line-height: 1.6; z-index: 3; }
.legend i { display: inline-block; width: 14px; height: 10px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.legend .lg-seen { border: 1.2px solid currentColor; }
.legend .lg-back { border: 1.2px dashed currentColor; }
.legend .lg-thru { background: rgba(192, 57, 43, .3); border: 1.2px solid #C0392B; }
.legend .lg-op { background: rgba(242, 176, 30, .3); border: 1.2px solid #C98A00; }

/* ---------- the 3D view */
.view { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 50% 35%, var(--view-a), var(--view-b)); min-width: 0; }
.floor { position: absolute; left: 12%; right: 12%; bottom: 10%; height: 10%; background: radial-gradient(closest-side, var(--floor), transparent); filter: blur(6px); pointer-events: none; }
.canvas, .canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dim { position: absolute; left: 0; top: 0; font-size: 12px; font-weight: 600; color: var(--dim-ink); background: var(--glass); padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; padding: 24px; pointer-events: none; }
.empty svg { width: 48px; height: 48px; stroke-width: 1.3; color: var(--line-strong); }
.empty b { color: var(--ink); font-size: 17px; font-weight: 600; }
.busy { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 10px; align-items: center; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); margin: 0 auto; width: max-content; max-width: min(440px, 90%); display: flex; flex-direction: column; gap: 6px; background: var(--bad-bg); color: var(--bad-ink); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.error span { font-size: 13px; opacity: .9; overflow-wrap: anywhere; }
.empty:not([hidden]) ~ .error { top: 16px; transform: none; z-index: 4; }   /* above the start screen, not over its link field */
.error.passing { cursor: pointer; }
.error .btns { margin-top: 6px; }
.error .btn { color: var(--ink); }
.busy small { color: var(--muted); font-size: 12px; margin-left: 2px; }
/* opening from Google Drive, on the start screen */
.empty .or { display: flex; align-items: center; gap: 10px; width: min(420px, 100%); margin: 12px 0 4px; font-size: 12px; }
.empty .or::before, .empty .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.drive { display: flex; gap: 6px; width: min(420px, 100%); margin: 0; pointer-events: auto; }
.drive input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 7px 11px; font-size: 13px; }
.drive input::placeholder { color: var(--muted); }
.drive input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drivebad { width: min(420px, 100%); text-align: left; font-size: 12px; color: var(--bad-ink); }
.float { position: absolute; display: flex; gap: 4px; padding: 4px; background: var(--glass); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 3; align-items: center; }
/* the floating bars at the top: a column, each under the one before; «Показати все» sits apart,
   bottom left, on a wide screen and leads the column on a narrow one */
.topstack { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px;
  pointer-events: none; z-index: 3; }
.topstack > * { pointer-events: auto; }
.topstack > .float { position: static; }
.topstack > .showall { position: absolute; }
.bar { font-size: 13px; padding-left: 12px; white-space: nowrap; }
.view.tape-mode { cursor: crosshair; }
.dim.tape { background: #D9480F; color: #fff; padding: 1px 6px; text-align: center; line-height: 1.25; }
.dim.tape b { display: block; font-weight: 700; }
.dim.tape small { display: block; font-weight: 500; font-size: 11px; opacity: .9; }
.showall { left: 12px; bottom: 12px; font-size: 13px; padding-left: 12px; }
.act { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 9px; padding: 6px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.act:hover { background: var(--surface-2); }
.act.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.act.on { background: var(--accent-soft); }
.dock { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 4px; padding: 5px; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); z-index: 3; }
.dock button { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; padding: 7px 14px; border-radius: 13px; font-size: 12px; color: var(--muted); cursor: pointer; }
.dock button.on { background: var(--accent-soft); color: var(--ink); }
.dock svg { width: 22px; height: 22px; }
.hint { position: absolute; left: 16px; bottom: 16px; font-size: 12px; color: var(--muted); pointer-events: none; }
.view:has(#showAll:not([hidden])) .hint { display: none; }
.pop { position: absolute; right: 12px; top: 10px; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 5; }
.pop h4 { margin: 4px 8px 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.pop label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.pop label:hover { background: var(--surface-2); }
.pop input { accent-color: var(--accent); width: 16px; height: 16px; }
/* the share popover: a link for the client, a link for the workshop */
.pop.share { width: 330px; padding: 10px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.srow + .srow { border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
.srow div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.srow b { font-size: 14px; font-weight: 600; }
.srow span { font-size: 12px; color: var(--muted); }
.srow .btn.done { background: var(--accent-soft); border-color: var(--line); }
.pop .shareurl { width: 100%; height: auto; margin: 6px 0 0; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-size: 12px; accent-color: auto; }
.pop.share .note { margin: 6px 8px 2px; font-size: 12px; color: var(--muted); }
.dropcover { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 16px; display: grid; place-items: center; font-size: 18px; font-weight: 600; background: rgba(242, 176, 30, .08); pointer-events: none; }
.view.hide-mode { cursor: crosshair; }

@media (max-width: 900px) {
  .body { --left-w: 260px; --right-w: 290px; }
  .body.has-left.has-right { grid-template-columns: minmax(0, 1fr) var(--right-w); }
  .body.has-left.has-right .panel.left, .body.has-left.has-right #splitLeft { display: none; }
}
/* A narrow screen: the panels become a bottom sheet, its height dragged by the grip on its top
   edge; the floating bars move to the top, where the sheet and the dock cannot cover them. */
@media (max-width: 720px) {
  .top { gap: 6px; padding: 0 8px; }
  .wide, .chip, .hint, .sep { display: none; }
  .seg button { padding: 5px 8px; }
  .body.has-left, .body.has-right, .body.has-left.has-right { grid-template-columns: minmax(0, 1fr); }
  .panel.left, .panel.right { position: absolute; left: 0; right: 0; bottom: 0; height: var(--sheet-h); z-index: 6; border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
  .body .split { display: none !important; }
  .body.has-left .sheetgrip, .body.has-right .sheetgrip { display: block; position: absolute; left: 0; right: 0; bottom: calc(var(--sheet-h) - 16px); height: 26px; z-index: 7; cursor: row-resize; touch-action: none; }
  .sheetgrip::after { left: 50%; top: 13px; width: 40px; height: 4px; margin-left: -20px; }
  .topstack > .showall { position: static; white-space: nowrap; }
  .legend { display: none; }
}
/* On a phone the view switcher leaves the top bar and floats, centred, just below it. */
@media (max-width: 600px) {
  .seg { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 4;
         background: var(--glass); backdrop-filter: blur(8px); box-shadow: var(--shadow); }
  .seg button.on { background: var(--accent-soft); }
  .pop { top: 56px; }
  .pop.share { left: 8px; right: 8px; width: auto; }
  .empty:not([hidden]) ~ .error { top: 52px; }
  .topstack { padding-top: 54px; }
}
