/* The pixel scenes provide the artwork. These surfaces frame it in both palettes. */
body {
  --glass: #251d35;
  --rim: #58415f;
  --ink-accent: #ffd0e4;
  --inset: #171221;
  --wash: #493044;
  --lift: 0 8px 20px #0d08172b;
  --edge: inset 0 1px 0 #ffffff12;
  min-height: 100dvh;
}
body.soft {
  --glass: #fff7f6;
  --rim: #dcadb9;
  --ink-accent: #762c52;
  --inset: #fffdfb;
  --wash: #ffe0e6;
  --lift: 0 8px 20px #88346012;
  --edge: inset 0 1px 0 white;
  --muted: #81505d;
}
html[lang="ar"] :is(h1,h2,h3,h4,.brand,.px-titlebar) { letter-spacing: normal; }
::selection { color: #401c31; background: #ffc3dd; }
.view :is(.card,.kpi-tile,.studio-block), .dlg:not(.profile-dlg,.shop-dlg) {
  border: 1px solid var(--rim);
  border-radius: 16px;
  background: linear-gradient(155deg,var(--panel-2) -70%,var(--glass) 64%);
  box-shadow: var(--edge),var(--lift);
}
.page-head { padding-block: 8px 14px; border-block-end: 1px solid var(--rim); }
:is(.page-title,.greeting,.question,.logo) { line-height: 1.25; text-wrap: balance; }
.greeting,.page-title { font-size: clamp(1.35rem,3vw,2rem); color: var(--ink-accent); }
.section-title { color: var(--ink-accent); }
.section-title::before {
  content: ''; display: inline-block; width: 5px; height: 10px;
  margin-inline-end: 10px; background: var(--neon);
  box-shadow: 3px -3px 0 var(--wash); vertical-align: baseline;
}

/* The sign-in room reads as a single arcade cabinet. */
.auth-wrap { padding-block: clamp(0px,1vw,14px); }
.auth-hero {
  position: relative; border: 6px solid var(--rim); border-bottom-width: 3px;
  border-radius: 18px 18px 0 0; overflow: hidden; background: var(--inset);
  box-shadow: 0 12px 40px #1b092e35;
}
.auth-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px #271a3066;
  background: linear-gradient(0deg,#2e103133,transparent 25%);
}
.view .auth-card { border-radius: 0 0 18px 18px; padding: clamp(18px,3vw,34px); }
.auth-card .logo { padding-inline-end: 4.5rem; font-size: clamp(1.45rem,4vw,2.25rem); color: var(--ink-accent); }
.auth-card .corner { inset-inline-end: 12px; }
.auth-card .tabs,.admin-tabs,.maker-tabs,.rk-spots {
  background: var(--inset); border: 1px solid var(--rim); border-radius: 12px; padding: 5px; gap: 4px;
}
.auth-card .tabs .tab,.admin-tabs .tab,.maker-tabs button,.rk-spot { border-radius: 8px; }
.auth-card .tab.active,.admin-tabs .tab.active,.maker-tabs button.on,.rk-spot.on {
  background: var(--wash); color: var(--ink-accent); border-color: var(--rim);
}
#auth-submit { min-height: 46px; }
button.primary,body.soft button.primary {
  background: linear-gradient(120deg,#ffb9d6,#ff80b7); color: #42152c;
  border-color: #b84d80; border-radius: 10px; text-shadow: none;
  box-shadow: inset 0 1px 0 #fff7,0 3px 0 #91365e;
}
:is(input:not([type]),input:is([type=text],[type=password],[type=email],[type=number],[type=search]),select,textarea) { border-radius: 8px; }
#topbar .brand { animation: none; color: var(--ink-accent); text-shadow: none; }
.main-nav button.on { box-shadow: inset 0 -3px 0 var(--neon); }

/* Preview windows, collection trays and the study scene. */
:is(.scene-wrap,.stage,.myroom-preview,.rk-stage canvas,.he-stage canvas,.studio-preview) {
  border-radius: 12px; outline: 1px solid var(--rim); outline-offset: -1px;
}
.room-card,.view .myroom-card,.hall-hero { box-shadow: var(--edge),var(--lift); }
:is(.room-card,.tile,.rk-card,.creator-tile,.badge-tile,.store-card,.studio-entry) { border-radius: 12px; }
:is(.rk-card.on,.creator-tile.on,.tile.selected,.studio-entry:focus-visible) {
  outline: 2px solid var(--ink-accent); outline-offset: -3px;
}
.session-bar,.timer,.side-panel { font-variant-numeric: tabular-nums; }
#session-time { letter-spacing: .02em; }
.kpi-tile { border-inline-start: 3px solid var(--soft) !important; }
.kpi-tile:nth-child(3n+2) { border-inline-start-color: var(--cyan) !important; }
.kpi-tile .v { text-shadow: none; }
.heatmap { padding: 4px; }
.hm,.badge-tile,.board-row,.pr-bar { border-radius: 5px; }
.sessions li,.board-row,.table td { overflow-wrap: anywhere; }
.board-row .who { min-inline-size: 0; }
.table-wrap { max-inline-size: 100%; overflow: auto; }
.table tbody tr:nth-child(even) { background: var(--wash); }
.px-window { border-radius: 12px; overflow: hidden; }
.px-titlebar { padding-block: 9px; }
.px-close { min-width: 32px; min-height: 32px; border-radius: 5px; }
.verify-card,.maint { border-block-start: 4px solid var(--neon) !important; }
dialog::backdrop { background: #180f249c; }

@keyframes tray-arrive {
  from { opacity: .35; translate: 0 6px; }
  to { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion:no-preference) {
  :is(.adm-panel,.rk-panel,.px-canvas-area,.section-heading,.studio-workspace):not([hidden]),
  .room-cards > .room-card,.kpi-grid > .kpi-tile { animation: tray-arrive .28s ease-out backwards; }
  :is(.room-cards,.kpi-grid) > :nth-child(2) { animation-delay: 35ms; }
  :is(.room-cards,.kpi-grid) > :nth-child(3) { animation-delay: 70ms; }
  :is(.room-cards,.kpi-grid) > :nth-child(4) { animation-delay: 105ms; }
}
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
  :is(.rk-card,.store-card,.creator-tile,.studio-entry) canvas { transition: scale .22s ease; }
  :is(.rk-card,.store-card,.creator-tile,.studio-entry):hover canvas { scale: 1.04; }
}
@media (max-width:680px) {
  .mr-cards { grid-template-columns: minmax(0,1fr); }
  .sim-range { min-width: 0; flex-basis: 100%; }
  .shop-admin-filters { grid-template-columns: minmax(0,1fr) !important; }
  .shop-admin-filters select { min-width: 0; }
  .auth-card .logo { padding-inline-end: 4rem; }
  .main-nav button.on { box-shadow: inset 0 2px 0 var(--neon); }
  .px-close { min-width: 44px; min-height: 44px; }
  .pr-row { grid-template-columns: minmax(0,1fr) minmax(32px,1fr) auto; }
  .sessions li { grid-template-columns: minmax(0,1fr) auto auto; }
}
@media (forced-colors:active) {
  .main-nav button.on,.rk-card.on,.creator-tile.on { outline: 2px solid Highlight; }
}

/* Keep the room art crisp and put the occupancy directly below its title. */
.room-card .info { display: grid; gap: 4px; text-align: start; background: var(--glass); }
.room-card .title { color: var(--ink-accent); line-height: 1.35; }
.room-card .count { font-variant-numeric: tabular-nums; }
.view .quote-card { border-inline-start: 4px solid var(--neon); }
.quote-card blockquote { text-wrap: pretty; line-height: 1.65; }
.credits-big,.kpis .kpi {
  padding: 12px; border-radius: 10px; background: var(--inset);
  box-shadow: var(--edge); min-inline-size: 0;
}
.kpi-v { font-variant-numeric: tabular-nums; }
.stage { background-color: var(--inset); }
.session-options button { border-radius: 12px; font-variant-numeric: tabular-nums; }
.hall-hero-pic { overflow: hidden; }
.scene-wrap { box-shadow: 0 0 0 3px var(--glass),0 0 0 4px var(--rim),var(--lift); }
.toast { max-inline-size: min(90vw,38rem); text-align: center; overflow-wrap: anywhere; }
@media (max-width:680px) {
  .kpis .kpi { padding: 8px; }
  .room-card .info { padding: 10px; }
  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion:no-preference) {
  .session-options button,.view .credits-big,.view .quote-card { animation: tray-arrive .32s ease-out backwards; }
  .session-options button:nth-child(2) { animation-delay: 40ms; }
  .session-options button:nth-child(3) { animation-delay: 80ms; }
}

/* A lit marquee over the sign-in room, with a toothed pixel edge. */
body {
  --lamp: #ffd698;
  --lilac: #c6b5ff;
  --mint: #96e3d4;
  --night: #291c3c;
}
body.soft {
  --lamp: #975019;
  --lilac: #7553a1;
  --mint: #266956;
  --night: #f2ddeb;
}
.auth-hero {
  padding-block-start: 18px; border-color: var(--night);
  background: radial-gradient(circle,var(--lamp) 1.5px,transparent 2px) 0 0 / 20px 18px,
    var(--night);
}
.auth-hero canvas { border-block-start: 2px solid var(--rim); }
.auth-wrap .auth-card {
  background: radial-gradient(ellipse at 96% 0%,var(--wash),transparent 54%),var(--glass);
}
.auth-card .logo .glitch { text-shadow: 2px 2px 0 var(--wash); }
.auth-card .tabs { margin-block: 18px; }
.auth-card .tabs button { flex: 1; }
.auth-card .tabs button.active { box-shadow: inset 0 -3px var(--neon); }
#auth-form label > span { color: var(--ink-accent); font-weight: 650; }
#auth-form input { border-width: 1px; padding-inline: 12px; }
#auth-error:empty { min-height: 0; }

/* A colored shelf edge ties each preview to its scene. Text stays in the theme ink. */
.room-card { --shelf: var(--soft); overflow: hidden; }
.room-card:is([data-scene=fireplace],[data-scene=library]) { --shelf: var(--lamp); }
.room-card:is([data-scene=rain],[data-scene=classroom]) { --shelf: var(--mint); }
.room-card:is([data-scene=lofi],[data-scene=goth],[data-scene=silent]) { --shelf: var(--lilac); }
.room-card canvas { border-block-end: 3px solid var(--shelf); }
.room-card .info { background: linear-gradient(145deg,var(--wash) -80%,var(--glass) 70%); }
.room-card .count { color: var(--shelf); font-weight: 700; }
.room-card .instances:empty { display: none; }
.hall-hero-info {
  background: radial-gradient(ellipse at 95% 0%,var(--wash),transparent 65%),var(--glass);
  color: var(--text);
}
.hall-stats > div { border-radius: 10px; }
.room-head,.page-head { gap: 10px; }
.room-tools,.pomo-row,.stage-actions { row-gap: 8px; }
.pomo-time,#session-time {
  border-radius: 8px; background: var(--inset); color: var(--ink-accent);
  padding: .12em .38em; font-variant-numeric: tabular-nums;
}
.session-bar { border-inline-start: 4px solid var(--mint); }
.view .progress-card,.view .studio-intro {
  background: radial-gradient(ellipse at 100% 0%,var(--wash),transparent 58%),var(--glass);
}
.kpi-grid .kpi-tile { background: linear-gradient(165deg,var(--wash),var(--glass) 72%); }
.board-row.you { border-inline-start: 4px solid var(--mint); }
.badge-tile.earned { background: linear-gradient(160deg,var(--wash),var(--glass)); }
.rk-stage,.he-stage { border-block-end: 3px solid var(--rim); }
#save-state:not(:empty) {
  display: inline-block; vertical-align: middle; background: var(--inset);
  color: var(--ink-accent); border: 1px solid var(--rim); border-radius: 100px; padding: 2px 9px;
}
.selected-bar,.rk-try { border-radius: 10px; border-inline-start: 4px solid var(--lilac); }
.px-titlebar { background: linear-gradient(105deg,#71315b,#98476e); color: white; }
.pf-portrait,.store-card .store-pic {
  background: repeating-conic-gradient(#fff2f7 0 25%,#fbdfe9 0 50%) 0 0 / 16px 16px;
}
.pf-stats div,.pf-counts button,.pf-tags span { border-radius: 8px; }
.pf-stats b,.pf-counts b { color: #813456; }
.dlg:not(.profile-dlg,.shop-dlg) { border-block-start: 4px solid var(--neon); }
.adm-panel fieldset { min-inline-size: 0; border-radius: 10px; }
.adm-panel summary { padding-block: 5px; }
.adm-panel .table-wrap { border-radius: 10px; scrollbar-width: thin; }
@keyframes marquee-light {
  from { opacity: 0; transform: scaleX(.3); }
  to { opacity: 1; transform: scaleX(1); }
}
@media (prefers-reduced-motion:no-preference) {
  .page-head { position: relative; }
  .page-head::after {
    content: ''; position: absolute; inset-block-end: -1px; inset-inline-start: 0;
    inline-size: min(7rem,30%); block-size: 2px; background: var(--neon);
    transform-origin: left; animation: marquee-light .36s ease-out both;
  }
  [dir=rtl] .page-head::after { transform-origin: right; }
  .rk-try:not([hidden]),#save-state:not(:empty) { animation: tray-arrive .22s ease-out; }
}
@media (max-width:680px) {
  .room-head,.pomo-row,.pf-counts { flex-wrap: wrap; }
  .room-tools { max-inline-size: 100%; flex-wrap: wrap; }
  .auth-hero { padding-block-start: 12px; background-size: 16px 12px,auto; }
  .page-head .page-title,.room-title { min-inline-size: 0; overflow-wrap: anywhere; }
}
