/* WPF-640: Quick play (index.html #view-quickplay, ui/lobby-quickplay.js). One dark panel like Updates and the campaign
   map: its header, the Open / In flight tabs with the invite code, then a grid of square cards: Create match first, a
   match card (ui/match-cards.js, the lobby's light card look) for each match other players made. No images: a slow
   machine draws a few dozen elements. The Create match sheet opens over it.
   WPF-571's sheet palette (--qp-*, was the hangar's All matches --hm-*): every text pair on the dark panel is at least
   4.5:1, checked on these exact values by tests/unit/client/hangar-sheet-contrast.test.js. */
.quick-play { --qp-panel: #102338; --qp-well: #0d1e2e; --qp-line: #496987; --qp-text: #eaf5ff; --qp-text-2: #bcd3e8; --qp-accent: #2a65a8; --qp-accent-text: #ffffff; --qp-chip: #24425f; --qp-chip-on: #1b4a7e; --qp-cloud: #3b5f84; }
/* The view fills the lobby panel's 1fr row (the panel hides overflow, like #view-campaign in ui/campaign-map.css), and the
   panel is a column: the header and the tabs stay put, the card grid takes the rest and scrolls inside it. A large match
   (more than four ships) caps its card at the grid's visible height and its ship list shrinks to fit, as in the lobby's
   match list (style.css .match-list-panel), so the first card's ships are on screen without scrolling the page. */
body.lobby-wide .lobby-panel > #view-quickplay { grid-row: 2; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; }
.quick-play { display: flex; flex-direction: column; width: min(100%, 1120px); height: 100%; min-height: 0; margin: 0 auto; padding: 24px 0 40px; color: var(--qp-text); }
.quick-play > * { flex: none; }
.quick-play-head { position: relative; padding: 26px 28px 20px; border: 1px solid #354c65; border-radius: 6px 6px 0 0; background: linear-gradient(120deg, #182c40, #122031 72%); }
.quick-play-head h1 { margin: 0; color: #f6d875; font: 900 30px/1.05 system-ui, sans-serif; }
.quick-play-head > p:last-child { margin: 7px 0 0; color: #aec5dc; font: 500 14px/1.3 system-ui, sans-serif; }
.quick-play-head .count { margin-left: 6px; vertical-align: middle; }
.quick-play-bar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; padding: 14px 28px; border: 1px solid #354c65; border-top: 0; background: var(--qp-panel); }
.quick-play-bar label { display: grid; gap: 5px; color: var(--qp-text-2); font: 700 11px/1 system-ui, sans-serif; }
.quick-play-bar input { min-height: 34px; padding: 0 9px; border: 1px solid var(--qp-line); border-radius: 3px; background: var(--qp-well); color: #f0f7ff; }
.quick-play .tabs { margin: 0; background: var(--qp-well); border-color: var(--qp-line); }
.quick-play .tab { color: var(--qp-text-2); }
.quick-play .tab:hover { color: var(--qp-text); }
.quick-play .tab.is-on, .quick-play .tab[aria-selected="true"] { background: var(--qp-accent); color: var(--qp-accent-text); box-shadow: none; }
.quick-play .count, .quick-play .tab .count { background: var(--qp-chip); color: var(--qp-text); }
.quick-play .count.is-zero, .quick-play .tab .count.is-zero { background: var(--qp-chip); color: var(--qp-text-2); }
.quick-play .tab.is-on .count, .quick-play .tab[aria-selected="true"] .count { background: var(--qp-chip-on); color: var(--qp-accent-text); }
/* The grid: Create match and the match cards share one track list (the list's items join the grid). */
.quick-play-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; align-items: stretch; padding: 18px 28px 22px; border: 1px solid #354c65; border-top: 0; border-radius: 0 0 6px 6px; background: var(--qp-panel); }
.quick-play > .quick-play-grid { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; }
.quick-play > .quick-play-grid:has(.match-card[data-large-match="true"]) { flex: 1 1 0; container-type: size; }
/* The cap never squeezes a large match's ship list below a few rows (it went to 0 px at 320x568 and 360x640): the
   list keeps 6rem (four rows), and the card keeps about its fixed sections plus that floor (19rem; a min-height
   beats the 100cqh cap, and the grid then scrolls); if a long name still needs more, the card scrolls itself. On a
   window too short for even that, the grid keeps a floor and the whole view scrolls (overflow above), so every row,
   Join and Details stay reachable. */
.quick-play .match-card[data-large-match="true"] { min-height: 19rem; overflow-y: auto; }
.quick-play .match-card[data-large-match="true"] .ships-strip { min-height: 6rem; }
.quick-play > .quick-play-grid:has(.match-card[data-large-match="true"]) { min-height: 14rem; }
.quick-play-grid > .matches { display: contents; }
.quick-play .match-card { color: var(--ink); } /* the match cards keep their own light card look */
.quick-create-card { display: grid; place-content: center; justify-items: center; gap: 8px; min-height: 220px; padding: 18px; border: 2px dashed #8ecaff; border-radius: var(--r-lg, 22px); background: rgba(42, 101, 168, .22); color: var(--qp-text); text-align: center; cursor: pointer; font: inherit; }
.quick-create-card:hover { background: rgba(42, 101, 168, .38); }
.quick-create-card:focus-visible { outline: 3px solid #f6d875; outline-offset: 3px; }
.quick-create-plus { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--qp-accent); color: var(--qp-accent-text); font: 900 30px/1 system-ui, sans-serif; }
.quick-create-card strong { font: 900 19px/1.1 system-ui, sans-serif; }
.quick-create-card small { max-width: 26ch; color: var(--qp-text-2); font: 600 12px/1.35 system-ui, sans-serif; }
.quick-play .empty-matches.empty { min-height: 0; margin: 14px 28px 0; padding: 18px; background: var(--qp-well); border: 1px solid var(--qp-line); color: var(--qp-text); }
/* With no matches the grid holds only Create match: it keeps its full height (it used to shrink and clip Create match
   under the empty card), and on a short window the view scrolls to the empty card. */
.quick-play:has(> .empty-matches:not([hidden])) > .quick-play-grid { flex: none; }
.quick-play .empty-matches.empty h3 { color: var(--qp-text); }
.quick-play .empty-matches.empty .meta { color: var(--qp-text-2); }
.quick-play .empty .cloud, .quick-play .empty .cloud::before, .quick-play .empty .cloud::after { background: var(--qp-cloud); box-shadow: none; }
.quick-play-status { margin: 12px 0 0; color: #d7e7f6; font: 600 14px/1.3 system-ui, sans-serif; text-align: center; }
.quick-play-status:empty { display: none; }
.quick-play-retry-row { margin: 8px 0 0; text-align: center; }
.quick-play-retry-row:has(> [hidden]) { display: none; }
/* The Create match sheet: the campaign level form's look, over the list. */
.quick-create-form { position: fixed; z-index: 30; top: 50%; right: max(16px, calc(50% - 540px)); display: grid; gap: 12px; width: min(340px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 20px; transform: translateY(-50%); border: 1px solid #527494; border-radius: 5px; background: #102338; box-shadow: 0 22px 65px rgba(0, 0, 0, .55); color: #eaf5ff; }
.quick-create-form header { position: relative; padding-right: 30px; }
.quick-create-form header p { margin: 0 0 4px; color: #8fc7f6; font: 800 10px/1 system-ui, sans-serif; letter-spacing: .12em; }
.quick-create-form h2 { margin: 0; color: #fff; font: 800 22px/1 system-ui, sans-serif; }
.quick-create-form header button { position: absolute; top: 0; right: 0; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #cde5fc; font-size: 22px; }
.quick-create-form label { display: grid; gap: 5px; color: #bcd3e8; font: 700 11px/1 system-ui, sans-serif; }
.quick-create-form input:not([type="checkbox"]), .quick-create-form select { min-height: 34px; padding: 0 9px; border: 1px solid #496987; border-radius: 3px; background: #0d1e2e; color: #f0f7ff; }
.quick-private-toggle { grid-template-columns: auto 1fr; align-items: center; cursor: pointer; }
.quick-private-toggle input { width: 16px; min-height: 16px; margin: 0; accent-color: #58a9ef; }
.quick-create-note { margin: -2px 0 0; color: #92abc4; font: 500 11px/1.35 system-ui, sans-serif; }
#quick-level-help { white-space: pre-line; }
.quick-create-submit { width: 100%; min-height: 39px; margin-top: 4px; border: 1px solid #397ac5; border-radius: 3px; background: #286dbb; color: #fff; font: 800 13px/1 system-ui, sans-serif; cursor: pointer; }
.quick-create-submit:hover { background: #3987dd; }
.quick-create-form [role="status"] { min-height: 14px; margin: -4px 0 0; color: #f6d875; font: 600 11px/1.2 system-ui, sans-serif; }

@media (max-width: 720px) {
  .quick-play { padding: 12px 0 24px; }
  .quick-play-head { padding: 22px 16px 14px; }
  .quick-play-head h1 { font-size: 24px; }
  .quick-play-bar, .quick-play-grid { padding-left: 12px; padding-right: 12px; }
  .quick-play-bar label { flex: 1 1 100%; }
  .quick-create-card { min-height: 120px; }
  .quick-create-form { top: auto; right: 12px; bottom: 12px; width: calc(100% - 24px); max-height: calc(100% - 24px); transform: none; }
}

/* Short windows (960x640) and phones: a compact header (Back beside the title, no subtitle) and tighter padding, so the
   first row of cards, a large match's ship list included, is on screen without scrolling. */
@media (max-height: 760px), (max-width: 720px) {
  body.quickplay-view .lobby-panel { padding: 8px; }
  .quick-play { padding: 0; }
  .quick-play-head { padding: 10px 16px 10px 84px; }
  .quick-play-head .quick-play-back { top: 50%; transform: translateY(-50%); }
  .quick-play-head .updates-eyebrow { margin-top: 0; }
  .quick-play-head h1 { font-size: 22px; }
  .quick-play-head > p:last-child { display: none; }
  .quick-play-bar { padding-top: 8px; padding-bottom: 8px; }
  .quick-play-grid { padding-top: 12px; padding-bottom: 12px; }
}
/* Phones: Create match is a row above the matches, not a square beside them. */
@media (max-width: 720px) {
  .quick-create-card { grid-template-columns: auto minmax(0, 1fr); place-content: center start; justify-items: start; align-items: center; gap: 2px 12px; min-height: 0; padding: 12px; text-align: left; }
  .quick-create-plus { grid-row: 1 / 3; width: 40px; height: 40px; font-size: 24px; }
  .quick-create-card small { max-width: none; }
}
/* Short landscape (an 844x390 phone on its side): the header and the tabs take the left column, the cards the right one,
   full height (the hangar's All matches sheet did the same before WPF-640). With no matches the empty card stays in the
   left column under the tabs (the 1fr row, scrolling if it must) and Create match keeps the right one: the empty card
   once shared the card grid's area and, drawn later, sat on Create match and took its clicks (the playtest's 800x450
   window). */
@media (min-width: 721px) and (max-height: 500px) {
  .quick-play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); grid-template-rows: auto auto minmax(0, 1fr); column-gap: 8px; }
  .quick-play > * { grid-column: 1; }
  .quick-play-bar { flex-direction: column; align-items: stretch; border-radius: 0 0 6px 6px; }
  .quick-play > .quick-play-grid { grid-column: 2; grid-row: 1 / 4; min-height: 0; }
  .quick-play > .empty-matches.empty { grid-row: 3; margin-top: 8px; overflow: auto; overscroll-behavior: contain; }
  .quick-play > .quick-play-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; border-top: 1px solid #354c65; border-radius: 6px; padding: 8px; }
  .quick-play .empty-matches.empty { margin: 0; overflow: auto; }
}
