/* 3D configuration inherits the app's Archivo, graphite and violet controls. */
.r3d-room-type { border: 0; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.r3d-room-type legend { font-size: 13px; color: var(--muted); padding: 0 0 10px; }
.r3d-room-type label { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border-radius: 12px; cursor: pointer; }
.r3d-room-type label:has(input:checked) { background: rgba(145,101,255,.17); outline: 1px solid var(--violet); }
.r3d-room-type input { width: 18px; height: 18px; accent-color: var(--violet); }
.r3d-room-type strong, .r3d-room-type small { display: block; }
.r3d-room-type small { margin-top: 4px; font-size: 12px; color: var(--muted); }
.r3d-create-sizes { margin: 16px 0; }
.r3d-dimensions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.r3d-dimensions label { min-width: 0; font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.r3d-dimensions input { min-width: 0; width: 100%; }
.r3d-config { position: fixed; inset: 0; margin: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; padding: 0; border: 0; border-radius: 0; color: var(--text,#f5f7ff); background: var(--bg,#090b12); overflow: hidden; }
.r3d-config[open] { display: grid; grid-template-rows: 72px minmax(0,1fr); }
.r3d-config::backdrop { background: #090b12; }
.r3d-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--edge); }
.r3d-header h1 { font-size: 1.35rem; font-weight: 620; letter-spacing: -.025em; margin: 0; }
.r3d-body { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 336px; }
.r3d-preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 22px; margin: 0; }
.r3d-stage { position: relative; flex: 1; min-height: 220px; border-radius: 16px; overflow: hidden; background: #0d111c; }
.r3d-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.r3d-stage canvas:active { cursor: grabbing; }
.r3d-stage canvas:focus-visible { outline-offset: -5px; }
.r3d-status { position: absolute; left: 20px; right: 20px; bottom: 20px; text-align: center; background: #111522; border-radius: 8px; padding: 12px; color: #a6afc2; font-size: 14px; }
.r3d-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 16px; }
.r3d-toolbar p { margin: 0 auto 0 0; font-size: 12px; color: var(--muted); }
.r3d-inspector { overflow: auto; padding: 0 22px 24px; background: var(--sidebar,#111522); scrollbar-color: #4b5367 #111522; }
.r3d-section { border-bottom: 1px solid var(--edge); padding: 22px 0; margin: 0; }
.r3d-section:last-child { border-bottom: 0; }
.r3d-section h2 { font-size: 15px; font-weight: 620; letter-spacing: -.01em; margin: 0 0 16px; }
.r3d-section .hint { font-size: 12px; line-height: 1.6; margin: 8px 0 14px; color: #a6afc2; }
.r3d-field { display: grid; gap: 7px; font-size: 12px; color: #a6afc2; margin-bottom: 14px; }
.r3d-field input:not([type=color]), .r3d-field select { width: 100%; min-width: 0; min-height: 40px; font-variant-numeric: tabular-nums; }
.r3d-field input[type=color] { width: 100%; height: 44px; padding: 4px; background: #090b12; border: 1px solid var(--edge); border-radius: 8px; }
.r3d-inspector input, .r3d-inspector select { background: var(--well,#090b12); color: #f5f7ff; border: 1px solid var(--edge-strong); border-radius: 8px; padding: 9px; font: inherit; caret-color: #b9a2ff; }
.r3d-item-list { display: grid; gap: 4px; margin-bottom: 12px; max-height: 260px; overflow: auto; }
.r3d-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; text-align: left; padding: 9px; background: transparent; border: 0; border-radius: 8px; }
.r3d-item:hover { background: rgba(255,255,255,.06); }
.r3d-item[aria-pressed=true] { background: rgba(145,101,255,.18); }
.r3d-item strong { font-size: 13px; font-weight: 550; }
.r3d-item small { font-size: 12px; color: #a6afc2; }
.r3d-add { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.r3d-add select { min-width: 0; font-size: 12px; }
.r3d-add button { font-size: 12px; white-space: nowrap; }
.r3d-handles { position: absolute; inset: 0; pointer-events: none; }
.r3d-handle { pointer-events: auto; position: absolute; width: 28px; min-height: 28px; height: 28px; border-radius: 50%; padding: 0; border: 1px solid var(--violet-ink); color: white; background: #191e2c; transform: translate(-50%,-50%); touch-action: none; cursor: move; }
.r3d-handle[aria-pressed=true] { background: rgba(145,101,255,.22); border-color: #b9a2ff; outline: 2px solid #b9a2ff; outline-offset: 3px; }
.r3d-handle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; margin: auto; display: block; }
.r3d-handle::after { content: ''; position: absolute; inset: -8px; }
.room3d-live { position: absolute; inset: 0; z-index: 1; background: #0d111c; }
.room3d-tile-source { position: fixed; left: -10000px; top: 0; width: 320px; height: 180px; visibility: hidden; pointer-events: none; }
.tile-photo canvas.tile-3d { display: block; width: 100%; height: 100%; object-fit: cover; background: #0d111c; }
.room-tile.off .tile-photo canvas.tile-3d { filter: grayscale(.7) brightness(.45); }
.room3d-live canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.room3d-view-tools { position: absolute; bottom: 54px; left: 18px; right: 18px; display: flex; justify-content: center; gap: 8px; }
.room3d-view-tools button { font-size: 12px; min-height: 40px; padding: 8px 12px; border-radius: 8px; background: #191e2c; color: #f5f7ff; border: 1px solid var(--edge-strong); }
.room3d-live > p { position: absolute; bottom: 18px; left: 18px; right: 18px; font-size: 12px; text-align: center; color: #a6afc2; margin: 0; pointer-events: none; }
@media (max-width:760px) {
  .r3d-config[open] { grid-template-rows: auto minmax(0,1fr); }
  .r3d-header { padding: 12px 14px; gap: 12px; flex-wrap: wrap; }
  .r3d-header h1 { font-size: 1.15rem; }
  .r3d-header .row { margin-left: auto; }
  .r3d-header button, .r3d-inspector button.small, .r3d-add select { min-height: 44px; }
  .r3d-body { display: block; overflow: auto; }
  .r3d-preview { padding: 12px; }
  .r3d-stage { flex: none; height: 340px; }
  .r3d-toolbar { justify-content: center; gap: 6px; padding-top: 12px; }
  .r3d-toolbar p { width: 100%; margin: 0 0 4px; text-align: center; }
  .r3d-toolbar button { min-height: 44px; }
  .r3d-inspector { overflow: visible; padding: 0 20px 20px; }
  .r3d-field input:not([type=color]),.r3d-field select { min-height: 44px; font-size: 16px; }
  .r3d-handle { min-height: 32px; width: 32px; height: 32px; }
  .r3d-item { min-height: 48px; }
  body:has(.room3d-live) { --stage-h: clamp(280px, calc((100vw - 20px) * .5625 + 76px), 54svh); }
  .room3d-live { display: grid; grid-template-rows: minmax(0,1fr) auto auto; }
  .room3d-live canvas { min-height: 0; }
  .room3d-view-tools { position: static; gap: 5px; padding: 0 10px 8px; }
  .room3d-view-tools button { font-size: 12px; padding: 6px 9px; min-height: 44px; }
  .room3d-live > p { position: static; padding: 0 10px 10px; }
}
@media (prefers-reduced-motion:reduce) { .r3d-config *, .room3d-live * { transition: none !important; animation: none !important; } }

/* The designer: floors, stairs, openings, reference pictures, the 2D plan and projects */
.r3d-stage canvas[hidden] { display: none; }
.r3d-stage canvas.r3d-plan { cursor: default; background: #0d111c; }
.r3d-stage canvas.r3d-plan:focus-visible { outline: 2px solid #b9a2ff; outline-offset: -4px; }
.r3d-plan-live { position: absolute; left: 12px; bottom: 10px; max-width: calc(100% - 24px); margin: 0; padding: 4px 8px; border-radius: 6px; font-size: 12px; color: #c9d0df; background: rgba(13,17,28,.82); pointer-events: none; }
.r3d-plan-live:empty { display: none; }
.r3d-viewbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 0 0 12px; }
.r3d-segment { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--well,#090b12); border: 1px solid var(--edge); }
.r3d-segment button { border: 0; min-height: 36px; }
.r3d-segment button[aria-pressed=true] { background: rgba(145,101,255,.28); color: #fff; }
.r3d-segment button[aria-disabled=true] { opacity: .45; }
.r3d-floor-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #a6afc2; }
.r3d-floor-pick select { min-height: 36px; background: var(--well,#090b12); color: #f5f7ff; border: 1px solid var(--edge-strong); border-radius: 8px; padding: 6px 8px; font: inherit; }
.r3d-viewbar .row { display: inline-flex; gap: 6px; }
.r3d-quality { font-size: 12px; color: #e0b25a; margin-left: auto; }
.r3d-quality:empty { display: none; }
.r3d-plan-tools { display: inline-flex; gap: 6px; }
.r3d-plan-tools[hidden], .r3d-toolbar > button[hidden] { display: none; }
.r3d-floor { display: grid; gap: 4px; padding: 0 0 14px; margin: 0 0 14px; border-bottom: 1px solid var(--edge); }
.r3d-floor:last-of-type { border-bottom: 0; }
.r3d-two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.r3d-measure { color: #c9d0df; }
.r3d-project { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.r3d-inspector h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.r3d-backup { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--edge); }
.r3d-backup small { display: block; font-size: 12px; color: #a6afc2; }
@media (max-width:760px) {
  .r3d-viewbar { padding-bottom: 8px; }
  .r3d-viewbar select, .r3d-viewbar button, .r3d-segment button { min-height: 44px; }
  .r3d-quality { margin-left: 0; width: 100%; }
  .r3d-backup { grid-template-columns: 1fr 1fr; }
  .r3d-backup > div { grid-column: 1 / -1; }
  .r3d-plan-tools button { min-height: 44px; }
}
