/* EasyCabinet app shell — consumes tokens from ui/theme.css.
   Every selector / element id is preserved so main.js + ui/*.js keep binding. */

:root { font-family: var(--font-ui); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }

/* Shared readable textarea styling (trial prompt, chat, comments) */
.app-textarea {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: normal;
  padding: 12px 14px;
  box-sizing: border-box;
  overflow-y: auto;
  word-wrap: break-word;
}

#app { display: grid; grid-template-columns: 320px 1fr 420px; height: 100vh; }
#app.chat-collapsed { grid-template-columns: 320px 1fr 0; }

/* ---------------- Sidebar ---------------- */
#sidebar, #wallDrawer, #inspectDrawer {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
}
/* Keep the drawer header (with its close button) pinned while the body scrolls,
   so tall content like Build order / Parts list is reachable, not clipped. */
#sidebar .side-head, #wallDrawer .side-head, #inspectDrawer .side-head { position: sticky; top: 0; z-index: 2; background: var(--rail, var(--panel)); }
.side-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.side-head-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.side-head-title::before {
  content: "";
  width: 22px; height: 22px; flex: none;
  border-radius: 7px;
  background: var(--accent);
  box-shadow: 0 3px 12px rgba(236, 154, 60, .4);
  background-image:
    linear-gradient(var(--amber-ink) 0 0),
    linear-gradient(var(--amber-ink) 0 0);
  background-size: 10px 2px, 2px 10px;
  background-position: center, center;
  background-repeat: no-repeat;
}
.side-home-link {
  font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
  letter-spacing: .04em; text-transform: uppercase;
}
.side-home-link:hover { color: var(--accent); }
.side-head h1 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.subtitle { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.dims { margin: 8px 0 0; font-size: 12px; color: var(--accent); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.tabs { display: flex; padding: 10px 12px 0; gap: 6px; }
.tab {
  flex: 1; padding: 8px; background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13px; font-weight: 600;
}
.tab.active {
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}

.panel { padding: 16px; overflow-y: auto; flex: 1; }
.panel.hidden { display: none; }

.control { margin-bottom: 18px; }
.control > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.val { color: var(--accent); float: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

.group { margin-bottom: 20px; }
.group h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin: 0 0 8px; }

.toggle-list { display: flex; flex-direction: column; gap: 7px; }
.row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.row.mt { margin-top: 10px; }
.row input { accent-color: var(--accent); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid var(--line); }
.count { color: var(--faint); font-size: 11px; margin-left: auto; }

.step-btns { display: flex; gap: 6px; margin-top: 10px; }
.step-btns button {
  flex: 1; padding: 7px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 12px;
}
.step-btns button:hover { border-color: var(--accent); }

.step-list { margin: 4px 0 0; padding-left: 20px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.step-list li { margin-bottom: 7px; }
.step-list li.active { color: var(--text); font-weight: 600; }
.step-list li.done { color: var(--accent-2); }

/* ---- hints ---- */
.hint-sm { font-size: 11px; color: var(--muted); line-height: 1.45; margin: 10px 0 0; }

/* ---- Parts list panel ---- */
.parts-hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 0 0 14px; }
.parts-list { display: flex; flex-direction: column; gap: 16px; }
.pl-group-head { display: flex; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin-bottom: 5px; }
.pl-group-head .count { margin-left: auto; }
.pl-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pl-table th { text-align: left; font-weight: 600; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; padding: 3px 6px; border-bottom: 1px solid var(--line); }
.pl-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.pl-table td:first-child { color: var(--accent); font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-table td.part-id-link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 2px; }
.pl-table td.part-id-link:hover { text-decoration-color: var(--accent); }
.pl-table td:nth-child(4) { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-table tbody tr { cursor: pointer; }
.pl-table tbody tr:hover { background: var(--panel-2); }
.pl-table tbody tr.sel { background: var(--accent-soft); outline: 1px solid var(--accent); outline-offset: -1px; }
.pl-table tbody tr.flash { animation: part-row-flash 1.2s ease-out; }
@keyframes part-row-flash {
  0%, 100% { background: var(--accent-soft); outline-color: var(--accent); }
  50% { background: var(--accent-softer); outline-color: var(--amber-2); }
}
.pl-table tbody tr.row-hidden { opacity: .38; }
.pl-badge { font-size: 9px; padding: 1px 6px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); margin-left: 6px; white-space: nowrap; }

.side-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); min-height: 38px; }

/* ---------------- Viewport (the stage) ---------------- */
#viewport {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 100% at 50% -10%, var(--glow), transparent 55%),
    var(--stage);
}
#scene { display: block; width: 100%; height: 100%; touch-action: none; position: relative; z-index: 1; }
/* Cinematic glow (top) + vignette (edges) over the canvas, center stays clear. */
#viewport::after {
  content: "";
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% -8%, var(--glow), transparent 52%),
    radial-gradient(120% 90% at 50% 42%, transparent 54%, var(--vignette) 100%);
}
#viewport > *:not(#scene) { z-index: 3; }

/* ---- live-model badge + dims (top-left / bottom-left stage overlays) ---- */
.ec-stage-badge {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--rail); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 600 11.5px var(--font-ui); color: var(--muted);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.ec-stage-badge-dot {
  width: 7px; height: 7px; border-radius: 999px; flex: none;
  background: var(--green); box-shadow: 0 0 8px rgba(131, 220, 160, .6);
}
.ec-stage-dims {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  padding: 6px 11px; border-radius: 9px;
  background: var(--rail); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 500 11.5px var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--faint); letter-spacing: .01em;
  pointer-events: none;
}

/* ---- minimal hover toolbar: subtle by default, full opacity on stage hover ---- */
.ec-hover-toolbar {
  opacity: .45;
  transition: opacity .18s ease;
}
#viewport:hover .ec-hover-toolbar,
#viewport:focus-within .ec-hover-toolbar,
.ec-hover-toolbar:focus-within {
  opacity: 1;
}
@media (pointer: coarse) {
  /* No hover on touch — keep controls reachable at all times. */
  .ec-hover-toolbar { opacity: .85; }
}

#toolbar { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 28px); }
#toolbar button {
  padding: 7px 11px; background: var(--rail); color: var(--muted);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 11.5px; font-weight: 600;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
#toolbar button:hover { border-color: var(--accent); color: var(--amber-2); }
@media (pointer: coarse) {
  /* 44px minimum tap targets for the stage toolbar on touch. */
  #toolbar button { min-width: 44px; min-height: 44px; }
}
#toolbar button.plans-btn,
#toolbar button#openPlans { border-color: transparent; background: var(--accent); color: var(--amber-ink); }
#toolbar button#openPlans:hover { filter: brightness(1.05); color: var(--amber-ink); }

/* "Dimensions" envelope toggle — same on/active convention as .mode-btn.active. */
#toolbar button.active {
  border-color: var(--accent); background: var(--accent-soft); color: var(--amber-2); font-weight: 700;
}

/* theme toggle button */
.theme-toggle {
  width: 36px; padding: 0; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
}

.regen-toast {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  max-width: min(92%, 520px);
  padding: 11px 16px;
  background: var(--rail);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 20;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.regen-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.regen-toast-hide { opacity: 0; transform: translateX(-50%) translateY(8px); }

.mode-toggle {
  display: flex; gap: 0; margin-right: 4px;
  background: var(--rail); border: 1px solid var(--line); border-radius: 9px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow: hidden;
}
.mode-btn {
  padding: 8px 12px; background: transparent; color: var(--muted);
  border: none; border-right: 1px solid var(--line); cursor: pointer; font-size: 12px; font-weight: 600;
}
.mode-btn:last-child { border-right: none; }
.mode-btn:hover { color: var(--text); background: var(--accent-softer); }
.mode-btn.active {
  color: var(--amber-2);
  background: var(--accent-soft);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--accent);
}

#viewport.comments-mode #controlsHint::after {
  content: ' · Comments mode: click to pin';
}

/* Amber numbered comment pins (teardrop, matches mockup). */
.comment-pin {
  width: 24px; height: 24px; border-radius: 999px 999px 999px 3px;
  background: var(--accent); color: var(--amber-ink); font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.7); box-shadow: 0 4px 14px rgba(0,0,0,.45);
  cursor: pointer; transform: translate(-50%, -100%); pointer-events: auto;
}
.comment-pin.draft { background: var(--faint); animation: pin-pulse 1.2s ease-in-out infinite; }
.comment-pin.active { outline: 2px solid #fff; outline-offset: 2px; }
.comment-pin.resolved { background: var(--accent-2); color: var(--amber-ink); opacity: .9; }

/* Keep the visible dot ~24px but grow the tap target to 44px on touch. */
@media (pointer: coarse) {
  .comment-pin {
    box-sizing: border-box;
    width: 44px; height: 44px;
    padding: 10px;
    background-clip: content-box;
    border-color: transparent; box-shadow: none;
    transform: translate(-50%, -100%);
  }
}

@keyframes pin-pulse {
  0%, 100% { transform: translate(-50%, -100%) scale(1); }
  50% { transform: translate(-50%, -100%) scale(1.08); }
}

.comment-modal {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--scrim); backdrop-filter: blur(3px); z-index: 20;
}
.comment-modal.hidden { display: none; }
.comment-modal-card {
  position: relative; width: min(420px, calc(100% - 32px));
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.comment-modal-close {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

@media (pointer: coarse) {
  .comment-modal-close {
    min-width: 44px; min-height: 44px;
    top: 0; right: 0;
  }
}
.comment-modal-close:hover { color: var(--text); }
.comment-modal-card h2 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.comment-modal-target { margin: 0 0 12px; font-size: 12px; color: var(--accent); }
.comment-modal-card .app-textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.comment-modal-card .app-textarea:focus { outline: none; border-color: var(--accent); }
.comment-modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.comment-btn {
  flex: 1; padding: 9px 12px; background: var(--panel-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.comment-btn:hover { border-color: var(--muted); }
.comment-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--amber-ink); }
.comment-btn.primary:hover { filter: brightness(1.05); }

.comments-hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 0 0 14px; }
.comment-screen-crop {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.comment-screen-crop.hidden { display: none; }
.comment-screen-crop img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.comment-screen-crop-label { font-size: 11px; color: var(--muted); }
.comment-batch-btn {
  width: 100%; padding: 9px 12px; margin: 0 0 14px;
  background: var(--accent); color: var(--amber-ink);
  border: 1px solid var(--accent); border-radius: 7px;
  cursor: pointer; font-size: 13px; font-weight: 700;
}
.comment-batch-btn:hover:not(:disabled) { filter: brightness(1.05); }
.comment-batch-btn.hidden { display: none; }
.comment-batch-btn:disabled { opacity: .55; cursor: not-allowed; }
.comments-section h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--faint); margin: 0 0 8px;
}
.comment-threads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.comment-thread {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.comment-thread:hover { border-color: var(--muted); }
.comment-thread.active { border-color: var(--accent); background: var(--accent-soft); }
.comment-thread.resolved { opacity: .72; }
.comment-thread.empty { cursor: default; color: var(--muted); font-size: 12px; }
.comment-thread-pin {
  flex: none; width: 22px; height: 22px; border-radius: 999px 999px 999px 3px;
  background: var(--accent); color: var(--amber-ink); font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.comment-thread.resolved .comment-thread-pin { background: var(--accent-2); }
.comment-thread-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.comment-thread-body strong { font-size: 12px; color: var(--accent); }
.comment-thread-text { font-size: 12px; color: var(--muted); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-thread-summary {
  font-size: 11.5px; color: var(--accent-2); line-height: 1.4; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.comments-section.resolved-section { margin-top: 16px; }
.comments-section.resolved-section.hidden { display: none; }
.comment-thread-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.comment-action-btn {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}
.comment-action-btn:hover { border-color: var(--muted); }
.comment-action-btn.primary {
  background: var(--accent);
  color: var(--amber-ink);
  border-color: var(--accent);
}
.comment-action-btn.primary:hover { filter: brightness(1.08); }
.comment-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.resolved-toggle {
  width: 100%; margin-top: 14px; padding: 8px 10px;
  background: transparent; color: var(--muted); border: 1px dashed var(--line);
  border-radius: 7px; cursor: pointer; font-size: 12px;
}
.resolved-toggle.hidden { display: none; }
.resolved-toggle:hover { color: var(--text); border-color: var(--muted); }

.action-btn {
  width: 100%; padding: 9px 12px; margin-top: 4px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }

#infoCard {
  position: absolute; top: 58px; left: 14px; width: 280px;
  background: var(--rail); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}
#infoCard.hidden { display: none; }
#infoClose { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
#infoClose:hover { color: var(--text); }
.info-id { display: flex; align-items: center; gap: 8px; }
#infoId { font-size: 20px; font-weight: 800; color: var(--accent); }
.chip { font-size: 10px; padding: 2px 7px; border-radius: 20px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
#infoCard h2 { margin: 4px 0 12px; font-size: 14px; font-weight: 600; }
.info-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.info-table td { padding: 4px 0; vertical-align: top; }
.info-table td:first-child { color: var(--muted); width: 46%; }
.info-table td:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.info-notes { margin: 12px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 10px; }
.info-notes:empty { display: none; }
.info-hide-btn {
  margin-top: 10px; width: 100%; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: none;
  color: var(--muted); font: 500 12px var(--font-ui); cursor: pointer;
}
.info-hide-btn:hover { color: var(--text); border-color: var(--accent); }

#legend {
  position: absolute; bottom: 14px; left: 14px;
  background: var(--rail); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; font-size: 11.5px; display: flex; flex-direction: column; gap: 5px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#legend .row { font-size: 11px; cursor: default; color: var(--muted); }

/* Dims chip, reparented (main.js) as the stage dock's header row — flows
   as a normal flex child instead of floating, so it and the legend below it
   can never overlap regardless of how many legend rows there are. Two IDs
   ((2,0,0)) beats shell.css's `.ec-stage-dims { left; bottom }` ((0,1,0))
   and styles.css's own base `.ec-stage-dims` rule above regardless of file
   load order. */
#ec-stage-dock #ec-stage-dims {
  position: static;
  left: auto; bottom: auto;
  padding: 0 0 9px;
  margin: 0;
  border: none; border-bottom: 1px solid var(--line-2);
  border-radius: 0;
  background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}

/* The hover toolbar (view buttons + the stage dock) must always stay above
   the part-info card — otherwise, on a narrow viewport pane where the
   wrapped toolbar row and the card's fixed-width box overlap, the card (later
   in DOM order, tied on z-index with the toolbar via the generic rule below)
   would silently sit on top and swallow clicks meant for Front/Left/Top/Reset. */
#viewport > #ec-hover-toolbar { z-index: 6; }

#controlsHint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: var(--rail); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-size: 11px; color: var(--faint);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); white-space: nowrap; pointer-events: none;
  max-width: calc(100vw - 32px);
  opacity: .5; transition: opacity .18s ease;
}
#viewport:hover #controlsHint { opacity: 1; }

/* Mouse/keyboard hints don't apply on touch devices; hide entirely. */
@media (pointer: coarse) {
  #controlsHint { display: none; }
}

#loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; pointer-events: none; z-index: 4;
}

.part-label {
  color: var(--text); font-size: 11px; font-weight: 700; padding: 1px 5px;
  background: var(--rail); border: 1px solid var(--line); border-radius: 4px; white-space: nowrap;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}

/* On-select part dims + the "Dimensions" envelope toggle — CSS2DObject labels
   riding the 3D dimension lines in main.js. Amber chip so it reads as a
   measurement, distinct from the neutral .part-label id tags. */
.dim-label {
  color: var(--amber-ink); font-size: 10.5px; font-weight: 700; padding: 1px 6px;
  background: var(--accent); border-radius: 4px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); pointer-events: none;
}

/* ---- Fixtures panel (Inspect drawer) ---- */
.fixtures-panel.hidden { display: none; }
.fixtures-panel .toggle-list { margin-top: 10px; }
.fixtures-panel .fixture-category {
  color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; margin-left: auto;
}

@media (max-width: 760px) {
  /* Stacked row template lives in ui/chat-panel.css's ≤900px block
     (auto 1fr 44vh + explicit grid-row placement) — a second template here
     always lost to its !important and misled readers. */
  #app { grid-template-columns: 1fr !important; }
  #sidebar, #wallDrawer, #inspectDrawer { order: 2; border-right: none; border-top: 1px solid var(--line); }
  #viewport { order: 1; }

  /* Comment modal must cover the whole screen on mobile, not just the 3D stage. */
  .comment-modal { position: fixed; inset: 0; z-index: 2100; }

  /* Legend/explode panel shouldn't blanket the ~420px-tall stage on mobile. */
  #legend { max-width: calc(100vw - 28px); max-height: 40%; overflow: auto; }

  /* The top-right view toolbar wraps on narrow screens; cap its reach so it can't
     extend left under the top-left "Live model" badge (they share top: 14px). */
  #toolbar { max-width: calc(100% - 172px); }
}
