/* Rooms: a calm sheet over the scene. Same type, same palette, hairlines instead of boxes. Primitives are built by kit.js. */
body[data-room] { --ink: var(--rink) !important; --ground: var(--rground) !important; }
.copy, .bottom { transition: opacity .45s ease, visibility 0s; }
body[data-room] .copy, body[data-room] .bottom { opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s .3s; }

/* ---- the sheet. Phone: rises from the bottom, the object keeps the space above. Wide: a column on the left. */
.room { --hair: color-mix(in srgb, var(--ink) 19%, transparent); --mute: color-mix(in srgb, var(--ink) 78%, var(--ground)); --veil: color-mix(in srgb, var(--ground) 95%, transparent);
  position: fixed; z-index: 5; left: 0; right: 0; bottom: var(--kb, 0px); height: var(--sheet, clamp(54cqh, 440px, 100cqh - 250px)); max-height: calc(100cqh - var(--kb, 0px) - 54px); color: var(--ink); background: var(--veil);
  opacity: 0; transition: opacity .32s ease, height .45s cubic-bezier(.22, 1, .36, 1), background-color .45s ease, color .45s ease; touch-action: pan-y; }
.room[hidden] { display: none; }
.room.on { opacity: 1; }
/* no edge: the sheet dissolves into the scene */
.room::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 40px; background: linear-gradient(to top, var(--veil), transparent); pointer-events: none; }
.room[data-size="short"] { --sheet: 38cqh; }
.room[data-size="tall"] { --sheet: 70cqh; }
.room[data-size="wide"] { --sheet: calc(100cqh - 64px); }
.room-in { height: 100%; display: flex; flex-direction: column; padding: 0 var(--pad); outline: none; }
.room-top { flex: none; min-height: 42px; display: flex; align-items: center; }
.room-head { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 610; letter-spacing: .015em; color: var(--mute); font-variant-numeric: tabular-nums; }
.room-head::before { content: ''; flex: none; width: 6px; height: 6px; background: currentColor; }
.room-close { position: fixed; z-index: 2; inset-block-start: calc(env(safe-area-inset-top) + (var(--top-h) - 44px) / 2); inset-inline-end: max(var(--pad), calc(env(safe-area-inset-right) + 12px)); min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px 0 11px; border: 1px solid #12121240; border-radius: var(--control-radius); color: var(--ink-c); background: var(--paper); font-size: 14px; font-weight: 670; line-height: 1; transition: color .2s ease, background-color .2s ease; }
.room-close:hover, .room-close:active { color: var(--paper); background: var(--ink-c); }
.room-close:focus-visible { outline-color: var(--ink); }
.room:not(.on) .room-close { visibility: hidden; }
.room-close-icon { flex: none; position: relative; display: block; width: 16px; height: 16px; }
.room-close-icon::before, .room-close-icon::after { content: ''; position: absolute; inset: 7px 1px auto; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.room-close-icon::after { transform: rotate(-45deg); }
.room-close.back .room-close-icon::before { inset: 4px auto auto 3px; width: 8px; height: 8px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; background: none; transform: rotate(45deg); }
.room-close.back .room-close-icon::after { inset: 7px 1px auto 3px; transform: none; }
.room-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; padding: 2px 5px calc(20px + env(safe-area-inset-bottom)) 4px; margin: 0 -9px 0 -4px; scroll-padding: 8px 0 24px; }
.room-el { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.room-el > * { flex: none; }
.room-el > .btn { align-self: flex-start; }

/* ---- type */
.r-title { font-size: clamp(31px, 9.6cqw, 40px); font-weight: 730; letter-spacing: -.046em; line-height: 1.04; text-wrap: balance; }
.r-title:focus { outline: none; }
.r-lead { font-size: 15px; line-height: 1.45; max-width: 25em; margin-top: -4px; text-wrap: pretty; }
.r-note { font-size: 14px; line-height: 1.45; color: var(--mute); max-width: 36em; text-wrap: pretty; }
.r-label { display: block; font-size: 13px; font-weight: 570; letter-spacing: .01em; color: var(--mute); }
.r-refusal { font-size: 13px; font-weight: 600; color: var(--red); min-height: 0; margin-top: -8px; }
.r-refusal:empty { display: none; }
/* on the red universe, red is the ground: what would be red turns to the ink of that universe */
.room[data-ground="3"] .r-refusal { color: inherit; }
.r-link { font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; min-height: 44px; text-align: left; align-self: flex-start; }

/* ---- one large input, a hairline under it */
.field-in { display: block; width: 100%; margin-top: 4px; padding: 6px 0 9px; background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 34%, transparent); border-radius: 0; color: inherit;
  font: 600 22px/1.25 'Inter Tight', system-ui, sans-serif; letter-spacing: -0.02em; outline: none; transition: border-color .25s; -webkit-appearance: none; appearance: none; }
textarea.field-in { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.4; resize: none; }
select.field-in { appearance: auto; -webkit-appearance: auto; min-height: 44px; width: min(100%, 15rem); padding: 6px 12px; border: 1px solid var(--hair); border-radius: var(--control-radius); background: var(--ground); font-size: 16px; font-weight: 570; }
.field-in:focus { border-bottom-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.field-in::placeholder { color: color-mix(in srgb, var(--ink) 55%, transparent); opacity: 1; }

/* ---- pills */
.btn { min-height: 50px; max-width: 100%; padding: 8px 19px 8px 21px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border-radius: var(--control-radius); background: var(--ink); color: var(--ground);
  font-size: 15px; font-weight: 650; letter-spacing: -.005em; line-height: 1.25; text-align: start; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s, background-color .45s ease, color .45s ease; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.97); }
.btn:hover .px::before { transform: translateX(3px); }
.btn.main { background: var(--red); color: #fff; }
.room[data-ground="3"] .btn.main { background: var(--ink); color: var(--ground); }
.btn.quiet { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent); padding: 0 22px; }
.btn.quiet:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.btn:disabled { opacity: .32; pointer-events: none; }
.r-actions { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 4px; }
.r-actions .r-link { align-self: center; margin-left: 4px; }

/* ---- a label and its choices on one line; groups are separated by hairlines */
.r-group { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.r-group > .r-label { width: 40px; flex: none; }
.r-groups { display: flex; flex-direction: column; }
.r-group.stack { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 0; }
.r-group.stack > .r-label { width: auto; }
.r-groups > .r-group + .r-group { border-top: 1px solid var(--hair); }
.chips, .swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.chip { height: 32px; padding: 0 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent); transition: background-color .2s, color .2s, box-shadow .2s, transform .2s; }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); box-shadow: none; }
.chips.big { gap: 10px; }
.chips.big .chip { height: 52px; padding: 0 24px; font-size: 15px; }
/* a swatch is one big pixel of the colour it gives */
.swatches { gap: 10px; }
.swatch { width: 30px; height: 30px; background: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent); transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--ink); transform: scale(.86); }

/* ---- lists with hairlines */
.rows { list-style: none; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 10px 0; border-top: 1px solid var(--hair); }
.row:last-child { border-bottom: 1px solid var(--hair); }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-t { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.row-n { font-size: 13px; line-height: 1.35; color: var(--mute); overflow-wrap: anywhere; }
.row-end { flex: none; font-size: 13px; font-weight: 600; text-align: right; }
.row-end .chip { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent); }

/* ---- press and hold: the pill fills while it is held */
.hold { position: relative; overflow: hidden; background: none; color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent); padding: 0 24px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* the same label again in the other colour, wiped in from the left */
.hold::after { content: attr(data-label); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: inherit; background: var(--ink); color: var(--ground); clip-path: inset(0 100% 0 0); transition: clip-path .2s ease-out; }
.hold.on::after { clip-path: inset(0 0 0 0); transition: clip-path var(--ms, 900ms) linear; }

/* ---- blocks: a heading over a hairline, never a box */
.room-el { overflow-wrap: anywhere; }
.r-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--hair); }
.r-sec[hidden] { display: none; }
.r-sec > .rows .row:first-child { border-top: 0; }
.r-sec-t { font-size: 15px; font-weight: 680; line-height: 1.25; letter-spacing: -.015em; color: var(--ink); }
.r-sub { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.r-empty { font-size: 15px; line-height: 1.45; color: var(--mute); padding: 6px 0; max-width: 26em; }
.r-secret { font-size: 13px; line-height: 1.4; padding: 10px 0; border-top: 1px dashed var(--hair); border-bottom: 1px dashed var(--hair); user-select: all; -webkit-user-select: all; }
.r-code { font-size: clamp(32px, 10cqw, 44px); font-weight: 700; letter-spacing: 0.04em; line-height: 1; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
.r-qr { display: flex; flex-direction: column; gap: 8px; }
.r-qr[hidden] { display: none; }
.r-qr canvas { width: 176px; height: 176px; image-rendering: pixelated; background: #fff; }
.badge-preview { align-self: flex-start; display: block; width: 110px; height: 122px; object-fit: contain; background: var(--paper); }
.badge-preview[hidden] { display: none; }
/* a warning is a red edge, not a box */
.r-warn { display: flex; flex-direction: column; gap: 6px; padding-left: 14px; box-shadow: inset 3px 0 0 var(--red); }
.room[data-ground="3"] .r-warn { box-shadow: inset 3px 0 0 var(--ink); }
.r-warn-t { font-size: 15px; font-weight: 700; }
.room-ice { margin-bottom: 14px; font-size: 13px; font-weight: 600; line-height: 1.4; max-width: 30em; }
.room-ice[hidden] { display: none; }
/* one of a few big choices, each with its sentence: a square marks the one picked */
.r-choices { display: flex; flex-direction: column; }
.r-choice { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 15px 0 15px 28px; text-align: left; border-top: 1px solid var(--hair); }
.r-choice:last-child { border-bottom: 1px solid var(--hair); }
.r-choice::before { content: ''; position: absolute; left: 0; top: 22px; width: 12px; height: 12px; box-shadow: inset 0 0 0 1.5px var(--ink); }
.r-choice[aria-pressed="true"]::before { background: var(--ink); box-shadow: none; }
.r-choice-t { font-size: 21px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.r-choice-n { font-size: 14px; line-height: 1.4; color: var(--mute); max-width: 26em; }
.r-choice[aria-pressed="false"] .r-choice-t { opacity: .7; }

/* ---- toasts */
.toasts { position: fixed; z-index: 9; top: calc(var(--top-h) + env(safe-area-inset-top) + 8px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 var(--pad); }
.toast { max-width: 100%; padding: 11px 18px; border-radius: 999px; background: #121212; color: #ECEAE4; font-size: 13px; font-weight: 600; line-height: 1.3; text-align: center; animation: toast-in .5s cubic-bezier(.2, .8, .2, 1) backwards; transition: opacity .35s, transform .35s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* short and narrow phones: the same screen, a little tighter, so the choices and the way forward stay in view */
@container (max-height: 700px) {
  .room-top { min-height: 38px; }
  .room-el { gap: 12px; }
  .r-title { font-size: clamp(27px, 8.4cqw, 34px); }
  .r-group { min-height: 40px; }
  .btn { min-height: 46px; }
}
@media (max-height: 700px) and (max-aspect-ratio: 4/5) {
  body[data-room="host"] .room:not([data-size="wide"]) { --sheet: min(67cqh, 433px); }
}
@container (max-width: 370px) {
  .chip { padding: 0 9px; }
  .chips { gap: 5px; }
  .r-title { font-size: clamp(26px, 8.6cqw, 32px); }
}

@media (min-aspect-ratio: 4/5) {
  .room { --col: min(44cqw, 560px); --panel-fade: clamp(34px, 8vw, 132px); right: auto; top: 0; bottom: 0; height: auto; max-height: none; width: calc(var(--pad) + var(--col) + var(--panel-fade)); background: linear-gradient(90deg, var(--veil) 0, var(--veil) calc(100% - var(--panel-fade)), transparent); }
  .room::before { display: none; }
  .room[data-size="wide"] { --col: min(980px, 62cqw); }
  /* the column starts at the same height on every step, so nothing jumps when the content changes */
  .room-in { position: absolute; left: var(--pad); top: calc(var(--top-h) + env(safe-area-inset-top)); bottom: clamp(16px, 4.4cqh, 40px); width: var(--col); height: auto; padding: clamp(6px, 14cqh - 78px, 88px) 0 0; justify-content: flex-start; }
  .room-top { min-height: 44px; margin-bottom: 8px; }
  .chips { gap: 8px; }
  .room-head { font-size: clamp(13px, .85cqw, 15px); }
  .room-body { flex: 0 1 auto; padding-bottom: 24px; }
  .room-el { gap: 22px; max-width: none; }
  .r-title { font-size: clamp(36px, min(4.3cqw, 7cqh), 64px); }
  .r-lead { font-size: clamp(15px, 1.12cqw, 18px); line-height: 1.5; margin-top: -6px; }
  .r-group { min-height: clamp(44px, 6cqh, 54px); gap: 16px; }
  .r-group > .r-label { width: 48px; }
  .chip { height: 38px; padding: 0 15px; font-size: 14px; }
  .swatch { width: 34px; height: 34px; }
  .swatches { gap: 12px; }
  .btn { min-height: 54px; padding-inline: 23px; }
  .btn.quiet, .hold { padding-inline: 23px; }
}
@media (prefers-reduced-motion: reduce) { .room, .room-close, .btn, .chip, .swatch, .toast, .copy, .bottom { transition-duration: .01s; animation: none; } }
