/* Existing ink, paper and fire; layout and interaction corrections only. */
:root { --ux-visible-height:100dvh; --ux-keyboard-bottom:0px; }
::selection { background:#ffb43a; color:#0e0b0c; }
:focus-visible { outline:3px solid #b32b1f; outline-offset:4px; }
.lab-ui :focus-visible,.p-hud :focus-visible { outline-color:#ffb43a; }
button,a,input,select,textarea,summary { touch-action:manipulation; }
button,select,input:not([type=checkbox]) { min-height:44px; }
input,textarea,select { font-size:max(16px,1em); }
dialog { max-height:calc(var(--ux-visible-height) - 24px); overscroll-behavior:contain; scrollbar-color:#79685f #f2ede8; }
.room-catalog-header { position:sticky; top:0; z-index:3; background:#21191b; padding:12px 0; }
.room-catalog-header button,.fc-close { flex-shrink:0; min-height:44px; }
.room-catalog-header h2 { order:1; }
.room-catalog-header .room-return { order:2; display:inline-flex; align-items:center; justify-content:flex-start; gap:8px; min-height:44px; padding:8px 0; border:0; border-radius:0; color:#d5c7c0; background:transparent; box-shadow:none; font:500 .875rem/1.4 'Outfit',sans-serif; cursor:pointer; }
.room-return svg { width:20px; height:20px; flex:none; }
/* En escritorio, lista y ficha tienen su propio desplazamiento; la acción
   queda fuera del contenido que se desplaza. El modo compacto sigue igual. */
#catalog-dialog[open]:has(.foxy-inventory:not(.is-compact):not(.has-entry)) {
  display:flex; flex-direction:column; height:min(90dvh,calc(var(--ux-visible-height) - 32px)); overflow:hidden;
}
#catalog-dialog:has(.foxy-inventory:not(.is-compact):not(.has-entry)) > :is(header,p) { flex-shrink:0; }
#catalog-dialog:has(.foxy-inventory:not(.is-compact):not(.has-entry)) #room-catalog { display:flex; flex-direction:column; flex:1; min-height:0; }
#catalog-dialog .foxy-inventory:not(.is-compact):not(.has-entry) { display:flex; flex-direction:column; flex:1; min-height:0; }
#catalog-dialog .foxy-inventory:not(.is-compact) > .inv-panel { flex:1; min-height:0; align-items:stretch; padding:3px 7px 10px 2px; margin:-3px -7px -10px -2px; }
#catalog-dialog .foxy-inventory:not(.is-compact) .inv-slots { min-height:0; grid-auto-rows:max-content; overflow:auto; overscroll-behavior:contain; scrollbar-color:#79685f #21191b; }
#catalog-dialog .foxy-inventory:not(.is-compact) .inv-panel > .inv-inspector { min-height:0; max-height:100%; }
#catalog-dialog .foxy-inventory:not(.is-compact) .inv-panel .inv-inspector__body { min-height:0; overflow:auto; scrollbar-gutter:stable; scrollbar-color:var(--inv-smoke) var(--inv-paper); overscroll-behavior:contain; }
#catalog-dialog .foxy-inventory:not(.is-compact) .inv-panel .inv-inspector__actions { padding-top:12px; border-top:2px solid var(--inv-ink); }
@media(min-width:1024px) and (max-height:800px) {
  #catalog-dialog .foxy-inventory:not(.is-compact) .inv-inspector__head { grid-template-columns:88px minmax(0,1fr); align-items:center; gap:12px; }
  #catalog-dialog .foxy-inventory:not(.is-compact) .inv-inspector__icon { aspect-ratio:1.4; }
  #catalog-dialog .foxy-inventory:not(.is-compact) .inv-inspector__title { font-size:1.25rem; line-height:1.2; }
}
.room-catalog-header .room-return:focus-visible { outline:2px solid #ffb43a; outline-offset:4px; }
@media(hover:hover) { .room-catalog-header .room-return:hover { color:#ffb43a; background:transparent; text-decoration:underline; text-underline-offset:4px; } }
.room-catalog-header .room-return:active { color:#ffb43a; }
.lab-chat__close { width:44px; height:44px; flex-shrink:0; }
.lab-chat__head,.lab-chat__form,.lab-chat__status { flex-shrink:0; }
.lab-chat__notice { margin:0; padding:.5rem .9rem; color:#514640; font:400 .86rem/1.35 'Outfit',sans-serif; }
.lab-say { flex-wrap:wrap; }
#say-notice { flex-basis:100%; color:#514640; font:400 .82rem/1.3 'Outfit',sans-serif; }
.lab-chat__list { min-height:0; overscroll-behavior:contain; }
.lab-chat__form button,.lab-gate button { color:#0e0b0c; }
.lab-chat__list:empty::after { content:'La conversación empieza contigo. Saluda o comparte en qué estás trabajando.'; color:#514640; font:400 1rem/1.5 'Outfit',sans-serif; }
.lab-chat__status { font:400 .9rem/1.45 'Outfit',sans-serif; }
.lab-chat[data-open=false] { visibility:hidden; }
.lab-board__form :is(input,textarea,select) { font-size:16px; }
.lab-board__form textarea { min-height:100px; resize:vertical; }
.lab-board__submit:disabled,.lab-chat__form button:disabled { opacity:.65; cursor:wait; }
.lab-gate { max-height:var(--ux-visible-height); overflow-y:auto; }
.lab-gate .access-change { background:transparent; color:#f2ede8; text-decoration:underline; box-shadow:none; }
.lab-gate .access-consent { min-height:44px; cursor:pointer; }
.lab-gate .access-form [hidden] { display:none; }
.lab-coach { max-height:calc(var(--ux-visible-height) - 200px); overflow:auto; }
.lab-coach.lab-coach--embedded { position:relative; inset:auto; width:auto; max-height:none; overflow:visible; margin:16px 6px 24px 0; flex-shrink:0; }
.lab-coach-back { margin-left:auto; }
.lab-profile__tabs { flex-wrap:wrap; }
.lab-profile__apps { padding:0; list-style:none; }
.lab-profile__apps li { padding:16px 0; border-bottom:2px solid #514640; }
.lab-profile__apps button { padding:8px 0; border:0; background:transparent; color:inherit; font:600 1.05rem/1.4 'Outfit',sans-serif; text-align:left; text-decoration:underline; text-underline-offset:4px; cursor:pointer; }
.lab-profile__apps p { margin:4px 0 0; }
.lab-connection-note { position:fixed; z-index:101; left:50%; bottom:calc(var(--ux-keyboard-bottom) + 100px); transform:translateX(-50%); width:max-content; max-width:calc(100% - 32px); padding:12px 16px; border:2px solid #0e0b0c; border-radius:7px 9px 8px 6px; background:#f2ede8; color:#0e0b0c; font:500 1rem/1.45 'Outfit',sans-serif; }
@media(max-width:1023px) {
 .hud-prototype .lab-chat { position:fixed; inset:auto 0 var(--ux-keyboard-bottom); width:auto; height:min(540px,calc(var(--ux-visible-height) - 16px)); max-height:calc(var(--ux-visible-height) - 16px); border:3px solid #0e0b0c; border-bottom:0; border-radius:18px 22px 0 0; }
 .hud-prototype .lab-chat[data-open=false] { transform:translateY(100%); }
 .room-catalog-dialog,.fc-detail { width:calc(100% - 16px); padding:16px; }
 .room-catalog-header { display:grid; grid-template-columns:minmax(0,1fr); align-items:start; gap:8px; padding-top:0; }
 .room-catalog-header h2 { font-size:clamp(1.4rem,4vw,2rem); }
 .room-catalog-header .room-return { order:0; margin:0; justify-self:start; }
 .p-menu-sheet { max-height:calc(var(--ux-visible-height) - 16px); bottom:var(--ux-keyboard-bottom); }
 .p-mission { max-height:calc(var(--ux-visible-height) - 260px); overflow:auto; }
 .lab-coach { top:auto; bottom:calc(var(--safe-bottom) + 112px); max-height:calc(var(--ux-visible-height) - 240px); }
 .p-quick button { min-height:48px; }
 .p-people-sheet .lab-online { position:static; max-height:none; display:block; }
}
@media(max-height:500px) {
 .lab-coach { top:72px; bottom:auto; left:16px; max-height:calc(var(--ux-visible-height) - 88px); }
 .p-mission { top:70px; max-height:calc(var(--ux-visible-height) - 86px); }
 .p-walk-hint { display:none; }
}
@media(prefers-reduced-motion:reduce) {
 .lab-coach,.lab-chat,.p-wheel,.inv-inspector > * { animation:none; transition:none; }
}

/* The entrance is a paper pass on the lab's own floor. */
.lab-gate { position:fixed; z-index:50; inset:0; gap:24px; padding:32px 20px; background:#100d0f url('assets/floor-tile.webp') center / 320px; background-blend-mode:multiply; text-align:left; }
.lab-gate .gate-logo { width:150px; height:64px; object-fit:contain; flex:none; }
.gate-ticket { width:min(100%,520px); flex:none; padding:clamp(24px,5vw,40px); background:#f2ede8; color:#171214; border:3px solid #171214; border-radius:14px 20px 16px 22px; box-shadow:6px 8px 0 #050405; }
.lab-gate .gate-ticket h1 { max-width:20ch; color:#171214; font-size:clamp(1.9rem,5vw,2.7rem); line-height:1.08; letter-spacing:-.025em; }
.lab-gate .gate-intro { margin:18px 0 12px; font-size:1.0625rem; line-height:1.6; }
.lab-gate .gate-access-note { margin:0; color:#67483a; font-size:.9rem; line-height:1.5; }
.lab-gate .lab-gate__prod { max-width:none; }
.lab-gate .access-form { margin:26px 0 0; gap:18px; }
.lab-gate .access-form label { color:#171214; }
.lab-gate .access-form input[type=email] { border:2px solid #79685f; background:#fffaf4; border-radius:7px 9px 8px 6px; }
.lab-gate .access-form .access-consent { color:#514640; font-size:.875rem; }
.lab-gate .access-form a { color:#754328; }
.lab-gate .access-form button { border:2px solid #171214; border-radius:8px 11px 9px 12px; box-shadow:3px 4px 0 #171214; }
.lab-gate .access-status { color:#514640; margin:0; overflow-wrap:anywhere; }
.lab-gate .access-change { color:#171214; border:0!important; box-shadow:none!important; }
.lab-gate .gate-next { margin:24px 0 0; padding-top:18px; border-top:1px solid #b4a59b; color:#67483a; font-size:.85rem; line-height:1.5; }
.lab-gate .gate-home { margin:0; color:#e3dcd3; }
.lab-gate :focus-visible { outline:3px solid #a8401c; }
.access-delivery svg { display:block; width:64px; height:48px; margin:0 0 20px; color:#a8401c; }
.access-delivery h2 { margin:0; font:400 1.8rem/1.15 'Archivo Black',sans-serif; letter-spacing:-.02em; }
.lab-gate[data-access=requested] .gate-ticket > :is(h1,.gate-intro,.gate-access-note,.gate-next) { display:none; }
.lab-gate .is-requested { margin:0; }
.is-requested > :is(label,a) { display:none!important; }
.is-requested .access-status { order:1; }
.is-requested > button { order:2; }
.access-form button[disabled] { cursor:wait; }
@media(max-height:760px) { .lab-gate { justify-content:flex-start; gap:18px; padding-block:20px; } .lab-gate .gate-logo { height:48px; } }
@media(prefers-reduced-motion:no-preference) { .gate-ticket { animation:gate-arrive .35s cubic-bezier(.16,1,.3,1); } }
@keyframes gate-arrive { from { transform:translateY(12px); opacity:.6; } }
