/**
 * Paper Gamble on a phone.
 *
 * Everything here is a phone or a tablet in portrait; `app.css` is left as the
 * desktop sheet it always was, so nothing in this file can change what a
 * 1440 px screen sees. Loaded after it, so plain class selectors win without
 * an arms race on specificity.
 *
 * Three things are structural rather than cosmetic and are the reason the file
 * exists at all:
 *
 *  1. **The bar had no menu.** Ten entries in a row that scrolls sideways with
 *     no scrollbar is not a menu: on a 390 px screen every one of them was off
 *     the right edge, and nothing on screen said so. The entries move into a
 *     sheet behind one button, and `app.js` moves the real `#nav` node in and
 *     out rather than drawing a second copy that could drift from the first.
 *  2. **A tap is not a click.** iOS zooms the page whenever a field smaller
 *     than 16 px takes focus, and it never zooms back out; Apple asks for 44 px
 *     of target and the site was shipping 21 px links. Both are fixed here for
 *     every control at once.
 *  3. **The screen is not a rectangle.** `viewport-fit=cover` was already in
 *     the page, which puts the corners, the island and the home bar over the
 *     layout unless every fixed edge pays `env(safe-area-inset-*)`.
 *
 * The runaway that made the whole site render zoomed out on a 3× phone was a
 * canvas sizing loop and is fixed at its root in `app.css`, not here.
 */

:root {
  /* Zero on a laptop, the notch and the home bar on a phone. Named once so a
     rule can add its own padding to the inset instead of guessing. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --bar-h: 58px;
}

/* The menu button belongs to the screens that cannot show the bar's entries;
   above 940px there is nothing for it to open. */
.nav-toggle { display: none; }

/* ---------------------------------------------------------------- pointer */
/**
 * A finger has no hover. Every hover rule the site has was firing on tap and
 * then *sticking* — the card you last touched stayed lit until you touched
 * another one, which reads as a selection that is not one. Kept for mice,
 * dropped for touch; the `:active` states do the work instead.
 */
@media (hover: none) {
  .game-card:hover { border-color: var(--line-soft); transform: none; }
  .table tbody tr:hover { background: transparent; }
  .btn:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
  .btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
  .btn.ghost:hover:not(:disabled) { background: transparent; }
  .btn.danger:hover:not(:disabled) { background: transparent; }
  .nav a:hover { color: var(--text-dim); background: transparent; }
  .nav a.active:hover { color: var(--text); background: var(--panel-2); }
  .lang-menu li:hover { background: transparent; }
  .toast.clickable:hover { background: var(--panel); transform: none; }
  .team-banner:hover { background: rgba(226, 176, 74, 0.1); }
  .mat-cell:hover { border-color: var(--line); }
  .keno-cell:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); color: inherit; }
  .bac-spot:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
  .dice-cell:hover:not(:disabled) { border-color: var(--line-soft); color: inherit; }
  .footer a:hover, .footer-sound:hover { color: var(--text-dim); }
  .chat-tip:hover { color: var(--text-faint); }
  .chat-jump:hover { background: var(--panel-2); }

  /* What a finger gets instead: the thing it is pressing moves. */
  .game-card:active { transform: scale(0.985); }
  .keno-cell:active:not(:disabled),
  .dice-cell:active:not(:disabled),
  .bac-spot:active:not(:disabled) { transform: scale(0.94); }
}

/* ============================================ the bar with no room for a bar == */
/**
 * Not a width — a **measurement**. `app.js` puts `nav-cramped` on the body when
 * the brand, the entries and the account no longer fit the bar at once, and
 * takes it off again when they do. It has to be measured because the bar is not
 * the same width for two players on the same screen: the entries want 701px in
 * English and 788 in Spanish, the admin button adds ninety more, and the
 * balance pill grows a tag inside a tandem lobby. Whole, the bar needs 1393px
 * in English and 1491 in Spanish — so a 1440px laptop fits it for one player
 * and clips it for the next, and any number written here would have been wrong
 * for somebody.
 *
 * The rules below are safe unprefixed: everything else in the sheet is already
 * scoped by `.nav-sheet`, which is `hidden` until the button opens it, and only
 * the button's own appearance turns on the class.
 */

/* The phone still owes the notch its inset, whatever the bar is doing. */
@media (max-width: 940px) {
  /* A phone on its side puts the notch on one of the long edges, so the bar
     owes the inset horizontally as well as at the top. */
  .topbar {
    padding-left: max(14px, var(--safe-l));
    padding-right: max(10px, var(--safe-r));
    /* Nothing left in the bar can overflow, and while it was a scroller a
       sideways swipe on the balance dragged the whole header. */
    overflow: visible;
  }
}

/* The button that owns the menu. 44 px square, at the thumb end of the bar. */
body.nav-cramped .nav-toggle {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.nav-toggle:active { background: var(--panel-2); }
.nav-toggle-bars { display: flex; flex-direction: column; gap: 4px; width: 19px; }
.nav-toggle-bars i {
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.22s var(--ease), opacity 0.14s var(--ease);
}
/* Open, the three bars are the cross that closes it — the same button, so a
   player never has to look for a second one. */
body.nav-open .nav-toggle-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle-bars i:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
/* Something is waiting behind the button: unread chat, or a daily nobody has
   claimed. Without it the news is inside a closed drawer. */
.nav-toggle-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

/* --------------------------------------------------------- the nav sheet */
.nav-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 5, 7, 0.55);
  backdrop-filter: blur(2px);
  animation: sheet-fade 0.16s var(--ease);
}
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
.nav-sheet-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--bar-h) + var(--safe-t) + 8px) max(14px, var(--safe-r)) 18px max(14px, var(--safe-l));
  background: rgba(10, 12, 15, 0.98);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 26px 50px -28px #000;
  animation: sheet-drop 0.2s var(--ease);
}
@keyframes sheet-drop { from { transform: translateY(-10px); opacity: 0.4; } to { transform: none; opacity: 1; } }

/* The entries themselves, once `app.js` has moved them in here. */
.nav-sheet .nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  overflow: visible;
}
.nav-sheet .nav a {
  justify-content: space-between;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  font-size: 14.5px;
}
.nav-sheet .nav a.active {
  border-color: var(--accent-dim);
  background: rgba(61, 220, 151, 0.08);
  color: var(--text);
}
.nav-sheet .nav a.nav-accent { border-color: rgba(226, 176, 74, 0.4); }

.nav-sheet-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.nav-sheet-extra a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
}
.nav-sheet-extra a:active { background: var(--panel-2); }

/* The foot of the sheet: who you are, where you are, what language. */
.nav-sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.nav-sheet-foot .user-slot { flex: 1; gap: 10px; }
.nav-sheet-foot .online { order: 3; }
/* The picker opens downwards inside the sheet, so it is anchored to the left
   of its button rather than the right edge of a bar that is not there. */
.nav-sheet-foot .lang-menu { right: auto; left: 0; }
.nav-sheet-foot .btn.sm { min-height: 40px; }

/* A sheet over the page must be the only thing that scrolls. */
body.nav-open { overflow: hidden; }
/* The bar stays on top of its own sheet: the button that opened it is the
   button that closes it, and the panel was covering it. */
body.nav-open .topbar { z-index: 71; }

/* ================================================================= phone == */
@media (max-width: 780px) {

  /* ------------------------------------------------------------ the shell */
  /**
   * One row, three things: who this is, what you have, and the way in. The
   * online pill, the language picker and the account buttons are moved into
   * the sheet by `app.js` — on a 390 px bar the balance is the only number
   * worth the space, and it is the one a player checks between bets.
   */
  :root { --bar-h: 54px; }
  .topbar { gap: 10px; height: var(--bar-h); }
  .brand-name { display: none; }
  .brand-mark { font-size: 18px; }
  /* With the name gone the link is one 19 px glyph. It still goes home, so it
     still needs something a thumb can hit. */
  .brand { justify-content: center; min-width: 40px; min-height: 42px; margin-left: -8px; padding: 0 8px; }
  .balance { padding: 5px 11px; }
  .balance-label { display: none; }
  .balance strong { font-size: 14.5px; }
  .topbar-right { gap: 8px; }

  /* ------------------------------------------------------- the other bars */
  .team-banner,
  .resume-bar {
    padding-left: max(14px, var(--safe-l));
    padding-right: max(14px, var(--safe-r));
  }
  .resume-bar { gap: 8px; }
  .resume-bar > strong { display: none; }
  .team-banner { gap: 8px; font-size: 12.5px; }

  .footer {
    padding: 16px max(16px, var(--safe-l)) calc(20px + var(--safe-b)) max(16px, var(--safe-r));
    line-height: 2.1;
  }
  /* The disclaimer is a sentence, the links are targets: 44 px of them. The
     mute button stands in that row and is reached with the same finger. */
  .footer a, .footer-sound { display: inline-block; padding: 4px 6px; }

  /* --------------------------------------------------------------- layout */
  .view {
    padding: 16px max(14px, var(--safe-l)) calc(40px + var(--safe-b)) max(14px, var(--safe-r));
  }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 21px; }
  .page-head p { font-size: 13.5px; }
  .card { padding: 15px; }

  /**
   * A card beside a card becomes a card above a card: 175 px of column is not
   * a panel. `.cols-2` in particular is almost always two *panels* — the two
   * halves of the friends page, two charts on the stats page, the two sides of
   * a tandem lobby — and squeezing those into halves of a phone put a "Level
   * 34" badge past the right edge of the screen on a friends list, which is
   * the sort of thing a local database with no friends in it never shows you.
   */
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  /**
   * The exception, and the reason any of this was worth changing: a strip of
   * KPI tiles is a label and a number, and one per row made the lobby eleven
   * screens long with every tile ninety per cent empty. Selected on what is
   * *in* the grid rather than on the class, because the same `.cols-2` means
   * "two panels" on one page and "two figures" on another — and a browser too
   * old for `:has()` simply keeps the one column above, which is safe.
   */
  .grid:has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The daily cards carry art and a clock; they are game cards, not figures. */
  .dailies-grid { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 10px; }

  /* A name with a badge after it wraps rather than reaching past the card:
     usernames here run to sixteen characters and the row is not negotiable. */
  .list-row .name { flex-wrap: wrap; min-width: 0; }
  .list-row .name a { word-break: break-word; }
  .kpi .value { font-size: 19px; }
  .kpi .label { font-size: 10.5px; }

  .game-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .game-art { height: 112px; padding: 12px 14px; }
  .game-body { padding: 14px 15px 15px; gap: 8px; }
  .game-title h3 { font-size: 16px; }
  .game-desc { font-size: 13px; }
  /* "Play →" was a 21 px tall link at the bottom of a card. It is the whole
     point of the card, so it gets a target the size of a button. */
  .game-play { padding: 8px 0; font-size: 14px; }
  .game-cta { min-height: 40px; }

  /* --------------------------------------------------------- the controls */
  /**
   * 16 px is not a taste, it is the number below which iOS zooms the page in
   * on focus and leaves it zoomed. Every field on the site was 15 px.
   */
  .input, select, textarea,
  input[type="text"], input[type="number"], input[type="password"], input[type="search"] {
    font-size: 16px;
    padding: 12px 13px;
  }
  select { min-height: 46px; }
  textarea { min-height: 88px; }

  .btn { min-height: 44px; padding: 11px 16px; }
  .btn.sm { min-height: 38px; padding: 8px 12px; font-size: 13.5px; }
  .btn.xl { min-height: 54px; font-size: 17px; }
  .switch input { width: 46px; height: 27px; }
  .switch input::after { width: 21px; height: 21px; }
  .switch input:checked::after { transform: translateX(19px); }

  /**
   * A segmented control is as wide as its options and phones do not have that
   * much width — the settings page had a 563 px one on a 390 px screen, which
   * pushed the whole document sideways. It scrolls inside itself instead, and
   * snaps so an option is never left half off the edge.
   */
  .seg {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .seg::-webkit-scrollbar { display: none; }
  /* The blinds picker is the one control allowed to wrap, and a pill that
     wraps stops looking like a pill: on a phone it scrolls like every other
     segmented control instead of drawing a two-storey capsule. */
  .poker-solo .seg { flex-wrap: nowrap; }
  .seg button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 14px;
    scroll-snap-align: center;
  }

  /* The half/double/min/max row and the leverage row share this class. Their
     buttons are `flex: 1` and would rather overflow the panel than lose a
     letter, so the side padding the generic `.btn.sm` rule above hands them
     has to come back off. */
  .amount-row { gap: 5px; flex-wrap: wrap; }
  .amount-row .btn.sm { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 8px 4px; font-size: 12.5px; }

  .chip-row { gap: 7px; }
  .chip { min-height: 30px; display: inline-flex; align-items: center; }

  /* A card's title and whatever sits opposite it are a row on a wide screen
     and two lines on a phone: side by side, the title broke into a column two
     words wide and the figure landed in the middle of it. */
  .card-head { flex-wrap: wrap; row-gap: 4px; }
  .card-head > * { min-width: 0; }

  /* ---------------------------------------------------------- the tables */
  .table th, .table td { padding: 9px 10px; }
  .table { font-size: 13px; }
  /**
   * A table that is allowed to scroll must not also wrap: given the choice
   * Chrome squeezed every column to its narrowest word instead, so "Dealer
   * wins" became two lines and "10.00 ◆" broke between the figure and its
   * symbol. The rows stay on one line and the box scrolls, which is the point
   * of `.table-wrap`.
   */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Otherwise a swipe that runs out of table walks the browser back a page. */
    overscroll-behavior-x: contain;
  }
  .table-wrap .table th,
  .table-wrap .table td { white-space: nowrap; }

  /* ------------------------------------------------------------- a stage */
  /**
   * Heights, once, by the shape of the thing rather than per game: a board the
   * player reads (a curve, a wheel) wants the room, a board they play on
   * (cards, a grid) wants to be as tall as its content and no taller.
   */
  .stage, #crash-canvas { min-height: 290px; height: 290px; }
  .plinko-stage, #plinko-canvas { min-height: 340px; height: 340px; }
  .wheel-stage, #wheel-canvas { min-height: 320px; height: 320px; }
  .daily-stage, #daily-canvas { min-height: 300px; height: 300px; }
  .roulette-stage { min-height: 300px; padding: 6px; }
  #roulette-canvas { height: 280px; }
  .market-stage { min-height: 0; }
  .market-canvas { height: 260px; }
  .numbers-stage { min-height: 330px; }
  #numbers-canvas { height: 330px; }
  .reflex-stage, .reflex-pad { min-height: 300px; }

  .mines-stage, .bj-stage, .track-stage, .duel-stage, .slot-stage,
  .keno-stage, .hilo-stage, .bac-stage, .ice-stage, .dice-stage,
  .craps-stage, .candy-stage, .needle-stage, .poker-stage {
    min-height: auto;
    height: auto;
    padding: 16px 12px;
  }

  .multiplier { font-size: clamp(38px, 13vw, 58px); }

  /* ------------------------------------------------------- the game pages */
  .game-layout { gap: 12px; }
  .game-panels { gap: 12px; margin-top: 14px; }
  .history-strip { padding-top: 10px; }

  /* ----------------------------------------------------------- roulette */
  /**
   * The mat turned on its side. Twelve columns of numbers need about 520 px to
   * stay legible and a phone has 360 of them; three columns of twelve fit
   * exactly, which is how every casino app in portrait draws it.
   *
   * The cells are emitted row by row — 3,6…36 then 2,5…35 then 1,4…34 — so
   * each block of twelve is pinned to a column and the rows fall out of it.
   * `dense` is what makes the second and third blocks start again at the top
   * instead of continuing below the first.
   */
  .mat-grid { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .mat-numbers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(12, minmax(0, 1fr));
    grid-auto-flow: row dense;
    gap: 5px;
  }
  .mat-numbers > .mat-cell:nth-child(-n+12) { grid-column: 3; }
  .mat-numbers > .mat-cell:nth-child(n+13):nth-child(-n+24) { grid-column: 2; }
  .mat-numbers > .mat-cell:nth-child(n+25) { grid-column: 1; }
  /* The column bets sit under the columns they pay, in the same order. */
  .mat-columns {
    grid-template-rows: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .mat-columns > .mat-cell:nth-child(1) { grid-column: 3; }
  .mat-columns > .mat-cell:nth-child(2) { grid-column: 2; }
  .mat-columns > .mat-cell:nth-child(3) { grid-column: 1; }
  .mat-cell { min-height: 38px; font-size: 13px; }
  .mat-cell.outside { font-size: 11.5px; padding: 4px 2px; }
  .mat-outside { gap: 5px; }
  .mat-chip { font-size: 10px; }

  /* -------------------------------------------------------- other boards */
  /* Full width and square: a 5×5 minefield on a phone is the page, not a
     420 px box in the middle of it. */
  .mines-grid { width: 100%; gap: 6px; }
  .keno-board { width: 100%; gap: 5px; }
  .keno-cell { font-size: 13px; }
  .candy-board { gap: 5px; }
  .dice-grid { gap: 6px; }
  .dice-cell { min-height: 44px; }
  .bac-mat { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ice-field { gap: 6px; }
  .floe { width: 40px; height: 36px; font-size: 17px; }
  .card-face { width: 44px; height: 63px; }
  .card-face.sm { width: 34px; height: 48px; }
  .hilo-cards { gap: 9px; }
  .lane { grid-template-columns: 104px 1fr 22px; }
  .duel-seats { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .duel-seat { padding: 10px 6px; }
  .duel-seat .avatar { width: 40px; height: 40px; font-size: 15px; }
  .duel-coin { width: 58px; height: 58px; }
  .mp-lane { grid-template-columns: 96px 1fr 70px; }
  .mp-seat { min-width: 100px; }
  .market-readout { gap: 10px; padding: 10px 12px; }
  .market-price { font-size: 22px; }
  .market-value { font-size: 15px; }
  .market-cell { min-width: 76px; }

  /* ----------------------------------------------------------------- chat */
  /**
   * The room fills what is left of the screen rather than a share of it:
   * `64vh` left a third of a phone empty under the composer, and `vh` is the
   * wrong unit anyway — it counts a toolbar that is not there.
   */
  .chat-shell { height: calc(100dvh - 210px); min-height: 340px; max-height: none; }
  .chat-list { padding: 12px; gap: 9px; }
  .chat-body { font-size: 14.5px; }
  .chat-missed { max-height: 56dvh; }
  /* What you are writing gets the whole width; the two buttons share the line
     under it. Side by side, "Ask for money" left the field about eight
     characters wide. */
  .chat-composer { padding: 10px; gap: 7px; flex-wrap: wrap; }
  .chat-composer .input { flex: 1 1 100%; }
  .chat-composer .btn { flex: 1 1 0; }
  /* "give" and "Lend" beside a name are 12 px of text and were 14 px of
     target; the padding is what makes them tappable without moving them. */
  .chat-tip { padding: 8px 7px; }

  /* ---------------------------------------------------------------- auth */
  .auth-wrap { margin-top: 2vh; }
  .auth-wrap .card { padding: 20px; }

  /* --------------------------------------------------------------- modal */
  /**
   * A dialog on a phone is a sheet: it comes up from the bottom, where the
   * thumb is, and it stops above the home bar instead of under it.
   */
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal {
    width: 100%;
    max-height: 92dvh;
    padding: 18px max(18px, var(--safe-l)) calc(18px + var(--safe-b)) max(18px, var(--safe-r));
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
    overscroll-behavior: contain;
    animation: modal-up 0.22s var(--ease);
  }
  @keyframes modal-up { from { transform: translateY(14px); opacity: 0.5; } to { transform: none; opacity: 1; } }
  /* The bar you grab to say "down". Drawn, not wired: the close button is
     still the control, this only makes the sheet read as one. */
  .modal::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    margin: -4px auto 12px;
    border-radius: 999px;
    background: var(--line);
  }
  .modal-head h2 { font-size: 17px; }

  /* -------------------------------------------------------------- toasts */
  /* Full width at the bottom, clear of the home bar, and never over the
     composer's send button. */
  .toasts {
    left: max(12px, var(--safe-l));
    right: max(12px, var(--safe-r));
    bottom: calc(12px + var(--safe-b));
  }
  .toast { min-width: 0; }
}

/* ============================================== very narrow (iPhone SE) == */
@media (max-width: 380px) {
  .view { padding-left: max(11px, var(--safe-l)); padding-right: max(11px, var(--safe-r)); }
  .card { padding: 13px; }
  .kpi .value { font-size: 17px; }
  .nav-sheet .nav { grid-template-columns: minmax(0, 1fr); }
  .mat-cell { min-height: 34px; font-size: 12px; }
  .floe { width: 34px; height: 32px; font-size: 15px; }
  .card-face { width: 40px; height: 57px; }
  .bac-mat { grid-template-columns: minmax(0, 1fr); }
}

/* ================================================== phone in landscape == */
/**
 * Turned sideways there are 390 px of height and the top bar, the title and
 * the stage cannot all have their portrait share of it. The stage keeps most
 * of what is left; the sheet becomes a scrolling panel rather than a list that
 * runs off the bottom.
 */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --bar-h: 46px; }
  .topbar { height: var(--bar-h); }
  .view { padding-top: 12px; }
  .page-head { margin-bottom: 10px; }
  .page-head h1 { font-size: 18px; }
  .page-head p { display: none; }
  .stage, #crash-canvas,
  .plinko-stage, #plinko-canvas,
  .wheel-stage, #wheel-canvas,
  .daily-stage, #daily-canvas { min-height: 240px; height: 240px; }
  #numbers-canvas, .numbers-stage { min-height: 250px; height: 250px; }
  .chat-shell { height: calc(100dvh - 130px); min-height: 240px; }
  .nav-sheet-panel { padding-top: calc(var(--bar-h) + var(--safe-t) + 6px); max-height: 100dvh; }
  /* Wide and short: three across, so the whole menu is on screen at once
     rather than a list the reader has to scroll inside a 390 px window. */
  .nav-sheet .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-sheet-extra { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-sheet .nav a { min-height: 40px; padding: 8px 12px; font-size: 13.5px; }
  .modal { max-height: 96dvh; }
}

/* ====================================== the sheet on something wider than a phone == */
/**
 * A tablet upright, and a laptop whose bar the entries have outgrown — Spanish
 * needs 1491px of bar and almost nobody has one. Everything else on the page is
 * the desktop layout; only the menu has moved, so the sheet spreads out rather
 * than staying a phone's two-column list stretched across 1400px.
 */
@media (min-width: 781px) {
  .nav-sheet .nav,
  .nav-sheet-extra { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-sheet-panel {
    padding-left: max(24px, var(--safe-l));
    padding-right: max(24px, var(--safe-r));
  }
}
@media (min-width: 1100px) {
  /* Ten entries, two rows, no scrolling: the whole menu answers at a glance. */
  .nav-sheet .nav,
  .nav-sheet-extra { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .nav-sheet .nav a { min-height: 44px; }
}
