/* Shared look: the tab bar on every page of the party (engine/pages/bar.js) and a grid page's tiles (the games,
   engine/pages/grid.js). A phone app's tab bar dressed in the party's theme: its paper, ink, accent and caps font
   only, the theme's own pictures. Phones: fixed at the bottom, showing the whole time except while the keyboard is up.
   Laptops: a slim band that sticks at the top, the picture beside the word. Low weight (:where) where a theme may
   want its own. */
.tabbar[hidden]{display:none !important}
:where(.tabbar){position:fixed; left:0; right:0; bottom:0; z-index:40; display:flex; justify-content:space-around; align-items:stretch;
  padding:5px max(8px, env(safe-area-inset-left, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
  background:rgba(var(--paper-rgb),.95); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  border-top:1.5px solid rgba(var(--ink-rgb),.18); box-shadow:0 -6px 18px rgba(var(--shadow-rgb),.10); touch-action:pan-y;
  transition:transform .25s}
.tabbar.typing{transform:translateY(110%)}
:where(.tabbar) .tb-tab{position:relative; flex:1 1 0; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:3px;
  min-height:56px; padding:4px 2px 3px; border-radius:10px; color:var(--soft); text-decoration:none; white-space:nowrap;
  font:600 12.5px/1.1 var(--f-caps); letter-spacing:.08em; text-transform:uppercase; -webkit-tap-highlight-color:transparent}
:where(.tabbar) .tb-tab img{width:34px; height:34px; object-fit:contain; opacity:.72; transition:transform .25s, opacity .25s}
:where(.tabbar) .tb-word{max-width:100%; overflow:hidden; text-overflow:ellipsis}
/* five tabs on a phone: tighter letters, so a long word ("Classmates") has its best chance to fit */
:where(.tabbar):has(.tb-tab:nth-child(5)) .tb-tab{letter-spacing:.02em}
:where(.tabbar) .tb-tab[aria-current="page"]{color:var(--ink); background:rgba(var(--wash-rgb),.28)}
:where(.tabbar) .tb-tab[aria-current="page"] img{opacity:1; transform:translateY(-2px) scale(1.1)}
.tabbar .tb-tab:focus-visible{outline:3px solid var(--accent); outline-offset:-3px}
/* a count of games still to play or new posts, and a pulsing dot while a game is on */
.tabbar .tb-mark{display:none}
:where(.tabbar) .tb-mark.count{display:block; position:absolute; top:2px; left:calc(50% + 8px); min-width:19px; height:19px; padding:0 5px; border-radius:999px;
  background:var(--accent); color:var(--card); font:600 12px/19px var(--f-body); letter-spacing:0; text-align:center}
:where(.tabbar) .tb-mark.live{display:block; position:absolute; top:5px; left:calc(50% + 12px); width:10px; height:10px; border-radius:50%;
  background:var(--accent); box-shadow:0 0 0 3px rgba(var(--paper-rgb),.95); animation:tb-pulse 1.6s ease-in-out infinite}
@keyframes tb-pulse{50%{transform:scale(1.35); opacity:.6}}
/* room at the foot of the page so the last lines clear the bar, and the notes that float at the foot sit above it */
body.has-tabs{padding-bottom:calc(72px + env(safe-area-inset-bottom, 0px))}
@media (max-width:720px){
  body.has-tabs .mode{bottom:calc(78px + env(safe-area-inset-bottom, 0px))}
  body.has-tabs .undo-note{bottom:calc(82px + env(safe-area-inset-bottom, 0px))}
}
@media (min-width:721px){
  :where(.tabbar){position:sticky; top:0; bottom:auto; justify-content:center; gap:6px; padding:6px 20px; border-top:0;
    border-bottom:1.5px solid rgba(var(--ink-rgb),.16); box-shadow:0 6px 18px rgba(var(--shadow-rgb),.08)}
  .tabbar.typing{transform:none}
  :where(.tabbar) .tb-tab{flex:0 0 auto; flex-direction:row; gap:9px; min-height:48px; padding:6px 18px; font-size:15px}
  :where(.tabbar) .tb-tab img{width:30px; height:30px}
  :where(.tabbar) .tb-tab[aria-current="page"] img{transform:scale(1.08)}
  :where(.tabbar) .tb-mark.count, :where(.tabbar) .tb-mark.live{position:static; margin-left:-2px}
  body.has-tabs{padding-bottom:0}
  /* the board's buttons stick under the band, not under it */
  body.has-tabs .page-tabs{top:66px}
}
@media (prefers-reduced-motion:reduce){.tabbar .tb-mark.live{animation:none} .tabbar, .tabbar .tb-tab img{transition:none}}

/* ---- a grid page's tiles: every game at once, two to a row on a phone, four on a laptop ---- */
[data-tab-off]{display:none !important}   /* nothing sets it now (every section on a page shows, tabs.js); kept for old pages still open */
.game-grid[hidden], .game-tile[hidden]{display:none !important}
:where(.game-grid){grid-column:1 / -1; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px; width:100%; max-width:600px; margin:18px auto 6px; padding:0 4px; box-sizing:border-box}
:where(.game-tile){display:flex; align-items:center; gap:10px; min-height:62px; padding:8px 10px; border:1.5px solid rgba(var(--ink-rgb),.18); border-radius:12px;
  background:var(--card); color:var(--ink); font:inherit; text-align:left; cursor:pointer; -webkit-tap-highlight-color:transparent}
:where(.game-tile) .gt-pic{width:36px; height:36px; object-fit:contain; flex:none}
:where(.game-tile) .gt-pic.none{width:0; margin-right:-10px}
:where(.game-tile) .gt-words{flex:1 1 0; min-width:0}   /* the tile's whole free width, so pages/grid.js measures the room a name has, not the name */
:where(.game-tile) b{display:block; font:600 var(--gt-size, 17px)/1.2 var(--f-body); overflow-wrap:break-word; -webkit-hyphens:auto; hyphens:auto}   /* a word too long for its tile shrinks the names (pages/grid.js fitNames); only past that does it break, at a hyphen where the phone can */
:where(.game-tile) .gt-line{display:block; margin-top:4px; font:600 12.5px/1.25 var(--f-caps); letter-spacing:.08em; text-transform:uppercase; color:var(--soft)}
:where(.game-tile) .gt-line:empty{display:none}
/* a screen too narrow for a name beside its picture: the picture stands over it (pages/grid.js fitNames) */
.game-grid.stack .game-tile{flex-direction:column; justify-content:center; text-align:center; gap:4px}
.game-grid.stack .game-tile .gt-pic.none{display:none}
.game-grid.stack .game-tile .gt-words{width:100%}
:where(.game-tile)[aria-selected="true"]{border:2.5px solid var(--accent); background:linear-gradient(rgba(var(--wash-rgb),.16), rgba(var(--wash-rgb),.16)) var(--card); padding:7px 9px}
:where(.game-tile).now .gt-line{color:var(--accent)}
.game-tile:focus-visible{outline:3px solid var(--accent); outline-offset:2px}
/* the live editor keeps a game that's on but opens later, as a dashed tile */
:where(.game-tile).later{border-style:dashed; background:transparent; opacity:.8}
.game-grid .game-tile.wide{grid-column:1 / -1}
:where(.grid-empty){grid-column:1 / -1; text-align:center; margin:24px auto; max-width:30em}
@media (min-width:721px){
  /* four to a row, a little wider than a narrow column (N0's sample) */
  :where(.game-grid){grid-template-columns:repeat(4, minmax(0, 1fr)); width:auto; max-width:none; margin-inline:calc((100% - max(100%, min(680px, 100vw - 48px))) / 2); padding:0}
  .game-grid .game-tile.wide{grid-column:auto}
}
