/* View Games (index.html). Colours come from the styles.css tokens, which switch under
   prefers-color-scheme; only the scrim and the panel shadow need their own dark values. */
:root{--games-scrim:#12243b66;--games-panel-shadow:-0.75rem 0 2.5rem rgba(21,40,59,.16);--games-count-bg:var(--pill-bg);--games-count-ink:var(--blue);--games-count-on-bg:var(--brand-soft);--games-count-on-ink:var(--ok-ink);--games-indicator:var(--brand-ink);--games-chip-on-bg:var(--brand-soft);--games-chip-on-ink:var(--ok-ink);--games-chip-on-line:var(--brand-ink)}
@media(prefers-color-scheme:dark){:root{--games-scrim:#000000a6;--games-panel-shadow:-0.75rem 0 2.5rem rgba(0,0,0,.5)}}
.games-page{padding-top:2rem}
.games-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:1rem 1.5rem;margin-bottom:1.25rem}
.games-head h1{font-size:2.25rem;letter-spacing:-.04em;margin-bottom:.25rem}
.games-head p{margin-bottom:0;max-width:36rem}
.games-create{display:flex;flex-direction:column;align-items:flex-end;gap:.375rem;max-width:22rem}
.games-create .button,.games-create button{min-height:2.75rem}
.games-create-why{margin:0;color:var(--muted);font-size:.84rem;text-align:right}

/* Tabs: a real tablist; the selected tab carries a bar and a filled count, not colour alone. */
.games-tabs{position:relative;display:flex;gap:.25rem;overflow-x:auto;border-bottom:1px solid var(--line);scrollbar-width:thin}
.games-tabs button.games-tab{flex:0 0 auto;display:inline-flex;align-items:center;gap:.5rem;min-height:2.75rem;padding:.5rem .875rem;border:0;border-bottom:.1875rem solid transparent;border-radius:.625rem .625rem 0 0;background:transparent;color:var(--muted);font-weight:650;font-size:.94rem;white-space:nowrap}
.games-tabs button.games-tab:hover:not(:disabled){background:var(--surface-hover);color:var(--ink)}
.games-tabs button.games-tab[aria-selected=true]{color:var(--ink);border-bottom-color:var(--games-indicator)}
.games-tabs button.games-tab:focus-visible{outline:.1875rem solid var(--focus);outline-offset:-.1875rem}
.games-tab-count{display:inline-flex;justify-content:center;min-width:1.5rem;padding:0 .45rem;border-radius:62rem;background:var(--games-count-bg);color:var(--games-count-ink);font-size:.78rem;font-weight:700;line-height:1.5rem}
.games-tab-count:empty{display:none}
.games-tab[aria-selected=true] .games-tab-count{background:var(--games-count-on-bg);color:var(--games-count-on-ink)}

/* Search, sort and chips */
.games-tools{display:grid;gap:.875rem;margin:1.25rem 0 .5rem}
.games-tools-row{display:flex;flex-wrap:wrap;gap:.75rem 1.5rem;align-items:flex-end}
.games-field{min-width:0}
.games-field label{font-size:.86rem;margin-bottom:.375rem}
.games-search{flex:1 1 16rem}
.games-sort{flex:0 1 13rem}
.games-chips{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;margin:0;padding:0;border:0;min-width:0}
.games-chips legend{float:left;width:100%;padding:0;margin-bottom:.375rem;font-weight:600;font-size:.86rem}
.chip-input{position:absolute;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}
.games-chips label.chip{display:inline-flex;align-items:center;justify-content:center;gap:.3rem;min-height:2.75rem;min-width:2.75rem;margin:0;padding:.375rem .875rem;border:1px solid var(--line-strong);border-radius:62rem;background:var(--paper);color:var(--ink);font-size:.88rem;font-weight:600;cursor:pointer}
.games-chips label.chip:hover{background:var(--surface-hover)}
.chip-input:checked+label.chip{background:var(--games-chip-on-bg);border-color:var(--games-chip-on-line);color:var(--games-chip-on-ink)}
.chip-input:checked+label.chip::before{content:"✓";font-weight:700}
.chip-input:focus-visible+label.chip{outline:.1875rem solid var(--focus);outline-offset:.125rem}
.games-status{min-height:1.4rem;margin:.5rem 0 1rem;color:var(--muted);font-size:.86rem}

/* Cards: a grid on wide screens, a single-column list on phones. */
.games-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(17.5rem,1fr));gap:1.125rem}
.games-grid[aria-busy=true]{opacity:.7}
.game-card{display:flex;flex-direction:column;gap:.75rem;min-width:0;padding:1.25rem;border:1px solid var(--line);border-radius:1.125rem;background:var(--paper);box-shadow:var(--shadow)}
.game-card-top{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem}
.game-card-body{min-width:0}
.game-card-heading{margin:0;font-size:1.13rem;line-height:1.35}
button.game-card-title,.game-card button.game-card-title:hover:not(:disabled){display:inline-flex;justify-content:flex-start;min-height:2.75rem;max-width:100%;padding:.25rem 0;border:0;border-radius:.375rem;background:transparent;color:var(--ink);font-size:inherit;font-weight:700;text-align:left;overflow-wrap:anywhere}
.game-card button.game-card-title:hover:not(:disabled){text-decoration:underline;text-underline-offset:.2rem}
.game-card-sub{margin:0;color:var(--muted);font-size:.88rem}
.game-badges{display:flex;flex-wrap:wrap;gap:.375rem;margin:.625rem 0 0;padding:0;list-style:none}
.game-badge{padding:.15rem .6rem;border:1px solid var(--line);border-radius:62rem;background:var(--surface-sunk);color:var(--ink);font-size:.76rem;font-weight:650}
.game-card-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin-top:auto}
.game-card-actions .button,.game-card-actions button{flex:1 1 auto;min-height:2.75rem}
.game-card-state{flex:0 0 auto;padding:0 .25rem;color:var(--muted);font-size:.9rem;font-weight:650}
.game-card-hint{flex-basis:100%;color:var(--muted);font-size:.82rem}
.games-empty .button,.games-empty button{margin-top:.5rem}
.games-more{display:flex;justify-content:center;margin-top:1.5rem}

/* Detail: a side panel on wide screens, a bottom sheet on phones. Not modal: no focus trap,
   but focus moves in on open and back to the opener on close (Escape, Close or the scrim). */
.games-scrim{position:fixed;inset:0;z-index:40;background:var(--games-scrim)}
.games-detail{position:fixed;top:0;right:0;bottom:0;z-index:50;display:flex;flex-direction:column;width:min(28rem,100%);padding:1rem 1.5rem 2rem;overflow-y:auto;overscroll-behavior:contain;border-left:1px solid var(--line);background:var(--paper);color:var(--ink);box-shadow:var(--games-panel-shadow)}
.games-detail-bar{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.games-detail-bar .eyebrow{margin:0}
.games-detail-close{min-height:2.75rem;min-width:2.75rem}
.games-detail-body h2{margin:.625rem 0 .25rem;font-size:1.45rem;overflow-wrap:anywhere}
.games-detail-body h2:focus-visible{outline:.1875rem solid var(--focus);outline-offset:.25rem;border-radius:.25rem}
.games-detail-body .game-card-actions{margin:1rem 0 .5rem}
.games-detail-section{margin-top:1.25rem}
.games-detail-section h3{margin-bottom:.25rem;font-size:.98rem}
.games-detail-section dl{margin:0}
.games-detail-section .detail-line dd{overflow-wrap:anywhere}

@media(max-width:43.75rem){
.games-page{padding-top:1.25rem}
.games-head h1{font-size:1.9rem}
.games-create{align-items:stretch;max-width:none;width:100%}
.games-create-why{text-align:left}
.games-sort{flex:1 1 100%}
.games-grid{grid-template-columns:1fr;gap:.75rem}
.game-card{padding:1rem;border-radius:.875rem}
.games-detail{top:auto;left:0;width:100%;max-height:85vh;padding:.75rem 1.125rem 1.5rem;border-left:0;border-top:1px solid var(--line);border-radius:1.25rem 1.25rem 0 0;box-shadow:0 -0.75rem 2.5rem rgba(0,0,0,.2)}
}
