/* Fit: the frame at every width, from laptops to phones. Loaded last.
   Nothing in the top bar is ever clipped: what doesn't fit leaves whole
   (the clock, then "BAR", then the steps' names) instead of being cut by
   the window's edge, and on a phone the bar wraps onto two rows. */

/* --- The top bar ------------------------------------------------------------ */
.top { gap: clamp(8px, 1vw, 20px); padding: 0 clamp(12px, 1.4vw, 20px); }
.top > * { flex-shrink: 0; }
.top > .steps { flex: 1 1 0; min-width: 0; gap: 2px; font-size: clamp(11px, .75vw, 15px); }
.steps .step { font-size: 1em; padding-left: .4em; padding-right: .4em; }
/* The current step is a filled pill: room inside it (the audit wants 6 px or more). */
.steps .step.now { padding-left: max(.6em, 8px); padding-right: max(.6em, 8px); }
/* The clock is on the receipt and, in game, on the stage: it goes first. */
@media (max-width: 1699px) { .top > .clock { display: none; } }
@media (max-width: 1799px) { .brand .brand-bar { display: none; } }
/* The steps' names only where all seven fit (in the steps' own ems);
   else numbers, and the one now keeps its name. */
@container (max-width: 50em) { .steps .step:not(.now) { padding-left: 7px; padding-right: 7px; } .step:not(.now) .lbl { display: none; } .step:not(.now) .n { opacity: 1; } }
@container (min-width: 50.01em) { .steps .step:not(.now) .lbl { display: inline; } .steps .step:not(.now) { padding-left: .4em; padding-right: .4em; } }
@media (max-width: 1099px) { .brand b { display: none; } }

/* --- Pull tabs: the last five games always read in full ------------------------ */
/* Your own tab takes the height it needs; the sealed ones share the rest. */
.tickets { display: flex; flex-direction: column; }
.tickets > .ticket { flex: 1 1 0; min-height: 56px; }
.tickets > .ticket:not(.others) { flex: none; }
.tickets .ticket .form, .tickets.many .ticket .form { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tickets .ticket .form .lbl, .tickets.many .ticket .form .lbl { display: flex; flex-direction: row; align-items: baseline; gap: 8px; white-space: nowrap; min-width: 0; overflow: hidden; }
.tickets .ticket .form .lbl .who, .tickets.many .ticket .form .lbl .who { color: var(--ink); font-weight: 700; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tickets .ticket .form .lbl .what, .tickets.many .ticket .form .lbl .what { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tickets .ticket .form .lbl b, .tickets.many .ticket .form .lbl b { margin-left: auto; flex: none; font-size: 14px; }
.tickets .ticket .form .cells, .tickets.many .ticket .form .cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.tickets .ticket .form .cell, .tickets.many .ticket .form .cell { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px; min-width: 0; padding: 2px 3px; border: 1px solid transparent; border-radius: 4px; }
.tickets .ticket .form .cell img, .tickets.many .ticket .form .cell img { display: block; width: 20px; height: 20px; flex: none; border-radius: 3px; }
.tickets .ticket .form .cell b, .tickets.many .ticket .form .cell b { font-size: 12px; white-space: nowrap; }
/* A wide stage with few players: the history is its own column, each game
   its champion over its number. */
@container (min-width: 1001px) {
  .tickets:not(.many) .ticket .form .cell { flex-direction: column; gap: 2px; }
  .tickets:not(.many) .ticket .form .cell img { width: 26px; height: 26px; }
}

/* --- Phones ------------------------------------------------------------------- */
@media (max-width: 720px) {
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; }
  .app { height: auto; min-height: 100vh; overflow: visible; grid-template-rows: auto auto auto; }

  /* Two rows: the bar's tools, then the seven steps across. */
  .top { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; justify-content: space-between; }
  .top > .steps { order: 9; flex: 1 0 100%; justify-content: space-between; }
  .brand b { display: none; }
  .room-code { letter-spacing: .2em; padding: 0 6px 0 8px; }

  /* The crew strip: five small seats, each its face, name, BAC and +1. */
  .wall { padding: 8px 16px; gap: 6px; }
  .wall .mate { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; justify-items: center; text-align: center; padding: 6px 4px; gap: 2px; }
  .wall .mate > * { grid-column: 1; grid-row: auto; }
  .wall .mate .av { width: 28px; height: 28px; }
  .wall .mate .nm { max-width: 100%; font-size: 10px; }
  .wall .mate .dr, .wall .mate .meter, .wall .mate .spark, .wall .mate .bac small { display: none; }
  .wall .mate .bac { text-align: center; font-size: 18px; }
  .wall .mate .plus { justify-self: stretch; height: 26px; padding: 0 4px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
  .wall .empty-seat { padding: 6px 2px; font-size: 10px; }

  /* The stage, then the printer under it; the page scrolls. */
  .main { grid-template-columns: minmax(0, 1fr); }
  .stage { overflow: visible; padding: 12px 16px; }
  .stage-h { flex-wrap: wrap; gap: 6px 12px; }
  .stage-h h1 { font-size: 28px; }
  .stage-h .acts { margin-left: 0; flex-wrap: wrap; }
  .printer { border-left: 0; border-top: 1px solid var(--line); }
  .paper-wrap { overflow: visible; }
  .seats2, .orders2, .igcols, .deal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal .card { height: auto; min-height: 260px; }

  /* A pull tab: who bets on top, the bet, the two sides, then the history. */
  .tickets .ticket, .tickets.many .ticket { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; max-height: none; }
  .tickets .ticket > *, .tickets.many .ticket > * { grid-column: 1; grid-row: auto; }
  .tickets .tk-stub, .tickets.many .tk-stub { flex-direction: row; justify-content: flex-start; border-right: 0; border-bottom: 2px dashed var(--paper); padding: 6px 12px; }
  .tickets .tk-sides, .tickets.many .tk-sides { grid-template-rows: none; grid-template-columns: 1fr 1fr; border-left: 0; border-top: 1px dashed var(--rule-2); height: 52px; }
  .tickets .ticket .form, .tickets.many .ticket .form { grid-column: 1; grid-row: auto; border-left: 0; border-top: 1px dashed var(--rule-2); padding: 6px 12px 8px; }
  .tickets .ticket .form .cell, .tickets.many .ticket .form .cell { flex-direction: column; gap: 2px; }
  .tickets > .ticket.others { min-height: 64px; }

  /* Receipts: who and their sips on one line, the +1 and the status under. */
  .line-up .q { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 6px; }
  .line-up .q > img { grid-row: 1 / 3; }
  .line-up .q .plus { grid-column: 2; grid-row: 2; justify-self: start; }
  .line-up .q .st { grid-column: 3; grid-row: 2; }
  /* Round-up: who, the change and BAC, then the drinks under them. */
  .rus .ru { grid-template-columns: 36px minmax(0, 1fr) auto auto; row-gap: 8px; }
  .rus .ru .ru-types { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rus .ru .ru-delta { min-width: 0; font-size: 26px; }
  .rus .ru .ru-bac { min-width: 0; font-size: 24px; }
}
