:root {
  color-scheme: dark;
  --bg: #14120f;
  --panel: rgba(22, 20, 17, .90);
  --panel-2: rgba(42, 37, 31, .94);
  --line: rgba(255,255,255,.14);
  --text: #f4f0e8;
  --muted: #aaa397;
  --gold: #d4a64d;
  --cyan: #56d8e6;
  --danger: #e27a6d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); }
button, input, select { font: inherit; }
button, .button-like, .upload-button { -webkit-tap-highlight-color: transparent; }
#app { width: 100%; height: 100%; position: relative; background: #0d0c0a; }
.topbar { position: absolute; z-index: 20; top: 0; left: 0; right: 0; height: calc(72px + var(--safe-top)); padding: calc(12px + var(--safe-top)) calc(18px + var(--safe-right)) 10px calc(18px + var(--safe-left)); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(to bottom, rgba(12,11,9,.93), rgba(12,11,9,.36), transparent); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.eyebrow { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .19em; }
h1 { margin: 2px 0 0; font-size: 19px; font-weight: 600; letter-spacing: .01em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.badge { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(0,0,0,.35); font-size: 11px; }
.icon-button { width: 38px; height: 38px; border-radius: 50%; font-size: 18px; }
#viewport { position: absolute; inset: 0; }
#stage { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.panel { position: absolute; z-index: 15; top: calc(84px + var(--safe-top)); bottom: calc(18px + var(--safe-bottom)); width: min(292px, 31vw); overflow: auto; overscroll-behavior: contain; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 15px 44px rgba(0,0,0,.30); backdrop-filter: blur(16px); transition: transform .25s ease, opacity .25s ease; }
.left-panel { left: calc(14px + var(--safe-left)); }
.right-panel { right: calc(14px + var(--safe-right)); }
.ui-hidden .left-panel { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.ui-hidden .right-panel { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.panel section + section { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
h2 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .13em; color: var(--muted); }
button, .button-like, .upload-button { display: flex; align-items: center; justify-content: center; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: rgba(255,255,255,.055); cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
button:active, .button-like:active, .upload-button:active { transform: scale(.985); }
button:hover, .button-like:hover, .upload-button:hover { border-color: rgba(255,255,255,.30); background: rgba(255,255,255,.09); }
button.active, button.primary { border-color: rgba(212,166,77,.74); background: rgba(212,166,77,.20); }
button.danger { color: #ffc7c0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 10px; background: rgba(0,0,0,.25); }
.segmented button { min-height: 34px; border-color: transparent; }
.environment-card { display: grid; gap: 3px; margin-bottom: 10px; padding: 10px 11px; border: 1px solid rgba(212,166,77,.28); border-radius: 9px; background: linear-gradient(145deg, rgba(212,166,77,.15), rgba(255,255,255,.035)); }
.environment-card strong { color: #f7e7c1; }
.environment-card span, .panel-note { color: var(--muted); font-size: 11px; }
.panel-note { margin: 8px 1px 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--text); }
.switch-row input { width: 20px; height: 20px; accent-color: var(--gold); }
.button-grid { display: grid; gap: 7px; }
.button-grid.two { grid-template-columns: 1fr 1fr; }
.span-two { grid-column: 1 / -1; }
.surface-list { display: grid; gap: 7px; }
.surface-button { justify-content: space-between; padding: 7px 10px; }
.surface-button small { color: var(--muted); }
.surface-button.active { border-color: var(--cyan); box-shadow: inset 3px 0 0 var(--cyan); }
.readout { margin-top: 9px; color: var(--muted); font-size: 12px; }
.artwork-library { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.art-card { aspect-ratio: 1; min-height: 0; padding: 4px; overflow: hidden; border-radius: 7px; position: relative; }
.art-card canvas, .art-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; }
.art-card.active { border-color: var(--gold); outline: 1px solid var(--gold); }
.art-card.multi-selected { border-color: rgba(86,216,230,.78); box-shadow: inset 0 0 0 1px rgba(86,216,230,.38); }
.art-card.multi-selected::before { content: '✓'; position: absolute; z-index: 3; right: 6px; top: 6px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(8,18,20,.88); color: var(--cyan); border: 1px solid rgba(86,216,230,.72); font-size: 12px; font-weight: 800; pointer-events: none; }
.art-card.active.multi-selected { border-color: var(--gold); outline: 1px solid var(--gold); }
.art-card::after { content: attr(data-short-title); position: absolute; left: 5px; right: 5px; bottom: 5px; padding: 10px 4px 3px; color: rgba(255,255,255,.82); font-size: 8px; line-height: 1.1; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.72)); pointer-events: none; }
.upload-button, .button-like { margin-top: 8px; }
.upload-button input, .button-like input { display: none; }
.selection-tools { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; margin-top: 8px; }
.selection-tools span { color: var(--muted); font-size: 11px; }
.selection-tools button { min-height: 30px; padding: 4px 8px; font-size: 10px; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.field.compact { margin-top: 10px; }
.field input[type="number"], .field select { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: rgba(0,0,0,.28); }
.field input[type="range"] { width: 100%; accent-color: var(--gold); }
.measurement-row { display: flex; justify-content: space-between; padding: 8px 1px 11px; color: var(--muted); font-size: 12px; }
.measurement-row strong { color: var(--text); }
.placement-list { display: grid; gap: 5px; margin-top: 10px; max-height: 150px; overflow: auto; }
.placement-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px; padding: 7px 8px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: rgba(0,0,0,.18); cursor: pointer; }
.placement-row.active { color: var(--text); border-color: var(--gold); }
.placement-row small { color: var(--muted); }
.loading-card { position: absolute; z-index: 30; left: 50%; top: 50%; transform: translate(-50%,-50%); min-width: 245px; display: grid; justify-items: center; gap: 8px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: rgba(15,14,12,.92); backdrop-filter: blur(14px); }
.loading-card.hidden { display: none; }
.loading-card span { color: var(--muted); font-size: 12px; }
.spinner { width: 26px; height: 26px; border: 2px solid rgba(255,255,255,.16); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: absolute; z-index: 25; left: 50%; bottom: calc(28px + var(--safe-bottom)); transform: translate(-50%, 15px); opacity: 0; pointer-events: none; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(12,11,10,.9); transition: opacity .2s, transform .2s; white-space: nowrap; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.instructions { position: absolute; z-index: 8; left: 50%; bottom: calc(12px + var(--safe-bottom)); transform: translateX(-50%); color: rgba(255,255,255,.58); font-size: 11px; text-shadow: 0 1px 3px #000; pointer-events: none; white-space: nowrap; }
.hidden { display: none !important; }

.walk-mode .panel { opacity: 0; pointer-events: none; }
.walk-mode .topbar { background: linear-gradient(to bottom, rgba(12,11,9,.72), transparent); }
.walk-hud { position: absolute; z-index: 17; inset: 0; pointer-events: none; }
.touch-pad { position: absolute; bottom: calc(20px + var(--safe-bottom)); width: 132px; height: 132px; border: 1px solid rgba(255,255,255,.20); border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.10), rgba(0,0,0,.18)); color: rgba(255,255,255,.48); font-size: 10px; letter-spacing: .15em; display: grid; place-items: center; pointer-events: auto; touch-action: none; user-select: none; backdrop-filter: blur(5px); }
.move-pad { left: calc(26px + var(--safe-left)); }
.look-pad { right: calc(26px + var(--safe-right)); }
.move-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border: 1px solid rgba(255,255,255,.36); border-radius: 50%; background: rgba(255,255,255,.16); box-shadow: 0 3px 15px rgba(0,0,0,.25); transform: translate(0,0); }
.walk-exit { position: absolute; left: 50%; bottom: calc(28px + var(--safe-bottom)); transform: translateX(-50%); min-width: 132px; pointer-events: auto; background: rgba(20,18,15,.76); backdrop-filter: blur(9px); }

@media (max-width: 900px) {
  .panel { width: min(260px, 34vw); padding: 11px; }
  .left-panel { left: calc(8px + var(--safe-left)); }
  .right-panel { right: calc(8px + var(--safe-right)); }
  .artwork-library { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 650px), (orientation: portrait) {
  .panel { top: auto; bottom: calc(8px + var(--safe-bottom)); width: calc(50% - 12px - var(--safe-left)); max-height: 48vh; border-radius: 12px; }
  .left-panel { left: calc(8px + var(--safe-left)); }
  .right-panel { right: calc(8px + var(--safe-right)); }
  h1 { font-size: 16px; }
  .instructions { display: none; }
  .touch-pad { width: 108px; height: 108px; }
  .move-knob { width: 44px; height: 44px; margin: -22px; }
}

/* v0.4 curator wall identification + debugger */
.wall-label-layer { position:absolute; inset:0; z-index:12; pointer-events:none; overflow:hidden; }
.wall-label { position:absolute; transform:translate(-50%,-50%); display:flex; align-items:center; gap:7px; padding:6px 9px; border:1px solid rgba(86,216,230,.58); border-radius:999px; background:rgba(8,12,13,.74); color:#eafcff; box-shadow:0 5px 18px rgba(0,0,0,.24); backdrop-filter:blur(7px); pointer-events:auto; cursor:pointer; white-space:nowrap; font-size:10px; letter-spacing:.02em; transition:opacity .15s, border-color .15s, background .15s, transform .15s; }
.wall-label strong { color:var(--cyan); font-size:10px; letter-spacing:.12em; }
.wall-label span { color:#e7e0d6; }
.wall-label.selected { border-color:var(--gold); background:rgba(49,35,14,.82); transform:translate(-50%,-50%) scale(1.06); }
.wall-label.selected strong { color:#ffd178; }
.wall-label.occupied::after { content:'•'; color:#8ee6b6; margin-left:1px; font-size:14px; line-height:8px; }
.wall-label.occluded { opacity:.22; }
.walk-mode .wall-label-layer, .ui-hidden .wall-label-layer { display:none; }
.surface-button .surface-code { color:var(--cyan); font-weight:700; letter-spacing:.08em; min-width:31px; }
.surface-button .surface-meta { display:grid; justify-items:end; line-height:1.15; }
.surface-button.occupied { border-color:rgba(116,216,159,.35); }
.surface-button.occupied .surface-status { color:#8ee6b6; }
.debug-state { margin-bottom:7px; padding:8px; border:1px solid var(--line); border-radius:7px; color:#d9d1c4; background:rgba(0,0,0,.22); font:10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; white-space:pre-wrap; }
.debug-log { margin:0 0 8px; padding:8px; max-height:185px; overflow:auto; border:1px solid var(--line); border-radius:7px; color:#9fe4ed; background:rgba(0,0,0,.38); font:9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space:pre-wrap; }
.loading-card.load-error { border-color: rgba(226,122,109,.65); }
.loading-card.load-error .spinner { animation: none; border-color: rgba(226,122,109,.35); border-top-color: var(--danger); }


/* Venue 002 v0.2 — museum expansion */
.bookmark-heading { margin: 11px 0 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.bookmark-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bookmark-button { min-height: 48px; display: grid; justify-items: start; align-content: center; padding: 7px 9px; text-align: left; }
.bookmark-button strong { font-size: 10px; font-weight: 600; color: var(--text); line-height: 1.2; }
.bookmark-button small { margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.1; }
.full-button { width: 100%; margin-top: 7px; }
.surface-room { border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: rgba(0,0,0,.12); overflow: hidden; }
.surface-room + .surface-room { margin-top: 7px; }
.surface-room summary { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:8px 9px; cursor:pointer; color:#e8e2d8; font-size:10px; letter-spacing:.035em; user-select:none; }
.surface-room summary small { color:var(--muted); font-size:8px; white-space:nowrap; }
.surface-room-list { display:grid; gap:5px; padding:0 6px 6px; }
.surface-room .surface-button { min-height:42px; font-size:10px; }
.surface-room .surface-button > span:nth-child(2) { flex:1; text-align:left; padding:0 6px; line-height:1.15; }

/* Venue 002 v0.2.1 — orientation & atmosphere */
.room-badge {
  position:absolute; z-index:11; left:50%; top:calc(78px + var(--safe-top));
  transform:translateX(-50%); padding:6px 11px; border:1px solid rgba(255,255,255,.16);
  border-radius:999px; background:rgba(16,15,13,.58); color:rgba(246,242,235,.84);
  font-size:10px; letter-spacing:.08em; text-transform:uppercase; backdrop-filter:blur(10px);
  pointer-events:none; transition:opacity .18s ease;
}
.ui-hidden .room-badge { opacity:.62; }
.walk-plan {
  position:absolute; left:50%; bottom:calc(76px + var(--safe-bottom)); transform:translateX(-50%);
  min-width:98px; pointer-events:auto; background:rgba(20,18,15,.76); backdrop-filter:blur(9px);
}
.plan-button { border-color:rgba(86,216,230,.28); }
.plan-overlay {
  position:absolute; z-index:40; inset:0; display:grid; place-items:center;
  padding:calc(24px + var(--safe-top)) calc(18px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(18px + var(--safe-left));
  background:rgba(8,8,7,.72); backdrop-filter:blur(16px); pointer-events:auto;
}
.plan-card {
  width:min(620px,92vw); height:min(790px,88vh); min-height:520px; display:grid;
  grid-template-rows:auto auto minmax(0,1fr) auto; gap:10px; padding:15px;
  border:1px solid rgba(255,255,255,.17); border-radius:16px; background:rgba(24,22,19,.96);
  box-shadow:0 24px 70px rgba(0,0,0,.48);
}
.plan-header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.plan-header strong { display:block; margin-top:2px; font-size:18px; font-weight:600; }
.plan-help { color:var(--muted); font-size:11px; }
.top-plan-svg { width:100%; height:100%; min-height:0; border:1px solid rgba(255,255,255,.08); border-radius:11px; background:#cbc5b9; touch-action:manipulation; }
.plan-room { cursor:pointer; transition:filter .15s ease, opacity .15s ease; }
.plan-room:hover { filter:brightness(1.04); }
.plan-room-shape { stroke:#706a60; stroke-width:2; vector-effect:non-scaling-stroke; }
.plan-room.current .plan-room-shape { stroke:#d5a64f; stroke-width:5; }
.plan-room text { fill:#3d3933; font-size:12px; font-weight:700; text-anchor:middle; dominant-baseline:middle; pointer-events:none; letter-spacing:.025em; }
.plan-room .plan-subtitle { font-size:8px; font-weight:500; fill:#6b655b; }
.plan-window { stroke:#6da8bb; stroke-width:7; stroke-linecap:round; vector-effect:non-scaling-stroke; }
#planVisitorDot { fill:#d5a64f; stroke:#fff4d3; stroke-width:3; vector-effect:non-scaling-stroke; }
#planVisitorArrow { fill:none; stroke:#5d331b; stroke-width:5; stroke-linecap:round; vector-effect:non-scaling-stroke; }
.plan-art-dot { fill:#6e8f78; opacity:.85; }
.plan-legend { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; color:var(--muted); font-size:9px; }
.plan-legend span { display:flex; align-items:center; gap:5px; }
.plan-legend i { width:12px; height:4px; display:inline-block; border-radius:4px; }
.legend-current { background:#d5a64f; }
.legend-window { background:#6da8bb; }
.walk-mode .room-badge { top:calc(70px + var(--safe-top)); }
@media (max-width:650px), (orientation:portrait) {
  .room-badge { top:calc(66px + var(--safe-top)); max-width:70vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .plan-card { width:96vw; height:86vh; padding:11px; }
  .walk-plan { bottom:calc(69px + var(--safe-bottom)); }
}

/* v0.2.4 bird-eye curator editing */
.navigation-tools { margin-top:10px; }
.navigation-tools button { min-height:42px; }

/* Venue 002 v0.2.6 — Curator Precision */
.fov-presets { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; margin-bottom:6px; }
.fov-presets button { min-height:30px; padding:5px 6px; font-size:9px; }
.fov-presets button.active { border-color:var(--gold); color:#ffe2a1; background:rgba(112,78,22,.28); }
.compact-row { padding:4px 1px 0; }
.surface-lock-toolbar { display:grid; grid-template-columns:1fr 1fr 1fr; gap:5px; margin-bottom:7px; }
.surface-lock-toolbar button { min-height:32px; padding:5px 6px; font-size:9px; }
.surface-row { display:grid; grid-template-columns:minmax(0,1fr) 34px; gap:4px; align-items:stretch; }
.surface-row .surface-button { width:100%; }
.surface-lock-button { min-width:34px; padding:0; display:grid; place-items:center; font-size:15px; border-color:rgba(255,255,255,.09); }
.surface-lock-button:disabled { opacity:.28; }
.surface-lock-button.locked { border-color:rgba(143,182,255,.55); background:rgba(55,82,126,.25); }
.surface-lock-button.partial { color:#c7d7ff; }
.placement-row.locked { border-color:rgba(143,182,255,.28); }
#wallElevationBtn.active { border-color:var(--cyan); color:#dffcff; background:rgba(40,105,114,.2); }

/* v0.2.7 Exhibition Environment */
.environment-editor{margin-top:14px;padding-top:12px;border-top:1px solid rgba(90,80,65,.14)}
.environment-editor .field{margin-top:8px}
.environment-editor select{width:100%}


/* v0.3.0 Arrival Atrium + Curator Navigation */
.curator-hud{position:absolute;z-index:16;inset:0;pointer-events:none}
.curator-move-pad{left:calc(282px + var(--safe-left));bottom:calc(20px + var(--safe-bottom));opacity:.72}
.curator-look-pad{right:calc(282px + var(--safe-right));bottom:calc(20px + var(--safe-bottom));opacity:.72}
.curator-key-hint{position:absolute;left:50%;bottom:calc(17px + var(--safe-bottom));transform:translateX(-50%);padding:6px 10px;border-radius:999px;background:rgba(10,10,9,.55);color:rgba(255,255,255,.58);font-size:9px;letter-spacing:.04em;backdrop-filter:blur(6px)}
.walk-mode .curator-hud,.ui-hidden .curator-hud{display:none}
@media(max-width:900px){.curator-move-pad{left:calc(268px + var(--safe-left))}.curator-look-pad{right:calc(268px + var(--safe-right))}.curator-key-hint{display:none}}
@media(max-width:650px),(orientation:portrait){.curator-move-pad{left:calc(52% + var(--safe-left));transform:translateX(-50%)}.curator-look-pad{right:calc(52% + var(--safe-right));transform:translateX(50%)}}

.camera-diagnostic{margin:.35rem 0 .7rem;padding:.45rem .55rem;border:1px solid rgba(255,255,255,.12);border-radius:7px;font-size:.72rem;line-height:1.35;color:var(--muted,#b9b7b0);font-variant-numeric:tabular-nums;background:rgba(0,0,0,.12)}

/* v0.4.0 — ART Gallery Museum / multi-exhibition web publishing */
.published-exhibition-controls{display:flex;align-items:center;gap:6px;padding:4px;border:1px solid rgba(255,255,255,.11);border-radius:9px;background:rgba(0,0,0,.28)}
.published-exhibition-controls select{max-width:220px;min-height:30px;padding:4px 8px;border:1px solid var(--line);border-radius:7px;color:var(--text);background:rgba(18,17,15,.94)}
.published-exhibition-controls button{min-height:30px;padding:4px 10px}
.field input[type="text"]{width:100%;min-height:38px;padding:7px 10px;border:1px solid var(--line);border-radius:8px;color:var(--text);background:rgba(0,0,0,.28)}
.web-export-status{margin-top:8px;padding:8px 9px;border:1px solid rgba(255,255,255,.08);border-radius:8px;background:rgba(0,0,0,.13);color:var(--muted);font-size:11px}
.web-export-status.ready{border-color:rgba(88,190,145,.34);color:#c5ead9}
.web-export-status.warning{border-color:rgba(212,166,77,.42);color:#f0d69e}
@media (max-width:900px){
  .published-exhibition-controls{display:none}
}

/* ART Gallery Museum v0.4.0.1 — public visitor + navigation refinement */
.public-visitor .panel,
.public-visitor #toggleUiBtn,
.public-visitor .walk-exit,
.public-visitor #curatorHud,
.public-visitor #curatorInstructions,
.public-visitor #wallLabels,
.public-visitor #debugPanel { display:none !important; }
.public-visitor .topbar { background:linear-gradient(to bottom,rgba(12,11,9,.60),rgba(12,11,9,.18),transparent); }
.public-visitor .top-actions,
.public-visitor .eyebrow { display:none !important; }
.public-visitor #stage { cursor:grab; }
.public-visitor #stage:active { cursor:grabbing; }
.walk-mode #stage { cursor:grab; }
.walk-mode #stage:active { cursor:grabbing; }
