/* Construtor de quartos da Wiki (/wiki/construtor) — usa os tokens de /ds/ds.css e /ds/wiki.css */
.cb-head { margin: 0 0 .8rem; }
.cb { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: .8rem; align-items: start; }
.cb > .ds-module { min-width: 0; margin: 0; }

/* Catálogo */
.cb-filters { display: flex; flex-direction: column; gap: .45rem; margin: 0 0 .4rem; }
.cb-search { display: flex; gap: .35rem; }
.cb-search .ds-input { flex: 1; min-width: 0; }
.cb-selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
.cb-filters .ds-select { width: 100%; min-width: 0; }
.cb-count { margin: 0 0 .35rem; font-size: .8rem; color: var(--ds-text-muted); }
.cb-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr)); gap: .3rem; margin: 0; padding: .3rem; list-style: none;
    max-height: 30rem; overflow-y: auto; border-radius: 2px; background: var(--ds-surface-alt); box-shadow: var(--ds-sunken); }
.cb-cat[aria-busy="true"] { opacity: .55; }
.cb-cat-item { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .25rem .1rem; border-radius: 2px; text-decoration: none;
    color: var(--ds-text); background: var(--ds-surface); box-shadow: 0 0 0 1px var(--ds-border-soft); }
.cb-cat-item img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.cb-cat-item span { width: 100%; font-size: .62rem; line-height: 1.15; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cb-cat-item:hover, .cb-cat-item:focus-visible { box-shadow: 0 0 0 2px var(--ds-brand); }
.cb-cat-item.is-sel { background: var(--ds-brand-soft); box-shadow: 0 0 0 2px var(--ds-brand); }
.cb-empty { grid-column: 1 / -1; padding: .6rem; font-size: .85rem; color: var(--ds-text-muted); }
.cb-pages { display: flex; justify-content: space-between; gap: .3rem; margin-top: .4rem; }
.cb-pages:empty { display: none; }

/* Quarto */
.cb-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; margin: 0 0 .5rem; }
.cb-modes, .cb-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.cb-modes .is-on { color: #fff; background: var(--ds-brand); }
.cb-zoom { min-width: 3rem; text-align: center; font: 600 .8rem var(--ds-mono); color: var(--ds-text-muted); }
.cb-danger { color: var(--ds-danger); }
.cb-stage { position: relative; height: min(34rem, 70vh); min-height: 16rem; overflow: hidden; border-radius: 2px; box-shadow: var(--ds-sunken);
    background: #10162b; background-image: radial-gradient(#ffffff14 1px, transparent 1px); background-size: 16px 16px; }
.cb-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.cb-stage noscript .ds-alert { position: absolute; inset: auto .6rem .6rem; margin: 0; }
.cb-flash { position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%); max-width: calc(100% - 1.2rem); margin: 0; padding: .3rem .6rem;
    border-radius: 2px; font-size: .82rem; font-weight: 600; color: #fff; background: #0b1840e6; box-shadow: var(--ds-raised); pointer-events: none; }
.cb-flash[hidden] { display: none; }

.cb-room { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .8rem; margin-top: .6rem; }
.cb-room > label { display: flex; flex-direction: column; gap: .15rem; font-size: .82rem; font-weight: 600; color: var(--ds-text-strong); }
.cb-room output { font: 700 .95rem var(--ds-font); color: var(--ds-brand); }
.cb-room input[type="range"] { width: 100%; accent-color: var(--ds-brand); }
.cb-room fieldset { grid-column: span 3; min-width: 0; margin: 0; padding: .35rem .5rem .45rem; border: 0; border-radius: 2px; background: var(--ds-surface-alt); box-shadow: 0 0 0 1px var(--ds-border-soft); }
.cb-room legend { padding: 0 .2rem; font-size: .8rem; font-weight: 700; color: var(--ds-text-strong); }
.cb-swatches { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .3rem; }
.cb-swatch { position: relative; cursor: pointer; }
.cb-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cb-swatch span { display: block; width: 1.5rem; height: 1.5rem; border-radius: 2px; box-shadow: inset 0 0 0 1px #00000059, inset 2px 2px 0 #ffffff59, inset -2px -2px 0 #00000033; }
.cb-swatch input:checked + span { outline: 2px solid var(--ds-brand); outline-offset: 2px; }
.cb-swatch input:focus-visible + span { outline: 2px dashed var(--ds-brand); outline-offset: 2px; }
.cb-check { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; cursor: pointer; }


@media (max-width: 900px) {
    .cb { grid-template-columns: 1fr; }
    .cb-cat { max-height: 16rem; }
}
@media (max-width: 520px) {
    .cb-room { grid-template-columns: 1fr; }
    .cb-room fieldset { grid-column: auto; }
    .cb-tools { justify-content: flex-start; }
    .cb-stage { height: 60vh; }
    .cb-acts .ds-btn, .cb-modes .ds-btn { padding-left: .4rem; padding-right: .4rem; }
}

/* Dica curta e painel do quarto (recolhido) */
.cb-tip { margin: .45rem 0 0; font-size: .74rem; color: var(--ds-text-muted); }
.cb-room-box { margin-top: .5rem; border-radius: 2px; background: var(--ds-surface-alt); box-shadow: 0 0 0 1px var(--ds-border-soft); }
.cb-room-box > summary { display: flex; align-items: center; gap: .35rem; padding: .4rem .55rem; cursor: pointer; font-size: .85rem; font-weight: 700; color: var(--ds-text-strong); }
.cb-room-box > summary:focus-visible { outline: 2px solid var(--ds-brand); outline-offset: 1px; }
.cb-room-box .cb-room { margin: 0; padding: 0 .55rem .55rem; }
.cb-room-box fieldset { background: var(--ds-surface); }
.cb-room-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
@media (max-width: 520px) { .cb-room-acts { grid-column: auto; } }
