/* Ops look for the challenge page, scoreboard and leaderboard.
   Loaded AFTER each page's own css; theme tokens only (no hex), works in every theme. */

.challenge-detail-shell, .sbx, .lbx {
  --ox-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --ox-edge: color-mix(in srgb, var(--primary) 32%, var(--line));
  --ox-card: color-mix(in srgb, var(--card-bg, var(--surface)) 92%, var(--bg, #000));
  --ox-glow: color-mix(in srgb, var(--primary) 20%, transparent);
}

/* corner brackets, same signature as the dashboard panels */
.ch-cols .panel, .sbx-board, .lbx-panel, .sbx-you { position: relative; }
.ch-cols .panel::before, .ch-cols .panel::after,
.sbx-board::before, .sbx-board::after,
.lbx-panel::before, .lbx-panel::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 0 solid var(--ox-edge);
  transition: border-color 0.2s, width 0.2s, height 0.2s;
}
.ch-cols .panel::before, .sbx-board::before, .lbx-panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 14px; }
.ch-cols .panel::after, .sbx-board::after, .lbx-panel::after { right: 0; bottom: -1px; border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 14px; }
.ch-cols .panel:hover::before, .ch-cols .panel:hover::after,
.sbx-board:hover::before, .sbx-board:hover::after,
.lbx-panel:hover::before, .lbx-panel:hover::after { border-color: var(--primary); width: 22px; height: 22px; }
.ch-cols > div > .panel, .ch-cols > aside > .panel { border-radius: 14px; box-shadow: none; background: var(--ox-card); }
.ch-cols .panel h2 { font-family: var(--ox-mono); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-soft); }
.ch-cols .panel h2::before { content: "// "; color: var(--primary); }
.ch-cols .panel h2 i { display: none; }

/* ============================ CHALLENGE PAGE ============================ */
.challenge-detail-shell .ch-hero { padding: clamp(1rem, 2.2vw, 1.4rem); border-radius: 16px; gap: 1rem; align-items: center; }
@media (min-width: 1001px) { .challenge-detail-shell .ch-hero { grid-template-columns: minmax(0, 1fr) 290px; } }
.challenge-detail-shell .ch-hero::before { height: 2px; }
.challenge-detail-shell .ch-hero-icon { width: 60px; height: 60px; font-size: 1.6rem; border-radius: 12px; }
.challenge-detail-shell .ch-hero h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
.challenge-detail-shell .ch-kicker { display: none; }  /* the chips below say the same thing */
.challenge-detail-shell .ch-hero-copy { gap: 0.55rem; }
.challenge-detail-shell .ch-chip { border-radius: 6px; font-family: var(--ox-mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; }
.challenge-detail-shell .ch-hero-bottom { padding-top: 0; }
.challenge-detail-shell .ch-readout { border-radius: 12px; gap: 0.55rem; padding: 0.75rem; }
.challenge-detail-shell .ch-readout-label { font-family: var(--ox-mono); font-weight: 600; letter-spacing: 0.12em; }
.challenge-detail-shell .ch-readout-label::before { content: "// "; color: var(--primary); }
.challenge-detail-shell .ch-readout-grid div { border-radius: 8px; padding: 0.45rem 0.55rem; }
.challenge-detail-shell .ch-readout-grid strong { font-family: var(--ox-mono); font-weight: 600; }
.challenge-detail-shell .ch-readout-actions .btn { min-height: 2.2rem; }

/* the flag box is the main action: dock it at the top of the right column */
.ch-cols .ch-col-side { position: static; }
.ch-cols .ch-flag-card {
  border-color: var(--ox-edge);
  background: radial-gradient(90% 120% at 0% 0%, var(--ox-glow), transparent 65%), var(--ox-card);
  box-shadow: 0 18px 40px -26px var(--ox-glow);
}
.ch-cols .ch-flag-card input[name="flag"], .ch-cols .ch-flag-card input[type="text"] { font-family: var(--ox-mono); border-color: var(--ox-edge); border-radius: 10px; }
.ch-cols .ch-flag-card input[name="flag"]:focus, .ch-cols .ch-flag-card input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ox-glow); outline: none; }
@media (min-width: 1001px) {
  .challenge-detail-shell .ch-readout-actions a[href="#ch-flag"] { display: none; }
}
@media (min-width: 1001px) and (min-height: 680px) {
  .ch-cols .ch-col-side .ch-flag-card { position: sticky; top: 84px; z-index: 3; max-height: calc(100vh - 110px); overflow-y: auto; }
}
@media (max-width: 1000px) {
  .ch-cols .ch-flag-card { position: static; }
}
@media (max-width: 700px) {
  .challenge-detail-shell .ch-readout-actions { display: none; }
}

/* hints: compact rows instead of tall boxes */
.ch-hints-list { display: grid; gap: 0.5rem; }
.ch-hint { display: grid; gap: 0.45rem; padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--bg, #000) 28%, transparent); }
.ch-hint.is-open { border-color: var(--ox-edge); }
.ch-hint-head { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.ch-hint-head > i { color: var(--primary); }
.ch-hint-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.ch-hint-cost { font-family: var(--ox-mono); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.15rem 0.45rem; border-radius: 6px; white-space: nowrap;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.ch-hint-cost.free { color: var(--success-fg, var(--primary)); background: color-mix(in srgb, var(--success-fg, var(--primary)) 12%, transparent); border-color: color-mix(in srgb, var(--success-fg, var(--primary)) 30%, transparent); }
.ch-hint-lock { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-size: 0.8rem; color: var(--text-soft); }
.ch-hint-lock form { margin: 0; }
.ch-hint-lock button { padding: 0.3rem 0.75rem; font-size: 0.78rem; min-height: 0; }
.ch-hint pre { margin: 0; padding: 0.6rem 0.75rem; border-radius: 8px; background: color-mix(in srgb, var(--bg, #000) 55%, transparent); font-family: var(--ox-mono); font-size: 0.82rem; white-space: pre-wrap; }

/* ============================ SCOREBOARD ============================ */
.sbx-hero, .lbx-hero { border-radius: 16px; padding: clamp(1rem, 2.4vw, 1.5rem); }
.sbx-hero::before, .lbx-hero::before { height: 2px; }
.sbx-hero h1, .lbx-hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.sbx-eyebrow, .sbx-kicker, .lbx-kicker { font-family: var(--ox-mono); font-weight: 600; letter-spacing: 0.12em; }
.sbx-stats dd, .lbx-stats dd, .sbx-stats strong, .lbx-stats strong { font-family: var(--ox-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.sbx-stats dt, .lbx-stats dt { font-family: var(--ox-mono); font-size: 0.64rem; letter-spacing: 0.08em; }
.sbx-you { border-radius: 12px; }
.sbx-place { border-radius: 14px; }
.sbx-board, .lbx-panel { border-radius: 14px; }

/* the table reads like a terminal listing */
.sbx-cols, .lbx-table thead th { font-family: var(--ox-mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; }
.leaderboard-row { border-radius: 10px; transition: background 0.15s, box-shadow 0.15s; }
.leaderboard-row:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.leaderboard-rank, .leaderboard-score, .leaderboard-stat, .leaderboard-score small { font-family: var(--ox-mono); font-variant-numeric: tabular-nums; }
.leaderboard-rank { font-weight: 600; }
.leaderboard-score { font-weight: 600; letter-spacing: -0.01em; }
.leaderboard-bar { height: 4px; }
.leaderboard-row.is-current { box-shadow: inset 3px 0 0 var(--primary), 0 0 0 1px var(--ox-edge); }
.leaderboard-you { font-family: var(--ox-mono); letter-spacing: 0.08em; }
.lbx-table td, .lbx-rank, .lbx-table .num { font-variant-numeric: tabular-nums; }
.lbx-table td:last-child, .lbx-table td:nth-child(3), .lbx-table td:nth-child(4), .lbx-table td:nth-child(5) { font-family: var(--ox-mono); }
.lbx-table tbody tr { transition: background 0.15s; }
.lbx-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
