/* ————————————————————————————————————————————————
   Wallerie — your wall, curated
   Type: Fraunces (display) · Inter (UI)
   ———————————————————————————————————————————————— */

:root {
  --paper: #f3eee3;
  --panel: #fbf8f1;
  --line: #e3dbc9;
  --line-soft: #ebe4d4;
  --ink: #22201b;
  --ink-soft: #4a463d;
  --muted: #8b8371;
  --accent: #bc5433;
  --accent-deep: #9c4224;
  --brass: #a98c57;
  --radius: 12px;
  --shadow-frame: 0 1px 2px rgba(30, 26, 18, 0.22), 0 10px 22px -8px rgba(30, 26, 18, 0.35);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: inherit; }
input[type="number"] {
  width: 52px;
  padding: 5px 2px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
input[type="number"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ————— Top bar ————— */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 22px;
  height: 62px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 40;
}

.brand { display: flex; align-items: baseline; gap: 12px; min-width: max-content; }

.wordmark {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 560;
  font-size: 27px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 40;
  display: inline-flex;
  align-items: center;
}

.wordmark .dot {
  color: var(--brass);
  font-style: normal;
  margin-left: 1px;
}

.tagline {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.layouts {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.layouts-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-right: 3px;
}

.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--ink); background: var(--ink); color: var(--panel); }
.chip:active { transform: scale(0.97); }
.chip.active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip-badge { font-size: 10.5px; opacity: 0.75; font-variant-numeric: tabular-nums; }

.top-actions { min-width: max-content; display: flex; align-items: center; gap: 9px; }

.btn-ink {
  background: var(--ink);
  color: var(--panel);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-ink:hover { background: var(--accent); }
.btn-ink .star { color: var(--brass); font-size: 14px; }
.btn-ink:hover .star { color: #fff; }

.btn-ghost {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.btn-ghost:hover { border-color: var(--ink); }

/* ————— Layout ————— */

main {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: 0;
}

.rail {
  padding: 16px 14px 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
}

.panel h2 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 17px;
  letter-spacing: 0.005em;
  margin-bottom: 8px;
}

.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin-bottom: 12px; }
.hint strong { color: var(--ink-soft); font-weight: 600; }

/* preset chips */

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 2px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  transition: all 0.14s ease;
}
.preset:hover { border-color: var(--accent); background: #fff; transform: translateY(-1px); }
.preset:active { transform: translateY(0); }

.preset-rect {
  background: var(--paper);
  border: 1.5px solid var(--ink-soft);
  border-radius: 1.5px;
  box-shadow: 1px 1.5px 0 rgba(30, 26, 18, 0.18);
}
.preset span { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

.custom-size {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 13px;
}
.custom-size .x, .frame-bar .x { color: var(--muted); font-size: 12px; }
.custom-size .unit, .frame-bar .unit { color: var(--muted); font-size: 11px; margin-right: 2px; }
.custom-size .btn-ghost { margin-left: auto; }

.finish-row { display: flex; align-items: center; gap: 10px; }

.mini-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
}

.finishes { display: flex; gap: 6px; }

.finish {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(30, 26, 18, 0.14);
  transition: transform 0.12s ease;
  position: relative;
}
.finish:hover { transform: scale(1.12); }
.finish.selected { border-color: var(--accent); box-shadow: none; }

.finish[data-finish="black"] { background: #1d1b18; }
.finish[data-finish="white"] { background: #f8f6ef; }
.finish[data-finish="oak"] { background: linear-gradient(135deg, #cfa76f, #b8905a); }
.finish[data-finish="walnut"] { background: linear-gradient(135deg, #6b4c35, #533a28); }
.finish[data-finish="brass"] { background: linear-gradient(135deg, #cbb078, #a4844b 60%, #c3a76e); }

/* photos */

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fdf6f2; }
.dropzone .privacy {
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tray-actions { display: flex; gap: 7px; margin: 10px 0; }
.tray-actions .btn-ghost { flex: 1; padding: 7px 4px; }

.tray {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  border: 1px solid var(--line-soft);
  transition: all 0.13s ease;
  touch-action: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumb:hover { transform: scale(1.05); box-shadow: 0 3px 10px -2px rgba(30, 26, 18, 0.3); }
.thumb-x {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(34, 32, 27, 0.82);
  color: #f6f2ea;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 2;
  padding: 0;
}
.thumb:hover .thumb-x { opacity: 1; }
.thumb-x:hover { background: var(--accent); }

.thumb.used::after {
  content: "";
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}
.thumb.used img { opacity: 0.55; }
.thumb.armed { outline: 2.5px solid var(--accent); outline-offset: 1px; }

.drag-ghost {
  position: fixed;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 10px 28px -6px rgba(30, 26, 18, 0.5);
  transform: translate(-50%, -60%) rotate(-3deg);
  opacity: 0.94;
}
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; }

/* ————— Stage ————— */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-width: 0;
  min-height: 0;
  overflow: hidden; /* the wall may zoom past the stage when framing a cluster */
}

.frame-bar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 18px -6px rgba(30, 26, 18, 0.18);
  z-index: 30;
}

.frame-bar { bottom: 34px; left: 50%; transform: translateX(-50%); }
.frame-bar[hidden] { display: none; }

.sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }

.toggle {
  white-space: nowrap;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 0.13s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.toggle:hover { border-color: var(--line); background: #fff; }
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.toggle.danger:hover { color: var(--accent-deep); border-color: var(--accent); }

.wall-swatches { display: flex; gap: 5px; }
.wall-swatch {
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(30, 26, 18, 0.14);
  transition: transform 0.12s ease;
}
.wall-swatch:hover { transform: scale(1.15); }
.wall-swatch.selected { border-color: var(--accent); box-shadow: none; }

/* wall */

.wall-area {
  position: relative;
  filter: drop-shadow(0 24px 40px rgba(30, 26, 18, 0.22));
}

.wall {
  position: relative;
  background: var(--wall-color, #f6f2ea);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
  transition: background 0.3s ease;
}

.wall-texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 90px rgba(30, 26, 18, 0.09), inset 0 -2px 0 rgba(30, 26, 18, 0.08);
}

.floor {
  height: 34px;
  background:
    repeating-linear-gradient(90deg, transparent 0 88px, rgba(30, 26, 18, 0.07) 88px 89px),
    linear-gradient(180deg, #cdb38b, #bfa47c);
  box-shadow: inset 0 3px 5px -2px rgba(30, 26, 18, 0.35);
}

.eyeline {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 65%, transparent);
  z-index: 1;
  pointer-events: none;
}
.eyeline span {
  position: absolute;
  right: 8px; top: 3px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.85;
}

/* furniture scenes — flat, cm-true, adaptive shadows */

.scene {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 6; /* furniture stands in front of whatever hangs too low */
}
.scene-svg { display: none; vertical-align: bottom; filter: drop-shadow(0 10px 14px rgba(30, 26, 18, 0.18)); }
.scene-svg.active { display: block; }

.scene-shadow {
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -7px;
  height: 16px;
  background: radial-gradient(ellipse at 50% 50%, rgba(30, 26, 18, 0.28), transparent 68%);
}

.f-body   { fill: #ccc4b2; }
.f-soft   { fill: #ddd6c6; }
.f-dark   { fill: #b5ac99; }
.f-wood   { fill: #7d5f43; }
.f-accent { fill: #bc5433; opacity: 0.92; }
.f-accent2{ fill: #a9b494; }
.f-pillow { fill: #f2ecdd; }
.f-vase   { fill: #b5ac99; }
.f-sheen  { fill: rgba(255, 255, 255, 0.22); }
.f-line   { stroke: rgba(30, 26, 18, 0.28); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.f-stem   { stroke: #7d6a4a; stroke-width: 3.5; fill: none; stroke-linecap: round; }
.f-leaf   { fill: #97a37f; }
.wall.dark .scene-shadow { background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.5), transparent 68%); }

/* wall finishes (panel / shiplap / brick painted in JS) */

.wall-finish { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.wf-panel {
  position: absolute;
  border: 1.5px solid rgba(30, 26, 18, 0.13);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 0 rgba(255, 255, 255, 0.3);
}
.wall.dark .wf-panel {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* segmented icon pickers */

.icon-seg { display: flex; gap: 2px; }
.seg {
  width: 27px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--ink-soft);
  transition: all 0.13s ease;
}
.seg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.seg:hover { background: #fff; }
.seg.selected { background: var(--ink); color: var(--panel); }

.guides { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.guide-v, .guide-h { position: absolute; background: var(--accent); opacity: 0.75; }
.guide-v { width: 1px; top: 0; bottom: 0; }
.guide-h { height: 1px; left: 0; right: 0; }

.draw-ghost {
  position: absolute;
  border: 1.5px dashed var(--ink-soft);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  z-index: 15;
  pointer-events: none;
}
.wall.dark .draw-ghost { border-color: rgba(250, 247, 240, 0.7); }
.ghost-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  white-space: nowrap;
  background: var(--ink);
  color: var(--panel);
  padding: 2px 7px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}

/* ————— Frames ————— */

.frame {
  position: absolute;
  cursor: grab;
  z-index: 5;
  touch-action: none;
  box-shadow: var(--shadow-frame);
  animation: frame-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1) backwards;
}
@keyframes frame-in {
  from { opacity: 0; transform: scale(0.92); }
}
.frame.moving { transition: left 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), top 0.45s cubic-bezier(0.3, 0.8, 0.3, 1); }
.frame.dragging { cursor: grabbing; z-index: 25; box-shadow: 0 3px 6px rgba(30,26,18,.25), 0 22px 40px -10px rgba(30,26,18,.45); }
.frame.selected { outline: 2px solid var(--accent); outline-offset: 3px; }
.frame.drop-target { outline: 2.5px dashed var(--accent); outline-offset: 3px; }

.frame.finish-black { background: linear-gradient(160deg, #2c2926 0%, #171512 55%, #26231f 100%); }
.frame.finish-white { background: linear-gradient(160deg, #ffffff, #ece9df 60%, #f8f6ef); }
.frame.finish-oak {
  background:
    repeating-linear-gradient(94deg, rgba(112, 78, 40, 0.12) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #d3ab72, #b98f58 55%, #c9a069);
}
.frame.finish-walnut {
  background:
    repeating-linear-gradient(94deg, rgba(30, 18, 8, 0.16) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #6f5038, #523926 55%, #5f4430);
}
.frame.finish-brass { background: linear-gradient(150deg, #d9c08a 0%, #a4844b 40%, #cfb37c 65%, #96793f 100%); }

.mat {
  width: 100%;
  height: 100%;
  background: #faf7ef;
  box-shadow: inset 0 1px 3px rgba(30, 26, 18, 0.35);
  position: relative;
}

.photo-slot {
  position: absolute;
  overflow: hidden;
  background: #eee9db;
  box-shadow: inset 0 1px 4px rgba(30, 26, 18, 0.28);
}
.photo-slot img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg, rgba(30, 26, 18, 0.035) 0 1px, transparent 1px 9px),
    #efeadb;
}
.placeholder span {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.frame-size-label {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  background: var(--ink);
  color: var(--panel);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  z-index: 30;
}
.frame.selected .frame-size-label, .frame.dragging .frame-size-label { opacity: 1; }

.stage-note {
  position: absolute;
  bottom: 12px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.kbd-hint { opacity: 0.75; }

/* ————— Waitlist dialog ————— */

.waitlist {
  margin: auto;
  border: none;
  border-radius: 18px;
  padding: 38px 40px 34px;
  width: min(430px, calc(100vw - 40px));
  background: var(--panel);
  box-shadow: 0 30px 80px -20px rgba(30, 26, 18, 0.5);
  position: relative;
}
.waitlist::backdrop { background: rgba(30, 26, 18, 0.45); backdrop-filter: blur(3px); }

.dialog-x {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 22px;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}
.dialog-x:hover { color: var(--ink); }

.waitlist-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
}

.waitlist h3 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 29px;
  letter-spacing: -0.01em;
  margin: 10px 0 10px;
  line-height: 1.12;
}

.waitlist-pitch { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 10px; }

.waitlist ul { list-style: none; margin-bottom: 20px; }
.waitlist li {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 5px 0 5px 22px;
  position: relative;
}
.waitlist li::before {
  content: "✦";
  position: absolute;
  left: 2px;
  color: var(--brass);
  font-size: 11px;
}
.waitlist li strong { color: var(--ink); }

#waitlistForm { display: flex; gap: 8px; }
#waitlistEmail {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13.5px;
  min-width: 0;
}
#waitlistEmail:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#waitlistEmail.invalid { outline: 2px solid #c03e2b; outline-offset: -1px; }

.waitlist-privacy { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

.waitlist-success { text-align: center; padding: 12px 0 4px; }
.waitlist-success .big-star { font-size: 34px; color: var(--brass); display: block; margin-bottom: 10px; }
.waitlist-success h3 { font-family: var(--font-display); font-size: 26px; font-weight: 560; margin-bottom: 8px; }
.waitlist-success p { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 20px; }

/* ————— Toast ————— */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--panel);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 90;
  box-shadow: 0 12px 30px -8px rgba(30, 26, 18, 0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ————— Small screens ————— */

@media (max-width: 860px) {
  body { overflow: auto; height: auto; display: block; }

  .topbar { position: sticky; top: 0; gap: 10px; flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .tagline { display: none; }
  .topbar .btn-ink { font-size: 12px; padding: 8px 12px; }

  /* wall on top, tools stacked below */
  main { display: flex; flex-direction: column; }
  .stage { order: -1; min-height: 52vh; padding: 16px 10px; }
  .rail { flex-direction: column; overflow: visible; padding: 0 12px 28px; gap: 12px; }
  .panel { min-width: 0; }

  /* tabs get bigger on touch (base rules handle show/hide) */
  .rail-tabs { padding: 10px 0 2px; }
  .rail-tabs button { padding: 12px 0; font-size: 13px; }

  /* touch targets — aim for ~44px */
  .chip, .toggle, .btn-ghost, .rail-tabs button { min-height: 44px; }
  input[type="number"] { min-height: 44px; }
  .seg { width: 44px; height: 40px; }
  .seg svg { width: 18px; height: 18px; }
  .wall-swatch, .finish { width: 38px; height: 38px; }
  .preset { padding: 12px 2px 10px; }
  .thumb-x { width: 28px; height: 28px; opacity: 1; }

  /* contextual bars reposition + wrap; hide the fine-print note so it can't sit under the frame-bar */
  .stage-note { display: none; }
  .frame-bar { bottom: 12px; flex-wrap: wrap; max-width: 94vw; justify-content: center; }
  .arrange-menu { width: min(280px, 82vw); }
  .photo-strip { max-width: 94vw; }
}

/* ————— Rail footer ————— */

.rail-foot {
  margin-top: auto;
  padding-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.rail-foot a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.rail-foot a:hover { color: var(--ink-soft); border-color: var(--muted); }

/* ————— Focus mode ————— */

body.focus .topbar,
body.focus .rail,
body.focus .stage-note,
body.focus .frame-bar { display: none; }
body.focus main { grid-template-columns: 1fr; }
body.focus .stage { padding: 12px; }

.focus-exit {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 80;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 6px 18px -6px rgba(30, 26, 18, 0.3);
}
body.focus .focus-exit { display: inline-flex; }
.focus-exit:hover { color: var(--ink); border-color: var(--muted); }

/* ————— focus photo picker strip ————— */

.photo-strip {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  max-width: min(84vw, 940px);
  overflow-x: auto;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(30, 26, 18, 0.35);
  scrollbar-width: thin;
}
.photo-strip[hidden] { display: none; }
.strip-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
}
.strip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip-thumb:hover { border-color: var(--brass); }
.strip-thumb.current { border-color: var(--accent); }


/* ————— Arrange popover ————— */

.arrange { position: relative; display: flex; }
.arrange-main { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 11px; }
.arrange-caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 7px 8px; margin-left: -1px; }
.arrange-caret[aria-expanded="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.arrange-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 262px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(30, 26, 18, 0.35);
  padding: 6px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.arrange-menu[hidden] { display: none; }
.arrange-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 11px;
  border-radius: 9px;
  text-align: left;
  transition: background 0.12s ease;
}
.arrange-item b { font-weight: 600; font-size: 13px; }
.arrange-item small { color: var(--muted); font-size: 11px; }
.arrange-item:hover { background: #fff; }
.arrange-item.active { background: color-mix(in srgb, var(--accent) 11%, transparent); }
.arrange-item.active b { color: var(--accent-deep); }
.arrange-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ————— Room panel rows ————— */

.room-row { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.room-row:last-child { margin-bottom: 0; }
.room-row > .mini-label { width: 46px; flex: 0 0 auto; }
.room-row .wall-swatches { flex-wrap: wrap; }
.room-actions { gap: 7px; margin-top: 3px; }
.room-actions .toggle { border: 1px solid var(--line); flex: 1; justify-content: center; }

/* ————— Rail tabs — one panel at a time, at every width ————— */

.rail-tabs { display: flex; gap: 5px; margin-bottom: 2px; }
.rail-tabs button {
  flex: 1;
  padding: 9px 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.14s ease;
}
.rail-tabs button:hover { border-color: var(--ink); }
.rail-tabs button[aria-selected="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
/* inactive tabpanels carry the `hidden` attribute, toggled in selectTab() */
.rail [data-panel][hidden] { display: none; }

/* ————— Collapsible side rail ————— */

.rail-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  transition: all 0.14s ease;
}
.rail-toggle:hover { border-color: var(--ink); color: var(--ink); }
.rail-toggle[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

body.rail-collapsed main { grid-template-columns: 1fr; }
body.rail-collapsed .rail { display: none; }

@media (max-width: 860px) {
  .rail-toggle { display: none; }              /* rail already stacks below the wall on mobile */
  body.rail-collapsed .rail { display: flex; } /* never let a desktop collapse hide the mobile tools */
}
