/* Movie Guess lobby — matched to provided design frames */

:root {
    --mg-bg: #ffffff;
    --mg-ink: #111111;
    --mg-card: #0d0d0d;
    --mg-red: #c92208;
    --mg-yellow: #feba00;
    --mg-grey: #d9d9d9;
    --mg-grey-2: #c8c8c8;
    --mg-tabs-bg: rgba(255, 255, 255, 0.5);
    --mg-slider-fill: #fbcd16;
    --mg-slider-track: #6e5800;
    --mg-option-hover: #ffeab2;
    --mg-chip: #efeeec;
    --font-display: "Bowlby One", system-ui, -apple-system, sans-serif;
    /* Figma "Create Room" frame: 788px film card, 60px sprocket strips, 30px padding */
    --card-w: min(788px, calc(100vw - 48px));
    /* 30px top + 90px header + 24px gap above; 30px below (Figma) */
    --card-min-h: min(906px, calc(100dvh - 174px));
    --film-strip-h: 60px;
    --film-pad: 30px;
    --radius-ctl: 18px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    /* Hard white offset + press travel (brutalist 3D) */
    --btn-pop-x: 5px;
    --btn-pop-y: 5px;
    --btn-pop-color: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--mg-bg);
}

body.lobby-body {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--mg-ink);
    font-family: var(--font-display);
    -webkit-font-smoothing: antialiased;
    /* Bowlby One ships a single weight — never fake bold */
    font-synthesis: none;
    overflow-x: hidden;
    background-color: #fff;
}

.lobby-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
        calc(30px + var(--safe-top))
        30px
        calc(30px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Stage: film card centred; cinema props hug the viewport edges (Figma frame) */
.lobby-stage {
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
}

.lobby-main {
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-width: 0;
    width: var(--card-w);
}

/* Props are exported edge-cropped from the 1920x1080 frame. Pin the rails to the
   viewport (the frame) and size each prop by whichever of vw / vh is tighter, so on
   short or wide windows they keep the Figma spacing instead of overlapping. Never
   wider than the gutter beside the card. */
.decor-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    width: max(0px, calc((100vw - var(--card-w)) / 2 - 16px));
    pointer-events: none;
    user-select: none;
    z-index: 0;
    /* Figma crops the soda and camera at the frame's bottom edge */
    overflow: hidden;
}
.decor-rail-left { left: 0; }
.decor-rail-right { right: 0; }

.decor-img {
    position: absolute;
    display: block;
    height: auto;
    max-width: 100%;
}

.decor-rail-left .decor-img { left: 0; }
.decor-rail-right .decor-img { right: 0; }

/* Tops are the Figma group y / 1080; widths the visible width / 1920
   (the vh term is the same width expressed against the 1080 height) */
.decor-img-clap { top: 16.03%; width: min(9.74vw, 17.32vh); }
.decor-img-ticket { top: 54.73%; width: min(10.16vw, 18.06vh); }
.decor-img-soda { top: 82.3%; width: min(10.68vw, 18.99vh); }
.decor-img-reel { top: 13.15%; width: min(12.76vw, 22.68vh); }
.decor-img-popcorn { top: 53.34%; width: min(10.42vw, 18.52vh); }
.decor-img-camera { top: 87.1%; width: min(10.63vw, 18.9vh); }

/* ---------- header ---------- */
.lobby-top {
    position: relative;
    z-index: 3;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.brand-title {
    margin: 0;
    font-weight: 400;
    font-size: clamp(2.25rem, 4.2vw, 64px);
    line-height: 1;
    color: var(--mg-ink);
    text-align: left;
}

.top-actions {
    flex-shrink: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* "Playing as" box (Figma Component 14: #efeeec, 305×90, 20/10 padding, 18px radius) */
.playing-as {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 305px;
    max-width: 100%;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-ctl);
    background: var(--mg-chip);
}

.playing-as-label {
    font-size: 16px;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
    white-space: nowrap;
}

.playing-as-row {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

/* Name column is 211px; the 1px rule sits on its bottom edge and does not add height */
.playing-as-field {
    position: relative;
    flex: 1 1 211px;
    width: 211px;
    max-width: 100%;
    height: 38px;
    min-width: 0;
}

.playing-as-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 24px;
    line-height: 38px;
    color: #000;
    text-transform: uppercase;
}

.playing-as-editor {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
}

.playing-as-input {
    width: 100%;
    height: 38px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #000;
    caret-color: rgba(0, 0, 0, 0.6);
    font: inherit;
    font-size: 24px;
    line-height: 38px;
    text-transform: uppercase;
    outline: none;
}

.playing-as-line {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    width: 100%;
    height: 1px;
}

.playing-as[data-mode="view"] .playing-as-editor,
.playing-as[data-mode="view"] .playing-as-go {
    display: none;
}

.playing-as[data-mode="edit"] .playing-as-name,
.playing-as[data-mode="edit"] .playing-as-edit {
    display: none;
}

/* 38px icon frame; the pencil glyph is centred with the Figma inset */
.playing-as-edit,
.playing-as-go {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}
.playing-as-edit img { display: block; }
.playing-as-edit:focus-visible,
.playing-as-go:focus-visible { outline: 2px solid var(--mg-yellow); outline-offset: 2px; }

/* Source arrow points left; the design flips it to point right */
.playing-as-arrow {
    display: block;
    width: 38px;
    height: 38px;
    transform: scaleX(-1);
}
.playing-as-arrow img { display: block; width: 38px; height: 38px; }

/* Yellow button, 4px black border, hard black copy 9px right / 8px down (Figma) */
.top-btn {
    --btn-pop-x: 9px;
    --btn-pop-y: 8px;
    flex-shrink: 0;
    margin: 0 var(--btn-pop-x) var(--btn-pop-y) 0;
    border: 4px solid #000;
    box-shadow: var(--btn-pop-x) var(--btn-pop-y) 0 #000;
    white-space: nowrap;
    border-radius: var(--radius-ctl);
    background: var(--mg-yellow);
    color: var(--mg-ink);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 24px;
    line-height: normal;
    padding: 18px;
    cursor: pointer;
    touch-action: manipulation;
    text-transform: uppercase;
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
}

.top-btn:hover { filter: brightness(1.04); }
.top-btn:active {
    transform: translate(var(--btn-pop-x), var(--btn-pop-y));
    box-shadow: 0 0 0 #000;
}

/* ---------- screens ---------- */
.screen {
    display: none;
    width: 100%;
    flex: 1;
    justify-content: center;
    align-items: stretch;
    position: relative;
    z-index: 2;
}
.screen.is-active { display: flex; }

.film-card {
    width: 100%;
    max-width: var(--card-w);
    min-height: var(--card-min-h);
    background: #000;
    color: #fff;
    /* 1px white edge drawn inside the 788px frame, like Figma (no layout width) */
    outline: 1px solid #fff;
    outline-offset: -1px;
    border-radius: var(--radius-ctl);
    position: relative;
    padding: calc(var(--film-strip-h) + var(--film-pad)) var(--film-pad);
    /* allow white button offset to show past the card edge */
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* film sprocket strips — 30px white squares, 18px apart, 20px inset (Figma) */
.film-card::before,
.film-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: var(--film-strip-h);
    background-color: #000;
    background-image: repeating-linear-gradient(90deg, #fff 0 30px, transparent 30px 48px);
    background-size: calc(100% - 20px) 30px;
    background-position: 20px center;
    background-repeat: no-repeat;
    pointer-events: none;
}
.film-card::before { top: 0; border-radius: var(--radius-ctl) var(--radius-ctl) 0 0; }
.film-card::after { bottom: 0; border-radius: 0 0 var(--radius-ctl) var(--radius-ctl); }

.film-inner {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Create screen: fields on top, CTA pinned to the bottom (Figma justify-between) */
.stack {
    justify-content: space-between;
    gap: 0;
}

/* Figma lets the CTA's white offset tuck 3px under the last field row */
.stack > .create-fields { margin-bottom: -3px; }

.create-fields,
.create-pane {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ---------- shared form pieces ---------- */
.field-label {
    display: block;
    margin: 0 0 18px;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: #fff;
    text-transform: uppercase;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 18px;
}

.field-row .field-label { margin: 0; }
/* Name label sits 8px above its input; Max Player label 20px above its slider */
.field-row-tight { margin-bottom: 8px; }
.field-row-loose { margin-bottom: 20px; }

.field-value {
    font-weight: 400;
    font-size: 18px;
    line-height: 1.5;
    color: var(--mg-yellow);
    text-transform: uppercase;
}

/* Name / room code input (Figma "Component 5": white, 24px padding, 18px radius) */
.name-input {
    display: block;
    width: 100%;
    border: none;
    border-radius: var(--radius-ctl);
    background: #fff;
    color: var(--mg-ink);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    padding: 24px;
    text-transform: uppercase;
    outline: none;
}

.name-input::placeholder {
    color: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.name-input:focus-visible {
    box-shadow: 0 0 0 3px var(--mg-yellow);
}

.code-input {
    letter-spacing: 0.22em;
}
.code-input::placeholder { letter-spacing: normal; }

/* tabs — translucent outer track, two inner segments (design) */
.mode-tabs {
    display: flex;
    gap: 24px;
    padding: 8px;
    background: var(--mg-tabs-bg);
    border-radius: 26px;
}

.mode-tab {
    flex: 1;
    min-width: 0;
    border: none;
    border-radius: var(--radius-ctl);
    padding: 18px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 24px;
    line-height: normal;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    background: transparent;
    color: var(--mg-ink);
    text-transform: uppercase;
    transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
}

.mode-tab:active:not(:disabled) { transform: scale(0.98); }

.mode-tab.is-active {
    background: var(--mg-red);
    color: #fff;
}

.mode-tab.is-active[data-tab="code"] {
    background: var(--mg-yellow);
    color: var(--mg-ink);
}

/* pills — flat wide chips */
.pill-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

.pill {
    flex: 1;
    min-width: 0;
    border: none;
    border-radius: var(--radius-ctl);
    padding: 12px 18px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 24px;
    line-height: 1.5;
    background: #fff;
    color: var(--mg-ink);
    cursor: pointer;
    touch-action: manipulation;
    text-transform: uppercase;
    transition: background 0.12s ease, transform 0.08s ease;
}

.pill:active { transform: scale(0.97); }
.pill.is-active { background: var(--mg-yellow); }

/* ---------- category multi-select (Figma: white field + chevron, checkbox list) ---------- */
.mg-select { position: relative; }

.mg-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: none;
    border-radius: var(--radius-ctl);
    background: #fff;
    color: var(--mg-ink);
    padding: 12px 18px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 24px;
    line-height: 1.5;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
}

.mg-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-select-chevron {
    flex-shrink: 0;
    display: block;
    transition: transform 0.15s ease;
}

/* Open state points the chevron up (Figma rotates the same icon) */
.mg-select.is-open .mg-select-chevron { transform: rotate(180deg); }

.mg-select-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 10;
    margin: 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border-radius: var(--radius-ctl);
    max-height: calc(8 * 60px);
    overflow-y: auto;
    outline: none;
}

.mg-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 60px;
    padding: 12px 18px;
    color: var(--mg-ink);
    font-size: 24px;
    line-height: 1.5;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.mg-select-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mg-select-option.is-highlighted { background: var(--mg-option-hover); }

/* 24px icon frame with the 20px checkbox glyph centred (Figma frame inset 2px) */
.mg-check,
.room-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
}
.mg-check img,
.room-icon img { display: block; }

/* ---------- sliders — 9px track, yellow fill, popcorn thumb ---------- */
/* Flex column so the label row's margin and the track's 11px offset add up
   (Figma: 32px slider box, track 11px from its top) instead of collapsing. */
.slider-field {
    display: flex;
    flex-direction: column;
}

.mg-slider {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 9px;
    margin: 11px 0 12px;
    border-radius: 8px;
    background: linear-gradient(
        90deg,
        var(--mg-slider-fill) 0 var(--fill, 50%),
        var(--mg-slider-track) var(--fill, 50%) 100%
    );
    outline: none;
}

.mg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 50px;
    height: 56px;
    border: none;
    background: url("/static/img/lobby/popcorn.png") center / contain no-repeat;
    background-color: transparent;
    cursor: pointer;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.mg-slider::-moz-range-thumb {
    width: 50px;
    height: 56px;
    border: none;
    border-radius: 0;
    background: url("/static/img/lobby/popcorn.png") center / contain no-repeat;
    background-color: transparent;
    cursor: pointer;
}

/* ---------- public-room toggle (Figma "Component 6") ---------- */
.room-access {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Public variant: keep the popcorn thumb clear of the CTA's top edge */
#max-players-wrap { margin-bottom: 16px; }

.toggle-row {
    display: flex;
    align-items: center;
    gap: 18px;
}

.toggle {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-icon { display: block; }
.toggle-icon-on,
.toggle input:checked ~ .toggle-icon-off { display: none; }
.toggle input:checked ~ .toggle-icon-on { display: block; }

.toggle input:focus-visible ~ .toggle-icon {
    outline: 2px solid var(--mg-yellow);
    outline-offset: 3px;
    border-radius: 10px;
}

.toggle-label,
.toggle-note {
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
}

.toggle-note {
    margin-left: auto;
    text-align: right;
}

/* ---------- buttons ---------- */
.btn-primary {
    border: none;
    border-radius: var(--radius-ctl);
    background: var(--mg-red);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 400;
    cursor: pointer;
    touch-action: manipulation;
    text-transform: uppercase;
    /* White hard offset — Figma "Component 7" stacks a white copy 8px down-right */
    box-shadow: var(--btn-pop-x) var(--btn-pop-y) 0 var(--btn-pop-color);
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
}

.btn-primary:active:not(:disabled) {
    transform: translate(var(--btn-pop-x), var(--btn-pop-y));
    box-shadow: 0 0 0 var(--btn-pop-color);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-cta {
    --btn-pop-x: 8px;
    --btn-pop-y: 8px;
    align-self: center;
    width: min(400px, calc(100% - 8px));
    padding: 18px;
    font-size: 24px;
    line-height: normal;
    /* keep the 8px white offset inside the card padding */
    margin-bottom: 8px;
}

.btn-yellow {
    background: var(--mg-yellow);
    color: var(--mg-ink);
}

.error-banner {
    width: var(--card-w);
    margin: 0 auto 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff1f0;
    border: 1px solid #ffb4ae;
    color: #9f120a;
    font-size: 0.88rem;
    display: none;
    position: relative;
    z-index: 3;
}
.error-banner.is-visible { display: block; }

/* ---------- shared scrollbar (Figma: 10px pale-yellow track, yellow thumb) ---------- */
.mg-scroll {
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--mg-yellow) var(--mg-option-hover);
}
.mg-scroll::-webkit-scrollbar { width: 10px; }
.mg-scroll::-webkit-scrollbar-track {
    background: var(--mg-option-hover);
    border-radius: 27px;
}
.mg-scroll::-webkit-scrollbar-thumb {
    background: var(--mg-yellow);
    border-radius: 16px;
    min-height: 66px;
}

/* ---------- public rooms (Figma "Public Room List") ---------- */
.public-inner {
    gap: 32px;
    min-height: 0;
}

/* Public screen fills the viewport under the header, so the room list (not the
   page) scrolls: 906px card in the 1080px Figma frame. */
.lobby-shell[data-screen="public"] {
    height: 100vh;
    height: 100dvh;
    min-height: 520px;
}
.lobby-shell[data-screen="public"] .lobby-stage { align-items: stretch; }
.lobby-shell[data-screen="public"] .lobby-main { min-height: 0; }
#screen-public { min-height: 0; }
#screen-public .film-card {
    min-height: 0;
    max-height: 906px;
}

.public-title {
    margin: 0;
    font-weight: 400;
    font-size: 32px;
    line-height: 1.5;
    color: #fff;
    text-transform: uppercase;
}

/* List scrolls inside the card; 10px yellow scrollbar 24px right of the rows */
.room-list {
    flex: 1 1 0;
    min-height: 0;
    padding-right: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* track always visible, as in the design */
    overflow-y: scroll;
}



.room-row {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.room-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.room-id {
    font-size: 24px;
    line-height: 1.5;
    color: #fff;
    text-transform: uppercase;
}

.room-live-tag {
    display: inline-block;
    margin-left: 12px;
    padding: 0 8px;
    border-radius: 8px;
    background: var(--mg-option-hover);
    color: var(--mg-ink);
    font-size: 12px;
    line-height: 1.8;
    vertical-align: middle;
}

.room-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--mg-yellow);
    font-size: 16px;
    line-height: 1.5;
    text-transform: uppercase;
}

.room-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.room-players {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.room-categories {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

.join-btn {
    flex-shrink: 0;
    border: none;
    border-radius: var(--radius-ctl);
    background: var(--mg-yellow);
    color: var(--mg-ink);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 18px;
    line-height: normal;
    padding: 18px;
    cursor: pointer;
    touch-action: manipulation;
    text-transform: uppercase;
    transition: transform 0.08s ease, filter 0.08s ease;
}
.join-btn:hover:not(:disabled) { filter: brightness(1.06); }
.join-btn:active:not(:disabled) { transform: scale(0.95); }
.join-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.empty-state {
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.65);
    padding: 40px 8px;
    font-size: 16px;
    text-transform: uppercase;
}

.hidden { display: none !important; }

@media (max-width: 1100px) {
    :root {
        --card-w: min(788px, calc(100vw - 220px));
    }
    .top-btn { font-size: 18px; padding: 14px 16px; }
    .top-actions { gap: 16px; }
    .playing-as { width: 250px; height: 74px; padding: 8px 16px; gap: 2px; }
    .playing-as-label { font-size: 13px; }
    .playing-as-field { height: 30px; }
    .playing-as-name,
    .playing-as-input { font-size: 18px; line-height: 30px; }
    .playing-as-input { height: 30px; }
    .playing-as-row { gap: 10px; }
    .playing-as-edit,
    .playing-as-go,
    .playing-as-arrow { width: 30px; height: 30px; }
    .playing-as-edit img { width: 24.375px; height: 24.993px; }
    .playing-as-arrow img { width: 30px; height: 30px; }
    .join-btn { padding: 14px 16px; }
}

@media (max-width: 860px) {
    /* Narrow tablets: a long name drops the name box + button under the title */
    .lobby-top { flex-wrap: wrap; row-gap: 12px; }
    .mode-tab,
    .pill,
    .mg-select-trigger,
    .mg-select-option,
    .btn-cta { font-size: 18px; }
    .mode-tabs { gap: 8px; }
    .public-title { font-size: 26px; }
    .room-id { font-size: 20px; }
    .toggle-row { flex-wrap: wrap; row-gap: 4px; }
}

/* Shorter desktop screens (e.g. 1440×900): tighten the Figma rhythm so the card fits */
@media (min-width: 721px) and (max-height: 960px) {
    :root {
        --film-strip-h: 44px;
        --film-pad: 22px;
        --card-min-h: auto;
    }
    .lobby-shell { padding-top: calc(24px + var(--safe-top)); }
    /* the button's border + black offset add 16px; give it back here */
    .lobby-top { margin-bottom: 12px; }
    .top-btn { padding: 14px 18px; }
    .playing-as { height: 76px; padding: 8px 20px; gap: 4px; }
    .film-card::before,
    .film-card::after {
        background-image: repeating-linear-gradient(90deg, #fff 0 22px, transparent 22px 36px);
        background-size: calc(100% - 16px) 22px;
        background-position: 16px center;
    }
    .stack, .create-fields, .create-pane { gap: 16px; }
    .public-inner { gap: 20px; }
    .lobby-shell { padding-bottom: calc(24px + var(--safe-bottom)); }
    .field-label { margin-bottom: 10px; }
    .field-row { margin-bottom: 10px; }
    .field-row-tight { margin-bottom: 6px; }
    .mode-tab { padding: 14px 18px; }
    .name-input { padding: 16px 24px; }
    .pill, .mg-select-trigger { padding-top: 8px; padding-bottom: 8px; }
    .room-access { gap: 12px; }
}

/* Laptop heights (1280×720, 1024×768): one step tighter so Create stays above the fold */
@media (min-width: 721px) and (max-height: 800px) {
    :root {
        --film-strip-h: 34px;
        --film-pad: 18px;
    }
    .lobby-shell { padding-top: calc(16px + var(--safe-top)); padding-bottom: 16px; }
    .lobby-top { margin-bottom: 6px; }
    .brand-title { font-size: 48px; }
    .top-btn { font-size: 18px; padding: 8px 16px; }
    .film-card::before,
    .film-card::after {
        background-image: repeating-linear-gradient(90deg, #fff 0 18px, transparent 18px 30px);
        background-size: calc(100% - 14px) 18px;
        background-position: 14px center;
    }
    .stack, .create-fields, .create-pane { gap: 12px; }
    .public-inner { gap: 14px; }
    .top-actions { gap: 16px; }
    .playing-as { width: 240px; height: 64px; padding: 6px 16px; gap: 0; }
    .playing-as-label { font-size: 12px; }
    .playing-as-field { height: 28px; }
    .playing-as-name,
    .playing-as-input { font-size: 16px; line-height: 28px; }
    .playing-as-input { height: 28px; }
    .playing-as-row { gap: 10px; }
    .playing-as-edit,
    .playing-as-go,
    .playing-as-arrow { width: 28px; height: 28px; }
    .playing-as-edit img { width: 22.75px; height: 23.327px; }
    .playing-as-arrow img { width: 28px; height: 28px; }
    .join-btn { padding: 12px 16px; }
    .room-list { gap: 14px; }
    .room-row { padding-bottom: 12px; }
    .room-info { gap: 8px; }
    .mode-tab,
    .pill,
    .mg-select-trigger,
    .mg-select-option,
    .btn-cta { font-size: 20px; }
    .public-title { font-size: 26px; }
    .mode-tab { padding: 12px 18px; }
    .name-input { padding: 12px 18px; }
    .pill, .mg-select-trigger { padding-top: 6px; padding-bottom: 6px; }
    .btn-cta { padding: 14px 18px; }
    .mg-select-option { height: 48px; }
    .mg-select-list { max-height: calc(8 * 48px); }
    .field-label { font-size: 14px; margin-bottom: 8px; }
    .field-row { margin-bottom: 8px; }
    .field-row-tight { margin-bottom: 4px; }
    .field-value { font-size: 16px; }
    .toggle { height: 44px; }
    .room-access { gap: 8px; }
}

@media (max-width: 720px) {
    .lobby-shell {
        padding:
            calc(14px + var(--safe-top))
            12px
            calc(16px + var(--safe-bottom));
    }
    .decor-rail { display: none; }
    .top-btn {
        --btn-pop-x: 5px;
        --btn-pop-y: 5px;
        font-size: 12px;
        padding: 10px 12px;
        border-width: 3px;
        border-radius: 12px;
    }
    .brand-title { font-size: 1.55rem; }
    /* Title and button share the first row; the name box takes the second */
    .lobby-top { flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
    .top-actions { display: contents; }
    .playing-as {
        order: 3;
        flex: 1 0 100%;
        width: 100%;
        height: auto;
        min-height: 72px;
        align-items: stretch;
        gap: 4px;
        padding: 8px 14px;
        border-radius: 12px;
    }
    .playing-as-label { font-size: 12px; }
    /* View: the pencil stays beside the name. Edit: the line grows so it is easy to type on. */
    .playing-as[data-mode="view"] .playing-as-field {
        flex: 0 1 auto;
        width: max-content;
        max-width: calc(100% - 44px);
        height: 28px;
    }
    .playing-as[data-mode="view"] .playing-as-name { width: auto; }
    .playing-as[data-mode="edit"] .playing-as-field {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
        height: 28px;
    }
    .playing-as-name,
    .playing-as-input { font-size: 16px; line-height: 28px; }
    .playing-as-input { height: 28px; }
    .playing-as-row { gap: 8px; }
    .playing-as-edit,
    .playing-as-go,
    .playing-as-arrow { width: 28px; height: 28px; }
    .playing-as-edit img { width: 22.75px; height: 23.327px; }
    .playing-as-arrow img { width: 28px; height: 28px; }
    .join-btn { padding: 12px 14px; border-radius: 12px; }
    :root {
        --card-w: calc(100vw - 28px);
        --card-min-h: min(640px, calc(100dvh - 100px));
        --film-strip-h: 40px;
        --film-pad: 18px;
    }
    .film-card::before,
    .film-card::after {
        background-image: repeating-linear-gradient(90deg, #fff 0 18px, transparent 18px 30px);
        background-size: calc(100% - 12px) 18px;
        background-position: 12px center;
    }
    .stack, .create-fields, .create-pane { gap: 18px; }
    .public-inner { gap: 18px; }
    .public-title { font-size: 22px; }
    .room-list { padding-right: 12px; }
    .room-id { font-size: 18px; }
    .room-info { gap: 10px; }
    .room-details { font-size: 13px; }
    .room-meta { gap: 10px; }
    .join-btn { font-size: 15px; }
    .mode-tab,
    .pill,
    .mg-select-trigger,
    .mg-select-option,
    .btn-cta { font-size: 16px; }
    .mode-tab { padding: 14px 8px; }
    .name-input { padding: 16px 18px; font-size: 14px; }
    .mg-select-option { height: 48px; }
    .mg-select-list { max-height: calc(8 * 48px); }
    .field-label, .toggle-label, .toggle-note { font-size: 13px; }
    .toggle-note { margin-left: 0; text-align: left; flex-basis: 100%; }
    .field-value { font-size: 15px; }
}

@media (max-width: 420px) {
    .brand-title { font-size: 1.4rem; }
    .mode-tab { font-size: 13px; }
    :root {
        --card-min-h: auto;
    }
    .film-card { min-height: auto; }
}
