/* ZIGGURAT — shared component library. Load after rawdm-tokens.css.
   Nested solid platforms; bevel reserved for pressables.
   Surface edges: hairline edges and solid wells — flat, sharp, no glass.
   Pressable controls only: classic hi/lo bevel that flips on :active.
   Signals: RAWDM red (CTAs / self), live green, champion gold. */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--g0);
  color: var(--prose);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
}

::selection { background: var(--red); color: #fff; }

:focus-visible { outline: 2px solid var(--red-hot); outline-offset: 1px; }

h1, h2, h3 { color: var(--signal); }
a { color: var(--red-hot); }
.muted { color: var(--ui); }

/* ============ PAGE FRAME ============ */
body { display: flex; flex-direction: column; }
main { flex: 1 0 auto; min-width: 0; }
main.page { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 60px; }

/* ============ SITE STRIP — the one nav, bottom of every page ============ */
.strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 9px 18px;
  border-top: 1px solid var(--edge);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--meta);
}
.strip-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .04em;
  color: var(--signal);
  text-decoration: none;
}
.strip-brand span { color: var(--red-hot); }
.strip-links {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}
.strip-links a {
  color: var(--ui);
  text-decoration: none;
  font-weight: 700;
}
.strip-links a:hover { color: var(--red-hot); }
.strip-links form { margin: 0; }
.strip-links .nav-logout button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ui);
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.strip-links .nav-logout button:hover { color: var(--red-hot); }
/* The online well is ziggurat's; the strip just tightens it. */
.strip .online { padding: 4px 10px; }
.strip .online small { font-size: 8px; }
.strip .online b { font-size: 14px; }

@media (max-width: 760px) {
  .strip { flex-wrap: wrap; gap: 14px; }
  .strip-links { margin-left: 0; flex-wrap: wrap; gap: 14px; }
}

/* Login buttons: one primary (Steam), the rest quieter. */
.login-btn.steam {
  background: var(--red-face);
  color: #ffe9e6;
  border-color: var(--red-hi) var(--red-lo) var(--red-lo) var(--red-hi);
}
.login-btn.steam:hover { background: var(--red-face-hot); color: #fff; }
.login-btn.steam:active { border-color: var(--red-lo) var(--red-hi) var(--red-hi) var(--red-lo); }
.login-btn.twitch {
  background: var(--twitch-face);
  color: #f3e8ff;
  border-color: var(--twitch-hi) var(--twitch-lo) var(--twitch-lo) var(--twitch-hi);
}
.login-btn.twitch:hover { background: var(--twitch-face-hot); color: #fff; }
.login-btn.twitch:active { border-color: var(--twitch-lo) var(--twitch-hi) var(--twitch-hi) var(--twitch-lo); }
.login-btn.guest {
  background: var(--g3);
  color: var(--prose);
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
}
.login-btn.guest:hover { background: var(--g2); color: #fff; }
.login-btn.guest:active { border-color: var(--lo) var(--hi) var(--hi) var(--lo); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Online counter: an inset well. */
.online {
  min-width: 132px;
  padding: 6px 12px;
  background: var(--g1);
  border: var(--line-well);
}
.online small {
  display: block;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--meta);
}
.online b {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--live);
}
.online.zero b, .online b[data-zero="1"] { color: var(--meta); }

/* ============ TYPE UTILITIES ============ */
/* The one tiny-uppercase label. Use sparingly — three per viewport max. */
.zg-label,
.kicker {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ui);
}
.kicker.live { color: var(--live); }

/* ============ PANELS / HEROES ============ */
/* Panel: a solid raised face. The default content container. */
.panel {
  padding: 18px 20px;
  margin-bottom: 18px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
}
.panel h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 10px;
}

/* ============ BUTTONS (bevel lives here) ============ */
/* Classic beveled buttons. :active flips the bevel + nudges 1px. */
.queue-btn,
.match-action,
.zg-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  background: var(--g5);
  color: var(--signal);
  border: var(--bv) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  padding: 11px 18px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
.queue-btn:hover,
.match-action:hover,
.zg-btn:hover { background: var(--g5-hot); color: #fff; }
.queue-btn:active,
.match-action:active,
.zg-btn:active {
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  transform: translate(1px, 1px);
}
.queue-btn.small { padding: 6px 10px; font-size: 11px; }
.queue-btn.disabled,
.queue-btn:disabled,
.match-action:disabled {
  opacity: .45;
  cursor: default;
  transform: none;
}
.queue-btn.disabled:active {
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  transform: none;
}

/* Red signal variant — the primary CTAs (REGISTER, ENTER ARENA). */
.cup-join,
.match-action {
  background: var(--red-face);
  color: #ffe9e6;
  border-color: var(--red-hi) var(--red-lo) var(--red-lo) var(--red-hi);
}
.cup-join:hover,
.match-action:hover { background: var(--red-face-hot); color: #fff; }
.cup-join:active,
.match-action:active {
  border-color: var(--red-lo) var(--red-hi) var(--red-hi) var(--red-lo);
  transform: translate(1px, 1px);
}

/* ============ TOAST — the one toast, every page ============ */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: 360px;
  padding: 12px 16px;
  background: var(--g2);
  border: var(--bv-sm) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  color: var(--signal);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: .2s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ============ STATUS DOTS ============ */
/* Square status dots. live = green, warn = amber. */
.zg-dot,
.cup-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--live);
}
.zg-dot.warn { background: var(--warn); }
.cup-live-dot { width: 7px; height: 7px; animation: zgBlink 1.2s steps(2, jump-none) infinite; }
@keyframes zgBlink { 50% { opacity: .25; } }

/* ============ ENTRANT / CHAMPION CHIPS ============ */
.cup-entrant {
  display: inline-block;
  background: var(--g4);
  color: var(--prose);
  border: var(--line-flat);
  border-color: var(--edge-hot);
  padding: 5px 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .04em;
}
.cup-entrant.empty {
  background: transparent;
  border: var(--line-well);
  color: var(--ui);
  padding: 6px 11px;
}

/* ============ CHAMPION BANNER ============ */
.cup-champ {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
}
.cup-champ-crown { font-size: 26px; line-height: 1; }
.cup-champ b {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .04em;
  color: var(--gold-hot);
}
.cup-champ small {
  display: block;
  margin-top: 3px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ui);
}
.cup-champ small a { color: var(--gold); text-decoration: none; }
.cup-champ small a:hover { color: var(--gold-hot); text-decoration: underline; }

/* ============ CHAMPIONS STRIP ============ */
/* Inset track holding a row of pressable gold chips. */
.cup-champions-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 9px 10px;
  background: var(--g1);
  border: var(--line-well);
}
.cup-strip-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--meta);
  margin-right: 4px;
}
.cup-strip-entry {
  display: inline-block;
  background: var(--g4);
  color: var(--gold);
  border: var(--bv-sm) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  padding: 4px 9px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .03em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.cup-strip-entry small {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ui);
}
.cup-strip-entry:hover { background: var(--g5); color: var(--gold-hot); }
.cup-strip-entry:active {
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  transform: translate(1px, 1px);
}
.cup-strip-all {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--red-hot);
  text-decoration: none;
  margin-left: auto;
}
.cup-strip-all:hover { color: #fff; }

/* ============ THE BRACKET ============ */
/* Inset well; each match is a higher solid face sitting inside it. */
.cup-bracket {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  padding: 14px;
  overflow-x: auto;
  background: var(--g1);
  border: var(--line-well);
}
.cup-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 12px;
  min-width: 205px;
  flex: 1;
}
.cup-round-name {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--meta);
  text-align: center;
  padding: 2px 0;
}
.cup-match {
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
}
.cup-match.done { background: var(--g2); }
.cup-match.done .cup-side-name { color: var(--ui); }
/* Live duel: green square dot (in the tag) + a green edge. */
.cup-match.live { outline: 1px solid var(--live-dim); outline-offset: 1px; }
/* The viewer's own pending duel: red signal treatment. */
.cup-match.live.mine,
.cup-match.mine { outline: 2px solid var(--red); outline-offset: 1px; }

.cup-live-tag {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 10px 2px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--live);
}
.cup-watch-link {
  margin-left: 6px;
  padding: 2px 7px;
  background: var(--g5);
  border: var(--bv-sm) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  color: var(--live);
  text-decoration: none;
  letter-spacing: .14em;
  cursor: pointer;
  font: inherit;
}
.cup-watch-link:hover { background: var(--g5-hot); color: #9ce8ae; }
.cup-watch-link:active {
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  transform: translate(1px, 1px);
}
.cup-watch-popout {
  margin-left: 2px;
  color: var(--meta);
  text-decoration: none;
  font-size: 12px;
  padding: 0 4px;
}
.cup-watch-popout:hover { color: var(--live); }

/* Reddit-style inline spectate expand (iframe lives in .cup-spectate-mount). */
.cup-match.spectate-open {
  outline: 1px solid var(--live);
  outline-offset: 1px;
}
.cup-spectate-frame {
  margin: 0;
  border-top: var(--line-soft);
  background: var(--g1);
}
.cup-spectate-frame[hidden] { display: none !important; }
.cup-spectate-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--live);
}
.cup-spectate-toolbar span { margin-right: auto; }
.cup-spectate-toolbar button {
  cursor: pointer;
  background: var(--g5);
  border: var(--bv-sm) solid;
  border-color: var(--hi) var(--lo) var(--lo) var(--hi);
  color: var(--prose);
  font: inherit;
  letter-spacing: .12em;
  padding: 3px 8px;
}
.cup-spectate-toolbar button:hover { color: #fff; background: var(--g5-hot); }
.cup-spectate-toolbar button:active {
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  transform: translate(1px, 1px);
}
.cup-spectate-mount {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.cup-spectate-mount iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.cup-spectate-frame:fullscreen,
.cup-spectate-frame:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
}
.cup-spectate-frame:fullscreen .cup-spectate-mount,
.cup-spectate-frame:-webkit-full-screen .cup-spectate-mount {
  aspect-ratio: auto;
  height: calc(100% - 36px);
}

/* Next-cup queue under a Live bracket. */
.cup-next {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--g2);
  border: var(--line-flat);
}
.cup-next-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.cup-next-head h3 {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: .04em;
}
.cup-next-count {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--meta);
  white-space: nowrap;
}

.cup-side {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .01em;
  color: var(--prose);
}
.cup-side + .cup-side { border-top: 1px solid var(--g1); }
.cup-side.won { background: rgba(95, 208, 122, 0.08); color: #9ce8ae; }
.cup-side.won .cup-side-score { color: var(--live); }
.cup-side.lost { color: var(--ui); }
.cup-side-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.cup-side-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--red-hot);
  min-width: 30px;
  text-align: right;
}

/* Permalink footer strip of each match card. */
.cup-slot-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 5px;
  border-top: 1px solid var(--g1);
}
.cup-slot-anchor {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--meta);
  text-decoration: none;
}
.cup-slot-anchor:hover { color: var(--red-hot); }
.cup-replay-link {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ui);
  text-decoration: none;
}
.cup-replay-link:hover { color: var(--red-hot); }

/* Square scrollbars for inset wells (bracket overflow). */
.cup-bracket::-webkit-scrollbar { height: 14px; }
.cup-bracket::-webkit-scrollbar-track { background: var(--g0); }
.cup-bracket::-webkit-scrollbar-thumb {
  background: var(--g4);
  border: 2px solid var(--g2);
}

/* ============ THE CUP PANEL — the centerpiece platform ============ */
.cup-panel {
  margin: 6px 0 24px;
  padding: 20px 22px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
}
.cup-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.cup-kicker {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ui);
}
.cup-kicker.live { color: var(--live); }
.cup-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1;
  letter-spacing: .03em;
  margin: 6px 0 8px;
  text-transform: uppercase;
}
.cup-title-link { color: var(--signal); text-decoration: none; }
.cup-title-link:hover { color: var(--red-hot); }
.cup-sub {
  font-family: var(--font-ui);
  color: var(--prose);
  margin: 0;
  max-width: 620px;
}

/* Countdown clock: inset well, big monospace digits. */
.cup-clock {
  min-width: 180px;
  padding: 10px 16px 12px;
  text-align: right;
  background: var(--g1);
  border: var(--line-well);
}
.cup-clock small {
  display: block;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--meta);
}
.cup-clock b {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 42px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--red-hot);
}
.cup-clock span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  color: var(--ui);
}

/* Entrants: an inset tray of solid chips. */
.cup-entrants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
  padding: 10px;
  background: var(--g1);
  border: var(--line-well);
}

.cup-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.cup-actions .queue-btn { min-width: 240px; padding: 13px 20px; }
.cup-registered {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--live);
}

/* "Your match is ready": a higher solid face shouting in green. */
.cup-ready-card {
  margin: 18px 0 4px;
  padding: 16px 18px;
  background: var(--g3);
  border: var(--line-flat);
  border-color: var(--edge-hot);
  outline: 2px solid var(--live-dim);
  outline-offset: 2px;
}
.cup-ready-card b {
  display: block;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--live);
}
.cup-ready-vs {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--signal);
  margin: 8px 0 2px;
}
.cup-ready-card small {
  display: block;
  margin-top: 8px;
  font-family: var(--font-ui);
  color: var(--ui);
}
.cup-ready-card .cup-actions { margin-top: 12px; }

.cup-viewer-note {
  margin: 14px 0 2px;
  padding: 8px 12px;
  border-left: 4px solid var(--red);
  background: var(--g1);
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--prose);
}

/* ============ PRIVATE GAME FRAGMENT (#privateSlot) ============ */
#privateSlot { min-width: min(340px, 100%); }
#privateSlot > form > .queue-btn,
#privateSlot .queue-btn { min-width: 250px; }
.private-link { font-family: var(--font-ui); }
.private-link input {
  width: 100%;
  padding: 10px;
  background: var(--g0);
  color: var(--live);
  border: var(--line-well);
  font-family: var(--font-mono);
  font-size: 12px;
}
.private-link-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.private-link-actions .queue-btn {
  min-width: 0;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .cup-bracket { flex-direction: column; }
  .cup-round { min-width: 0; }
  .cup-side-name { max-width: none; }
}
