/* Camera wall visualizer */
.viz-page .site-footer, .viz-page .mobile-bar, .viz-page .fab-viz, .viz-page .topbar { display: none; }
.viz-page { padding-bottom: 0 !important; background: var(--night); }
.viz-page .site-header { background: rgba(23, 16, 12, .9); backdrop-filter: blur(12px); }
.viz-page .site-header .brand-text strong { color: #fff; }
.viz-page .site-header .brand-text span { color: rgba(255, 255, 255, .6); }
.viz-page .float-stack { bottom: 150px; }

.viz { display: flex; flex-direction: column; height: calc(100svh - 76px); min-height: 520px; color: #fff; background: radial-gradient(800px 500px at 50% 30%, #2a1c15, var(--night)); }
.viz-stage { position: relative; flex: 1; overflow: hidden; touch-action: none; }
.viz video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.viz-canvas { position: absolute; display: block; border-radius: 14px; }
.viz-ov { cursor: crosshair; }
.is-editing .viz-ov { cursor: grab; }

/* Start: your room / demo rooms (TriaLook-style chooser) */
.viz-start { position: absolute; inset: 0; z-index: 10; display: flex; justify-content: center; align-items: flex-start; padding: clamp(10px, 2.5vw, 28px); background: radial-gradient(700px 420px at 50% 20%, rgba(124, 30, 36, .35), transparent), rgba(10, 6, 4, .72); overflow-y: auto; }
.vc { width: min(1180px, 100%); background: #fffdf9; color: var(--ink); border-radius: 26px; box-shadow: var(--shadow-deep); border: 1px solid var(--line-gold); overflow: hidden; margin: auto 0; }
.vc-head { display: flex; align-items: center; gap: 14px; padding: 14px clamp(14px, 2.5vw, 26px); border-bottom: 1px solid var(--line); }
.vc-back { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; color: var(--ink); border: 1px solid var(--line); flex-shrink: 0; }
.vc-back:hover { border-color: var(--gold); color: var(--maroon); }
.vc-product { display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px; border: 1px solid var(--line); border-radius: 16px; min-width: 0; background: #fff; }
.vc-product img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.vc-product b { display: block; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-product small { color: var(--ink-soft); font-size: .78rem; }
.vc-product > div { min-width: 0; }
.vc-product-generic { padding: 10px 16px; }
.vc-product-generic .icon { color: var(--gold); }
.vc-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .82rem; color: var(--maroon); background: rgba(200, 154, 60, .14); border-radius: 999px; padding: 8px 14px; white-space: nowrap; }
.vc-cols { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; }
.vc-cols.vc-single { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; }
.vc-own, .vc-demo { padding: clamp(16px, 2.5vw, 28px); }
.vc-own { border-right: 1px solid var(--line); }
.vc h1, .vc h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.1; margin: 0 0 16px; }
.vc h1 em, .vc h2 em { font-style: normal; color: var(--gold-dark, #a67c25); }
.vc h2 { color: var(--ink-soft); }
.vc-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 26px 16px; border: 2px dashed rgba(124, 30, 36, .25); border-radius: 18px; background: var(--bg); cursor: pointer; transition: border-color .2s, background .2s; color: var(--ink-soft); }
.vc-drop .icon { color: var(--maroon); margin-bottom: 6px; }
.vc-drop b { color: var(--ink); }
.vc-drop:hover, .vc-drop.over { border-color: var(--gold); background: rgba(200, 154, 60, .08); }
.vc-camera { width: 100%; margin-top: 12px; display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 0; background: var(--maroon); color: #fff; cursor: pointer; font: inherit; }
.vc-camera span { flex: 1; }
.vc-camera b { display: block; }
.vc-camera small { opacity: .8; font-size: .78rem; }
.vc-camera:hover { filter: brightness(1.08); }
.vc-qr { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding: 12px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.vc-qr img { width: 104px; height: 104px; border-radius: 8px; background: #fff; flex-shrink: 0; image-rendering: pixelated; }
.vc-qr b { display: block; margin-bottom: 2px; }
.vc-qr span, .vc-qr small { font-size: .8rem; color: var(--ink-soft); display: block; }
.vc-qr small { margin-top: 4px; font-style: italic; }
.vc-own .alert { margin-top: 12px; }
.vc-own .form-note { margin-top: 12px; }
.vc-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.vc-cats button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--ink-soft); }
.vc-cats button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.vc-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.vc-room { padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.vc-room img { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: 14px; display: block; border: 2px solid transparent; transition: transform .25s, border-color .25s, box-shadow .25s; }
.vc-room span { display: block; margin-top: 6px; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.vc-room:hover img { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 10px 24px rgba(23, 16, 12, .18); }
.vc-room[hidden] { display: none; }
@media (max-width: 860px) {
  .vc-cols { grid-template-columns: 1fr; }
  .vc-own { border-right: 0; border-bottom: 1px solid var(--line); }
  .vc-qr { display: none; }
  .vc-badge { display: none; }
  .vc-rooms { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (hover: none) and (pointer: coarse) { .vc-qr { display: none; } }

/* Walls / Floors pills over the room (tap to choose where products go) */
.viz-pills { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.viz-pill { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, .85); background: rgba(23, 16, 12, .6); color: #fff; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: background .2s, transform .2s; }
.viz-pill:hover { transform: translate(-50%, -50%) scale(1.05); }
.viz-pill.on { background: var(--gold); border-color: #fff; }
.viz-pill .tick { width: 16px; height: 16px; border-radius: 999px; background: #fff; color: var(--gold-dark, #a67c25); display: grid; place-items: center; font-size: 11px; }
.viz.show-orig .viz-pills { display: none; }

/* Room toolbar (Reset / Rotate / Grout) */
.viz-room-tools { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -4px 0 10px; flex-wrap: wrap; }
.viz-room-tools button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.viz-room-tools button:hover, .viz-room-tools button.on { background: var(--gold); border-color: var(--gold); }
.vrt-target { font-size: .8rem; color: rgba(255, 255, 255, .7); margin-right: 8px; }
.vrt-target b { color: var(--gold); }
.viz:not(.is-room) .room-only, .viz.is-room .live-only { display: none !important; }
.viz-start-card { width: min(620px, 100%); background: rgba(255, 253, 249, .97); color: var(--ink); border-radius: 28px; padding: clamp(22px, 4vw, 38px); box-shadow: var(--shadow-deep); border: 1px solid var(--line-gold); }
.viz-start-card h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 8px; }
.viz-how { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 10px; }
.viz-how li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: .92rem; }
.viz-how .icon { color: var(--maroon); margin-top: 2px; }
.viz-start-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.viz-start-actions .btn { flex: 1 1 auto; }
.viz-samples-title { font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin: 4px 0 8px; }
.viz-samples { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.viz-samples button { padding: 0; border: 2px solid transparent; border-radius: 14px; overflow: hidden; cursor: pointer; aspect-ratio: 4/3; background: var(--bg-alt); transition: border-color .2s, transform .2s; }
.viz-samples button:hover { border-color: var(--gold); transform: translateY(-2px); }
.viz-samples img { width: 100%; height: 100%; object-fit: cover; }

/* Status */
.viz-status { position: absolute; z-index: 5; top: 14px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 28px); }
.viz-status span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: rgba(23, 16, 12, .72); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(10px); font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.viz-status span::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--muted); flex-shrink: 0; }
.viz-status [data-kind="scan"]::before, .viz-status [data-kind="busy"]::before { background: var(--gold); animation: blink 1s infinite; }
.viz-status [data-kind="ok"]::before { background: #3ccf7a; }
.viz-status [data-kind="warn"]::before { background: #ffb020; }
@keyframes blink { 50% { opacity: .2; } }

/* Tools */
.viz-tools { position: absolute; z-index: 5; right: 12px; top: 60px; display: flex; flex-direction: column; gap: 8px; }
.viz-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 60px; padding: 9px 4px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(23, 16, 12, .62); color: #fff; backdrop-filter: blur(10px); cursor: pointer; font-size: .64rem; font-weight: 700; }
.viz-tool:hover { background: rgba(124, 30, 36, .8); }
.viz:not(.is-running) .viz-tools, .viz:not(.is-running) .viz-status { display: none; }
.viz:not(.is-camera) .cam-only { display: none; }
.surface-floor [data-act="surface"], .is-editing [data-act="edit"], .is-frozen [data-act="freeze"] { background: var(--gold); border-color: var(--gold); }
.viz:not(.is-running) [data-act="surface"], .viz:not(.wall-ready) [data-act="edit"], .viz:not(.wall-ready) [data-act="compare"] { opacity: .45; pointer-events: none; }

/* Panel */
.viz-panel { position: absolute; z-index: 6; right: 82px; top: 60px; width: 300px; max-height: calc(100% - 80px); overflow-y: auto; padding: 16px; border-radius: 20px; background: rgba(255, 253, 249, .97); color: var(--ink); box-shadow: var(--shadow-deep); display: none; }
.viz-panel.open { display: block; }
.viz-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.viz-panel-head .icon-btn { width: 32px; height: 32px; }
.viz-row { margin-bottom: 14px; }
.viz-row label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.viz-row output { color: var(--maroon); }
.viz-row input[type=range] { width: 100%; accent-color: var(--maroon); }
.viz-row select { width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-gold); background: #fff; }
.viz-row.checkbox label { justify-content: flex-start; gap: 8px; font-weight: 600; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 999px; border: 2px solid rgba(0, 0, 0, .12); cursor: pointer; }
.swatches button.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.viz.is-room.has-room-tile .tile-only { display: block !important; }
.viz:not(.has-tile) .tile-only, .viz:not(.has-overlay) .overlay-only, .viz:not(.is-floor) .floor-only { display: none !important; }

/* Selected chips */
.viz-selected { position: absolute; z-index: 5; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.viz-selected .sel { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-radius: 999px; background: rgba(23, 16, 12, .72); border: 1px solid rgba(255, 255, 255, .16); font-size: .78rem; backdrop-filter: blur(8px); max-width: 70vw; }
.viz-selected .sel small { color: rgba(255, 255, 255, .6); font-weight: 600; }
.viz-selected .sel b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viz-selected button { width: 22px; height: 22px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .15); color: #fff; display: grid; place-items: center; cursor: pointer; }

/* Bottom */
.viz-bottom { position: relative; z-index: 7; background: rgba(23, 16, 12, .96); border-top: 1px solid rgba(255, 255, 255, .08); }
.viz-tray { display: none; padding: 12px 14px 6px; }
.viz-tray.open { display: block; }
.viz:not(.is-running) .viz-tray { display: none; }
.viz-tray-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.viz-filters { display: flex; gap: 6px; overflow-x: auto; }
.viz-filters button { padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: transparent; color: rgba(255, 255, 255, .8); font-weight: 600; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.viz-filters button.on { background: var(--gold); border-color: var(--gold); color: #fff; }
.viz-tray-head input { width: 160px; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #fff; }
.viz-tray-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.tray-item { flex: 0 0 96px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; padding: 0; background: none; border: 0; color: #fff; cursor: pointer; text-align: left; }
.tray-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 2px solid transparent; background: #3a2a21; }
.tray-item.on img { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 154, 60, .35); }
.tray-item span { font-size: .74rem; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tray-item small { font-size: .66rem; color: rgba(255, 255, 255, .55); }
.tray-empty { color: rgba(255, 255, 255, .6); font-size: .85rem; padding: 10px; }
.viz-actions { display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); overflow-x: auto; }
.viz-actions .btn { flex: 1 0 auto; }
.viz-actions .btn-outline { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .18); }
.viz:not(.is-running) .viz-actions { display: none; }
.viz:not(.wall-ready) [data-act="capture"], .viz:not(.wall-ready) [data-act="send"] { opacity: .5; pointer-events: none; }

@media (max-width: 640px) {
  .viz { height: calc(100svh - 62px); }
  .viz-tools { top: 56px; right: 8px; }
  .viz-tool { width: 52px; font-size: .6rem; }
  .viz-panel { left: 10px; right: 70px; width: auto; top: 56px; }
  .viz-tray-head input { width: 110px; }
  .viz-actions .btn { padding: 9px 12px; font-size: .78rem; }
  .viz-page .float-stack { display: none; }
}
