:root {
  color-scheme: dark;
  --bg: #0b0b0d; --panel: rgba(17, 17, 21, .78); --panel2: rgba(255, 255, 255, .05); --line: rgba(255, 255, 255, .09);
  --text: #ecebe6; --muted: #9b9a97; --acc: #c9a35d; --acc-ink: #17130b; --danger: #e0846b;
  --font-d: "Bricolage Grotesque", "Manrope", system-ui, sans-serif; --font-b: "Manrope", system-ui, sans-serif;
  --r: 16px; --gut: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font-b); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }
#c.painting { cursor: copy; }
#c.grabbing { cursor: grabbing !important; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--muted); font: 600 15px var(--font-b); z-index: 50; padding: 24px; text-align: center; }

.panel, .tray, .toolbar, .selcard, .back, .tag, .bnav, .tip, .pcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.back { position: fixed; top: var(--gut); left: var(--gut); z-index: 12; padding: 9px 14px; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 13px; }
.back:hover { border-color: var(--acc); color: var(--acc); }
.back .short { display: none; }

/* toolbar */
.toolbar { position: fixed; top: var(--gut); right: var(--gut); z-index: 12; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; }
.toolbar button { display: inline-flex; align-items: center; gap: 8px; height: 38px; min-width: 38px; justify-content: center; border: 0; border-radius: 10px; background: transparent; padding: 0 9px; }
.toolbar button:hover { background: var(--panel2); }
.toolbar button.on { background: var(--acc); color: var(--acc-ink); }
.toolbar button:disabled { opacity: .35; cursor: default; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.toolbar .more { display: contents; }
.toolbar .more em { display: none; }
.toolbar .moreBtn { display: none !important; }

/* painel esquerdo */
.panel { position: fixed; z-index: 10; padding: 16px; }
.panel.left { top: 66px; left: var(--gut); width: 292px; max-height: calc(100dvh - 82px); overflow: auto; scrollbar-width: thin; }
.panel h1 { font: 800 25px/1.05 var(--font-d); margin: 0 0 6px; letter-spacing: -.01em; }
.panel h1 span { color: var(--acc); }
.panel h2 { font: 700 11px var(--font-b); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.panel h2 small { letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--acc); font-size: 12px; }
.lead { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; }
.moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.moods > div { background: var(--panel2); border-radius: 10px; padding: 8px; display: grid; gap: 1px; }
.moods b { font-size: 12.5px; } .moods small { color: var(--muted); font-size: 10.5px; }
.moods strong { font: 800 20px var(--font-d); color: var(--acc); font-variant-numeric: tabular-nums; }
.moods i { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.moods u { display: block; height: 100%; background: var(--acc); width: 0; transition: width .4s; }
.moodtxt { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.moodtxt b { color: var(--text); font-weight: 600; }
.presets { display: grid; gap: 6px; }
.presets button, .rooms button { text-align: left; border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 9px 11px; font-weight: 600; }
.presets button:hover, .rooms button:hover { border-color: rgba(201, 163, 93, .6); }
.presets button.on, .rooms button.on { border-color: var(--acc); color: var(--acc); }
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 5px; display: grid; gap: 2px; text-align: left; min-width: 0; }
.tile img { width: 100%; aspect-ratio: 1.5; object-fit: cover; border-radius: 6px; display: block; }
.tile small { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tile span { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile:hover { border-color: var(--acc); }
.rooms { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rooms button { padding: 7px 9px; font-size: 12.5px; }

/* luz */
.panel.right { top: 66px; right: var(--gut); width: 252px; }
.lhead { display: flex; justify-content: space-between; align-items: baseline; }
.lhead h2 { margin: 0; }
.lhead strong { font: 800 26px var(--font-d); font-variant-numeric: tabular-nums; }
.lbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 12px; }
.lbtns button { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 8px; }
.lbtns button svg { grid-row: span 2; }
.lbtns button b { font-size: 12.5px; } .lbtns button small { color: var(--muted); font-size: 11px; }
.lbtns button.on { border-color: var(--acc); color: var(--acc); }
input[type=range] { width: 100%; accent-color: var(--acc); height: 28px; }
.scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10.5px; margin-top: -4px; }
.hint { color: var(--muted); font-size: 11.5px; margin: 8px 0 0; }

/* bandeja de materiais */
.tray { position: fixed; z-index: 10; bottom: var(--gut); left: 50%; transform: translateX(-50%); width: min(760px, calc(100vw - 640px)); min-width: 420px; padding: 10px 12px 12px; }
.ttabs { display: flex; gap: 4px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.ttabs button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.ttabs button.on { background: var(--text); color: var(--bg); }
.ttabs button[data-t=moveis] { margin-left: auto; }
.swatches { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.sw { flex: none; width: 74px; border: 0; background: transparent; padding: 0; display: grid; gap: 4px; justify-items: center; }
.sw img { width: 64px; height: 64px; border-radius: 10px; display: block; border: 2px solid transparent; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.sw span { font-size: 10.5px; line-height: 1.2; color: var(--muted); text-align: center; font-weight: 600; }
.sw:hover img { border-color: rgba(201, 163, 93, .55); }
.sw.on img { border-color: var(--acc); transform: translateY(-2px); }
.sw.on span { color: var(--acc); }
.swatches.cat .ci { flex: none; width: 128px; text-align: left; border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 9px 10px; display: grid; gap: 3px; }
.swatches.cat .ci b { font-size: 12.5px; line-height: 1.2; }
.swatches.cat .ci small { color: var(--muted); font-size: 10.5px; line-height: 1.25; }
.swatches.cat .ci:hover { border-color: var(--acc); }
.applybar { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.applybar img { width: 26px; height: 26px; border-radius: 6px; }
.applybar .x { order: 2; }
.applybar .seg { order: 3; }
.applybar b { font-size: 12.5px; }
.seg { display: inline-flex; gap: 3px; background: rgba(255, 255, 255, .05); border-radius: 999px; padding: 3px; margin-left: auto; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--acc); color: var(--acc-ink); }
.x { border: 0; background: var(--panel2); border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; }

/* móvel selecionado */
.selcard { position: fixed; z-index: 11; left: 50%; transform: translateX(-50%); bottom: 168px; width: min(560px, calc(100vw - 2 * var(--gut))); padding: 12px 14px; display: grid; gap: 8px; }
.sinfo b { font: 700 15px var(--font-d); display: block; }
.sinfo small { color: var(--acc); font-weight: 600; font-size: 12px; }
.sinfo p { margin: 4px 0 0; color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.sbtns button { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 12.5px; min-height: 38px; }
.sbtns button:hover:not(:disabled) { border-color: var(--acc); }
.sbtns button:disabled { opacity: .35; cursor: default; }
.sbtns .danger { color: var(--danger); }
.sbtns .x { margin-left: auto; width: 38px; height: 38px; padding: 0; }

/* etiquetas */
.tag { position: fixed; z-index: 13; top: var(--gut); left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13px; max-width: min(520px, calc(100vw - 32px)); text-align: center; pointer-events: none; }
.tag.fade { animation: tagin .25s ease-out; }
@keyframes tagin { from { opacity: 0; transform: translate(-50%, -6px); } }
.tip { position: fixed; z-index: 14; padding: 6px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; pointer-events: none; white-space: nowrap; }
#pins { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.pin { position: absolute; left: 0; top: 0; }
.pin .pcard { position: absolute; left: 0; bottom: 64px; transform: translateX(-50%); padding: 6px; border-radius: 12px; display: grid; grid-template-columns: 40px auto; column-gap: 8px; align-items: center; width: max-content; max-width: 220px; }
.pin .pcard img { width: 40px; height: 40px; border-radius: 8px; grid-row: span 2; }
.pin .pcard b { font-size: 12px; } .pin .pcard small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.pin i { position: absolute; left: -1px; bottom: 4px; width: 2px; height: 60px; background: linear-gradient(rgba(255, 255, 255, .85), rgba(255, 255, 255, .3)); }
.pin u { position: absolute; left: -5px; bottom: -4px; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .25); }

.bnav { display: none; }

/* desktops médios */
@media (max-width: 1180px) and (min-width: 761px) {
  .panel.left { width: 262px; }
  .panel.right { width: 228px; }
  .tray { min-width: 0; width: calc(100vw - 2 * var(--gut) - 262px - 12px); left: auto; right: var(--gut); transform: none; }
  .selcard { bottom: 200px; }
}

/* celular */
@media (max-width: 760px) {
  :root { --gut: 10px; }
  .back { top: calc(var(--gut) + env(safe-area-inset-top)); padding: 11px 12px; font-size: 12.5px; }
  .back .full { display: none; }
  .back .short { display: inline; }
  .applybar .x { margin-left: auto; }
  .toolbar { top: calc(var(--gut) + env(safe-area-inset-top)); }
  .toolbar button { height: 40px; min-width: 40px; padding: 0 8px; }
  .toolbar .moreBtn { display: inline-flex !important; }
  .toolbar .more { display: none; }
  .toolbar.open .more { display: grid; position: absolute; top: calc(100% + 6px); right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px; gap: 2px; min-width: 190px; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  .toolbar.open .more .sep { display: none; }
  .toolbar.open .more button { justify-content: flex-start; height: 44px; }
  .toolbar .more em { display: inline; font-style: normal; font-weight: 600; }
  .tag { top: calc(62px + env(safe-area-inset-top)); font-size: 12.5px; }
  .bnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); border-radius: 0; border-width: 1px 0 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bnav button { border: 0; background: transparent; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 4px 2px; font-size: 11px; font-weight: 700; color: var(--muted); border-radius: 12px; }
  .bnav button.on { color: var(--acc); background: var(--panel2); }
  .sheet { position: fixed; left: 0; right: 0; top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; min-width: 0; max-height: 50dvh; overflow: auto; border-radius: 18px 18px 0 0; border-width: 1px 0 0; transform: translateY(calc(100% + 80px)); transition: transform .28s cubic-bezier(.2, .8, .2, 1); z-index: 14; padding: 14px var(--gut) 12px; }
  .sheet.open { transform: none; }
  .panel.left, .panel.right { top: auto; left: 0; right: 0; width: auto; max-height: 56dvh; }
  .tray { left: 0; transform: translateY(calc(100% + 80px)); }
  .tray.open { transform: none; }
  .panel h1 { font-size: 21px; }
  .board { grid-template-columns: repeat(3, 1fr); }
  .rooms { grid-template-columns: 1fr 1fr 1fr; }
  .rooms button { padding: 9px 8px; font-size: 12px; min-height: 40px; }
  .presets { grid-template-columns: 1fr 1fr 1fr; }
  .presets button { font-size: 12px; padding: 10px 8px; min-height: 44px; }
  .sw { width: 72px; }
  .sw img { width: 60px; height: 60px; }
  .seg { margin-left: 0; width: 100%; overflow-x: auto; }
  .seg button { padding: 8px 10px; white-space: nowrap; }
  .lbtns button { padding: 10px 8px; }
  input[type=range] { height: 36px; }
  .selcard { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .sbtns button { flex: 1 1 auto; min-height: 42px; padding: 8px 10px; }
  .pin .pcard { max-width: 170px; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .moods u { transition: none; } .tag.fade { animation: none; } }
