/* Planthy 3D: the scene fills the window; bar, palette, selection card and chat
   float over it as white cards. Colours follow the customiser and the AI panel
   (#253C28 forest ink, #3E6B45 accent, Outfit). */
:root { --ink: #253C28; --accent: #3E6B45; --soft: #EEF3EC; --line: #D5DFD2; --err: #A23B2A;
  --card: rgba(255, 255, 255, .94); --shadow: 0 14px 40px rgba(20, 35, 22, .16); --r: 16px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e9e7e1; color: var(--ink);
  font: 15px/1.35 'Outfit', system-ui, sans-serif; }
[hidden] { display: none !important; }
button, .btn, input, textarea { font: inherit; color: inherit; }
button, .btn { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; transition: border-color .15s, background .15s; }
button:hover:not(:disabled), .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover:not(:disabled) { background: var(--accent); }
button.danger { color: var(--err); }
button.danger:hover { border-color: var(--err); }
:focus-visible { outline: 3px solid #9BC48F; outline-offset: 2px; }
kbd { font-size: 11px; opacity: .6; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 4px; }

.scene { position: fixed; inset: 0; touch-action: none; }
.scene canvas { display: block; }
.scene.placing { cursor: copy; }
.scene.hovering { cursor: grab; } /* a box or legs: click selects, drag moves */
.scene.dragging { cursor: grabbing; }

/* --- top bar */
/* the bar itself is invisible and lets clicks through; its two pills (brand, actions) are the cards */
.bar { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  pointer-events: none; }
.bar > .brand, .bar > .bar-actions { pointer-events: auto; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.bar > .brand { padding: 13px 22px; line-height: 1; }
.bar > .bar-actions { padding: 6px; }
.brand { font-size: 19px; letter-spacing: .2px; white-space: nowrap; flex: none; }
.brand span { font-weight: 300; color: var(--accent); }
.brand.big { font-size: 30px; margin-bottom: 4px; }
/* size and price: a small pill under the dock */
.stats { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 5; max-width: calc(100vw - 24px);
  padding: 3px 12px; font-size: 13px; color: var(--ink); background: var(--card); border-radius: 999px; box-shadow: 0 4px 14px rgba(20, 35, 22, .12);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats b { font-weight: 600; }
.bar-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.bar-actions > * { flex: none; }
.bar { z-index: 8; } /* the Widok menu opens over the cards and their sheets (z-index 7 on narrow screens) */
/* inline SVG icons (bar, dock, start card) */
svg.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.ico .dot { fill: currentColor; stroke: none; }
.bar-actions > button, .view-menu > button { padding: 7px 14px; gap: 6px; }
#viewBtn .chev { width: 14px; height: 14px; margin-left: -2px; transition: transform .15s; }
#viewBtn.open { border-color: var(--ink); }
#viewBtn.open .chev { transform: rotate(180deg); }
/* Widok menu: under its button, right-aligned */
.view-menu { position: relative; }
.view-pop { position: absolute; top: calc(100% + 10px); right: 0; width: 260px; padding: 12px; display: grid; gap: 8px;
  background: #fff; border-radius: var(--r); box-shadow: var(--shadow); }
.pop-label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; opacity: .6; }
.pop-stats { display: none; font-size: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg .btn { border: 0; border-radius: 0; justify-content: center; padding: 7px 0; }
.seg .btn + .btn { border-left: 1px solid var(--line); }
.seg .btn[aria-current="page"] { background: var(--ink); color: #fff; }
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pop-row select { font: inherit; color: inherit; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.pop-toggle { justify-content: space-between; border-radius: 12px; padding: 9px 12px; }
.switch { width: 32px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
[aria-pressed="true"] > .switch { background: var(--accent); }
[aria-pressed="true"] > .switch::after { transform: translateX(14px); }

/* --- dock: the editing tools, bottom centre between the side cards */
.dock { position: fixed; left: 50%; bottom: 40px; /* the size and price line sits under it */ transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 2px;
  padding: 5px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(8px); white-space: nowrap; }
.dock button { border-color: transparent; background: transparent; padding: 7px 11px; gap: 6px; }
.dock button:hover:not(:disabled) { background: var(--soft); border-color: transparent; }
.dock .sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line); }
.day-label { font-variant-numeric: tabular-nums; }
#dayBtn .moon, #dayBtn[data-night] .sun { display: none; }
#dayBtn[data-night] .moon { display: block; }
/* not enough room between the side cards for the words: icons only (the title is the tooltip) */
@media (max-width: 1439px) { .dock .lbl { display: none; } .dock button { padding: 8px 10px; } }

/* --- floating cards: palette left, chat right */
.palette, .chat { position: fixed; top: 76px; bottom: 12px; background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow); z-index: 4; display: flex; flex-direction: column; backdrop-filter: blur(8px); }
.chat { right: 12px; width: 340px; }
/* Left column: the modules card and the wall/floor card stacked. The column spans the height; its empty part lets
   clicks through to the scene. An open modules card takes the room left; the wall/floor card keeps its own height. */
.side-left { position: fixed; top: 76px; bottom: 12px; left: 12px; width: 268px; z-index: 4; display: flex; flex-direction: column;
  gap: 10px; pointer-events: none; }
.side-left .palette { position: relative; top: auto; bottom: auto; width: auto; pointer-events: auto; min-height: 0; flex: 0 1 auto; }
.side-left .palette:not(.look):not(.folded) { flex: 1 1 0; min-height: 140px; }
.side-left .look:not(.folded) { flex: 0 0 auto; max-height: 55%; }
.side-left .folded { flex-shrink: 0; } /* a folded card keeps its whole heading */
.fold-title { display: grid; text-align: left; }
.fold-sub { display: none; font-size: 12px; font-weight: 400; opacity: .7; white-space: normal; }
.chat.solo .fold-sub { display: block; } /* no room yet: the heading says what the card is for */
.chat.solo .chat-body, .chat:not(.solo) .share, .folded .share { display: none; }
.chat.solo { bottom: auto; } /* only the share form: as tall as it is */
.share { display: grid; gap: 8px; padding: 12px 16px 16px; }
.share p { margin: 0 0 4px; font-size: 14px; opacity: .85; }
.share label { font-size: 13px; font-weight: 500; }
.share input { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.share input:focus { border-color: var(--accent); }
.share .primary { justify-content: center; padding: 10px; }
.fold { border: 0; border-bottom: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; justify-content: space-between;
  width: 100%; padding: 10px 16px; font-weight: 600; background: transparent; }
.fold::after { content: '–'; font-weight: 400; opacity: .6; }
.folded .fold { border-bottom: 0; border-radius: var(--r); }
.folded .fold::after { content: '+'; }
.folded { bottom: auto !important; }
.folded .palette-body, .folded .chat-body { display: none; }
.palette-body { overflow: auto; padding: 10px 14px 14px; }
.row-label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; opacity: .6; margin: 10px 0 6px; }
.row-label:first-child { margin-top: 2px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatches.small .swatch { width: 24px; height: 24px; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
/* "any colour": a rainbow ring around a native picker; filled with the colour once it is a custom one */
.swatch.custom { position: relative; overflow: hidden; cursor: pointer; display: inline-block;
  background: conic-gradient(#e94b4b, #f0c23c, #5fc55f, #3fb6d9, #6a5be0, #d35bd0, #e94b4b); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.chips.finish { margin: 8px 0 2px; }
.chips.finish .chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.group h3 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.item { flex-direction: column; align-items: stretch; gap: 2px; border-radius: 12px; padding: 6px; text-align: left; white-space: normal; }
.item .th { display: block; aspect-ratio: 1; overflow: hidden; background: var(--soft); border-radius: 8px; }
.item img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.45); } /* renders have wide transparent margins */
.item .t { font-size: 12px; line-height: 1.2; }
.item .d { font-size: 11px; opacity: .65; }
.groups .item { touch-action: pan-y; cursor: grab; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; } /* drag into the scene; touch still scrolls the list */
.groups .item.lifted { transform: scale(.94); border-color: var(--accent); box-shadow: 0 6px 18px rgba(20, 35, 22, .22); } /* long-pressed on touch: in hand */
.item[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); }

/* --- selection card + hint, bottom centre */
.selcard, .hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: 100px; z-index: 6; background: var(--card);
  border-radius: var(--r); box-shadow: var(--shadow); }
.selcard { padding: 12px 14px; width: 300px; display: grid; gap: 8px; }
.sel-head { display: flex; justify-content: space-between; align-items: center; }
.x { border: 0; font-size: 22px; padding: 0 4px; line-height: 1; background: none; }
.sel-meta { font-size: 13px; opacity: .75; }
.selcard .row-label { margin: 2px 0 -2px; }
.sel-types { grid-template-columns: repeat(3, 1fr); } /* the card's type picker: 3 small thumbnails a row */
.sel-types .item { padding: 4px; }
.sel-types .item .t { font-size: 11px; }
.sel-sizes { margin: 0; }
.sel-move { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } /* ← / → side by side */
.sel-move button, .selcard .danger, #selDup { justify-content: center; }
.sel-sizes .chip small { opacity: .6; }
.sel-sizes .chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.selcard { max-height: calc(100vh - 160px); overflow: auto; } /* type + size + colour can outgrow a short window */
.hint { padding: 9px 16px; font-size: 14px; border-radius: 999px; }
.selcard.beside { transform: none; bottom: auto; max-height: calc(100vh - 150px); } /* desktop: placed beside the module by app.js placeSelcard() */
.hint.bad { color: var(--err); }

/* --- chat */
.chat-body { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 8px 12px 12px; }
.people { font-size: 13px; }
.conn { font-size: 12px; opacity: .55; margin-bottom: 6px; }
.log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.msg { max-width: 92%; padding: 8px 11px; border-radius: 14px; background: var(--soft); font-size: 14px; word-wrap: break-word; }
.msg .who { font-size: 12px; font-weight: 600; display: block; margin-bottom: 1px; }
.msg.mine { align-self: flex-end; background: var(--ink); color: #fff; }
.msg.mine .who { display: none; }
.msg.ai { background: #fff; border: 1px solid var(--line); }
.msg.ai .who { color: var(--accent); }
.msg .meta { display: block; font-size: 12px; opacity: .7; margin-top: 4px; }
.msg img { display: block; max-width: 100%; max-height: 160px; border-radius: 8px; margin-top: 4px; }
.msg.sys { align-self: center; background: none; font-size: 12px; opacity: .6; padding: 0; text-align: center; }
.aitag { color: var(--accent); }
.msg.mine .aitag { color: #BFE0B5; }
.typing { align-self: flex-start; font-size: 13px; opacity: .7; }
.typing::after { content: '…'; animation: blink 1s steps(3) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips:empty { display: none; }
.chip { font-size: 12px; padding: 4px 10px; background: var(--soft); white-space: normal; text-align: left; }
.pending { position: relative; width: 64px; margin-bottom: 6px; }
.pending img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.pending button { position: absolute; top: -6px; right: -6px; padding: 0 6px; }
.composer { border: 1px solid var(--line); border-radius: 14px; padding: 6px; background: #fff; }
.composer:focus-within { border-color: var(--accent); }
.composer textarea { width: 100%; border: 0; resize: none; outline: none; padding: 4px 6px; max-height: 120px; background: transparent; }
.composer-row { display: flex; gap: 6px; justify-content: flex-end; }
.composer-row button.ai { color: var(--accent); margin-right: auto; }
.composer-row #attach { margin-right: 0; }
/* Talk mode (voice.js): the mic button shows the phase; red pulse while it listens. */
.composer-row button.talk { position: relative; min-width: 40px; }
.talk[data-phase="listening"] { background: #c0392b; color: #fff; border-color: #c0392b; animation: talkPulse 1.4s ease-out infinite; }
.talk[data-phase="transcribing"], .talk[data-phase="waiting"] { background: var(--accent); color: #fff; opacity: .8; }
.talk[data-phase="speaking"] { background: var(--accent); color: #fff; }
@keyframes talkPulse { 0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .55); } 100% { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); } }
.talk-status { font-size: 13px; color: var(--accent); font-weight: 600; margin: 4px 2px 6px; }
@media (prefers-reduced-motion: reduce) { .talk[data-phase="listening"] { animation: none; } }

/* --- name labels of other people, drawn by CSS2DRenderer */
.tag { padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap;
  transform: translate(10px, -14px); pointer-events: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.dim { padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .85); font-size: 12px; pointer-events: none; color: var(--ink); }

/* --- lobby */
.lobby { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(233, 231, 225, .35); backdrop-filter: blur(2px); } /* light: a design picked here shows through */
.lobby-card { width: min(380px, calc(100vw - 32px)); background: #fff; border-radius: 22px; padding: 26px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.lobby-card p { margin: 0 0 6px; opacity: .8; }
.lobby-card label { font-size: 13px; font-weight: 500; }
.lobby-card input { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.lobby-card input:focus { border-color: var(--accent); }
.lobby-card .primary { justify-content: center; padding: 10px; }
.lobby-card textarea { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; resize: vertical; }
.lobby-card textarea:focus { border-color: var(--accent); }
/* start: three ways to begin, one row on a computer, stacked on a phone */
.start-picks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; } /* four ways to begin: 2 × 2 */
#start .lobby-card { width: min(440px, calc(100vw - 32px)); } /* room for the bigger buttons */
.start-picks button { justify-content: center; padding: 18px 12px; font-size: 17px; border-radius: 16px; background: var(--soft); border-color: var(--soft); white-space: normal; text-align: center; }
.start-picks button[aria-pressed="true"] { border-color: var(--ink); }
.start-picks button { gap: 8px; flex-direction: column; }
.start-picks svg { width: 25px; height: 25px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.start-picks svg .dot { fill: currentColor; stroke: none; }
.start-ai { display: grid; gap: 8px; }
@media (max-width: 520px) { .start-picks { grid-template-columns: 1fr; } .start-picks button { flex-direction: row; gap: 10px; padding: 16px 14px; } }
.lobby-card .busy { cursor: progress; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- loader: over everything until the first frame; the fill follows the boot stages, the shimmer always moves */
.loader { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #e9e7e1; transition: opacity .4s; }
.loader.done { opacity: 0; pointer-events: none; }
.loader-card { width: min(320px, calc(100vw - 48px)); display: grid; gap: 14px; text-align: center; }
.loader-bar { position: relative; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.loader-bar i { position: absolute; inset: 0 auto 0 0; width: 5%; border-radius: inherit; background: var(--accent); transition: width .5s ease-out; overflow: hidden; }
.loader-bar i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-100%); animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.loader-text { font-size: 14px; opacity: .7; min-height: 1.35em; }
.loader.failed .loader-bar { display: none; }
.loader.failed .loader-text { color: var(--err); opacity: 1; }
@media (prefers-reduced-motion: reduce) { .loader-bar i::after, .spin { animation-duration: 3s; } }
.err { color: var(--err); font-size: 13px; min-height: 1em; }
.lobby-card .err:empty, .share .err:empty { display: none; }

/* --- narrow screens: cards become sheets that start folded */
@media (max-width: 900px) {
  /* the cards are bottom sheets here: the dock moves up under the bar, the selection card and hints under it */
  .dock { bottom: auto; top: 70px; }
  .stats { display: none; }
  .pop-stats { display: block; }
  .dock .lbl { display: none; }
  /* the left column's two headings stack bottom-left, the chat sits bottom-right */
  .side-left, .chat, .chat.folded { top: auto; bottom: 12px !important; max-height: 60vh; width: calc(50vw - 18px); }
  .side-left { justify-content: flex-end; gap: 8px; }
  .side-left:has(.palette:not(.folded)), .chat:not(.folded) { width: calc(100vw - 24px); z-index: 7; } /* an open sheet takes the full width */
  .items { grid-template-columns: repeat(4, 1fr); }
  .item .d { display: none; }
  .selcard, .hint { bottom: auto; top: 128px; }
  /* carrying a module from the palette: the sheets fade and pass touches through, so it can be dropped on the
     furniture behind them (pointer capture keeps the drag on the palette item) */
  .carrying .side-left .palette, .carrying .chat { opacity: .2; pointer-events: none; transition: opacity .15s; }
}

/* --- phones: brand and icon buttons only; the size and price line moves into the Widok menu */
@media (max-width: 760px) {
  .bar { top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; }
  .bar { gap: 6px; }
  .bar > .brand { padding: 12px 14px; font-size: 17px; }
  .bar > .bar-actions { padding: 4px; gap: 4px; }
  .view-menu { position: static; }
  .view-pop { right: 0; width: min(300px, calc(100vw - 20px)); }
  .bar-actions .lbl:not(.keep) { display: none; }
  .bar-actions > button, .view-menu > button { padding: 8px 10px; }
  .dock { top: calc(66px + env(safe-area-inset-top)); }
  .dock button { padding: 8px 9px; }
  .selcard, .hint { top: calc(122px + env(safe-area-inset-top)); }
}

/* AR on Android (ar.js): the overlay over the camera view, kept clear of the notch and the home bar */
.ar-overlay { position: fixed; inset: 0; pointer-events: none; font: 15px/1.35 'Outfit', system-ui, sans-serif; }
.ar-hint { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 16px; right: 16px; text-align: center;
  padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .9); color: var(--ink); }
.ar-actions { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex;
  justify-content: center; gap: 12px; pointer-events: auto; }
.ar-actions button { padding: 12px 20px; font-size: 16px; background: rgba(255, 255, 255, .92); }

/* AR on a computer (ar.js): a QR code of the page, to open the design on a phone */
.ar-qr { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(20, 35, 22, .35); }
.ar-qr-card { width: min(340px, calc(100vw - 32px)); background: #fff; border-radius: 22px; padding: 22px; box-shadow: var(--shadow);
  display: grid; gap: 10px; text-align: center; }
.ar-qr-card p { margin: 0; font-size: 14px; opacity: .8; }
.ar-qr-card .primary { justify-content: center; }
.ar-qr-code svg { width: 100%; height: auto; display: block; }

/* --- ready designs (gallery.js): the dice and the gallery, in the lobby and the bar */
.gallery { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 35, 22, .32); backdrop-filter: blur(4px); }
.gal-card-wrap { width: min(980px, 100%); height: min(86vh, 100%); /* steady height: filtering does not make it jump */ display: flex; flex-direction: column; background: #fff;
  border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.gal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.gal-head b { font-size: 18px; flex: 1; }
.gal-head .x { border: 0; font-size: 22px; padding: 0 8px; line-height: 1; }
.gal-body { overflow: auto; padding: 0 18px 18px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.gal-grid:empty { display: none; }
.gal-empty { font-size: 13px; opacity: .65; margin: 0 0 4px; }
.gal-card { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border-radius: 16px;
  white-space: normal; text-align: left; }
.gal-card b { font-size: 14px; font-weight: 600; margin-top: 4px; }
.gal-card small { font-size: 12px; opacity: .65; }
.gal-img { display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden;
  background: linear-gradient(100deg, #efece6 40%, #f7f5f1 50%, #efece6 60%) 0 0 / 200% 100%; animation: galShimmer 1.2s linear infinite; }
.gal-img img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.gal-img img.ready { opacity: 1; }
.gal-card:hover .gal-img img { transform: scale(1.03); transition: transform .3s, opacity .25s; }
@keyframes galShimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .gal-img { animation: none; } .gal-card:hover .gal-img img { transform: none; } }
.gal-del { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); font-size: 16px; line-height: 1; }
.gal-del:hover { color: var(--err); }
@media (max-width: 640px) {
  .gallery { padding: 8px; }
  .gal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gal-head { padding: 12px 12px 8px; }
  .gal-body { padding: 0 12px 12px; }
  #galSave { font-size: 13px; padding: 5px 10px; }
}
#galName { flex: 0 1 240px; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; outline: none; }
#galName:focus { border-color: var(--accent); }
@media (max-width: 640px) {
  .gal-head { flex-wrap: wrap; }
  .gal-head b { flex-basis: calc(100% - 44px); }
  #galName { order: 3; flex: 1 1 auto; }
  #galSave { order: 4; }
}

/* gallery filters: two rows of chips (colour with a swatch, type), each with its count */
.gal-filters { padding: 0 18px 8px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.gal-frow { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.gal-frow::-webkit-scrollbar { display: none; }
.gal-flabel { flex: none; width: 52px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; opacity: .6; }
.gal-chip { flex: none; font-size: 13px; padding: 4px 10px; }
.gal-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.gal-chip i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.gal-chip small { opacity: .6; font-size: 11px; }
@media (max-width: 640px) { .gal-filters { padding: 0 12px 8px; } .gal-flabel { width: auto; } }
.gal-search { padding: 0 18px 8px; }
.gal-search input { width: 100%; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px 8px 34px; outline: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23253C28' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 12px center; }
.gal-search input:focus { border-color: var(--accent); }
@media (max-width: 640px) { .gal-search { padding: 0 12px 8px; } }
.gal-search { display: flex; gap: 8px; }
.gal-search input { flex: 1; min-width: 0; }
#galSort { flex: none; max-width: 46%; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: #fff; cursor: pointer; }
#galSort:focus { border-color: var(--accent); outline: none; }
/* gallery pages */
.gal-pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 12px 0 4px; }
.gal-page { min-width: 34px; justify-content: center; padding: 5px 9px; font-size: 13px; }
.gal-page[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; opacity: 1; }
.gal-gap { padding: 0 2px; opacity: .5; }
.gal-range { margin-left: 8px; font-size: 12px; opacity: .6; }
.gal-body .row-label { scroll-margin-top: 8px; }
/* gallery favourites: a heart in the card's top-left corner (the × to delete is top-right) */
.gal-fav { position: absolute; top: 12px; left: 12px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15); font-size: 16px; line-height: 1; color: var(--ink); }
.gal-fav small { font-size: 12px; font-weight: 600; color: var(--ink); }
.gal-fav:hover { color: #c0392b; }
.gal-fav[aria-pressed="true"] { color: #c0392b; }
/* Share on a gallery card: top right, left of the × when the card has one. */
.gal-share { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); color: var(--ink); }
.gal-share.with-del { right: 46px; }
.gal-share.with-hide { right: 80px; }
.gal-share:hover { color: var(--accent); }
.gal-share-menu { position: fixed; z-index: 100; min-width: 168px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.gal-share-menu button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 8px; font: inherit; color: var(--ink); }
.gal-share-menu button:hover, .gal-share-menu button:focus-visible { background: var(--soft); }
/* Comments: the bubble on a card's picture, and a design's thread over the gallery (src/client/3d/gallery.js). */
.gal-img { position: relative; }
.gal-cm { position: absolute; left: 6px; bottom: 6px; min-width: 28px; height: 26px; padding: 0 8px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; gap: 4px; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); color: var(--ink); }
.gal-cm small { font-size: 12px; font-weight: 600; opacity: 1; }
.gal-cm:hover { color: var(--accent); }
.gal-card-wrap { position: relative; }
.gal-thread { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; background: #fff; }
.gal-thead { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.gal-thead b { flex: 1; min-width: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-back { flex: none; }
.gal-topen { flex: none; }
.gal-tbody { flex: 1; overflow: auto; padding: 14px 18px; }
.gal-tdesign { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.gal-tdesign img { width: 160px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #efece6; flex: none; }
.gal-tdesign div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gal-tdesign small { font-size: 13px; opacity: .7; }
.gal-tlist { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.gal-tlist li { background: var(--soft); border-radius: 14px; padding: 10px 14px; }
.gal-cmeta { display: flex; align-items: baseline; gap: 8px; }
.gal-cmeta b { font-size: 14px; }
.gal-cmeta time { font-size: 12px; opacity: .6; flex: 1; }
.gal-tlist p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.gal-cdel { border: 0; background: none; padding: 0 4px; font-size: 18px; line-height: 1; opacity: .5; }
.gal-cdel:hover { opacity: 1; color: var(--err); }
.gal-tform { display: grid; grid-template-columns: 160px 1fr; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.gal-tform input, .gal-tform textarea { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 14px; outline: none; min-width: 0; }
.gal-tform textarea { resize: vertical; min-height: 42px; max-height: 160px; }
.gal-tform input:focus, .gal-tform textarea:focus { border-color: var(--accent); }
.gal-tsend { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.gal-tcount { font-size: 12px; opacity: .55; }
@media (max-width: 640px) {
  .gal-thead, .gal-tbody { padding-left: 12px; padding-right: 12px; }
  .gal-tform { grid-template-columns: 1fr; padding: 8px 12px 12px; }
  .gal-tdesign img { width: 110px; }
  .gal-back { padding: 5px 8px; }
}
.gal-crep { border: 0; background: none; padding: 0 2px; font-size: 12px; opacity: 0; transition: opacity .15s; color: var(--ink); text-decoration: underline; }
.gal-tlist li:hover .gal-crep, .gal-crep:focus-visible { opacity: .55; }
.gal-crep:hover { opacity: 1 !important; color: var(--err); }
@media (hover: none) { .gal-crep { opacity: .55; } }
/* Admin mode: the × that deletes anyone's saved design (public/admin.js turns it on in this browser). */
.gal-del.admin { color: var(--err); box-shadow: 0 0 0 2px var(--err), 0 2px 8px rgba(0, 0, 0, .15); }
/* …and the crossed-out eye left of it, which hides the design for everyone. */
.gal-hide.admin { position: absolute; top: 12px; right: 46px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: var(--err); box-shadow: 0 0 0 2px var(--err), 0 2px 8px rgba(0, 0, 0, .15); }
.gal-hide.admin:hover { background: #fff; }
.gal-cdel.admin { display: inline-grid; place-items: center; line-height: 1; flex: none; opacity: 1; color: var(--err); width: 22px; height: 22px; padding: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--err); font-size: 15px; }
.gal-chide.admin { border: 0; background: none; padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--err); text-decoration: underline; flex: none; }

/* --- Pora dnia (daylight.js): a card over the bottom of the scene; the hour, play, tempo, the show and the shot view */
.daycard { position: fixed; left: 50%; bottom: 100px; /* above the dock */ transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); z-index: 6;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); backdrop-filter: blur(8px); padding: 10px 14px 12px; }
.day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.day-head .x { border: 0; background: none; font-size: 20px; padding: 0 4px; line-height: 1; }
.day-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.day-time { font-size: 22px; font-weight: 500; min-width: 84px; font-variant-numeric: tabular-nums; }
.daycard input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.day-play { min-width: 112px; justify-content: center; }
.day-play[aria-pressed="true"] { background: var(--soft); border-color: var(--ink); }
.day-tempo-label { font-size: 12px; opacity: .6; }
.day-tempo { display: flex; gap: 4px; }
.day-tempo .chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.day-extra { border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 760px) { .daycard { bottom: 10px; } .day-tempo-label { display: none; } }

/* --- The screenshot view (<html class="shot">): the room and the furniture only. Every card, the bar, the lobby,
   the dimension labels and others' name tags go; the scene stays. */
.shot body > :not(#scene) { display: none !important; }
.shot .dim, .shot .tag { display: none !important; }
.shot .scene.hovering { cursor: default; }
.shot-hint { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; font-size: 13px;
  background: rgba(20, 30, 22, .62); color: #fff; pointer-events: none; opacity: 0; transition: opacity .4s; z-index: 2; }
.shot-hint.on { opacity: 1; }
:root:not(.shot) .shot-hint { display: none; }
