/* Blitz tournaments: the cards on the Contests page and a tournament's own
   page (js/blitz.js): the stages, the player's own game, the groups and the
   bracket. Colours and type are the site's (style.css). */

/* ── The Contests page: a blitz box among the contests (js/blitz-list.js) ── */
.contest-box.bz-box { border-top: 3px solid var(--accent); }
.contest-box.bz-box.ended { border-top-color: var(--border2); }
.bz-when b, .bz-tick { font-family: var(--mono); font-weight: 600; color: var(--text); }
.contest-card .bz-when { margin-left: 0.5rem; color: var(--text2); font-size: 0.9rem; }

/* ── The page head ─────────────────────────────────────────────────────── */
.bz-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.4rem; }
.bz-head h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 790; margin: 0; overflow-wrap: anywhere; }
.bz-head .bz-facts { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin-top: 0.7rem; color: var(--text2); font-size: 0.95rem; }
.bz-head .bz-facts b { color: var(--text); font-weight: 650; }
.bz-head-side { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── The stages, in order ──────────────────────────────────────────────── */
.bz-stages { display: flex; gap: 0.35rem; margin: 0 0 1.4rem; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: thin; }
.bz-stages li {
  flex: none; display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.8rem;
  border: 1px solid var(--border); border-radius: 999px; font-size: 0.88rem; color: var(--text3); background: var(--bg2); white-space: nowrap;
}
.bz-stages li.done { color: var(--text2); }
.bz-stages li.done::before { content: ''; width: 6px; height: 10px; border: solid var(--success); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -2px); }
.bz-stages li.now { border-color: var(--accent); color: var(--accent); font-weight: 650; background: var(--accent-dim); }
.bz-stages li.now::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: bz-pulse 1.6s var(--ease) infinite; }
@keyframes bz-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .bz-stages li.now::before { animation: none !important; } }

/* ── Panels ────────────────────────────────────────────────────────────── */
.bz-panel { padding: 1.3rem 1.4rem; margin-bottom: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); }
.bz-panel > h2 { font-size: 1.05rem; margin: 0 0 0.8rem; }
.bz-countdown { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.bz-countdown .bz-label { color: var(--text2); font-size: 0.95rem; margin: 0; }
.bz-big { font-family: var(--mono); font-size: clamp(2.4rem, 7vw, 3.6rem); font-weight: 650; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.bz-big.low { color: var(--error); }
.bz-sub { color: var(--text3); font-size: 0.92rem; margin: 0.35rem 0 0; }
.bz-join .btn { min-width: 10rem; }

.bz-people { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.1rem; }
.bz-person { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.22rem 0.65rem 0.22rem 0.25rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); font-size: 0.92rem; }
.bz-person.me { border-color: var(--accent); background: var(--accent-dim); font-weight: 650; }
.bz-count { font-size: 0.95rem; color: var(--text2); margin: 1.1rem 0 0; }
.bz-count b { font-size: 1.15rem; color: var(--text); }

.bz-how { margin-bottom: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); }
.bz-how summary { cursor: pointer; padding: 0.85rem 1.2rem; font-weight: 650; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.bz-how summary::-webkit-details-marker { display: none; }
.bz-how summary::after { content: '+'; font-size: 1.2rem; color: var(--text3); }
.bz-how[open] summary::after { content: '−'; }
.bz-how ol { margin: 0; padding: 0 1.2rem 1.1rem 2.6rem; display: grid; gap: 0.45rem; color: var(--text2); line-height: 1.5; }
.bz-how ol b { color: var(--text); }

/* ── The viewer's own game ─────────────────────────────────────────────── */
.bz-mine { border-color: var(--accent); border-width: 2px; }
.bz-mine .bz-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin: 0.4rem 0 1.1rem; }
.bz-mine .bz-side { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; text-align: center; min-width: 0; }
.bz-mine .bz-side .bz-name { font-weight: 700; font-size: 1.05rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-mine .bz-side small { color: var(--text3); }
.bz-mine .bz-side .bz-big { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.bz-mine .bz-side.out .bz-big { color: var(--text3); }
.bz-mine .bz-vs-mark { font-weight: 750; color: var(--text3); font-size: 0.95rem; }
.bz-mine .bz-go { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem 1rem; }
.bz-mine .bz-go .btn { min-width: 14rem; }
.bz-mine-title { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; }
.bz-mine-title h2 { margin: 0; font-size: 1.15rem; }
.bz-note { color: var(--text2); margin: 0; text-align: center; }
.bz-result-line { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.bz-result-line strong { font-size: 1.2rem; }

/* ── The champion ──────────────────────────────────────────────────────── */
.bz-champion { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; border-color: var(--gold); border-width: 2px; }
.bz-champion img { width: 76px; height: 76px; flex: none; }
.bz-champion .bz-champ-label { color: var(--text3); font-size: 0.9rem; font-weight: 650; margin: 0; }
.bz-champion .bz-champ-name { font-size: clamp(1.7rem, 4.5vw, 2.4rem); font-weight: 790; letter-spacing: -0.035em; line-height: 1.1; margin: 0.1rem 0 0.2rem; overflow-wrap: anywhere; }
.bz-champion .bz-champ-more { color: var(--text2); margin: 0; }

/* ── The groups ────────────────────────────────────────────────────────── */
.bz-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.bz-group { padding: 1rem 1.1rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); min-width: 0; }
.bz-group.mine { border-color: var(--accent); }
.bz-group h3 { font-size: 1rem; margin: 0 0 0.6rem; display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.bz-group h3 small { font-weight: 500; color: var(--text3); font-size: 0.82rem; }
.bz-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.bz-table th { text-align: right; font-weight: 600; color: var(--text3); font-size: 0.78rem; padding: 0 0.3rem 0.35rem; }
.bz-table th:nth-child(2) { text-align: left; }
.bz-table td { padding: 0.38rem 0.3rem; border-top: 1px solid var(--border); text-align: right; }
.bz-table td.bz-who { text-align: left; max-width: 0; width: 100%; }
.bz-table td.bz-who > span { display: flex; align-items: center; gap: 0.4rem; overflow: hidden; }
.bz-table td.bz-who .bz-cut { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-table td.bz-place { color: var(--text3); width: 1.6rem; text-align: left; padding-left: 0.5rem; }
.bz-table td.bz-pts { font-weight: 750; }
.bz-table tr.through td.bz-place { box-shadow: inset 3px 0 0 var(--success); color: var(--success); font-weight: 700; }
.bz-table tr.me td { background: var(--accent-dim); }
.bz-group-key { color: var(--text3); font-size: 0.82rem; margin: 0.55rem 0 0; display: flex; align-items: center; gap: 0.4rem; }
.bz-group-key::before { content: ''; width: 3px; height: 0.95rem; background: var(--success); }
.bz-games { margin-top: 0.75rem; display: grid; gap: 0.3rem; }
.bz-game { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: center; padding: 0.35rem 0.55rem; border-radius: var(--radius-sm); background: var(--bg); font-size: 0.88rem; }
.bz-game > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-game > span:last-child { text-align: right; }
.bz-game .won { font-weight: 700; color: var(--success); }
.bz-game .bz-mid { font-family: var(--mono); font-size: 0.8rem; color: var(--text3); text-align: center; white-space: nowrap; }
.bz-game.live { box-shadow: inset 0 0 0 1px var(--accent); }
.bz-group details { margin-top: 0.6rem; font-size: 0.88rem; }
.bz-group summary { cursor: pointer; color: var(--text2); }
.bz-md { color: var(--text3); font-size: 0.78rem; font-weight: 650; margin: 0.6rem 0 0.1rem; }

/* ── The bracket ───────────────────────────────────────────────────────── */
.bz-bracket-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0 0 0.6rem; }
.bz-bracket-head h2 { font-size: 1.15rem; margin: 0; }
.bz-hint { color: var(--text3); font-size: 0.86rem; margin: 0; }
/* Announce (organisers only, js/blitz.js renderAnnounce) */
.bz-ann-label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.bz-ann-row { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.4rem; }
.bz-ann-row textarea { flex: 1; min-width: 0; }
.bz-ann-item { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.35rem 0; border-top: 1px solid var(--border); }
.bz-ann-item .bz-hint { flex: none; padding-top: 0.1rem; }
.bz-ann-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; }
#bzWrap {
  position: relative; height: clamp(420px, 68vh, 860px); overflow: hidden; cursor: grab; touch-action: none;
  border: 1px solid var(--border); border-radius: var(--radius); background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--text3) 34%, transparent) 1px, transparent 1.2px); background-size: 24px 24px;
}
#bzWrap.dragging { cursor: grabbing; }
#bzWrap:fullscreen { height: 100vh; border: 0; border-radius: 0; }
#bzSvg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
/* bottom left: the site's Chat button floats on the right */
.bz-controls { position: absolute; bottom: 12px; left: 12px; display: flex; gap: 6px; }
.bz-controls button {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--bg2); color: var(--text);
  font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; font-family: var(--font);
}
.bz-controls button:hover { background: var(--bg3); }
.bz-controls button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.bz-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.3rem; margin: 0.65rem 0 1.4rem; padding: 0; list-style: none; color: var(--text3); font-size: 0.85rem; }
.bz-legend li { display: flex; align-items: center; gap: 0.4rem; }
.bz-legend i { display: inline-block; font-style: normal; }
.bz-legend .k-won { width: 18px; height: 3px; background: var(--success); }
.bz-legend .k-live { width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 3px; }
.bz-legend .k-me { width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 3px; background: var(--accent-dim); }
.bz-legend .k-t { font-family: var(--mono); color: var(--text2); }

/* inside the svg */
.bz-edge { fill: none; stroke: var(--border2); stroke-width: 2; }
.bz-edge.won { stroke: var(--success); stroke-width: 2.5; }
.bz-node > rect.box { fill: var(--bg2); stroke: var(--border2); stroke-width: 1.5; }
.bz-node.live > rect.box { stroke: var(--accent); stroke-width: 2; }
.bz-node.mine > rect.box { stroke: var(--accent); stroke-width: 3; }
.bz-node.pass > rect.box { stroke-dasharray: 4 4; }
.bz-node .rule { stroke: var(--border); }
.bz-node .bar { fill: var(--success); }
.bz-node .dot { fill: var(--bg3); stroke: var(--border2); }
.bz-node .dot.won { fill: var(--success-dim); stroke: var(--success); }
.bz-node .ini { font-size: 11px; font-weight: 700; fill: var(--text2); }
.bz-node text { font-family: var(--font); font-size: 14px; fill: var(--text); }
.bz-node text.won { font-weight: 700; }
.bz-node text.lost { fill: var(--text3); }
.bz-node text.wait { fill: var(--text3); font-style: italic; font-size: 13px; }
.bz-node text.me { fill: var(--accent); }
.bz-node text.note { font-family: var(--mono); fill: var(--text3); font-size: 12.5px; }
.bz-node text.note.won { fill: var(--success); font-weight: 600; }
.bz-node text.clock { font-family: var(--mono); fill: var(--accent); font-weight: 650; font-size: 13px; }
.bz-node text.clock.low { fill: var(--error); }
.bz-round { font-family: var(--font); font-size: 14px; font-weight: 700; fill: var(--text3); }
.bz-champ > rect { fill: var(--bg2); stroke: var(--gold); stroke-width: 2.5; }
.bz-champ text { font-family: var(--font); font-size: 18px; font-weight: 790; fill: var(--text); }
.bz-champ text.lbl { font-size: 12px; font-weight: 650; fill: var(--text3); }

/* ── Live screens (js/blitz-screen.js) ─────────────────────────────────── */
.bz-lock { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); }
.bz-lock-box { max-width: 30rem; padding: 1.6rem 1.7rem; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--bg2); box-shadow: var(--shadow); }
.bz-lock-box h2 { margin: 0 0 0.6rem; font-size: 1.35rem; }
.bz-lock-box p { margin: 0 0 0.8rem; color: var(--text2); line-height: 1.5; }
.bz-lock-error { color: var(--error) !important; margin: 0.8rem 0 0 !important; }
.bz-problem { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: var(--bg); }
.bz-problem-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.5rem 16px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.bz-problem iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.bz-screens-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; margin-bottom: 0.8rem; }
.bz-screens-head h2 { font-size: 1.05rem; margin: 0; }
.bz-screen-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 0.5rem; }
.bz-screen-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem 0.4rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); min-width: 0; }
.bz-screen-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-share-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--border2); }
.bz-share-dot.on { background: var(--success); }
.bz-watch { position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 16px; background: rgba(20, 12, 8, 0.6); }
.bz-watch-box { width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; border: 1px solid var(--border2); border-radius: var(--radius); background: var(--bg2); box-shadow: var(--shadow); overflow: hidden; }
.bz-watch-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.bz-watch-head strong { font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-watch-head .modal-close { margin-left: auto; }
.bz-watch-state { font-size: 0.85rem; font-weight: 650; color: var(--text3); display: inline-flex; align-items: center; gap: 0.35rem; }
.bz-watch-state.on { color: var(--success); }
.bz-watch-state.on::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bz-watch-state.off { color: var(--error); }
.bz-watch-screen { flex: 1; min-height: 240px; display: grid; place-items: center; background: #111; overflow: auto; }
.bz-watch-screen img { max-width: 100%; max-height: calc(100vh - 140px); display: block; }
.bz-watch-screen p { color: #bbb; }
.bz-rec-bar { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); }
.bz-rec-bar input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent, currentColor); }
.bz-rec-time { font-size: 0.85rem; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bz-watch-box:has(.bz-rec-bar) .bz-watch-screen img { max-height: calc(100vh - 190px); }

@media (max-width: 600px) {
  .bz-panel { padding: 1rem; }
  .bz-mine .bz-vs { gap: 0.5rem; }
  .bz-mine .bz-go .btn { min-width: 0; width: 100%; }
  .bz-join .btn { width: 100%; }
  #bzWrap { height: 62vh; }
}
.bz-table td.bz-who .bz-dq { color: var(--error); font-size: 0.7rem; white-space: nowrap; }
