/* =====================================================================
   GALLERY + LEADERBOARD (gallery.html) — "trusted dark".
   Loaded after style.css. Everything this page needs (tokens, page, tabs,
   search field, dialogs, toast, footer links) is redefined here so the
   page stays self-consistent whatever the game's stylesheet does.
   One accent (orange), lime only for "voted", coral only for errors.
   No glows, no gradient borders, no looping motion except loading states.
   ===================================================================== */
:root {
  --bg: #0b0b0a;
  --panel: #141412;
  --panel2: #1c1b18;
  --line: #2a2824;
  --line2: #3a3732;
  --text: #f7f5f0;
  --cream: #f7f5f0;
  --muted: #a39d93;
  --dim: #6f6a62;
  --ink: #0b0b0a;             /* text on orange / cream fills */
  --orange: #fc7208;
  --orange-d: #fc7208;        /* small orange text on dark: ~6.9:1 */
  --lime: #b0ea42;
  --peach: #fcd5a3;
  --coral: #fd6f65;
  --red: #fd6f65;
  --display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --ui: Inter, system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 30px -18px rgba(0, 0, 0, .8);
  --wrap: 1180px;
  color-scheme: dark;
}

/* ---------- page ---------- */
html { background: radial-gradient(120% 60% at 50% -10%, rgba(252, 114, 8, .10), transparent 60%) top / 100% 900px no-repeat, var(--bg); color: var(--text); }
body.gallery { background: transparent; color: var(--text); font-family: var(--ui); overscroll-behavior-y: auto; -webkit-font-smoothing: antialiased; }
body.gallery::before, body.gallery::after { content: none; display: none; animation: none; }
.gallery a { color: inherit; }
.gallery :focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
:where(.gallery) button { color: inherit; }

/* ---------- top bar ---------- */
.g-top { position: sticky; top: 0; z-index: 8; padding-top: env(safe-area-inset-top);
  background: rgba(11, 11, 10, .82); backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--line); }
.g-top-in { max-width: var(--wrap); margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.g-logo { display: block; flex: 0 1 auto; min-width: 0; }
.g-logo img { display: block; height: 44px; width: auto; }
.g-play { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px 0 16px; border-radius: 999px; text-decoration: none;
  font: 800 14.5px/1 var(--ui); letter-spacing: .2px; color: var(--ink); background: var(--orange);
  transition: translate .2s var(--ease), background .2s; }
.gallery .g-play { color: var(--ink); }
.g-play span { font-size: 10px; }
@media (hover: hover) { .g-play:hover { translate: 0 -1px; background: #ff8126; } }
.g-play:active { scale: .98; }

/* ---------- hero ---------- */
.g-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.g-hero { text-align: center; padding: 34px 0 6px; animation: rise .3s var(--ease) both; }
.g-eyebrow { margin: 0; font: 800 11px/1 var(--ui); letter-spacing: 2.2px; text-transform: uppercase; color: var(--orange); }
.g-h1 { margin: 14px 0 0; font-family: var(--display); font-weight: 400; font-size: clamp(38px, 10vw, 68px); line-height: .96; letter-spacing: -.5px; color: var(--text); }
.g-h1 span { color: var(--orange); }
.g-lede { max-width: 520px; margin: 14px auto 0; font-size: 15.5px; line-height: 1.55; font-weight: 500; color: var(--muted); }
.g-lede b { color: var(--text); font-weight: 700; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------- tabs + search ---------- */
.g-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 26px 0 16px; scroll-margin-top: 80px; }
.gallery .g-tabs { flex: 1 1 340px; display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.gallery .g-tabs button { flex: 1; padding: 10px 6px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap;
  background: transparent; transition: background .2s, color .2s; }
.gallery .g-tabs button.on { background: var(--orange); color: var(--ink); }
.gallery .g-tabs button:active { scale: .98; }
@media (hover: hover) { .gallery .g-tabs button:not(.on):hover { background: var(--panel2); color: var(--text); } }
.gallery .g-search { flex: 1 1 240px; position: relative; margin: 0; display: flex; align-items: center; padding-left: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; transition: border-color .2s; }
.gallery .g-search:focus-within { border-color: var(--orange); }
.gallery .g-search span { color: var(--orange); font-weight: 800; }
.gallery .g-search input { flex: 1; min-width: 0; padding: 13px 8px 13px 4px; font-size: 16px; font-weight: 600; color: var(--text); background: none; border: 0; outline: none; }
.g-search input::-webkit-search-cancel-button { display: none; }
.g-search input::placeholder { color: #8a847a; font-weight: 500; }
.g-clear { width: 36px; height: 36px; margin-right: 4px; border-radius: 10px; color: var(--muted); font-weight: 800; }
.g-clear:hover { background: var(--panel2); color: var(--text); }

.g-layout { display: grid; gap: 18px; }
.g-main { min-width: 0; }

/* ---------- leaderboard: a swipeable strip on phones, a sticky side card on desktop ---------- */
.g-board { min-width: 0; }
.g-board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 10px; }
.g-board-head h2 { margin: 0; font: 800 11px/1 var(--ui); letter-spacing: 2.2px; text-transform: uppercase; color: var(--text); }
.g-board-head small { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.g-players { list-style: none; margin: 0 -16px; padding: 0 16px 4px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.g-players::-webkit-scrollbar { display: none; }
.gp-row { flex: 0 0 auto; scroll-snap-align: start; }
.gp-btn { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: left;
  color: var(--text); transition: transform .2s var(--ease), border-color .2s, background .2s; }
@media (hover: hover) { .gp-btn:hover { transform: translateY(-1px); border-color: var(--line2); } }
.gp-btn:active { transform: scale(.98); }
.gp-btn.on { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.gp-rank { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font: 800 13px/1 var(--ui);
  font-variant-numeric: tabular-nums; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.r1 .gp-rank { background: var(--orange); color: var(--ink); border-color: var(--orange); }
.r2 .gp-rank, .r3 .gp-rank { color: var(--text); border-color: var(--line2); }
.gp-who { display: flex; flex-direction: column; min-width: 0; max-width: 150px; gap: 1px; }
.gp-who b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-who small { font-size: 12px; color: var(--muted); font-weight: 500; }
.gp-votes { display: flex; align-items: center; gap: 4px; margin-left: 6px; font: 800 14px/1 var(--ui); font-variant-numeric: tabular-nums; }
.gp-votes i { font-style: normal; font-size: 12px; }
.gp-empty { color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 12px 2px; }
.gp-row.sk { width: 170px; height: 50px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 9px; }
.gp-row.sk .gp-rank { background: var(--panel2); border: 0; }
.gp-row.sk .gp-who { height: 11px; flex: 1; border-radius: 6px; background: var(--panel2); }

/* handle page header */
.g-player { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow); animation: rise .25s var(--ease) both; }
.gp-av { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-family: var(--display); font-size: 22px;
  background: var(--orange); color: var(--ink); }
.gph-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gph-txt small { font-size: 10.5px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; color: var(--orange); }
.gph-txt b { font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gph-line { font-size: 13px; color: var(--muted); font-weight: 500; }
.gph-line a { color: var(--text); font-weight: 700; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.gph-line a:hover { text-decoration-color: var(--orange); }
.gph-clear { flex: 0 0 auto; padding: 9px 13px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text); background: var(--panel2); border: 1px solid var(--line); }
.gph-clear span { margin-left: 5px; }
.gph-clear:hover { border-color: var(--line2); }
@media (max-width: 459px) { .gph-clear span { display: none; } .gph-clear { padding: 9px 12px; } .gph-txt b { font-size: 20px; } }

/* ---------- run grid ---------- */
.g-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
.run-card { container-type: inline-size; position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 16px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s; animation: rise .3s var(--ease) both; }
@media (hover: hover) { .run-card:hover { transform: translateY(-2px); border-color: var(--line2); } }
.run-card.featured { border-color: var(--orange); box-shadow: inset 0 0 0 .5px var(--orange), var(--shadow); }

.rc-media { position: relative; display: block; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; background: #080807; padding: 0; margin: 0; border: 0; border-radius: 0; cursor: pointer; }
.rc-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.run-card.ready .rc-media video { opacity: 1; }
/* placeholder: the logo's rising bars, quiet, until the first frame loads */
.rc-ph { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 4px; padding-bottom: 46%; background: #0f0f0d; }
.rc-ph i { width: 7px; border-radius: 4px; background: var(--line2); }
.rc-ph i:nth-child(1) { height: 14px; } .rc-ph i:nth-child(2) { height: 22px; } .rc-ph i:nth-child(3) { height: 30px; }
.rc-ph i:nth-child(4) { height: 38px; background: var(--orange); opacity: .8; }
.run-card.broken .rc-ph::after { content: "Video unavailable"; position: absolute; bottom: 30%; font-size: 12px; font-weight: 600; color: var(--muted); }
.rc-play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  padding-left: 3px; font-size: 14px; color: var(--text); background: rgba(11, 11, 10, .55); border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .2s var(--ease), background .2s, color .2s, border-color .2s; }
@media (hover: hover) { .rc-media:hover .rc-play { background: var(--orange); border-color: var(--orange); color: var(--ink); } }
.rc-media:active .rc-play { transform: scale(.96); }
.rc-media::after { content: ""; position: absolute; inset: auto 0 0; height: 34%; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); pointer-events: none; }
.rc-rank { position: absolute; top: 8px; left: 8px; z-index: 1; min-width: 30px; padding: 5px 8px; border-radius: 8px; text-align: center;
  font: 800 12.5px/1 var(--ui); font-variant-numeric: tabular-nums; color: var(--text);
  background: rgba(11, 11, 10, .66); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rc-rank.r1 { background: var(--orange); color: var(--ink); border-color: var(--orange); }
.rc-feat { position: absolute; z-index: 1; left: 8px; bottom: 8px; display: inline-block; max-width: calc(100% - 60px); padding: 5px 8px; border-radius: 7px;
  font: 800 9.5px/1.2 var(--ui); letter-spacing: .9px; text-transform: uppercase; color: var(--text);
  background: rgba(11, 11, 10, .72); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rc-feat::first-letter { color: var(--orange); }
.rc-dur { position: absolute; z-index: 1; right: 8px; bottom: 8px; padding: 4px 7px; border-radius: 7px; font: 700 11px/1 var(--ui); font-variant-numeric: tabular-nums;
  color: var(--text); background: rgba(11, 11, 10, .66); }

.rc-body { padding: 10px 10px 10px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rc-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rc-handle { flex: 1 1 auto; min-width: 0; padding: 0; text-align: left; font-weight: 800; font-size: 14.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .rc-handle:hover { color: var(--orange); } }
.gallery .rc-ig { flex: 0 0 auto; font-size: 10px; font-weight: 800; letter-spacing: .6px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line2); color: var(--muted); text-decoration: none; }
.gallery .rc-ig:hover { color: var(--text); border-color: var(--muted); }
.rc-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.rc-beat { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-score { flex: 0 0 auto; font: 800 12px/1 var(--ui); font-variant-numeric: tabular-nums; color: var(--orange); padding: 4px 7px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line2); }
.rc-actions { display: flex; gap: 6px; margin-top: 4px; }
.rc-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 14px; display: grid; place-items: center;
  color: var(--text); transition: border-color .2s, transform .15s; }
.rc-more { font-weight: 800; font-size: 17px; letter-spacing: 1px; color: var(--muted); }
@media (hover: hover) { .rc-icon:hover { border-color: var(--line2); } }
.rc-icon:active { transform: scale(.96); }
.rc-more.done { opacity: .4; }

/* 🔥 vote button (cards + big view) */
.vote { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; border-radius: 10px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 13px;
  transition: transform .15s var(--ease), background .2s, border-color .2s, color .2s; }
.vote i { font-style: normal; font-size: 13px; }
.vote b { font: 800 14px/1 var(--ui); font-variant-numeric: tabular-nums; }
.vote span { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
@media (hover: hover) { .vote:not(:disabled):hover { border-color: var(--orange); } }
.vote:not(:disabled):active { transform: scale(.98); }
.vote.on { background: rgba(176, 234, 66, .08); border-color: rgba(176, 234, 66, .45); color: var(--lime); cursor: default; }
.vote.on span { color: var(--lime); }
.vote.pop { animation: vote-pop .25s var(--ease); }
@keyframes vote-pop { 50% { transform: scale(1.04); } }
/* two-up cards on phones: the count says it all; voted shows a check */
@container (max-width: 215px) {
  .run-card .vote span { display: none; }
  .run-card .vote.on::after { content: "✓"; font-weight: 800; font-size: 12px; }
  .rc-icon { width: 34px; }
  .rc-actions { gap: 5px; }
}

/* skeletons */
.run-card.sk { animation: none; box-shadow: none; }
.run-card.sk .rc-media { background: var(--panel2); cursor: default; }
.run-card.sk .rc-media::after { display: none; }
.sk-line { display: block; height: 10px; margin: 12px 10px 0; border-radius: 6px; background: var(--panel2); }
.sk-line.short { width: 55%; margin-bottom: 14px; }
.sk .rc-media, .sk-line, .gp-row.sk .gp-who { background: linear-gradient(90deg, var(--panel2) 0%, #24231f 45%, var(--panel2) 90%); background-size: 250% 100%; animation: sk 1.6s linear infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* empty / error / opening-soon */
.g-state { text-align: center; padding: 40px 22px 36px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.g-state b { display: block; margin-top: 18px; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.15; color: var(--text); }
.g-state p { max-width: 380px; margin: 10px auto 20px; font-size: 14.5px; line-height: 1.55; color: var(--muted); font-weight: 500; }
.g-state.error { border-color: rgba(253, 111, 101, .45); }
.g-state.error b { color: var(--text); }
.g-state-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.g-mark { display: inline-flex; align-items: flex-end; gap: 5px; height: 40px; }
.g-mark i { width: 8px; border-radius: 4px; background: var(--cream); transform-origin: bottom; animation: gbar 2.4s var(--ease) infinite; }
.g-mark i:nth-child(1) { height: 34%; } .g-mark i:nth-child(2) { height: 55%; background: var(--peach); animation-delay: .6s; }
.g-mark i:nth-child(3) { height: 77%; background: var(--lime); animation-delay: 1.2s; } .g-mark i:nth-child(4) { height: 100%; background: var(--orange); animation-delay: 1.8s; }
.g-state.error .g-mark i { animation: none; background: var(--line2); }
.g-state.error .g-mark i:nth-child(4) { background: var(--coral); }
@keyframes gbar { 0% { transform: scaleY(1.08); } 20%, 100% { transform: scaleY(1); } }
.g-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 46px; padding: 0 22px; border-radius: 999px; font-weight: 800; font-size: 14.5px;
  text-decoration: none; background: var(--orange); color: var(--ink); border: 1px solid var(--orange); transition: translate .2s var(--ease), background .2s, border-color .2s; }
.gallery .g-btn { color: var(--ink); }
.gallery .g-btn.ghost { color: var(--text); }
@media (hover: hover) { .g-btn:hover { translate: 0 -1px; background: #ff8126; } .g-btn.ghost:hover { background: var(--panel2); border-color: var(--muted); } }
.g-btn:active { scale: .98; }
.g-btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.g-more { display: block; margin: 22px auto 0; height: 46px; padding: 0 26px; border-radius: 999px; background: transparent; color: var(--text); border: 1px solid var(--line2); font-weight: 700; }
.g-more:hover { background: var(--panel2); }
.g-more:disabled { opacity: .6; }
#sentinel { height: 1px; }

/* ---------- one run, large ---------- */
.gallery .run-dlg { padding: 0; width: min(920px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9); }
.gallery .run-dlg::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.run-dlg[open] { animation: rise .25s var(--ease) both; }
.rd-in { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); overflow-y: auto; }
.rd-media { position: relative; background: #000; display: grid; place-items: center; }
.rd-media video { display: block; width: 100%; max-height: 62dvh; aspect-ratio: 9 / 16; object-fit: contain; background: #000; }
.rd-media .rc-feat { top: 12px; bottom: auto; left: 12px; font-size: 10.5px; padding: 6px 10px; }
.rd-info { position: relative; padding: 18px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.rd-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 800; }
.rd-close:hover { border-color: var(--line2); }
.rd-info .g-eyebrow { font-size: 10.5px; }
.rd-handle { margin: 0; padding-right: 48px; }
.rd-h { padding: 0; text-align: left; font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.05; color: var(--text); word-break: break-all; }
.rd-h:hover { color: var(--orange); }
.gallery .rd-ig { align-self: flex-start; font-size: 13px; font-weight: 700; color: var(--muted); margin-top: -6px; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.gallery .rd-ig:hover { color: var(--text); text-decoration-color: var(--orange); }
.rd-beat { margin: 2px 0 0; font-size: 14px; color: var(--muted); font-weight: 500; }
.rd-beat b { color: var(--text); font-weight: 700; }
.rd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rd-stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px 11px; text-align: center; }
.rd-stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rd-stat:first-child b { color: var(--orange); }
.rd-stat span { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; }
.gallery .rd-vote { flex: 0 0 auto; height: 52px; border-radius: 14px; font-size: 15px; gap: 8px; background: var(--orange); border-color: var(--orange); color: var(--ink); }
.gallery .rd-vote span { color: var(--ink); opacity: .75; font-size: 12px; }
.rd-vote i { font-size: 18px; }
.rd-vote b { font-size: 19px; }
@media (hover: hover) { .gallery .rd-vote:not(:disabled):hover { background: #ff8126; } }
.gallery .rd-vote.on { background: rgba(176, 234, 66, .08); border-color: rgba(176, 234, 66, .45); color: var(--lime); }
.gallery .rd-vote.on span { color: var(--lime); opacity: 1; }
.rd-row { display: flex; gap: 8px; }
.rd-row button { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: border-color .2s; }
.rd-row button:hover { border-color: var(--line2); }
.rd-row button b { font-weight: 800; }
.rd-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.gallery .rd-play { font-size: 13.5px; font-weight: 700; color: var(--orange); text-decoration: none; }
.gallery .rd-play:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd-report { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 4px; }
.rd-report:hover { color: var(--text); }
.rd-report.done { opacity: .5; }
@media (min-width: 760px) {
  .rd-in { flex-direction: row; overflow: hidden; }
  .rd-media { flex: 0 0 auto; width: min(calc((100dvh - 24px) * 9 / 16), 470px); }
  .rd-media video { max-height: calc(100dvh - 24px); height: 100%; }
  .rd-info { flex: 1; min-width: 0; padding: 28px 26px 22px; overflow-y: auto; }
  .rd-foot { margin-top: auto; }
}

/* report dialog (and any dialog on this page) */
.gallery dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; }
.gallery dialog::backdrop { background: rgba(0, 0, 0, .72); }
#reportDlg { padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9); }
#reportDlg h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 20px; transform: none; color: var(--text); }
#reportDlg p.muted { margin: 0 0 4px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.rp-reasons { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.rp-reasons label { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: border-color .15s; }
.rp-reasons label:hover { border-color: var(--line2); }
.rp-reasons label:has(input:checked) { border-color: var(--orange); box-shadow: inset 0 0 0 .5px var(--orange); }
.rp-reasons input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange); }
.gallery #rpText { width: 100%; padding: 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  font: 400 14px/1.5 var(--ui); resize: vertical; outline: none; }
.gallery #rpText::placeholder { color: #8a847a; }
.gallery #rpText:focus { border-color: var(--orange); }
.gallery .row-btns { display: flex; gap: 8px; margin-top: 12px; }
.gallery .row-btns button { flex: 1; height: 46px; padding: 0 14px; border-radius: 999px; background: transparent; border: 1px solid var(--line2); color: var(--text); font-weight: 700; }
.gallery .row-btns button:hover { background: var(--panel2); }
.gallery .row-btns .primary { background: var(--orange); border-color: var(--orange); color: var(--ink); font-weight: 800; }
.gallery .row-btns .primary:hover { background: #ff8126; }
.gallery .row-btns .primary:disabled { opacity: .6; }

/* toast (a top-layer popover where supported, so it shows above open dialogs) */
.gallery .toast { position: fixed; left: 50%; translate: -50% 12px; z-index: 30; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--cream); color: var(--ink); font-weight: 700; font-size: 14px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
  opacity: 0; pointer-events: none; transition: opacity .2s, translate .2s var(--ease); }
.gallery .toast.show { opacity: 1; translate: -50% 0; }
.toast[popover] { inset: auto; margin: 0; border: 0; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); overflow: visible; }
.toast:not([popover]) { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ---------- footer ---------- */
.gallery .legal-links { margin: 56px 0 8px; padding-top: 24px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; line-height: 2.1; color: var(--muted); }
.gallery .legal-links a { margin: 0 7px; color: var(--muted); text-decoration: none; font-weight: 600; }
.gallery .legal-links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.gallery .legal-links small { display: inline-block; margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }

@media (max-width: 459px) { .g-hero { padding-top: 26px; } .g-lede { font-size: 14.5px; } }

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .g-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px 14px; }
}
@media (min-width: 700px) {
  .g-top-in { padding: 10px 24px; }
  .g-logo img { height: 50px; }
  .g-wrap { padding-left: 24px; padding-right: 24px; }
  .g-hero { padding-top: 48px; }
}
@media (min-width: 1000px) {
  .g-controls { flex-wrap: nowrap; margin-top: 34px; }
  .gallery .g-tabs { flex: 0 1 440px; }
  .gallery .g-search { flex: 0 1 320px; margin-left: auto; }
  .g-layout { grid-template-columns: minmax(0, 1fr) 290px; gap: 28px; align-items: start; }
  .g-board { grid-column: 2; grid-row: 1; position: sticky; top: 88px; padding: 18px 12px 12px; border-radius: 18px; background: var(--panel);
    border: 1px solid var(--line); box-shadow: var(--shadow); max-height: calc(100dvh - 110px); overflow-y: auto; }
  .g-board-head { margin: 0 6px 12px; }
  .g-main { grid-column: 1; grid-row: 1; }
  .g-players { flex-direction: column; margin: 0; padding: 0; overflow: visible; gap: 2px; }
  .gp-btn { width: 100%; border-color: transparent; background: transparent; padding: 7px 8px; border-radius: 12px; }
  .gp-btn:hover { background: var(--panel2); transform: none; border-color: transparent; }
  .gp-btn.on { background: var(--panel2); border-color: var(--orange); }
  .gp-who { max-width: none; flex: 1; }
  .gp-row.sk { width: 100%; border-color: transparent; background: transparent; }
  .g-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery *, .gallery *::before, .gallery *::after { animation: none !important; transition: none !important; }
}

/* ⋯ menu (report / block) and the blocked-players list */
.more-dlg .md-list { display: grid; gap: 8px; margin: 12px 0 4px; }
.more-dlg .md-list button { text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); font-weight: 700; font-size: 15px; }
.more-dlg .md-list button:disabled { color: var(--muted); }
.more-dlg #mdBlock { color: var(--coral); }
@media (hover: hover) { .more-dlg .md-list button:not(:disabled):hover { border-color: var(--line2); } }
.blocked-list { list-style: none; margin: 12px 0 4px; padding: 0; display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.blocked-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel2); }
.blocked-list b { overflow-wrap: anywhere; }
.blocked-list .g-btn { height: 36px; padding: 0 14px; font-size: 13px; }
.legal-links .linkish { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
