/* V-Pop! rooms (round 6, docs/v-pop-round6.md §6; round 7, docs/v-pop-round7.md "rooms"). Owned by the rooms agent;
 * every rule starts with .rm-
 * The room editor is a wide modal (dom.openModal): a sticky preview with a tap grid over it, the selected thing's
 * tools, then the tabs (✨ Themes · 🧱 Walls · 🛋️ My things · 🛍️ Get more). Phone first: 390 px wide, 44 px taps,
 * nothing wider than the screen (strips scroll sideways inside themselves, and the long lists — the themes, her
 * things, the catalogue by category — scroll inside their own box so the preview stays in view). Tokens come from
 * vpop.css. */

.rm-ed { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding-right: 44px; }
.rm-title { margin: 0; font: 800 var(--fs-lg, 19px)/1.2 var(--font-display, system-ui, sans-serif); }
.rm-cosy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rm-score { align-self: flex-start; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 14px; color: #fff;
  background: linear-gradient(120deg, rgba(255, 79, 154, .9), rgba(139, 92, 255, .9)); box-shadow: 0 3px 10px rgba(255, 79, 154, .3); }
.rm-note { font-size: 12px; color: var(--muted, #b8aed3); line-height: 1.3; }

/* the preview: stays in view while the tabs scroll under it */
.rm-stage { position: sticky; top: 0; z-index: 2; margin: 0 calc(-1 * var(--pad, 14px)); padding: 6px var(--pad, 14px) 2px;
  background: linear-gradient(180deg, #221a37 85%, rgba(34, 26, 55, 0)); }
.rm-view { position: relative; width: 100%; max-width: calc(42vh * 4 / 3); max-width: calc(42dvh * 4 / 3); margin: 0 auto; aspect-ratio: 4 / 3;
  border-radius: 14px; overflow: hidden; background: #2a2242; box-shadow: 0 6px 20px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.rm-pic, .rm-pic > .rm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rm-svg { display: block; width: 100%; height: auto; }
.rm-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(6, 1fr);
  touch-action: none; -webkit-user-select: none; user-select: none; }
.rm-cell { min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.rm-cell:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.rm-grid.on .rm-cell:hover, .rm-grid.on .rm-cell:active { background: rgba(255, 255, 255, .22); }
.rm-thumb { display: block; width: 80px; height: 60px; border-radius: 8px; }

/* what she has selected, or what to do next */
.rm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 52px; padding: 6px 0 4px; }
.rm-hint { flex: 1 1 160px; margin: 0; font-size: 13.5px; line-height: 1.35; color: var(--muted, #b8aed3); }
.rm-hint b { color: var(--text, #f7f2ff); }
.rm-selrow { display: flex; align-items: center; gap: 6px; width: 100%; }
.rm-selname { flex: 1 1 auto; font-size: 14.5px; color: var(--text, #f7f2ff); min-width: 0; }
.rm-selname small { font-size: 12px; color: var(--muted, #b8aed3); white-space: nowrap; }
.rm-x { flex: none; width: 44px; min-height: 44px; padding: 0; }
.rm-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
.rm-tool { min-height: 44px; flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-cancel { flex: none; }
.rm-tool.on { background: var(--grad, linear-gradient(120deg, #ff4f9a, #8b5cff)); border-color: transparent; color: #fff; }
.rm-itemsws { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  padding: 4px 2px 6px; scrollbar-width: thin; }
.rm-itemsws .rm-sw { flex: none; width: 44px; }
.rm-itemsws .rm-tool { flex: none; }
/* 🎨 on a thing with two colours: which one she is painting */
.rm-paint { width: 100%; min-width: 0; }
.rm-which { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; padding: 3px; border-radius: 12px; background: var(--ink, #14101f); }
.rm-wh { min-height: 44px; padding: 2px 6px; border: 0; border-radius: 9px; background: transparent; color: var(--muted, #b8aed3); font-size: 13px; font-weight: 800; }
.rm-wh.on { background: var(--ink-4, #362c55); color: #fff; box-shadow: inset 0 0 0 2px var(--pink, #ff4f9a); }

.rm-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rm-act { min-height: 44px; padding: 6px 4px; font-size: 13px; line-height: 1.15; white-space: normal; }
.rm-act:disabled { opacity: .45; }

.rm-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--ink, #14101f); }
.rm-tab { min-height: 48px; min-width: 0; padding: 4px 3px; border: 0; border-radius: 10px; background: transparent; color: var(--muted, #b8aed3);
  font-size: 12.5px; font-weight: 800; line-height: 1.2; }
.rm-tab.on { background: var(--grad, linear-gradient(120deg, #ff4f9a, #8b5cff)); color: #fff; box-shadow: 0 3px 10px rgba(139, 92, 255, .35); }
.rm-panel { min-height: 200px; min-width: 0; }
.rm-sec h4 { margin: 12px 2px 6px; font-size: 14px; font-weight: 800; }
.rm-lbl { margin: 8px 2px 2px; font-size: 12px; font-weight: 700; color: var(--muted, #b8aed3); }
/* the long lists scroll inside their own box, so the room above stays in view */
.rm-box { max-height: 46vh; max-height: min(46dvh, 440px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 2px 2px 8px; border-radius: 14px; scrollbar-width: thin; }
.rm-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.rm-theme { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; min-height: 44px; padding: 5px; border: 2px solid transparent; border-radius: 14px;
  background: var(--ink-3, #2a2242); color: var(--text, #f7f2ff); font-size: 12.5px; line-height: 1.2; text-align: center; }
.rm-theme:active { border-color: var(--pink, #ff4f9a); }
.rm-thpic { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden; }
.rm-thpic > svg { display: block; width: 100%; height: 100%; }
.rm-mix { width: 100%; min-height: 48px; margin-top: 10px; }
.rm-toggle { width: 100%; min-height: 44px; }
.rm-toggle.on { background: var(--grad, linear-gradient(120deg, #ff4f9a, #8b5cff)); border-color: transparent; color: #fff; }
.rm-reset { height: 44px; min-width: 44px; padding: 0; }
.rm-cathead { grid-column: 1 / -1; margin: 8px 2px 0; font-size: 13px; font-weight: 800; }
.rm-sub { margin: 6px 2px; font-size: 12.5px; color: var(--muted, #b8aed3); }
.rm-empty { margin: 18px 4px 10px; text-align: center; color: var(--muted, #b8aed3); }

/* strips of wallpapers, floors and windows: they scroll sideways inside the panel */
.rm-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 76px; gap: 6px; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding: 2px 2px 8px; scrollbar-width: thin; }
.rm-th { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; min-height: 44px; padding: 5px 3px; border-radius: 12px;
  border: 2px solid transparent; background: var(--ink-3, #2a2242); color: var(--text, #f7f2ff); scroll-snap-align: start; }
.rm-th.on { border-color: var(--pink, #ff4f9a); background: var(--ink-4, #362c55); }
.rm-th .rm-ico { width: 62px; height: 46px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.rm-th small { font-size: 11px; line-height: 1.15; text-align: center; }

.rm-sws { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; width: 100%; margin-top: 4px; }
.rm-sw { position: relative; display: flex; align-items: center; justify-content: center; height: 44px; min-width: 44px; padding: 0; border: 0;
  border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); font-size: 18px; cursor: pointer; }
.rm-sw.on { box-shadow: 0 0 0 3px var(--ink-2, #1e1830), 0 0 0 5px #fff; }
.rm-pick { background: conic-gradient(#ff4f9a, #ffcb4d, #79d45a, #22d3ee, #8b5cff, #ff4f9a); overflow: hidden; }
.rm-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }

/* things to place and things to buy */
.rm-shophead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; margin: 6px 2px; }
.rm-money { font-weight: 800; font-size: 15px; }
.rm-cats { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; padding: 2px 2px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.rm-cat { flex: none; min-height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--ink-3, #2a2242); color: var(--text, #f7f2ff);
  font-size: 13px; font-weight: 700; white-space: nowrap; }
.rm-cat.on { background: var(--grad, linear-gradient(120deg, #ff4f9a, #8b5cff)); color: #fff; }
.rm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.rm-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 8px 6px; border-radius: 14px;
  background: var(--ink-3, #2a2242); text-align: center; border: 2px solid transparent; }
.rm-tile.on { border-color: var(--pink, #ff4f9a); background: var(--ink-4, #362c55); }
.rm-tile .rm-ico { width: 64px; height: 64px; }
.rm-tname { font-size: 12.5px; line-height: 1.2; }
.rm-price, .rm-count { font-size: 12px; color: var(--muted, #b8aed3); line-height: 1.25; }
.rm-buy, .rm-put { width: 100%; min-height: 44px; margin-top: auto; }

@media (max-width: 359px) {
  .rm-acts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .rm-th, .rm-sw, .rm-tile, .rm-tool, .rm-theme { transition: none; }
}
