/* We pigs fly: the sign-in and lobby page (index.html). One design system, "hangar deck on a bright day"
   (docs/design/lobby-redesign.md §2, WPF-328): a CSS sky, opaque cream cards, logo-pink for the one primary action per
   view, Nunito. Part 1 is the reusable system (tokens, type, buttons, cards, tags, pigs, forms, tabs, toast, sheet);
   part 2 puts today's lobby markup on it. Classes only: the CSP forbids style="" (JS may set custom properties). */

/* ============================================================ 1. design system */

/* Nunito, self-hosted (public/fonts/README.md): the variable font, every weight in one 39 KB Latin file. */
@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-latin-var.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tokens: the day set. The night-sky set (WPF-335) redefines them under prefers-color-scheme: dark at the end. */
:root {
  color-scheme: light;
  /* sky (page gradient top → bottom) and surfaces */
  --sky-1: #a9d6ff;  --sky-2: #e4f3ff;  --sky-3: #ffffff;
  --paper: #fffdf9;  --paper-2: #fff4f8;  --paper-3: #f6f1ea;   /* card, tinted panel, section header */
  --field: #ffffff;                                             /* inputs and opaque rows on a card */
  --line: #ecd8e1;   --line-2: #d9c3cf;                         /* borders: soft, strong */
  /* ink */
  --ink: #27304a;  --ink-2: #5c6578;  --ink-3: #8b93a5;         /* text 12.9:1, meta 5.8:1, hint 3:1 (non-text, placeholders) */
  /* brand, from the logo */
  --pink: #d92a77;  --pink-hover: #cc2470;  --pink-deep: #b81f63;  /* primary fill (white text 4.6:1, AA), its hover (5.2:1), its 3D edge (6.2:1) */
  --pink-ink: #c51e6a;  --pink-soft: #ffe1ee;   /* link/ghost text (spec #c71f6b was 4.498:1 on --pink-soft), tint */
  --olive: #5f6f3a; --olive-soft: #e9efd6;                      /* AI crew, in flight */
  --sun: #ffc83d;   --sun-ink: #7a5200;  --sun-soft: #fff1c6;   /* captain star, Story */
  --skyblue: #2f8fd6; --skyblue-ink: #1d6aa6; --skyblue-soft: #dcefff; /* Cloud Island, focus ring, info */
  --danger: #c22e28; --danger-soft: #fde7e5;                    /* 4.8:1 on its soft tint */
  --focus: var(--skyblue);
  /* shape */
  --r-sm: 8px; --r: 14px; --r-lg: 22px; --r-pill: 999px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 8px 24px rgba(50, 60, 110, 0.10);
  --shadow-lift: 0 14px 40px rgba(50, 60, 110, 0.18);
  --scrim: rgba(39, 48, 74, 0.38);
  /* type: Nunito, then a system face with a close x-height */
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-xs: 12px; --t-sm: 13.5px; --t-md: 15px; --t-lg: 17px; --t-xl: 22px; --t-2xl: 28px; --t-3xl: 36px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* The account dropdown is intentionally removed from the top bar on every view. */
#me-menu-button, #me-menu { display: none !important; }

/* The sky: a daytime gradient with a few pure-CSS clouds (no images, no blur). */
body {
  margin: 0;
  font: 600 var(--t-md)/1.45 var(--font);
  color: var(--ink);
  background-color: var(--sky-2);
  background-image:
    radial-gradient(70px 30px at 8% 14%, #fff 60%, transparent 62%),
    radial-gradient(110px 44px at 15% 16%, #fff 60%, transparent 62%),
    radial-gradient(60px 26px at 22% 14%, #fff 60%, transparent 62%),
    radial-gradient(90px 36px at 76% 7%, #fff 60%, transparent 62%),
    radial-gradient(130px 50px at 84% 8%, #fff 60%, transparent 62%),
    radial-gradient(60px 26px at 92% 6%, #fff 60%, transparent 62%),
    radial-gradient(80px 32px at 4% 62%, rgba(255, 255, 255, 0.8) 60%, transparent 62%),
    radial-gradient(120px 46px at 10% 64%, rgba(255, 255, 255, 0.8) 60%, transparent 62%),
    radial-gradient(90px 34px at 90% 48%, rgba(255, 255, 255, 0.8) 60%, transparent 62%),
    radial-gradient(900px 300px at 50% 115%, rgba(255, 255, 255, 0.9), transparent 70%),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  background-repeat: no-repeat;
}

/* Type scale (§2.2): 900 headings at 1.15, 600 body at 1.45. */
h1, h2, h3, h4 { line-height: 1.15; font-weight: 900; letter-spacing: -0.01em; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
.t-3xl { font-size: var(--t-3xl); }
.eyebrow { margin: 0; font-size: var(--t-xs); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pink-ink); }
.lede { color: var(--ink-2); font-size: var(--t-lg); font-weight: 600; }
.meta { color: var(--ink-2); font-size: var(--t-sm); font-weight: 700; }
.hint, .fine { color: var(--ink-2); font-size: var(--t-xs); font-weight: 600; } /* ink-2, not ink-3: hints are text (AA) */
.caps { font-size: var(--t-xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Buttons. One .btn-primary per view. A bare <button> reads as secondary (so JS-built buttons are never pink slabs). */
button { font: inherit; font-weight: 800; cursor: pointer; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line-2); border-radius: var(--r-pill); padding: 9px 18px; }
button:disabled { opacity: 0.5; cursor: default; }
/* #handle-submit carries no classes (app.test.js pins its markup, WPF-261), so it joins the primary large block by id. */
.btn, #handle-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--r-pill); font: 800 var(--t-md)/1.2 var(--font); white-space: nowrap;
  text-decoration: none; cursor: pointer; transition: transform 0.06s ease, background-color 0.12s, border-color 0.12s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary, #handle-submit { background: var(--pink); color: #fff; border-color: var(--pink-deep); box-shadow: 0 3px 0 var(--pink-deep), 0 8px 18px rgba(217, 42, 119, 0.30); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); }
.btn-primary:hover:not(:disabled), #handle-submit:hover:not(:disabled) { background: var(--pink-hover); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line-2); box-shadow: 0 2px 0 rgba(50, 60, 110, 0.08); }
.btn-secondary:hover:not(:disabled) { background: #fff; border-color: var(--ink-3); }
.btn-ghost { background: transparent; color: var(--pink-ink); border-color: transparent; padding: 0 10px; min-height: 36px; }
.btn-ghost:hover:not(:disabled) { background: var(--pink-soft); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-lg, #handle-submit { min-height: 52px; padding: 0 26px; font-size: var(--t-lg); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: var(--t-sm); }
.btn-ghost.btn-sm { padding: 0 8px; }
.btn.block, #handle-submit { display: flex; width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: 0.5; cursor: default; box-shadow: none; }

/* Cards: opaque paper straight on the sky. */
.card { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-tint { background: var(--paper-2); }
.card-pad { padding: 18px 20px; }

/* Tags and counts. */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font: 800 var(--t-xs)/1 var(--font); letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; background: var(--paper-3); color: var(--ink-2); }
.tag-dm { background: var(--pink-soft); color: var(--pink-ink); }
.tag-ci { background: var(--skyblue-soft); color: var(--skyblue-ink); }
.tag-story { background: var(--sun-soft); color: var(--sun-ink); }
.tag-flight { background: var(--olive-soft); color: var(--olive); }
.tag-ai { background: var(--olive-soft); color: var(--olive); text-transform: none; letter-spacing: 0; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-pill); background: var(--pink); color: #fff; font: 800 var(--t-xs)/1 var(--font); vertical-align: 3px; margin-left: 4px; }
.count.is-zero, .tab .count { background: var(--line); color: var(--ink-2); }

/* Pig face: CSS only, tinted from JS with el.style.setProperty('--hide', '#rrggbb'). Markup: <span class="pig"><i></i></span>. */
.pig {
  --hide: #ffb3cc; --size: 32px;
  position: relative; isolation: isolate; display: inline-block; flex: none; vertical-align: middle;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: radial-gradient(circle at 32% 42%, #3a2230 7%, transparent 8%), radial-gradient(circle at 68% 42%, #3a2230 7%, transparent 8%), var(--hide);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08), 0 0 0 2px #fff;
}
.pig::before, .pig::after { content: ""; position: absolute; top: -12%; width: 34%; height: 34%; background: var(--hide); border-radius: 60% 60% 45% 45%; z-index: -1; }
.pig::before { left: 4%; transform: rotate(-18deg); }
.pig::after { right: 4%; transform: rotate(18deg); }
.pig i { position: absolute; left: 50%; top: 64%; width: 46%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: #ff8fb8; box-shadow: inset 0 0 0 1px rgba(60, 20, 40, 0.18); }
.pig i::before, .pig i::after { content: ""; position: absolute; top: 32%; width: 18%; height: 36%; border-radius: 50%; background: rgba(60, 20, 40, 0.55); }
.pig i::before { left: 25%; }
.pig i::after { right: 25%; }
.pig-xs { --size: 20px; }
.pig-lg { --size: 48px; }
.pig-xl { --size: 72px; }
/* Keep the CSS pig's box sizes; pictures carry their own transparent silhouette. */
.pig.pig-picture { background: none; box-shadow: none; border-radius: 0; object-fit: contain; }
.pig.pig-picture::before, .pig.pig-picture::after { content: none; }
/* A crew member (pig + handle, optional ★ Captain), an open seat, and the seat dots of a match card. */
.pig-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 36px; padding: 0 12px 0 4px; border-radius: var(--r-pill); background: var(--field); border: 1.5px solid var(--line); font-weight: 800; font-size: var(--t-sm); }
.pig-chip .pig { --size: 26px; }
.pig-chip .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pig-chip .star { margin-left: 2px; color: var(--sun-ink); background: var(--sun-soft); border-radius: var(--r-pill); padding: 1px 8px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.seat-empty { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1.5px dashed var(--line-2); color: var(--ink-2); font-weight: 700; font-size: var(--t-sm); }
.seats { display: inline-flex; gap: 3px; }
.seats > i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--field); }
.seats > i.on { background: var(--pink); border-color: var(--pink-deep); }
.seats > i.ai { background: var(--olive); border-color: var(--olive); }

/* Forms. A .field is label + control + optional .hint; .field-row puts two fields side by side (stacks on phones). */
label { display: block; margin-bottom: 6px; font: 800 var(--t-sm)/1.3 var(--font); color: var(--ink); }
.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field > legend { margin: 0; padding: 0; font: 800 var(--t-sm)/1.3 var(--font); color: var(--ink); }
.field .opt { font-weight: 600; color: var(--ink-2); }
.field > .hint { margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.input, input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"])) {
  width: 100%; height: 46px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: var(--r);
  background: var(--field); color: var(--ink); font: 600 var(--t-md) var(--font);
}
input::placeholder { color: var(--ink-3); opacity: 1; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--pink); }
.code-input { height: 60px; text-align: center; font: 900 30px/1 var(--font); letter-spacing: 0.45em; padding-left: 0.45em; font-variant-numeric: tabular-nums; }
select { height: 46px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: var(--r); background: var(--field); color: var(--ink); font: 600 var(--t-md) var(--font); }
select:disabled { background: var(--paper-3); color: var(--ink-2); border-style: dashed; opacity: 1; }
/* .select wraps a native <select> to give it a drawn chevron; .is-locked = dashed with a padlock (and `disabled`). */
.select { position: relative; display: block; min-width: 0; }
.select > select { width: 100%; appearance: none; padding-right: 38px; }
.select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px; border-right: 2.5px solid var(--ink-2); border-bottom: 2.5px solid var(--ink-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select-sm > select { height: 34px; font-size: var(--t-sm); padding: 0 30px 0 10px; border-radius: var(--r-sm); }
.select-sm::after { right: 12px; width: 7px; height: 7px; }
.select.is-locked > select { background: var(--paper-3); color: var(--ink-2); border-style: dashed; }
.select.is-locked::before { content: ""; position: absolute; right: 16px; top: calc(50% - 9px); width: 8px; height: 7px; border: 2px solid var(--ink-3); border-bottom: 0; border-radius: 5px 5px 0 0; pointer-events: none; }
.select.is-locked::after { right: 14px; top: calc(50% - 2px); width: 12px; height: 9px; border: 0; border-radius: 2px; background: var(--ink-3); transform: none; }
/* Segmented choice: buttons with .is-on, or labels around radios (<label><input type="radio"><span>2</span></label>). */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--paper-3); border: 1.5px solid var(--line); }
.seg > button, .seg > label { display: inline-grid; place-items: center; min-width: 48px; height: 38px; margin: 0; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: transparent; font: 800 var(--t-md)/1 var(--font); color: var(--ink-2); cursor: pointer; }
.seg > label > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg > button.is-on, .seg > label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 2px 6px rgba(50, 60, 110, 0.14); }
.seg > label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg.is-locked { opacity: 0.6; }
/* Radio cards (mode picker): <label class="choice"><input type="radio"><span class="ico">⚔</span><b>Title</b><small>Rule</small></label>. */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.choice { position: relative; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; row-gap: 2px; align-items: center; margin: 0; padding: 12px 34px 12px 14px; border-radius: var(--r); border: 1.5px solid var(--line-2); background: var(--field); cursor: pointer; font-weight: 600; }
.choice > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.choice .ico { grid-row: 1 / 3; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: var(--paper-3); }
.choice b { font-size: var(--t-md); font-weight: 900; }
.choice small { color: var(--ink-2); font-size: var(--t-xs); line-height: 1.35; }
.choice.is-on, .choice:has(> input:checked) { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.choice.is-on::after, .choice:has(> input:checked)::after { content: "✓"; position: absolute; right: 10px; top: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 12px; font-weight: 900; display: grid; place-items: center; }
.choice:has(> input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Toggle: <label class="switch"><input type="checkbox"><span class="knob"></span>AI crew</label> (or .is-on from JS). */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; font: 700 var(--t-sm)/1.2 var(--font); color: var(--ink-2); cursor: pointer; }
.switch > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch .knob { position: relative; flex: none; width: 36px; height: 22px; border-radius: var(--r-pill); background: var(--line-2); transition: background-color 0.12s; }
.switch .knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: left 0.12s; }
.switch.is-on .knob, .switch > input:checked + .knob { background: var(--olive); }
.switch.is-on .knob::after, .switch > input:checked + .knob::after { left: 17px; }
.switch > input:focus-visible + .knob { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Range with its value: <label class="range">Skill <input type="range"><output>50%</output></label>. */
.range { display: inline-flex; align-items: center; gap: 8px; margin: 0; font: 700 var(--t-sm)/1.2 var(--font); color: var(--ink-2); }
.range > input { width: 110px; }
.range > output { min-width: 34px; font-variant-numeric: tabular-nums; color: var(--ink); }

/* Tabs: <div class="tabs" role="tablist"><button class="tab is-on" role="tab" aria-selected="true">Open <span class="count">3</span></button>…</div>. */
.tabs { display: inline-flex; gap: 4px; padding: 3px; background: rgba(255, 255, 255, 0.55); border: 1.5px solid rgba(255, 255, 255, 0.9); border-radius: var(--r-pill); }
.tab { height: 34px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent; font: 800 var(--t-sm)/1 var(--font); color: var(--ink-2); cursor: pointer; }
.tab.is-on, .tab[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 2px 6px rgba(50, 60, 110, 0.12); }

/* Toast (the page's notice): role="status" text, .error for failures. */
.toast { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; border-radius: var(--r); background: var(--paper); border: 1.5px solid var(--line); box-shadow: var(--shadow); font-weight: 700; font-size: var(--t-sm); color: var(--ink); }
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--skyblue); }
.toast.error { border-color: #f1b4b0; background: var(--danger-soft); color: var(--danger); }
.toast.error::before { background: var(--danger); }

/* Sheet: a modal <dialog class="sheet"> > .sheet-panel > .sheet-head / .sheet-body (scrolls) / .sheet-foot (sticky).
   Behaviour in public/ui/sheet.js. Centred card on desktop; a bottom sheet with a grab handle at ≤ 720 px. */
dialog.sheet {
  width: min(calc(100% - 32px), 560px); max-height: min(88vh, 860px); padding: 0; overflow: hidden;
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
}
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-sm { width: min(calc(100% - 32px), 440px); }
dialog.sheet-lg { width: min(calc(100% - 32px), 760px); }
.sheet-panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.sheet-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 10px; }
.sheet-head h2 { margin: 0; font-size: var(--t-2xl); }
.sheet-note { margin: 4px 0 0; color: var(--ink-2); font-size: var(--t-sm); font-weight: 600; }
.x { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--paper-3); color: var(--ink-2); font: 700 22px/1 var(--font); cursor: pointer; }
.x:hover { background: var(--line); color: var(--ink); }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 16px; padding: 6px 22px 18px; }
.sheet-foot { flex: none; display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 18px; border-top: 1px solid var(--line); background: var(--paper-2); }
.sheet-foot .btn { min-width: 130px; }

@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; }
  dialog.sheet, .sheet-sm, dialog.sheet-lg { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  dialog.sheet[open]::before { content: ""; flex: none; width: 44px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--line-2); }
  .sheet-head { padding: 12px 18px 8px; }
  .sheet-head h2 { font-size: var(--t-xl); }
  .sheet-body { padding: 4px 18px 16px; }
  .sheet-foot { padding: 12px 18px max(20px, env(safe-area-inset-bottom)); }
  .sheet-foot .btn { flex: 1; min-width: 0; }
}

/* ============================================================ 2. the lobby page on the system */

html, body { height: 100%; overflow: hidden; }
body { display: grid; place-items: center; padding: 32px 32px 12px; }
p { margin: 0 0 8px; }

.landing {
  width: 100%;
  max-width: 1320px;
  height: calc(100vh - 44px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px) minmax(0, 1fr);
  grid-template-rows: min-content minmax(0, 1fr);
}

/* The lobby panel is one opaque card (it was a translucent glass box over the poster). */
.lobby-panel {
  grid-column: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 24px;
}
body.lobby-wide .lobby-panel {
  grid-column: 1 / -1;
  grid-row: 2;
  width: min(100%, 1200px);
  justify-self: center;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

@media (max-width: 720px) {
  body { place-items: start center; padding: 74px 16px 12px; }
  .landing { height: calc(100vh - 86px); display: flex; flex-direction: column; max-width: 520px; }
  .lobby-panel { flex: 1; padding: 18px 16px; }
}

.view h2 { margin: 18px 0 10px; }
.view > h2:first-child, .view > .row:first-child h2 { margin-top: 0; }
form > button { margin-top: 14px; }
form > button + button { margin-top: 10px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.spread { justify-content: space-between; }
.row p { margin: 0; }
.view > .row { margin-top: 12px; justify-content: space-between; }
#notice { margin: 0 0 14px; }

/* --- sign-in: email, code, first handle (body.auth). The poster art is a strip behind the card that fades into
   the sky; the card is the lobby panel, narrow, with the badge logo on top. */
body.auth { align-content: start; overflow: auto; }
body.auth::before {
  content: ""; position: fixed; inset: 0 0 auto; height: 220px; z-index: -1; pointer-events: none;
  background: url("/art/login-bg.jpg") center 30% / cover no-repeat;
  /* the art fades out to transparent, so its foot melts into whatever height of the sky gradient it ends on */
  -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
}
body.auth .landing { height: auto; }
body.auth .lobby-panel { width: min(100%, 440px); height: auto; justify-self: center; margin-top: 96px; padding: 0 28px 26px; text-align: center; overflow: visible; }
body.auth .auth-logo { display: block; width: 150px; height: auto; margin: -64px auto 6px; filter: drop-shadow(0 6px 10px rgba(50, 60, 110, 0.25)); }
body.auth .view > h2:first-child { margin-top: 26px; }
body.auth .form-title { margin: 0 0 4px; font-size: var(--t-2xl); }
body.auth .form-sub { margin: 0 0 18px; color: var(--ink-2); font-size: var(--t-md); }
body.auth .form-sub strong { color: var(--ink); }
body.auth form { text-align: left; }
body.auth .fine { margin: 14px 0 0; }
body.auth .links { margin-top: 14px; justify-content: center; gap: 12px; flex-wrap: wrap; }
body.auth .lobby-panel { display: flex; flex-direction: column; }
body.auth #notice { order: 1; margin: 18px 0 0; text-align: left; } /* under the form: the badge logo tops the card */
@media (max-width: 720px) {
  body.auth::before { height: 150px; }
  body.auth .lobby-panel { margin-top: 56px; padding: 0 20px 22px; }
  body.auth .auth-logo { width: 120px; margin-top: -52px; }
}

/* --- lobby: open matches */
#view-lobby { height: 100%; min-height: 0; display: flex; flex-direction: column; }
#view-match {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; /* WPF-332: header card, ship cards (scroll), footer card */
  gap: 12px;
  overflow: hidden;
}
.match-list-panel {
  width: min(100%, 460px);
  height: min(58vh, calc(100% - 80px));
  min-height: 180px;
  align-self: flex-start;
  margin: auto 0;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper-2);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.match-list-panel .matches { width: 100%; }
body.lobby-wide .match-list-panel {
  width: 100%;
  height: min(58vh, 360px);
  min-height: 180px;
  flex: 0 1 auto;
  align-self: stretch;
  margin: 0;
}
body.lobby-wide .match-list-panel .matches {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
body.lobby-wide #view-match > .ships {
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  align-content: start;
  padding-right: 4px;
}
#ships.ships[data-large-match="true"] { touch-action: pan-y; }
.empty-matches {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 18px;
  text-align: left;
  color: var(--ink-2);
}
.empty-matches span { display: block; max-width: 100%; }

.matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.matches > li.match {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--field);
  display: grid;
  gap: 10px;
}
.details-button { flex: 0 0 auto; width: max-content; min-width: 0; margin: 0; white-space: nowrap; }
.name { min-width: 0; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- WPF-330: match cards (ui/match-cards.js), the Open / In flight tabs, the empty state, the Pick-a-ship sheet.
   The list fills the rest of the lobby column and scrolls inside it; the page itself never scrolls. */
.match-tabs { margin-left: 8px; }
body.lobby-wide .lobby-panel > #view-lobby { grid-row: 2; } /* the panel's 1fr row (row 1 is the notice), so the list can fill it */
body.lobby-wide .match-list-panel { flex: 1 1 auto; height: auto; min-height: 180px; margin-top: 12px; }
body.lobby-wide .match-list-panel .matches { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; align-content: start; }
body.lobby-home .match-list-panel { padding: 4px 2px 8px; background: transparent; border-color: transparent; } /* cards straight on the sky, like the hero */
.matches > li.match-card { min-width: 0; display: flex; flex-direction: column; padding: 16px 16px 14px; gap: 8px; background: var(--paper); border-radius: var(--r-lg); }
.matches > li.match-card.is-flight { background: var(--paper-3); box-shadow: none; }
/* WPF-332 (wpf-fade): the tag row is laid out the same on every card: the tags, then "map · N ships" on its own line
   (one row truncated the ship count on the wider Deathmatch tag; letting it wrap only when needed made rows differ). */
.match-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 4px 8px; min-width: 0; }
.match-card-tags { display: inline-flex; gap: 6px; flex: none; }
.match-card-map { flex: 1 0 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-card h3.name { margin: 0; font-size: var(--t-lg); }
.match-owner { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; }
.match-owner-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ships-strip { list-style: none; margin: 2px 0; padding: 0; display: grid; gap: 5px; }
.ships-strip li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--t-xs); font-weight: 700; color: var(--ink-2); }
.ships-strip .seats { flex: none; }
.match-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; }
.match-card-foot .join-button { min-width: 96px; }
.match-card-foot .details-button:only-child { margin-left: auto; }

/* The empty list: a dashed card with a CSS cloud and its own New match. */
.empty-matches.empty { position: static; inset: auto; display: grid; justify-items: center; justify-content: stretch; align-content: center; gap: 8px; min-height: 100%;
  padding: 32px 20px 28px; text-align: center; border-style: dashed; background: rgba(255, 255, 255, 0.7); box-shadow: none; color: var(--ink); }
.empty-matches.empty h3 { margin: 0; font-size: var(--t-lg); }
.empty-matches.empty p { margin: 0; }
.empty-matches.empty .btn { margin-top: 6px; }
.empty .cloud { position: relative; width: 110px; height: 44px; margin: 22px 0 8px; border-radius: 40px; background: #fff; box-shadow: 0 6px 14px rgba(50, 60, 110, 0.12); }
.empty .cloud::before, .empty .cloud::after { content: ""; position: absolute; border-radius: 50%; background: #fff; }
.empty .cloud::before { left: 22px; top: -22px; width: 44px; height: 44px; }
.empty .cloud::after { right: 20px; top: -14px; width: 36px; height: 36px; }

/* Pick a ship: each ship's crew as pig chips, its open seats or AI crew, and one secondary "Board ship N". */
#match-details-ships .details-ship { gap: 10px; background: var(--paper-2); }
.details-ship-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.crew-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crew-chips .tag-ai { height: 36px; padding: 0 12px; font-size: var(--t-sm); }

@media (max-width: 720px) {
  .match-tabs { margin-left: 0; }
  .match-card-foot .join-button { flex: 1; }
}

/* --- crew room: ships and crew */
.ships { display: grid; gap: 10px; align-items: start; }
.ship {
  min-width: 0;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper-2);
  display: grid;
  gap: 8px;
}
.ship > .btn { justify-self: end; }
.ship-title { font-weight: 900; }

@media (max-width: 720px) {
  body.lobby-wide #view-match > .ships { grid-template-columns: 1fr; }
  body.lobby-wide .match-list-panel .matches { grid-template-columns: 1fr; }
}

/* --- WPF-332: crew room (lobby-redesign.md §3.4; ui/crew-room.js, lobby-cards.js crewRoomModel). A header card, the
   ship cards (2 columns, 1 on phones; #ships scrolls), and a footer card with the status dot and the one primary.
   Like the lobby home, the panel drops its card look (body.crew-room) so the three sit straight on the sky. */
body.crew-room .lobby-panel { padding: 0 8px 10px; background: transparent; border-color: transparent; box-shadow: none; }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 16px 22px; }
.room-head-text { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.room-head h1 { max-width: 100%; margin: 2px 0 0; font-size: var(--t-2xl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-head .meta { margin: 0; }
.room-head #leave { flex: none; }
/* WPF-640: the captain's Map choice (moved from the hangar's match setup); PvP only, hidden otherwise */
.room-map { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--ink-2); font-size: var(--t-sm); font-weight: 700; }
.room-map select { min-height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: inherit; }
body.lobby-wide #view-match > .ships { gap: 14px; padding: 3px 6px 3px 3px; } /* room for the .is-mine ring */
.ship.ship-card { gap: 12px; padding: 14px 16px; background: var(--paper); border-radius: var(--r-lg); align-content: start; }
.ship-card.is-mine { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft), var(--shadow); }
.ship-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.ship-card h3.ship-title { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: var(--t-lg); }
.ship-card .ship-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-card .you { flex: none; padding: 2px 8px; border-radius: var(--r-pill); background: var(--pink-soft); color: var(--pink-ink); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.ship-card .ship-class.select { flex: none; width: 130px; }
.ship-card .ship-mode-label { display: flex; align-items: center; gap: 8px; margin: 0; }
.ship-crew .pig-chip { min-width: 0; }
.ship-crew .seat-sum { display: none; } /* phones: one "N open seats" chip instead of a chip per seat */
#ships[data-large-match="true"] .ship-card .seat-modes { max-height: 11rem; overflow-y: auto; }
.host-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; border-top: 1px dashed var(--line); }
.host-row .lbl { font: 800 var(--t-xs)/1.2 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.host-row .range > input { width: 100px; }
.host-row .board-button, .ship-card-foot .board-button { margin-left: auto; }
.ship-card-foot { display: flex; }
.room-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 18px 12px 22px; }
.room-foot .status { display: flex; align-items: center; gap: 12px; min-width: 0; margin: 0; font-weight: 800; }
.room-foot .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 4px var(--sun-soft); }
.room-foot .dot.ok { background: var(--olive); box-shadow: 0 0 0 4px var(--olive-soft); }
.room-foot .status-text { display: grid; min-width: 0; }
.room-foot .status small { color: var(--ink-2); font-size: var(--t-xs); font-weight: 600; }
.room-foot .status small:empty { display: none; }
.room-foot .room-wait { flex: none; margin: 0; color: var(--ink-2); font-weight: 800; font-size: var(--t-sm); text-align: right; }
.room-foot #start { flex: none; }

@media (max-width: 720px) {
  body.crew-room .lobby-panel { padding: 0; }
  .room-head { gap: 10px; padding: 12px 14px; }
  .room-head h1 { font-size: var(--t-xl); white-space: normal; overflow-wrap: anywhere; } /* up to two lines beside Leave */
  .room-head .meta { font-size: var(--t-xs); }
  .room-head .room-note { display: none; }
  .ship.ship-card { gap: 10px; padding: 12px 14px; }
  .ship-crew .seat-one { display: none; }
  .ship-crew .seat-sum { display: inline-flex; }
  .host-row { gap: 8px 12px; }
  .host-row .lbl { display: none; }
  .host-row .range > input { width: 80px; }
  .room-foot { gap: 10px; padding: 10px 12px 10px 16px; }
  .room-foot .status { gap: 10px; font-size: var(--t-sm); }
  .room-foot #start { min-height: 46px; padding: 0 18px; font-size: var(--t-md); }
  .room-foot:has(.room-wait:not([hidden])) { flex-wrap: wrap; row-gap: 6px; }
  .room-foot .room-wait { flex: 1 1 100%; padding-left: 22px; text-align: left; font-size: var(--t-xs); } /* under the status, past the dot */
}

/* --- the lobby's sheets (structure and behaviour: part 1 .sheet, ui/sheet.js) */
#match-details-ships { gap: 12px; }
#match-details-ships .ship > .btn { justify-self: end; } /* WPF-330: a secondary "Board ship N", not a slab */

/* --- WPF-334: the Settings and Help & controls sheets (lobby-redesign.md §3.6, §3.7). Settings is the in-match panel
   (ui/settings-panel.js + .css, unchanged, so the controls-panel scene is too) restyled in this lobby scope only: the
   panel's title left with its next-match note, the sheet's round close (#close-settings) over it, sections as flat
   cards with a caps header strip, controls right-aligned, keys as keycaps, and a sticky footer whose Reset all controls
   and Done press the panel's own Reset and Back (ui/lobby-settings.js), so those two are hidden here. The panel
   scrolls; the title stays on top while it does. Help is help.js's card per station (ui/lobby-help.js), same look. */
.settings-dialog .lobby-settings:not([hidden]) { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.settings-dialog .settings-card {
  flex: 1 1 auto; min-width: 0; max-width: none; min-height: 0; max-height: none; overflow: auto; overscroll-behavior: contain;
  align-content: start; grid-auto-rows: max-content; gap: 12px; padding: 0 22px 18px; border-radius: 0; background: transparent; box-shadow: none;
  color: var(--ink); font-family: var(--font);
}
.settings-dialog .settings-title {
  position: sticky; top: 0; z-index: 1; margin: 0 -22px; padding: 18px 72px 6px 22px; background: var(--paper);
  text-align: left; font: 900 var(--t-2xl)/1.15 var(--font);
}
.settings-dialog .settings-note { margin: -6px 0 2px; text-align: left; color: var(--ink-2); font-size: var(--t-sm); font-weight: 600; }
.settings-x { position: absolute; top: 16px; right: 18px; z-index: 2; }
.settings-dialog .settings-section, .help-card {
  display: grid; gap: 0; min-width: 0; margin: 0; padding: 0;
  border: 1.5px solid var(--line); border-radius: var(--r); background: var(--field);
}
/* A floated legend is laid out as the section's first row (not drawn into the border), so it can be a header strip. */
.settings-dialog .settings-section > legend, .help-card .help-title {
  float: left; width: 100%; margin: 0; padding: 9px 14px; background: var(--paper-3); border-bottom: 1px solid var(--line);
  border-radius: calc(var(--r) - 1.5px) calc(var(--r) - 1.5px) 0 0;
  font: 800 var(--t-xs)/1.3 var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); text-align: left;
}
.settings-dialog .settings-row, .help-card .help-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; margin: 0; padding: 7px 14px;
  border-top: 1px solid var(--line); font: 700 var(--t-sm)/1.3 var(--font); color: var(--ink);
}
.settings-dialog .settings-section > legend + .settings-row, .help-card .help-title + .help-row { border-top: 0; }
.settings-dialog select.settings-choice {
  width: 160px; max-width: 55%; height: 34px; padding: 0 30px 0 10px; appearance: none; border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm); background: var(--field) no-repeat; color: var(--ink); font: 700 var(--t-sm) var(--font);
  /* the .select chevron, drawn as two triangles since a <select> has no ::after */
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px;
}
.settings-dialog .settings-binding, .help-card .help-key {
  display: inline-grid; place-items: center; min-width: 36px; max-width: 55%; min-height: 30px; height: auto; padding: 3px 9px;
  border: 1.5px solid var(--line-2); border-bottom-width: 3px; border-radius: var(--r-sm); background: var(--field); box-shadow: none;
  color: var(--ink); font: 800 var(--t-sm)/1.2 var(--font); text-align: center; white-space: normal;
}
.settings-dialog .settings-binding { cursor: pointer; }
.settings-dialog .settings-binding:hover { border-color: var(--pink); }
.settings-dialog input.settings-range { width: 160px; max-width: 50%; height: auto; padding: 0; border: 0; background: transparent; }
.settings-dialog input.settings-checkbox { width: 18px; height: 18px; margin: 0; padding: 0; }
.settings-dialog .settings-hint { margin: 2px 0 0; text-align: left; color: var(--ink-2); opacity: 1; font-size: var(--t-xs); font-weight: 600; }
.settings-dialog .settings-row:has(> .settings-reset), .settings-dialog .settings-close { display: none; } /* the footer's */
.settings-foot { justify-content: space-between; }
/* WPF-524: 44 px controls for touch (phones and tablets); mouse layouts keep the compact 34 px selects. */
@media (pointer: coarse) {
  .settings-dialog select.settings-choice { height: 44px; }
  .settings-dialog .settings-binding { min-height: 44px; }
}
/* Help & controls: walking, gunner and special down the left, the long navigator card down the right. */
.lobby-help:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.help-card[data-station="nav"] { grid-column: 2; grid-row: 1 / span 3; }
.help-card .help-row { min-height: 40px; padding: 5px 14px; }
.help-card .help-key { order: 2; flex: none; max-width: 45%; white-space: nowrap; }
.help-card .help-label { text-align: left; }
@media (max-width: 720px) {
  .settings-dialog .settings-card { padding: 0 18px 16px; }
  .settings-dialog .settings-title { margin: 0 -18px; padding: 12px 64px 6px 18px; font-size: var(--t-xl); }
  .settings-x { top: 21px; right: 14px; }
  .settings-dialog select.settings-choice { width: 130px; }
  .settings-dialog input.settings-range { width: 120px; }
  .lobby-help:not([hidden]) { grid-template-columns: 1fr; }
  .help-card[data-station="nav"] { grid-column: auto; grid-row: auto; }
}

/* Pig avatars (WPF-61): a CSS pig face, tinted per variant, with a hat-like accessory band. Same look in light and dark. */
.avatar {
  --pig: #ffb8d1; --acc: transparent; --acc-top: -8%; --acc-h: 30%; --acc-l: 10%; --acc-r: 10%; --acc-round: 8px 8px 2px 2px;
  position: relative; display: inline-block; flex: none; width: 26px; height: 26px; border-radius: 50%; vertical-align: middle;
  background: var(--pig); border: 1.5px solid rgba(60, 30, 45, 0.45);
}
.avatar::before { content: ""; position: absolute; left: 50%; top: 62%; width: 48%; height: 34%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(60, 30, 45, 0.3); }
.avatar::after { content: ""; position: absolute; top: var(--acc-top); height: var(--acc-h); left: var(--acc-l); right: var(--acc-r); border-radius: var(--acc-round); background: var(--acc); }
.avatar.big { width: 52px; height: 52px; border-width: 2px; }
.avatar-pink { --pig: #ffb8d1; }
.avatar-captain { --pig: #ffa8bd; --acc: #1f4b99; }
.avatar-aviator { --pig: #eaa08c; --acc: #3a3a44; --acc-top: 22%; --acc-h: 26%; --acc-l: 2%; --acc-r: 2%; --acc-round: 5px; }
.avatar-engineer { --pig: #fac8af; --acc: #e0b52a; --acc-top: -14%; --acc-h: 42%; --acc-l: 2%; --acc-r: 2%; --acc-round: 14px 14px 3px 3px; }
.avatar-scout { --pig: #f8a9cf; --acc: #8a2a4a; --acc-top: -6%; --acc-h: 26%; --acc-l: 0%; --acc-r: 22%; --acc-round: 50% 50% 30% 30%; }
.avatar-sailor { --pig: #dca1ba; --acc: #f4f4f4; --acc-top: -6%; --acc-h: 26%; --acc-l: 6%; --acc-r: 6%; --acc-round: 4px 4px 12px 12px; }
.avatar-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 4px; }
.avatar-choice { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 44px; padding: 10px 4px; background: var(--field); color: var(--ink); border: 2px solid var(--line-2); border-radius: var(--r); font-weight: 700; font-size: var(--t-sm); }
.avatar-choice input { position: absolute; width: 1px; height: 1px; margin: -1px; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.avatar-choice:has(input:checked) { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.avatar-choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }


/* --- WPF-329: top bar, handle menu, hero card, me-card and the phone bottom bar (lobby-redesign.md §2.3, §3.2).
   The top bar heads the lobby and the crew room (body.has-topbar); on the lobby (body.lobby-home) the panel drops its
   card look so the hero card and the match list sit straight on the sky. */
body.has-topbar { padding-top: 6px; }
body.has-topbar .landing { height: calc(100vh - 18px); }
.topbar {
  grid-column: 1 / -1; grid-row: 1; width: min(100%, 1200px); justify-self: center; position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 8px 12px;
}
.topbar-logo { display: block; flex: none; height: 66px; width: auto; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.08)); }
.topnav { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
.pill-me {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 240px; height: 40px; padding: 0 12px 0 6px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-pill); background: var(--paper); color: var(--ink);
  font: 800 var(--t-sm)/1 var(--font); box-shadow: 0 2px 0 rgba(50, 60, 110, 0.06);
}
.pill-me:hover, .pill-me[aria-expanded="true"] { border-color: var(--pink); }
.pill-me .avatar { width: 28px; height: 28px; }
.pill-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-me .chev { flex: none; width: 8px; height: 8px; margin: 0 2px 0 2px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-2px) rotate(45deg); }
.pill-me[aria-expanded="true"] .chev { transform: translateY(2px) rotate(225deg); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; display: grid; min-width: 200px; padding: 6px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lift);
}
.menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: none; box-shadow: none; color: var(--ink); text-align: left; font: 700 var(--t-sm)/1.2 var(--font); white-space: nowrap; }
.menu button:hover, .menu button:focus-visible { background: var(--pink-soft); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover, .menu button.danger:focus-visible { background: var(--danger-soft); }
.menu hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }

body.lobby-home .lobby-panel { padding: 0 8px 10px; background: transparent; border-color: transparent; box-shadow: none; }
.hero { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin: 0 0 18px; padding: 24px 28px; }
.hero h1 { margin: 4px 0 8px; font-size: var(--t-3xl); overflow-wrap: anywhere; }
.hero .lede { margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 10px; }
.hero .hint { margin: 0; }
.hero .hint:empty, .hero .lede:empty { display: none; }
.me-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-self: start; align-content: start; gap: 6px 14px;
  padding: 16px; background: var(--paper-2); border: 1.5px solid var(--line); border-radius: var(--r);
}
.me-card .pig { grid-row: 1 / 3; }
.me-card strong { align-self: end; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-lg); font-weight: 900; }
.me-card .record { align-self: start; margin: 0; color: var(--ink-2); font-size: var(--t-xs); font-weight: 700; }
.me-card .btn { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }

@media (max-width: 720px) {
  .topbar { padding: 4px 0 10px; }
  .topbar-logo { height: 40px; }
  .topnav-wide { display: none; }
  body.lobby-home .lobby-panel { padding: 0 0 84px; } /* room for the bottom bar */
  .hero { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; padding: 16px 18px; }
  .hero h1 { margin: 2px 0 4px; font-size: var(--t-xl); }
  .hero .lede { font-size: var(--t-sm); }
  .hero .hint { display: none; }
  /* the bottom bar: the view's two actions above the thumb zone */
  .hero-actions.bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; flex-wrap: nowrap; margin: 0;
    padding: 10px 16px max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.92) 30%);
  }
  .hero-actions .btn { flex: 1; min-width: 0; }
  .me-card { grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 10px; padding: 10px 12px; }
  .me-card .pig { --size: 40px; }
  .me-card .btn { grid-column: 3; grid-row: 1 / 3; margin: 0; }
}

/* --- WPF-333: the Your pig page (lobby-redesign.md §3.5; index.html #view-profile, ui/avatar-picker.js with
   `groups: true`, ui/your-pig.js). Two cards straight on the sky: the preview (WebGL pig in a sky frame, Randomize /
   Reset, the record) and the wardrobe (handle, Back to hangar, preset portraits, Face / Hair / Gear, Cancel + Save).
   Only the wardrobe's middle scrolls. ui/avatar-picker.css still styles the avatar-picker scene; the selectors here
   start at #view-profile so they win over its older page rules and never reach the scene. */
.lobby-panel:has(> #view-profile:not([hidden])) { padding: 0 8px 10px; background: transparent; border-color: transparent; box-shadow: none; }
.lobby-panel > #view-profile { display: block; height: 100%; min-height: 0; overflow: hidden; }
#view-profile .pig-page { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(200px, min(340px, 34%)) minmax(0, 1fr); gap: 18px; align-items: start; }
#view-profile .preview-card { display: grid; gap: 10px; align-content: start; padding: 14px; }
/* the frame is the preview's own clear colour (#e8f3f4, avatar-picker.js), so the 3:2 canvas sits in it seamlessly */
#view-profile .pig-preview { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r); background: #e8f3f4; }
#view-profile .pig-preview canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; }
#view-profile .avatar-picker-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0; background: none; border: 0; border-radius: 0; }
#view-profile .avatar-picker-actions .btn { width: 100%; min-width: 0; margin: 0; }
#view-profile .pig-record { margin: 0; text-align: center; }
#view-profile .wardrobe { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
#view-profile .wardrobe-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 4px; }
#view-profile .wardrobe-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
#view-profile .wardrobe-title .eyebrow { flex-basis: 100%; }
#view-profile .profile-title { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: var(--t-2xl); }
#view-profile .wardrobe-head .btn { flex: none; }
#view-profile .wardrobe-head { grid-row: 1; }
#view-profile .wardrobe-tabs { display: none; grid-row: 2; }
#view-profile .wardrobe-scroll { grid-row: 3; }
#view-profile .pig-foot { grid-row: 4; }
#view-profile .wardrobe-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 16px; padding: 10px 20px 16px; }
#view-profile .group { display: grid; gap: 8px; min-width: 0; }
#view-profile .group h4 { margin: 0; font-size: var(--t-xs); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
#view-profile .wardrobe-groups { display: grid; gap: 16px; }
#view-profile .group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
#view-profile .group-grid label { display: grid; gap: 4px; min-width: 0; margin: 0; font-size: var(--t-xs); font-weight: 800; color: var(--ink-2); }
#view-profile .group-grid select { width: 100%; min-width: 0; height: 40px; font-size: var(--t-sm); }
#view-profile .group fieldset { display: flex; flex-wrap: wrap; gap: 6px 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
#view-profile .group legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; font-size: var(--t-xs); font-weight: 800; color: var(--ink-2); }
#view-profile .group fieldset label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); text-transform: capitalize; }
#view-profile .group fieldset input { width: 16px; height: 16px; margin: 0; }
#view-profile .presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
#view-profile .preset {
  display: grid; justify-items: center; gap: 4px; min-width: 0; padding: 8px 4px 6px; border: 1.5px solid var(--line-2); border-radius: var(--r);
  background: var(--field); box-shadow: none; color: var(--ink-2); font-size: var(--t-xs); font-weight: 800; line-height: 1.2; text-transform: capitalize;
}
#view-profile .preset img { order: -1; width: 56px; height: 56px; border-radius: 10px; }
#view-profile .preset:hover { border-color: var(--ink-3); }
#view-profile .preset.is-on { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); color: var(--ink); }
#view-profile .pig-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 16px; border-top: 1px solid var(--line); background: var(--paper-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
#view-profile .pig-foot .btn { min-width: 130px; }
@media (max-width: 720px) {
  body:has(#view-profile:not([hidden])) { padding-top: 12px; }
  body:has(#view-profile:not([hidden])) .landing { height: calc(100vh - 24px); }
  .lobby-panel:has(> #view-profile:not([hidden])) { padding: 0 0 76px; } /* room for the bottom bar */
  #view-profile .pig-page { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
  /* the preview: a 140 px square beside Randomize / Reset */
  #view-profile .preview-card { grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px; }
  #view-profile .pig-preview { aspect-ratio: 1 / 1; }
  #view-profile .avatar-picker-actions { grid-template-columns: 1fr; }
  #view-profile .pig-record { display: none; }
  #view-profile .wardrobe-head { align-items: center; padding: 12px 14px 4px; }
  #view-profile .wardrobe-title .eyebrow { display: none; }
  #view-profile .profile-title { font-size: var(--t-lg); }
  #view-profile .wardrobe-tabs { display: flex; justify-self: start; margin: 6px 14px 4px; }
  #view-profile .wardrobe-tabs .tab { padding: 0 12px; }
  #view-profile .wardrobe-scroll { padding: 8px 14px 14px; }
  #view-profile .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-profile .presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Cancel / Save: the phone's bottom bar, above the thumb zone */
  #view-profile .pig-foot.bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0; border: 0; border-radius: 0;
    padding: 10px 16px max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.92) 30%);
  }
  #view-profile .pig-foot .btn { flex: 1; min-width: 0; min-height: 52px; font-size: var(--t-lg); }
}

/* --- Lobby backdrops (WPF-333; ui/lobby-backdrop.js, made by tools/lobby-art.js). The illustrated art behind a lobby
   page, added as `body.backdrop.backdrop-<name>` only once the image has decoded, so the CSS sky is the fallback. A
   light sky-tinted scrim calms the busy art; text sits on the opaque cards. Any lobby view can use it (app.js
   VIEW_BACKDROPS); the Your pig page uses the hangar. */
body.backdrop::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(228, 243, 255, 0.28), rgba(228, 243, 255, 0.5)), var(--backdrop-wide) center / cover no-repeat;
}
body.backdrop-hangar { --backdrop-wide: url("/art/lobby/hangar-wide.webp"); --backdrop-narrow: url("/art/lobby/hangar-narrow.webp"); }
body.backdrop-night { --backdrop-wide: url("/art/lobby/night-wide.webp"); --backdrop-narrow: url("/art/lobby/night-narrow.webp"); }
@media (max-width: 720px) {
  body.backdrop::before { background-image: linear-gradient(rgba(228, 243, 255, 0.28), rgba(228, 243, 255, 0.5)), var(--backdrop-narrow); }
}

/* ============================================================ 3. night sky (WPF-335)
   The dark theme, for players whose system asks for it (prefers-color-scheme: dark; index.html says "light dark").
   lobby-redesign.md T8: a navy night sky with stars instead of the clouds, deep navy cards, the same pink. Every text
   pair is AA (tests/unit/client/contrast.test.js checks this set too). Then the few day colours written as literals
   (white chips, the white clouds, the light scrims and bottom-bar fades) get their night values. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --sky-1: #070e24;  --sky-2: #16264d;  --sky-3: #22335f;
    --paper: #1c2442;  --paper-2: #26203f;  --paper-3: #232b4b;
    --field: #141b35;
    --line: #34406a;   --line-2: #4b5787;
    --ink: #eef1fb;  --ink-2: #b3bbd6;  --ink-3: #7c86a8;
    --pink-ink: #ff7fb5;  --pink-soft: #4a1f3d;
    --olive: #bfd38a; --olive-soft: #2c3520;
    --sun-ink: #ffd978;  --sun-soft: #3b3115;
    --skyblue: #5fb0f0; --skyblue-ink: #9ccfff; --skyblue-soft: #16304f;
    --danger: #ff8f86; --danger-soft: #4a1c22;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 14px 40px rgba(0, 0, 0, 0.5);
    --scrim: rgba(3, 6, 18, 0.62);
  }
  /* stars and a low moonlit glow instead of the clouds */
  body {
    background-image:
      radial-gradient(1.5px 1.5px at 7% 12%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 16% 30%, #dfe7ff 50%, transparent 51%),
      radial-gradient(2px 2px at 24% 8%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 33% 22%, #cfd9ff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 47% 6%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 58% 18%, #dfe7ff 50%, transparent 51%),
      radial-gradient(2px 2px at 69% 11%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 78% 27%, #cfd9ff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 88% 9%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 94% 36%, #dfe7ff 50%, transparent 51%),
      radial-gradient(1px 1px at 4% 48%, #cfd9ff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 96% 58%, #fff 50%, transparent 51%),
      radial-gradient(38px 38px at 86% 14%, #fff7dc 45%, rgba(255, 247, 220, 0.18) 60%, transparent 75%),
      radial-gradient(900px 300px at 50% 115%, rgba(120, 140, 220, 0.22), transparent 70%),
      linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 60%, var(--sky-3) 100%);
  }
  body.auth::before { opacity: 0.55; } /* the day poster strip, dimmed into the night */
  .btn-secondary:hover:not(:disabled) { background: var(--paper-3); }
  .seg > button.is-on, .seg > label:has(input:checked) { background: var(--paper-3); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.35); }
  .pig { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08), 0 0 0 2px var(--paper); }
  .tabs { background: rgba(20, 27, 53, 0.6); border-color: rgba(255, 255, 255, 0.12); }
  .tab.is-on, .tab[aria-selected="true"] { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.35); }
  .toast.error { border-color: #7a3036; }
  .empty-matches.empty { background: rgba(28, 36, 66, 0.8); }
  .empty .cloud, .empty .cloud::before, .empty .cloud::after { background: #3a4672; }
  .avatar::before { background: rgba(255, 255, 255, 0.4); }
  #view-profile .preset:hover { border-color: var(--ink-2); }
  #view-profile .pig-preview { background: #26304f; } /* avatar-picker.js clears the night preview to the same */
  @media (max-width: 720px) {
    .hero-actions.bottom-bar, #view-profile .pig-foot.bottom-bar { background: linear-gradient(rgba(7, 14, 36, 0), rgba(7, 14, 36, 0.92) 30%); }
  }
  /* the art, under a navy scrim */
  body.backdrop::before { background: linear-gradient(rgba(7, 14, 36, 0.55), rgba(7, 14, 36, 0.75)), var(--backdrop-wide) center / cover no-repeat; }
}
@media (prefers-color-scheme: dark) and (max-width: 720px) {
  body.backdrop::before { background-image: linear-gradient(rgba(7, 14, 36, 0.55), rgba(7, 14, 36, 0.75)), var(--backdrop-narrow); }
}

/* WPF-346: the Story board occupies the same scrolling column as match cards. */
#leaderboard { width: 100%; min-width: 0; }
.leaderboard-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.leaderboard-controls .field { flex: 1; min-width: 120px; }
.leaderboard-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.leaderboard-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 16px; overflow-wrap: anywhere; }
.leaderboard-row p { flex-basis: 100%; margin: 0; }
/* WPF-372: every station remains visible on phones as well as desktop. */
.seat-modes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seat-mode { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; min-width: 0; background: var(--field); }
.seat-mode-label { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-xs); }
.seat-mode select { width: 100%; min-width: 0; }
.seat-mode-bot { border-color: var(--olive); }
.seat-mode-closed { border-style: dashed; background: var(--paper-3); }
@media (max-width: 720px) { .seat-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.seats > i.closed { background: var(--paper-3); border-color: var(--ink-2); }

/* Large cards fit the available lobby panel; their ship list takes the remaining space.
   Size containment makes the card cap follow the panel rather than its overflowing contents. */
.match-list-panel:has(.match-card[data-large-match="true"]) { container-type: size; }
.match-card[data-large-match="true"] { max-height: 100cqh; min-height: 0; }
.match-card[data-large-match="true"] .ships-strip { min-height: 0; max-height: 11rem; overflow-y: auto; }
.match-card[data-large-match="true"] > :not(.ships-strip) { flex-shrink: 0; }
body.lobby-home:has(.match-card[data-large-match="true"]) .hero { padding: 12px 18px; margin-bottom: 8px; }
body.lobby-home:has(.match-card[data-large-match="true"]) .hero h1 { font-size: var(--t-xl); }
body.lobby-home:has(.match-card[data-large-match="true"]) .hero .lede { font-size: var(--t-sm); }
body.lobby-home:has(.match-card[data-large-match="true"]) .hero-actions { margin: 8px 0; }
body.lobby-home:has(.match-card[data-large-match="true"]) .hero .hint { display: none; }
@media (max-height: 500px) {
  /* Keep Play now / New match reachable while the greeting yields room to the ships. */
  body.lobby-home:has(.match-card[data-large-match="true"]) .hero { display: block; padding: 0; border: 0; background: transparent; box-shadow: none; }
  body.lobby-home:has(.match-card[data-large-match="true"]) .hero-text > :not(.hero-actions),
  body.lobby-home:has(.match-card[data-large-match="true"]) .hero .me-card { display: none; }
  body.lobby-home:has(.match-card[data-large-match="true"]) .hero-actions { margin: 0; }
  .match-card[data-large-match="true"] { padding: 10px; gap: 4px; overflow-y: auto; }
  /* Preserve two ship rows when the fixed card sections exhaust the height budget. */
  .match-card[data-large-match="true"] .ships-strip { min-height: 3rem; }
}

/* Launcher home — a dense dark game hub, based on the supplied reference.  This is
   scoped to the signed-in lobby, leaving authentication, the match room and dialogs intact. */
body:has(#view-lobby:not([hidden])) {
  color-scheme: dark;
  background: #0e1622;
  background-image: radial-gradient(circle at 30% -20%, #1c2b3c 0, transparent 42%);
  color: #f5f7fc;
}
body:has(#view-lobby:not([hidden])) .landing { width: min(100% - 12px, 1240px); margin: 0 auto; }
body:has(#view-lobby:not([hidden])) .topbar {
  width: 100%; min-height: 51px; padding: 0 0 12px; border-bottom: 1px solid #2d3a4b;
}
.launcher-logo { display: block; width: auto; height: 38px; object-fit: contain; object-position: left center; }
.topbar-logo { display: none; }
body:has(#view-lobby:not([hidden])) .topnav { gap: 4px; }
.launcher-nav-link, .launcher-icon {
  min-height: 30px; padding: 0 5px; border: 0; border-radius: 4px; background: transparent; color: #dce8ff;
  font: 500 12px/1 system-ui, sans-serif;
}
.launcher-nav-link:hover, .launcher-icon:hover { background: #1b2939; color: #fff; }
.launcher-icon { font-size: 18px; padding: 0 4px; }
body:has(#view-lobby:not([hidden])) .pill-me { height: 30px; padding: 0 4px; border-color: #33465d; background: #142131; color: #e7effc; }
body:has(#view-lobby:not([hidden])) .pill-me .avatar { width: 22px; height: 22px; }
body:has(#view-lobby:not([hidden])) .pill-me .chev { border-color: #9cb0ca; }
body:has(#view-lobby:not([hidden])) .lobby-panel { padding: 24px 0 0; background: transparent; border: 0; box-shadow: none; }
.launcher-home { display: grid; gap: 16px; }
/* WPF-470: the launcher scrolls inside the lobby column (the page never scrolls): on a phone its three cards and the
   tools row are taller than the screen, and the tools (Profile, Rankings, Friends…) must stay reachable by touch. */
#view-lobby > .launcher-home { flex: 1 1 auto; min-height: 0; align-content: start; overflow-y: auto; overscroll-behavior: contain; }
.launcher-heading h1 { margin: 0 0 4px; color: #fff; font: 800 clamp(21px, 3vw, 29px)/1.1 system-ui, sans-serif; letter-spacing: -0.055em; }
.launcher-heading p { margin: 0; color: #a9c5f3; font: 500 13px/1.4 system-ui, sans-serif; }
.battle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.battle-card { min-width: 0; overflow: hidden; border: 1px solid #2e4057; border-radius: 5px; background: #1d3954; }
.battle-art { height: min(31vw, 270px); min-height: 190px; background: center / cover no-repeat; }
/* WPF-546: Campaign and Quick match show their pictures again (the pre-merge launcher's look, owner request
   2026-10-17): the night sky and the hangar, the same small webp the lobby backdrops use (lobby-style.test.js). */
.campaign-card .battle-art { background-image: linear-gradient(0deg, rgba(6, 14, 24, .2), rgba(6, 14, 24, .05)), url('/art/lobby/night-wide.webp'); background-position: 32% center; }
.quick-card .battle-art { background-image: linear-gradient(0deg, rgba(8, 13, 28, .12), rgba(38, 10, 72, .1)), url('/art/lobby/hangar-wide.webp'); background-position: center; }
.server-card .battle-art { background-image: linear-gradient(0deg, rgba(63, 14, 38, .18), rgba(255, 165, 105, .08)); background-position: center; }
.battle-copy { min-height: 48px; padding: 9px 12px 5px; }
.battle-copy h2, .launcher-utility h2 { margin: 0; color: #fff; font: 800 14px/1.15 system-ui, sans-serif; letter-spacing: -0.035em; }
.battle-copy p { margin: 4px 0 0; color: #b9d2f5; font: 500 12px/1.2 system-ui, sans-serif; }
.launcher-play { display: block; width: calc(100% - 12px); height: 37px; margin: 0 6px 7px; border: 0; border-radius: 4px; background: #3d78ee; color: #fff; font: 800 13px/1 system-ui, sans-serif; }
.launcher-play:hover { background: #568afa; }
.launcher-utility { padding: 14px 10px 9px; border: 1px solid #26394f; border-radius: 6px; background: #182636; }
.launcher-utility h2 { font-size: 13px; }
.utility-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 10px; } /* WPF-546: Profile, Rankings, Friends, Updates, Help; WPF-878: and Hangar */
.launcher-utility > .utility-grid { margin-top: 0; }
.utility-grid button { display: grid; justify-items: start; gap: 5px; min-height: 43px; padding: 0 4px; border: 0; border-radius: 4px; background: transparent; color: #d7e5fb; font: 600 11px/1.1 system-ui, sans-serif; text-align: left; }
.utility-grid button span { color: #90bdfa; font-size: 17px; line-height: 1; }
.utility-grid button:hover { background: #243a53; color: #fff; }
/* WPF-546: the hero is not shown on the launcher, and the match list lives in the hangar's All matches; Rankings shows
   this panel for the leaderboard. */
#view-lobby > .hero, #view-lobby > .match-list-panel { display: none; }
body.launcher-ranking .launcher-home { display: none; }
body.launcher-ranking #view-lobby > .match-list-panel { display: flex; flex-direction: column; max-width: 760px; min-height: 420px; margin: 0 auto; padding: 14px; border: 1px solid #2d4158; border-radius: 5px; background: #131f2d; }
body.launcher-ranking #leaderboard { display: grid !important; grid-template-rows: auto auto minmax(100px, 1fr) auto; gap: 10px; width: 100%; min-height: 360px; }
.launcher-leaderboard-head { display: none; align-items: center; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid #2d3a4b; }
.launcher-ranking .launcher-leaderboard-head { display: flex; }
.launcher-leaderboard-head h1 { margin: 0; color: #fff; font: 800 23px/1 system-ui, sans-serif; letter-spacing: -0.05em; }
.launcher-leaderboard-head button { min-height: 32px; padding: 0 8px; border: 0; background: transparent; color: #a9c5f3; font: 600 13px/1 system-ui, sans-serif; }
.launcher-leaderboard-head button:hover { color: #fff; }
body:has(#view-lobby:not([hidden])) .leaderboard-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; } /* WPF-470: Board, Human ships or Sort by, Search */
body:has(#view-lobby:not([hidden])) .leaderboard-controls .field { min-width: 0; }
body:has(#view-lobby:not([hidden])) .leaderboard-controls label { color: #a9c5f3; font: 600 11px/1.2 system-ui, sans-serif; }
body:has(#view-lobby:not([hidden])) .leaderboard-controls .input,
body:has(#view-lobby:not([hidden])) .leaderboard-search { width: 100%; min-height: 38px; border: 1px solid #344b66; border-radius: 4px; background: #162536; color: #edf5ff; padding: 0 10px; }
body:has(#view-lobby:not([hidden])) .leaderboard-control-label { display: none; }
body:has(#view-lobby:not([hidden])) .leaderboard-controls .field select { display: block; width: 100%; margin: 0; font-size: 14px; line-height: 1.2; }
body:has(#view-lobby:not([hidden])) #leaderboard > .leaderboard-status { color: #a9c5f3; min-height: 0; height: 0; margin: 0; overflow: hidden; font: 500 12px/1.3 system-ui, sans-serif; }
body.launcher-ranking #view-lobby > .match-list-panel { border-color: #334b66; background: linear-gradient(145deg, #1b2b3d 0%, #111d2a 60%, #172536 100%); box-shadow: 0 18px 44px rgba(0, 0, 0, .28); }
body.launcher-ranking .launcher-leaderboard-head { border-bottom-color: #3d526b; }
body.launcher-ranking .launcher-leaderboard-head h1 { color: #f8d982; text-shadow: 0 2px 14px rgba(248, 217, 130, .14); }
body.launcher-ranking .launcher-leaderboard-head button { color: #9dcaff; }
body:has(#view-lobby:not([hidden])) .leaderboard-controls label { color: #d8b968; }
body:has(#view-lobby:not([hidden])) .leaderboard-controls .input,
body:has(#view-lobby:not([hidden])) .leaderboard-search { border-color: #405c79; background: #0e1a27; box-shadow: inset 0 1px 4px rgba(0, 0, 0, .35); }
body:has(#view-lobby:not([hidden])) .leaderboard-controls .input:focus,
body:has(#view-lobby:not([hidden])) .leaderboard-search:focus { border-color: #58a7ff; outline: 2px solid rgba(88, 167, 255, .24); }
body:has(#view-lobby:not([hidden])) .leaderboard-rows { min-height: 0; gap: 0; overflow-y: auto; border: 1px solid #40556c; border-radius: 6px; background: #122131; box-shadow: 0 8px 22px rgba(0, 0, 0, .2); }
body:has(#view-lobby:not([hidden])) .leaderboard-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; min-height: 42px; padding: 7px 14px; border: 0; border-bottom: 1px solid rgba(87, 115, 145, .26); border-radius: 0; background: #17293a; color: #eff6ff; box-shadow: none; cursor: pointer; }
body:has(#view-lobby:not([hidden])) .leaderboard-row p { grid-column: 1 / -1; color: #9fb4cc; font-size: 12px; }
body:has(#view-lobby:not([hidden])) .leaderboard-row:nth-child(even) { background: #1b3043; }
body:has(#view-lobby:not([hidden])) .leaderboard-row:last-child { border-bottom: 0; }
body:has(#view-lobby:not([hidden])) .leaderboard-row:hover, body:has(#view-lobby:not([hidden])) .leaderboard-row:focus-visible { background: #284560; outline: 0; }
body:has(#view-lobby:not([hidden])) .leaderboard-player-name { overflow: hidden; color: #ecf4ff; font: 650 14px/1.2 system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
body:has(#view-lobby:not([hidden])) .leaderboard-score { min-width: 86px; color: #aee4ff; font: 800 14px/1.2 system-ui, sans-serif; text-align: right; font-variant-numeric: tabular-nums; }
body:has(#view-lobby:not([hidden])) .leaderboard-rank { display: inline-grid; width: 38px; height: 27px; place-items: center; border-radius: 4px; background: #24384c; color: #b8c9da; font: 800 11px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
body:has(#view-lobby:not([hidden])) .leaderboard-rank.rank-1 { background: #f6d875; color: #503a09; box-shadow: 0 0 14px rgba(246, 216, 117, .18); }
body:has(#view-lobby:not([hidden])) .leaderboard-rank.rank-2 { background: #c8d4df; color: #314355; }
body:has(#view-lobby:not([hidden])) .leaderboard-rank.rank-3 { background: #d99865; color: #482914; }
body:has(#view-lobby:not([hidden])) .leaderboard-own { border: 1px solid #4786ba; border-radius: 5px; background: linear-gradient(100deg, #1f4563, #263752 72%, #3a3540); box-shadow: inset 3px 0 #58b8ff, 0 0 18px rgba(60, 158, 228, .1); }
body:has(#view-lobby:not([hidden])) .leaderboard-own-row { min-height: 48px; border-radius: 5px; background: transparent; }
body:has(#view-lobby:not([hidden])) .leaderboard-own-row .leaderboard-player-name { color: #fff; font-weight: 900; }
body:has(#view-lobby:not([hidden])) .leaderboard-rank.rank-you { background: #58b8ff; color: #082038; }
body:has(#view-lobby:not([hidden])) .leaderboard-own-row .leaderboard-score { color: #d9f4ff; }
.leaderboard-no-score { margin: 0; padding: 12px; color: #a9c5f3; font: 500 12px/1.3 system-ui, sans-serif; }
.player-profile-dialog { width: min(420px, calc(100% - 32px)); padding: 0; overflow: hidden; border: 1px solid #415a75; border-radius: 6px; background: #172637; color: #eff6ff; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.player-profile-dialog::backdrop { background: rgba(3, 8, 15, .72); }
.player-profile-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: #cde0f9; font-size: 25px; line-height: 1; }
.player-profile-head { display: flex; align-items: center; gap: 12px; padding: 26px 24px 18px; border-bottom: 1px solid #334a63; }
.player-profile-head h2 { margin: 0; font: 800 25px/1 system-ui, sans-serif; }
.player-profile-avatar { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 50%; background: #3d78ee; color: #fff; font-size: 27px; }
.player-profile-stats { margin: 20px 24px 8px; padding: 14px; border: 1px solid #3b5470; border-radius: 4px; background: #101d2b; }
.player-profile-stats p { margin: 3px 0; color: #b9d2f5; font: 600 14px/1.35 system-ui, sans-serif; }
.player-profile-status { min-height: 18px; margin: 0 24px 10px; color: #9fc1ff; font: 500 12px/1.2 system-ui, sans-serif; }
.player-profile-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid #334a63; background: #132131; }
.player-profile-actions button { min-height: 35px; padding: 0 12px; border: 0; border-radius: 4px; background: #3d78ee; color: #fff; font: 700 12px/1 system-ui, sans-serif; }
.player-profile-actions button:disabled { background: #3a4655; color: #93a1b0; opacity: 1; }
.friends-list { min-height: 120px; padding: 0 24px 24px; color: #b9d2f5; font: 500 14px/1.35 system-ui, sans-serif; }
.friends-list p { margin: 0; padding: 10px 0; border-bottom: 1px solid #334a63; }
.friend-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 8px; border-bottom: 1px solid #334a63; }
.friends-list .friend-row { display: block; width: 100%; min-width: 0; min-height: 42px; padding: 10px 0; border: 0; border-radius: 0; background: transparent; color: #d7e9ff; text-align: left; overflow-wrap: anywhere; font: 600 14px/1.3 system-ui, sans-serif; }
.friends-list .friend-row:hover { color: #fff; background: #203a52; }
.friend-action { min-height: 42px; padding: 0 10px; border: 1px solid #415a75; border-radius: 4px; background: #203a52; color: #eff6ff; font: 700 12px/1 system-ui, sans-serif; }
.friend-action:disabled { opacity: .6; }
.friend-error { grid-column: 1 / -1; color: #ffb9b9; font-size: 12px; }
.friend-error:not(:empty) { padding-bottom: 10px; }
/* Update log: a dedicated, extendable release feed rather than a one-off dialog. */
body:has(#view-updates:not([hidden])) { color-scheme: dark; background: #0e1622; background-image: radial-gradient(circle at 30% -20%, #1c2b3c 0, transparent 42%); color: #f5f7fc; }
body:has(#view-updates:not([hidden])) .landing { width: min(100% - 12px, 1240px); margin: 0 auto; }
body:has(#view-updates:not([hidden])) .topbar { width: 100%; min-height: 51px; padding: 0 0 12px; border-bottom: 1px solid #2d3a4b; }
body:has(#view-updates:not([hidden])) .topnav { gap: 4px; }
.updates-screen { width: min(100%, 820px); margin: 0 auto; padding: 28px 0 48px; }
.updates-page-head { position: relative; padding: 26px 28px; border: 1px solid #354c65; border-radius: 6px 6px 0 0; background: linear-gradient(120deg, #182c40, #122031 72%); }
.updates-back { position: absolute; top: 13px; left: 16px; min-height: 30px; padding: 0 6px; border: 0; border-radius: 3px; background: transparent; color: #9dcaff; font: 700 12px/1 system-ui, sans-serif; }
.updates-back:hover { background: #213a52; color: #fff; }
.updates-eyebrow { margin: 19px 0 3px; color: #7fb9ee; font: 800 11px/1 system-ui, sans-serif; letter-spacing: .12em; }
.updates-page-head h1 { margin: 0; color: #f6d875; font: 900 32px/1 system-ui, sans-serif; }
.updates-page-head > p:last-child { margin: 7px 0 0; color: #aec5dc; font: 500 14px/1.3 system-ui, sans-serif; }
.updates-feed { padding: 20px 28px 30px; border: 1px solid #354c65; border-top: 0; border-radius: 0 0 6px 6px; background: #111e2c; }
.update-card { position: relative; padding: 20px; border: 1px solid #3d5874; border-left: 3px solid #f6d875; border-radius: 4px; background: linear-gradient(120deg, #1b3045, #172638); }
.update-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.update-tag { padding: 4px 7px; border-radius: 3px; background: #f6d875; color: #42330d; font: 900 10px/1 system-ui, sans-serif; letter-spacing: .08em; }
.update-card time { color: #9eb7d1; font: 600 12px/1 system-ui, sans-serif; }
.update-card h2 { margin: 0 0 10px; color: #fff; font: 800 20px/1.15 system-ui, sans-serif; }
.update-card ul { display: grid; gap: 8px; margin: 0; padding-left: 20px; color: #c4d6e8; }
.update-card li { padding-left: 3px; font: 500 14px/1.35 system-ui, sans-serif; }
.updates-future { margin: 18px 0 0; padding: 15px; border: 1px dashed #3d5874; border-radius: 4px; color: #91abc5; text-align: center; font: 600 13px/1.3 system-ui, sans-serif; }

/* Your hangar (WPF-878, single-player): the canvas is the play space; the header stays out of its sightlines. */
body:has(#view-hangar:not([hidden])) { overflow: hidden; color-scheme: dark; background: #08111b; }
body:has(#view-hangar:not([hidden])) .landing { width: min(100% - 12px, 1240px); margin: 0 auto; height: calc(100vh - 18px); }
body:has(#view-hangar:not([hidden])) .topbar { width: 100%; min-height: 51px; padding: 0 0 12px; border-bottom: 1px solid #2d3a4b; }
body:has(#view-hangar:not([hidden])) .topnav { gap: 4px; }
body:has(#view-hangar:not([hidden])) .lobby-panel { width: 100%; max-width: none; height: calc(100vh - 74px); padding: 0; overflow: hidden; border: 0; border-radius: 6px; background: #08111b; box-shadow: none; }
/* WPF-470: the stage fills the panel (no empty band below): the panel's two-row lobby grid doesn't apply here */
body:has(#view-hangar:not([hidden])) .lobby-panel { display: block; }
#view-hangar:not([hidden]) { height: 100%; min-height: 0; }
.hangar-stage { position: relative; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(circle at 50% 25%, #1f3850, #08111b 74%); }
.hangar-stage canvas { display: block; width: 100%; height: 100%; outline: 0; }
.hangar-hud { position: absolute; z-index: 2; pointer-events: none; }
.hangar-header { top: 20px; left: 22px; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: start; }
.hangar-header p { grid-column: 2; width: fit-content; margin: 3px 0 0; padding: 3px 6px; border-radius: 3px; background: rgba(8, 17, 27, .78); color: #cfe9ff; font: 800 10px/1 system-ui, sans-serif; letter-spacing: .12em; } /* WPF-470: a dark tag, readable on the bright sky */
.hangar-header h1 { grid-column: 2; margin: 0; color: #fff; font: 900 25px/1 system-ui, sans-serif; text-shadow: 0 2px 12px #000; }
.hangar-back { grid-row: 1 / 3; align-self: center; pointer-events: auto; min-height: 32px; padding: 0 8px; border: 1px solid #496987; border-radius: 3px; background: rgba(13, 28, 43, .86); color: #cde8ff; font: 700 12px/1 system-ui, sans-serif; }
.hangar-back:hover { background: #284965; color: #fff; }
.hangar-help { grid-column: 1 / -1; justify-self: start; margin-top: 8px; padding: 3px 6px; border-radius: 3px; background: rgba(8, 17, 27, .6); color: #c4d8ea; font: 600 11px/1.2 system-ui, sans-serif; text-shadow: 0 1px 5px #000; }
.hangar-help-short { display: none; } /* WPF-470: the phone's one-line version */
/* The campaign level form's Create (WPF-641; the hangar's Create match and boarding card had it before WPF-640/878). */
.hangar-launch { width: 100%; min-height: 39px; margin-top: 11px; border: 1px solid #397ac5; border-radius: 3px; background: #286dbb; color: #fff; font: 800 13px/1 system-ui, sans-serif; }
.hangar-launch:hover { background: #3987dd; }
.hangar-private-toggle { grid-template-columns: auto 1fr; align-items: center; cursor: pointer; }
.hangar-private-toggle input { width: 16px; min-height: 16px; margin: 0; accent-color: #58a9ef; }

/* Account profile. Level is deliberately fixed at 1 until progression is implemented. */
  body:has(#view-account:not([hidden])) .lobby-panel { max-width: 530px; padding: 28px 0 0; background: transparent; border: 0; box-shadow: none; }
  /* WPF-470: the profile scrolls inside the panel: on a 390x844 phone its one-column stats push Log out below the screen */
  #view-account:not([hidden]) { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  /* WPF-470: the page's one grid column may not grow to the profile's min-content (a long nowrap handle made it 480 px
     on a 390 px phone); the handle itself contributes no width and takes what the row leaves, with its ellipsis. */
  body.account-view { grid-template-columns: minmax(0, 1fr); }
  body.account-view { color-scheme: dark; background: radial-gradient(circle at 25% 0%, #294b67, transparent 48%), #0d1722; color: #eff6ff; }
  .account-profile { width: min(100%, 480px); margin: 0 auto; color: #eff6ff; }
  .account-kicker { margin: 0 0 8px 5px; color: #f7d880; font: 800 25px/1 system-ui, sans-serif; letter-spacing: -.8px; }
  .account-kicker span { color: #9dbad8; font-size: 14px; letter-spacing: 0; }
  .account-card { position: relative; overflow: hidden; border: 2px solid #46617c; border-radius: 4px; background: linear-gradient(145deg, #1b2d40, #101c29 72%); color: #eff6ff; }
  .account-close { position: absolute; z-index: 1; top: 10px; right: 11px; width: 31px; height: 31px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #b9d2f5; font-size: 26px; line-height: 1; }
  .account-close:hover { background: #2c465f; color: #fff; }
  .account-head { display: flex; align-items: center; gap: 15px; padding: 28px 48px 20px 22px; border-bottom: 1px solid #38516a; background: linear-gradient(100deg, rgba(78, 159, 235, .14), transparent); }
  .account-avatar { position: relative; display: grid; flex: 0 0 auto; width: 66px; height: 66px; place-items: center; padding: 0; border: 3px solid #8ec6ff; border-radius: 50%; background: #294967; cursor: pointer; box-shadow: 0 0 0 5px rgba(76, 155, 230, .12); }
  .account-avatar:hover { border-color: #f6d875; transform: translateY(-1px); }
  .account-pig { pointer-events: none; }
  .account-avatar-pencil { position: absolute; right: -7px; bottom: -5px; display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid #9ed2ff; border-radius: 50%; background: #173149; color: #f6d875; font: 800 15px/1 system-ui, sans-serif; }
  .account-identity { flex: 1 1 0; min-width: 0; }
  .account-name-row { display: flex; align-items: center; gap: 8px; }
  .account-head h1 { flex: 1 1 auto; width: 0; min-width: 0; margin: 0; overflow: hidden; color: #fff; font: 800 27px/1 system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
  .account-pencil { display: grid; width: 27px; height: 27px; place-items: center; padding: 0; border: 1px solid #5a7b9d; border-radius: 50%; background: #19344d; color: #f6d875; cursor: pointer; font: 800 17px/1 system-ui, sans-serif; }
  .account-pencil:hover { border-color: #9ed2ff; background: #265273; }
  .account-head p { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; color: #b4cee8; font: 600 14px/1.1 system-ui, sans-serif; }
  .account-head strong { color: #f6d875; }
  .account-head small { flex-basis: 100%; color: #8eacc9; font: 500 10px/1.2 system-ui, sans-serif; }
  .account-stats { margin: 20px 20px 10px; padding: 16px; border: 1px solid #3d5770; border-radius: 3px; background: #0e1b29; }
  .account-stats h2 { margin: 0; color: #f6d875; font: 800 17px/1.2 system-ui, sans-serif; }
  .account-note { margin: 5px 0 13px; color: #a8c4e4; font: 500 12px/1.35 system-ui, sans-serif; }
  .account-stat-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .account-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; min-height: 46px; padding: 8px 9px; border: 1px solid #304960; border-radius: 3px; background: #16283a; color: #e8f2ff; cursor: pointer; }
  .account-stat:hover { border-color: #5b82a8; background: #1c3449; }
  .account-stat > span { min-width: 0; overflow: hidden; font: 650 13px/1.2 system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
  .account-stat small { grid-column: 1; color: #8fb0d4; font: 500 10px/1 system-ui, sans-serif; }
  .account-stat input { grid-column: 2; grid-row: 1 / 3; width: 17px; height: 17px; margin: 0; accent-color: #58b8ff; }
  .account-status { min-height: 18px; margin: 6px 20px 12px; color: #9dd5ff; font: 500 12px/1.3 system-ui, sans-serif; }
  .account-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 18px 20px; border-top: 1px solid #38516a; background: #142434; }
  .account-actions button { min-height: 54px; padding: 0 15px; border: 1px solid #426383; border-radius: 3px; background: #203a52; color: #e9f4ff; font: 800 14px/1 system-ui, sans-serif; }
  .account-actions button:hover { background: #2f597d; }
  .account-actions #account-logout { border-color: #785264; background: #3d2632; color: #ffd8df; }
  .account-actions #account-logout:hover { background: #663543; }

@media (max-width: 720px) {
  body:has(#view-lobby:not([hidden])) .landing { width: min(100% - 20px, 620px); }
  body:has(#view-lobby:not([hidden])) .topbar { padding-bottom: 10px; }
  .launcher-logo { height: 30px; }
  .topnav-wide { display: none; }
  .battle-grid { grid-template-columns: 1fr; }
  .battle-art { height: 150px; min-height: 0; }
  .utility-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 0; }
  body.launcher-ranking #view-lobby > .match-list-panel { min-height: 400px; }
  .account-stat-list { grid-template-columns: 1fr; }
    .account-actions { grid-template-columns: 1fr; }
  .updates-screen { padding: 18px 0 32px; }
  .updates-page-head, .updates-feed { padding-left: 18px; padding-right: 18px; }
  body:has(#view-hangar:not([hidden])) .topbar { padding: 5px 12px; }
  /* WPF-470 phone hangar: full bleed, and the stage ends at the screen's bottom edge (the landing is the viewport less
     body.has-topbar's 6px top padding; the panel takes what the top bar leaves). */
  body:has(#view-hangar:not([hidden])) { padding-left: 0; padding-right: 0; }
  body:has(#view-hangar:not([hidden])) .landing { width: 100%; height: calc(100vh - 6px); height: calc(100dvh - 6px); }
  body:has(#view-hangar:not([hidden])) .lobby-panel { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 0; }
  .hangar-header { top: 12px; left: 12px; }
  .hangar-header h1 { font-size: 19px; white-space: nowrap; }
  .hangar-help-long { display: none; }
  .hangar-help-short { display: block; }
}
