/* GamerSaloon Pick'em — viewer page */
:root {
  --bg: #1a1c20;
  --panel: #24272d;
  --panel-2: #2c3037;
  --rule: #373b43;
  --text: #eceef1;
  --muted: #99a0aa;
  --orange: #f26522;
  --orange-ink: #1a1c20;
  --orange-soft: rgba(242, 101, 34, .14);
  --win: #4fc47f;
  --loss: #e05a4f;
  --orange-hi: #ff7a3d;
  --gold: #ffc93c;
  --silver: #cfd8e3;
  --bronze: #e0915a;
  --live: #ff3b30;
  --radius-bug: 6px;
  --radius-chip: 999px;
  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --body: "Saira", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--body);
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(26, 28, 32, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.wordmark {
  font: 700 20px/1 var(--display); letter-spacing: .02em; color: var(--text); text-decoration: none;
}
.wordmark b { color: var(--orange); font-weight: 700; }
.wallet {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-chip);
  padding: 4px 6px 4px 12px;
}

.logo { display: flex; align-items: center; flex: none; }
.logo img { display: block; width: auto; max-width: 200px; }
@media (max-width: 420px) { .logo img { max-width: 180px; } }

.wallet-total { font: 700 20px/1 var(--display); font-variant-numeric: tabular-nums; }
.wallet-sub { color: var(--muted); font-size: 12px; line-height: 1.1; }
.coin {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #ff9a63, var(--orange) 55%, #b9440f);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
}
.rank-pill {
  font: 600 14px/1 var(--display); background: var(--orange); color: var(--orange-ink);
  border-radius: var(--radius-chip); padding: 6px 10px;
}

/* ---------- event header ---------- */
.event-head { max-width: 1120px; margin: 0 auto; padding: 22px 16px 6px; }
.event-head h1 {
  font: 700 clamp(30px, 6vw, 46px)/1 var(--display); margin: 0; letter-spacing: -.005em;
}
.event-sub { color: var(--muted); margin: 6px 0 0; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.banner {
  max-width: 1120px; margin: 14px auto 0; padding: 0 16px;
}
.banner > div {
  border: 1px solid var(--rule); border-left: 3px solid var(--orange);
  background: var(--panel); padding: 10px 14px; border-radius: 4px; color: var(--muted);
}

/* ---------- claim panel ---------- */
.claim {
  max-width: 1120px; margin: 18px auto 0; padding: 0 16px;
}
.claim-inner {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 20px;
}
.claim-amount { font: 700 54px/0.9 var(--display); color: var(--orange); font-variant-numeric: tabular-nums; }
.claim-amount small { display: block; font: 500 15px/1.2 var(--body); color: var(--text); margin-top: 4px; }
.claim p { margin: 0; color: var(--muted); max-width: 52ch; }
.btn {
  border: 0; cursor: pointer; border-radius: 6px; padding: 12px 18px;
  font: 700 18px/1 var(--display); letter-spacing: .01em;
}
.btn-primary { background: var(--orange); color: var(--orange-ink); }
.btn-primary:hover { background: #ff7638; }
.btn-primary[disabled] { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--rule); color: var(--text); }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; font-size: 13px; }
@media (max-width: 640px) {
  .claim-inner { grid-template-columns: 1fr; gap: 10px; }
  .claim-amount { font-size: 46px; }
  .claim .btn { width: 100%; }
}

/* ---------- layout ---------- */
.layout {
  max-width: 1120px; margin: 0 auto; padding: 18px 16px 80px;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .side { display: none; } .side.show { display: block; } }

.tabs { display: none; gap: 6px; margin-bottom: 14px; }
@media (max-width: 900px) { .tabs { display: flex; } }
.tab {
  background: none; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; color: var(--muted);
  font: 600 17px/1 var(--display);
}
.tab[aria-selected="true"] { background: var(--panel); color: var(--text); }

.rounds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.round-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 64px; padding: 10px 6px; cursor: pointer;
  background: var(--orange); color: var(--orange-ink); border: 0; border-radius: 10px;
  font: 700 24px/1 var(--display); letter-spacing: .01em;
  box-shadow: 0 3px 0 #b9440f;                       /* raised button edge */
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.round-btn:hover { background: var(--orange-hi); }
.round-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9440f; }
.round-btn .sub { font: 600 13px/1 var(--body); color: rgba(26, 28, 32, .78); }
.round-btn .count { background: var(--orange-ink); color: #fff; border-radius: var(--radius-chip); padding: 3px 8px; font: 700 13px/1 var(--body); }
/* selected round: white, with an orange ring and a pointer down to the matches */
.round-btn[aria-pressed="true"] {
  position: relative; background: #fff; color: var(--orange-ink);
  box-shadow: 0 0 0 3px var(--orange), 0 3px 0 3px #b9440f;
}
.round-btn[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%);
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 9px solid var(--orange);
}
.round-btn[aria-pressed="true"] .count { background: var(--orange); color: var(--orange-ink); }
.round-btn[aria-pressed="true"] .sub { color: #5b616b; }

.round-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.round-title h2 { font: 700 26px/1 var(--display); margin: 0; }
.round-title span { color: var(--muted); font-size: 13px; }

/* ---------- scorebug ---------- */
.bugs { display: grid; gap: 12px; }
.bug {
  background: var(--panel); border-radius: var(--radius-bug); overflow: hidden;
  border: 1px solid var(--rule);
}
.bug.picked { border-color: rgba(242,101,34,.55); }
.bug-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 7px 12px; background: var(--panel-2); font-size: 13px; color: var(--muted);
}
.bug-head .label { font: 600 15px/1 var(--display); color: var(--text); }
.status { font: 600 15px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.status.open { color: var(--orange); }
.status.live { color: var(--live); }
.status.final { color: var(--text); }

.side-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 56px; align-items: center; gap: 10px;
  width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; cursor: default;
  border-top: 1px solid var(--rule); position: relative;
}
.side-row:first-of-type { border-top: 0; }
button.side-row { cursor: pointer; }
button.side-row:hover { background: rgba(255,255,255,.025); }
.side-row[aria-pressed="true"] { background: var(--orange-soft); box-shadow: inset 4px 0 0 var(--orange); }
.seed {
  font: 700 15px/1 var(--display); color: var(--muted); text-align: center;
  border: 1px solid var(--rule); border-radius: 4px; padding: 5px 0;
}
.pname { font: 700 22px/1.05 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname.tbd { color: var(--muted); font-weight: 500; }
.mult { font: 600 16px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.pct { font: 700 22px/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.side-row.winner .pname::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 8px; vertical-align: 4px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 9px solid var(--orange); }
.side-row.loser .pname, .side-row.loser .pct { color: var(--muted); font-weight: 500; }
.mine-tag { font: 600 12px/1 var(--body); color: var(--orange); margin-left: 8px; vertical-align: 3px; }

/* pick-split bar, drawn like yard lines */
.split { position: relative; height: 6px; background: var(--panel-2); }
.split > i { position: absolute; inset: 0 auto 0 0; background: var(--orange); transition: width .6s ease; }
.split::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(26,28,32,.55) calc(10% - 1px) 10%);
}

.bug-foot { padding: 10px 12px 12px; border-top: 1px solid var(--rule); display: grid; gap: 10px; }
.stakes { display: grid; grid-template-columns: auto repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center; }
.stakes-label { color: var(--text); font: 600 15px/1.1 var(--display); margin-right: 2px; }
.chip {
  min-height: 46px; padding: 8px 6px; cursor: pointer; border-radius: 8px;
  background: var(--orange); color: var(--orange-ink); border: 2px solid var(--orange);
  font: 700 21px/1 var(--display); font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 0 #b9440f;
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.chip:hover { background: var(--orange-hi); border-color: var(--orange-hi); }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9440f; }
.chip[aria-pressed="true"] { background: #fff; color: var(--orange-ink); border-color: #fff; box-shadow: 0 0 0 3px var(--orange), 0 3px 0 3px #b9440f; }
.chip[disabled] { background: var(--panel-2); border-color: var(--panel-2); color: var(--muted); box-shadow: none; cursor: not-allowed; text-decoration: line-through; }
.confirm-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.confirm-row .btn { flex: none; }
.confirm-row .btn-lock { flex: 1 1 100%; min-height: 54px; font-size: 22px; border-radius: 10px;
  background: var(--orange); box-shadow: 0 0 0 2px #fff inset, 0 4px 0 #b9440f; }
.confirm-row .btn-lock:hover { background: var(--orange-hi); }
.confirm-row .btn-lock + .note { flex: 1 1 100%; text-align: center; }
.confirm-row .note { color: var(--muted); font-size: 13px; }
.pick-summary { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.pick-summary b { font: 700 17px/1 var(--display); }
.result-win { color: var(--win); font: 700 18px/1 var(--display); }
.result-loss { color: var(--loss); font: 700 18px/1 var(--display); }
.result-void { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }

.bug.just-picked { animation: lockin .7s ease; }
@keyframes lockin { 0% { box-shadow: 0 0 0 0 rgba(242,101,34,.7); } 100% { box-shadow: 0 0 0 14px rgba(242,101,34,0); } }

/* ---------- side panel: leaderboard ---------- */
.side h2 { font: 700 26px/1 var(--display); margin: 0 0 10px; }
.board { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-bug); overflow: hidden; }
.board li { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--rule); }
.board li:first-child { border-top: 0; }
.board .r { font: 700 18px/1 var(--display); color: var(--muted); text-align: center; }
.board .trophy { width: 20px; height: 20px; flex: none; margin-right: 6px; vertical-align: -3px; }
.board .n .nm { display: inline-flex; align-items: center; max-width: 100%; }
.board .n .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li.top { padding-top: 12px; padding-bottom: 12px; border-left: 4px solid var(--medal); padding-left: 8px;
  background: linear-gradient(90deg, var(--medal-bg), rgba(0,0,0,0) 85%); }
.board li.top .r { color: var(--medal); font-size: 24px; }
.board li.top .n { font-size: 21px; font-weight: 700; color: #fff; }
.board li.top .trophy { color: var(--medal); filter: drop-shadow(0 0 6px var(--medal-bg)); }
.board li.top .c { color: var(--medal); font-size: 21px; }
.board li.gold   { --medal: var(--gold);   --medal-bg: rgba(255, 201, 60, .22); }
.board li.silver { --medal: var(--silver); --medal-bg: rgba(207, 216, 227, .16); }
.board li.bronze { --medal: var(--bronze); --medal-bg: rgba(224, 145, 90, .2); }
.board .n { font: 600 18px/1.1 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .n small { display: block; font: 400 12px/1.3 var(--body); color: var(--muted); }
.board .c { font: 700 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.board li.me { background: var(--orange-soft); }
.board-foot { color: var(--muted); font-size: 13px; margin-top: 8px; }
.side .empty { background: var(--panel); border: 1px dashed var(--rule); border-radius: 6px; padding: 16px; color: var(--muted); }

.history { list-style: none; padding: 0; margin: 16px 0 0; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.history .amt { font: 700 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.history .amt.pos { color: var(--win); }
.history .when { color: var(--muted); font-size: 12px; }

/* ---------- toast + dialog ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(calc(100% + 40px));
  visibility: hidden;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 600;
  transition: transform .25s ease, visibility .25s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }
.toast.err { background: var(--loss); color: #fff; }

dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--rule); border-radius: 8px;
  max-width: 520px; width: calc(100% - 32px); padding: 22px;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { font: 700 26px/1 var(--display); margin: 0 0 12px; }
dialog ul { padding-left: 18px; margin: 0 0 16px; color: var(--muted); }
dialog li { margin-bottom: 6px; }
dialog li b { color: var(--text); font-weight: 600; }

footer.page-foot { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
