/* rooms.css — the Rooms panel's two groups and the five shared rooms.
   One file, two copies (frontend/css/rooms.css, backend/css/rooms.css):
   the same class names in both apps, so the twelve rooms read the same.

   THE LIST: a numbered room is a 44 px hand — the number in a small
   circle, the title bold, the subtitle small beneath it. "Rooms" heads the
   first twelve; "More rooms" is a ruled divider before the rest.
   THE ROOMS (.xr-room): cards on the page's own glass, laid in columns on
   a desk and one column on a phone; nothing here names a colour. */

/* ---- the numbered list ---- */
.nav-item.nav-room { align-items: flex-start; gap: 10px; padding: 7px 10px 7px 8px; min-height: 48px; line-height: 1.2; }
.nav-item.nav-room .nav-n {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-muted);
  border: 1px solid var(--border-strong); background: var(--bg-elevated);
}
.nav-item.nav-room.is-active .nav-n { color: var(--accent-contrast); background: var(--accent); border-color: var(--accent); }
.nav-item.nav-room .nav-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.nav-item.nav-room .nav-title { font-weight: 700; font-size: 14px; color: inherit; }
.nav-item.nav-room .nav-sub { font-size: 11.5px; font-weight: 400; color: var(--text-faint); white-space: normal; overflow-wrap: anywhere; }
.nav-item.nav-room.is-active .nav-sub { color: var(--text-muted); }
.nav-group-label.nav-group-main { padding-top: 10px; }
.nav-group-label.nav-divider {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border-strong);
}
.nav-group-label.nav-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sidebar-nav .nav-group-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 12px 10px 4px; font-family: var(--font-mono); }

/* the mobile More sheet carries the same list */
.more-sheet .more-sheet-nav { display: flex; flex-direction: column; gap: 2px; max-height: min(72dvh, 640px); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 2px calc(4px + env(safe-area-inset-bottom)); }
.more-sheet .more-sheet-nav .nav-item { border: none; background: transparent; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.more-sheet .more-sheet-nav .nav-item.is-active { background: linear-gradient(90deg, rgba(var(--glow-rgb), .16), rgba(var(--glow-rgb), .02)); color: var(--accent-strong); box-shadow: inset 2px 0 0 var(--accent); }

/* the console's left panel: two views, Rooms | Builder */
.left-panel-views { display: flex; align-items: stretch; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); }
.left-panel-view {
  flex: 1; min-height: 44px; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: .02em;
}
.left-panel-view:hover { color: var(--text); }
.left-panel-view.is-active { color: var(--text); border-bottom-color: var(--accent); }
.left-panel-view:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#builder-panel-mount { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
#builder-panel-mount[hidden] { display: none; }
.builder-panel-waiting { padding: 14px 12px; font-size: 12.5px; color: var(--text-faint); }
/* a FIXED left column: no pin, no close, no edge tab on a tablet or a desk */
@media (min-width: 481px) {
  html.sp-left-fixed .side-panel-left .side-panel-pin,
  html.sp-left-fixed .side-panel-left .side-panel-close,
  html.sp-left-fixed .side-panel-tab-left,
  html.sp-left-fixed #hamburger-btn { display: none !important; }
}

/* ---- the five rooms ---- */
.view-xr .xr-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.view-xr .xr-body { padding: 0 14px; }
.xr-room { font-size: 14px; }
.xr-room .card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); backdrop-filter: blur(10px) saturate(1.1); -webkit-backdrop-filter: blur(10px) saturate(1.1); box-shadow: inset 0 1px 0 rgba(var(--glow-rgb), .10), var(--shadow-md); padding: 16px; margin-bottom: 14px; min-width: 0; }
.xr-room .hint { font-size: 12px; color: var(--text-faint); margin: 4px 0 0; }
.xr-room .chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); background: var(--neutral-chip); color: var(--text-muted); font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); }
.xr-room .form-error { color: var(--danger); font-size: 12.5px; }
.xr-room p { margin: 0 0 10px; line-height: 1.5; }
.xr-room code { font-family: var(--font-mono); font-size: .92em; background: var(--bg-sunken); padding: 1px 5px; border-radius: 5px; }
.xr-h { font-family: var(--font-display, inherit); font-size: 19px; font-weight: 700; margin: 0 0 8px; }
.xr-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.xr-cols > .card { margin-bottom: 0; }
.xr-span2 { grid-column: 1 / -1; }
.xr-ol, .xr-ul { margin: 0; padding-left: 20px; line-height: 1.5; }
.xr-ol li, .xr-ul li { margin: 0 0 6px; }
.xr-foot { margin: 6px 2px 0; }

/* code blocks and copy */
.xr-code { position: relative; margin: 8px 0 0; }
.xr-code .xr-copy { position: absolute; top: 8px; right: 8px; min-height: 44px; padding: 0 14px; font-size: 12px; }
.md-pre { margin: 8px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-sunken); border: 1px solid var(--border); overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; white-space: pre; }
.md-pre code { background: transparent; padding: 0; font-size: inherit; }
.xr-code .md-pre { padding-right: 110px; min-height: 60px; }

/* documentation */
.xr-docs { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; align-items: start; }
.xr-docs-list { position: sticky; top: 0; max-height: calc(100dvh - 140px); overflow-y: auto; }
.xr-docs-list .xr-h { font-size: 15px; margin-top: 8px; }
.xr-docs-list .xr-h:first-child { margin-top: 0; }
.xr-list { display: flex; flex-direction: column; gap: 2px; }
.xr-list-sub { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 8px 8px 2px; font-family: var(--font-mono); }
.xr-item { display: flex; flex-direction: column; gap: 1px; width: 100%; min-height: 44px; padding: 6px 10px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.xr-item:hover { background: var(--bg-sunken); }
.xr-item.is-active { background: linear-gradient(90deg, rgba(var(--glow-rgb), .16), rgba(var(--glow-rgb), .02)); color: var(--accent-strong); box-shadow: inset 2px 0 0 var(--accent); }
.xr-item-title { font-weight: 600; font-size: 13.5px; }
.xr-item-sub { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.xr-docs-body { min-height: 300px; line-height: 1.55; overflow-wrap: anywhere; }
.xr-docs-body h2, .xr-docs-body h3, .xr-docs-body h4 { font-family: var(--font-display, inherit); margin: 18px 0 8px; line-height: 1.25; }
.xr-docs-body h2 { font-size: 22px; } .xr-docs-body h3 { font-size: 18px; } .xr-docs-body h4 { font-size: 15px; }
.xr-docs-body ul, .xr-docs-body ol { padding-left: 22px; margin: 0 0 10px; }
.xr-docs-body blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.xr-docs-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.xr-doc-meta { margin-bottom: 8px; }
.md-table, .xr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.md-table th, .md-table td, .xr-table th, .xr-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md-table th, .xr-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-family: var(--font-mono); }
.xr-table-wrap { overflow-x: auto; padding: 8px; }
.xr-nowrap { white-space: nowrap; }

/* incidents */
.xr-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.xr-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.xr-filters select, .xr-filters input { min-height: 44px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 14px; }
.xr-filters .xr-grow { flex: 1; min-width: 160px; }
.xr-filters .hint { margin: 0 0 12px; }

/* architecture */
.xr-pipe { width: 100%; height: auto; display: block; margin-top: 8px; font-family: inherit; }

/* graphic design */
.xr-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.xr-swatch { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto auto; column-gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elevated); }
.xr-sw { grid-row: 1 / 4; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); }
.xr-sw-name { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; }
.xr-sw-val { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.xr-sw-c { font-size: 10.5px; color: var(--text-faint); }
.xr-orbs { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; margin: 6px 0 10px; }
.xr-orb-seat { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.xr-orb-seat canvas { display: block; }
.xr-moods { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.xr-moods .btn { min-height: 44px; padding: 0 14px; font-size: 12.5px; text-transform: capitalize; }
.xr-type { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); }
.xr-type-px { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.xr-type-sample { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xr-glass-demo { margin: 12px 0 0; }

/* ---- tablet: one column for the wide grids ---- */
@media (max-width: 900px) {
  .xr-docs { grid-template-columns: 1fr; }
  .xr-docs-list { position: static; max-height: none; }
}

/* ---- THE PHONE RULE, written from the 375×812 measurement ---- */
@media (max-width: 480px) {
  .xr-cols { grid-template-columns: 1fr !important; }
  .view-xr .xr-body { padding: 0 10px !important; }
  .xr-room .card { padding: 12px !important; }
  .xr-code .md-pre { padding-right: 14px !important; padding-bottom: 48px !important; }
  .xr-code .xr-copy { top: auto !important; bottom: 8px !important; }
  .xr-filters label { width: 100%; }
  .xr-docs-list { max-height: 40dvh; overflow-y: auto; }
  .xr-swatches { grid-template-columns: 1fr 1fr; }
  .xr-orbs { justify-content: center; }
}

/* ---- the console's Chat (room 1) and Comparison (room 2) ---- */
.cr-card { display: flex; flex-direction: column; min-height: min(70dvh, 720px); }
.cr-log { flex: 1; min-height: 240px; max-height: 60dvh; overflow-y: auto; padding: 6px 2px; display: flex; flex-direction: column; gap: 10px; }
.cr-msg { max-width: 82%; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); line-height: 1.5; overflow-wrap: anywhere; }
.cr-msg p { margin: 0 0 6px; } .cr-msg p:last-child { margin-bottom: 0; }
.cr-user { align-self: flex-end; background: var(--accent-soft); }
.cr-assistant { align-self: flex-start; background: var(--bg-elevated); }
.cr-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.cr-meta .hint { margin: 0; }
.cr-composer { margin-top: 10px; border-top: 0; background: transparent; padding-left: 0; padding-right: 0; }
.cr-composer .rp-input, .cmp-form .rp-input { min-height: 44px; }
.cr-safety { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 12.5px; color: var(--text-muted); }
.cr-safety input { width: 18px; height: 18px; }
.cmp-form { border-top: 0; background: transparent; padding: 0; margin-top: 6px; }
.cmp-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cmp-body { min-height: 120px; line-height: 1.5; overflow-wrap: anywhere; }
.cmp-stats { margin-top: 8px; }
.thinking-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.thinking-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: xr-dot 1s infinite ease-in-out; }
.thinking-dots span:nth-child(2) { animation-delay: .15s; } .thinking-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes xr-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (max-width: 480px) { .cmp-cols { grid-template-columns: 1fr !important; } .cr-msg { max-width: 94%; } }
