/* ===== compete.css — the Arcade's competitions hub. Brand tokens/utilities come from styles.css. =====
 * Owns only .cmp-*. Never edit styles.css or arcade.css for this block. */

.cmp { padding: 0 0 1.6rem; }
.cmp-head { text-align: center; max-width: 720px; margin: 0 auto 0.9rem; }
.cmp-h { margin-bottom: 0.35rem; }
.cmp-sub { margin: 0; color: var(--text-dim); font-size: max(var(--text-floor), 0.95rem); line-height: 1.55; }
.cmp-sub b { color: var(--text); }

/* ---------- jump chips: one per board, in-page links ---------- */
.cmp-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin: 0 0 1.1rem; }
.cmp-jump:empty { display: none; }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0.35rem 0.9rem;
  border-radius: var(--r-pill); border: 1.5px solid var(--ctl-fill); background: var(--ctl-fill);
  color: var(--ctl-ink); font-weight: 800; font-size: max(var(--text-floor), 0.86rem); text-decoration: none; line-height: 1.2;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.cmp-chip:hover { border-color: var(--green); background: var(--green-bright); color: var(--ctl-ink); transform: translateY(-2px); box-shadow: 0 6px 18px var(--glow-g); }
.cmp-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- the grid ---------- */
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 1.2rem; align-items: start; }
.cmp-loading, .cmp-empty { margin: 0; color: var(--text-dim); font-size: max(var(--text-floor), 0.9rem); line-height: 1.5; text-align: center; padding: 0.8rem 0.4rem; }
.cmp-err { grid-column: 1 / -1; }
.cmp-card { padding: 1.15rem 1.15rem 1.2rem; display: flex; flex-direction: column; gap: 0.7rem; scroll-margin-top: calc(var(--nav-h, 58px) + 1.6rem); position: relative; overflow: visible; }
.cmp-card:target { outline: 3px solid var(--green-bright); outline-offset: 4px; }
.cmp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.cmp-card-h {
  margin: 0; font-family: 'Luckiest Guy', 'Rubik', cursive; letter-spacing: 0.03em; font-size: max(var(--text-floor), 1.3rem);
  color: var(--green-bright); display: inline-flex; align-items: center; gap: 0.45rem;
}
.cmp-card-ico { font-size: max(var(--text-floor), 1.35em); line-height: 1; }
.cmp-head-tools { display: inline-flex; align-items: center; gap: 0.5rem; }
.cmp-live-pill {
  display: inline-flex; align-items: center; gap: 0.4rem; border-radius: var(--r-pill);
  padding: 0.25rem 0.65rem; font-size: max(var(--text-floor), 0.74rem); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1.5px solid color-mix(in srgb, var(--green) 50%, transparent); background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green-bright); white-space: nowrap;
}
.cmp-live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 70%, transparent); animation: cmp-pulse 1.8s ease-out infinite; }
@keyframes cmp-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 70%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- the clock + week progress ---------- */
.cmp-clock { margin: 0; font-size: max(var(--text-floor), 0.84rem); color: var(--text-dim); display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.5rem; }
.cmp-count { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 900; }
.cmp-prog { flex: 1 0 100%; height: 6px; border-radius: 999px; background: var(--ink-3); overflow: hidden; }
.cmp-prog > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--green-bright)); transition: width 0.6s ease; }
.cmp-prize { margin: 0; font-size: max(var(--text-floor), 0.86rem); line-height: 1.5; color: var(--text-dim); }
.cmp-prize b { color: var(--gold); }

/* ---------- podium: DOM order 1-2-3; visually 2-1-3 with #1 tallest ---------- */
/* flex, not a 3-column grid: with one or two entrants the steps still sit centred instead of hugging the left */
.cmp-podium { list-style: none; margin: 0.2rem 0 0; padding: 0; display: flex; justify-content: center; gap: 0.5rem; align-items: flex-end; }
.cmp-step { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; min-width: 0; flex: 1 1 0; max-width: calc((100% - 1rem) / 3); }
.cmp-step--1 { order: 2; } .cmp-step--2 { order: 1; } .cmp-step--3 { order: 3; }
.cmp-step-who { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; min-width: 0; max-width: 100%; }
.cmp-step-name { display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; min-width: 0; flex-wrap: wrap; justify-content: center; }
.cmp-ava { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--ink-3); display: grid; place-items: center; font-size: max(var(--text-floor), 1.4rem); flex-shrink: 0; border: 2px solid var(--ink-4); }
.cmp-step--1 .cmp-ava { width: 56px; height: 56px; border-color: var(--gold); box-shadow: 0 0 22px rgba(255,179,64,0.35); }
.cmp-ava--sm { width: 28px; height: 28px; font-size: max(var(--text-floor), 0.95rem); border-width: 1.5px; }
.cmp-bar {
  width: 100%; height: var(--h, 40%); min-height: 44px; border-radius: 12px 12px 4px 4px;
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2)); border: 1.5px solid var(--ink-4); border-bottom: none;
  display: grid; place-items: start center; padding-top: 0.35rem; font-size: max(var(--text-floor), 1.4rem); line-height: 1;
  transform-origin: bottom; animation: cmp-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cmp-podium { min-height: 150px; }
.cmp-step--1 .cmp-bar { background: linear-gradient(180deg, rgba(255,179,64,0.35), rgba(255,179,64,0.08)); border-color: rgba(255,179,64,0.6); }
.cmp-step--2 .cmp-bar { background: linear-gradient(180deg, rgba(200,210,230,0.28), rgba(200,210,230,0.06)); border-color: rgba(200,210,230,0.5); }
.cmp-step--3 .cmp-bar { background: linear-gradient(180deg, rgba(205,127,50,0.32), rgba(205,127,50,0.07)); border-color: rgba(205,127,50,0.55); }
.cmp-step.is-me .cmp-bar { outline: 2px solid var(--green-bright); outline-offset: 2px; }
@keyframes cmp-rise { from { transform: scaleY(0.15); opacity: 0.4; } to { transform: scaleY(1); opacity: 1; } }
.cmp-step-val { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; font-size: max(var(--text-floor), 0.9rem); text-align: center; line-height: 1.3; }
.cmp-step-val small, .cmp-val small { display: block; color: var(--text-dim); font-weight: 600; font-size: max(var(--text-floor), 0.74rem); }

/* ---------- places 4+ ---------- */
.cmp-list, .cmp-comms, .cmp-og { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.cmp-list { margin-top: 0.4rem; }
.cmp-list li, .cmp-comms li { display: flex; align-items: center; gap: 0.5rem; background: var(--ink); border-radius: 10px; padding: 0.4rem 0.6rem; min-width: 0; }
.cmp-list li.is-me, .cmp-comms li.is-me { border: 1.5px solid var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); }
.cmp-rank { min-width: 30px; text-align: center; font-weight: 900; font-size: max(var(--text-floor), 0.86rem); color: var(--text-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cmp-name { font-weight: 800; font-size: max(var(--text-floor), 0.88rem); text-decoration: none; color: var(--green-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cmp-list .cmp-name { flex: 1 1 auto; }
.cmp-name:hover { text-decoration: underline; }
.cmp-name:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.cmp-val { margin-left: auto; font-weight: 900; color: var(--gold); font-size: max(var(--text-floor), 0.86rem); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; flex-shrink: 0; }
.cmp-val b { color: var(--gold); }

/* ---------- movement since your last visit ---------- */
.cmp-move { font-size: max(var(--text-floor), 0.68rem); font-weight: 900; border-radius: var(--r-pill); padding: 0.1rem 0.4rem; line-height: 1.3; white-space: nowrap; flex-shrink: 0; }
.cmp-move--up { color: var(--on-green); background: var(--green-bright); }
.cmp-move--down { color: var(--on-red); background: var(--red); }   /* --on-red clears 4.5:1 on the brand red; white does not */
.cmp-move--new { color: var(--on-diamond); background: var(--diamond); }

/* ---------- prize chips + "you" line ---------- */
.cmp-prizechip { font-weight: 900; font-size: max(var(--text-floor), 0.72rem); color: var(--on-gold); background: linear-gradient(180deg, var(--gold), var(--gold-deep)); border-radius: var(--r-pill); padding: 0.1rem 0.45rem; white-space: nowrap; }
.cmp-me { margin: 0; font-size: max(var(--text-floor), 0.86rem); line-height: 1.55; padding: 0.6rem 0.75rem; border-radius: var(--r-2); background: var(--g-wash); border: 1px solid color-mix(in srgb, var(--green) 30%, transparent); color: var(--text); }
.cmp-me:empty { display: none; }
.cmp-me b { color: var(--green-bright); }
.cmp-me .btn { margin-left: 0.35rem; vertical-align: middle; }
.cmp-carry { display: block; margin-top: 0.35rem; color: var(--text-dim); }
.cmp-carry b { color: var(--gold); }
.cmp-last { display: block; margin: 0.45rem 0 0; font-size: max(var(--text-floor), 0.8rem); color: var(--text-dim); line-height: 1.6; }
.cmp-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; }
.cmp-actions:empty { display: none; }

/* ---------- communities ---------- */
.cmp-cava { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; background: var(--ink-3); flex-shrink: 0; }
.cmp-cava--txt { display: grid; place-items: center; font-weight: 900; font-size: max(var(--text-floor), 0.68rem); color: var(--text-dim); letter-spacing: 0.02em; }
.cmp-comm-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.cmp-comm-main small { color: var(--text-dim); font-size: max(var(--text-floor), 0.74rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-comm-main small b { color: var(--green-bright); }
.cmp-xpbar { display: block; height: 4px; border-radius: 999px; background: var(--ink-3); overflow: hidden; margin-top: 0.2rem; }
.cmp-xpbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--diamond-deep), var(--diamond)); animation: cmp-grow 0.7s ease-out both; transform-origin: left; }
@keyframes cmp-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- OG windows ---------- */
.cmp-og-row { display: grid; grid-template-columns: auto auto auto 1fr; align-items: center; gap: 0.55rem; background: var(--ink); border-radius: 10px; padding: 0.45rem 0.6rem; font-size: max(var(--text-floor), 0.86rem); }
.cmp-og-row.is-closed { border: 1.5px solid transparent; }   /* a closed window is marked by its medal, not by dimming its text under 4.5:1 */
.cmp-og-row.is-closed .cmp-og-medal { opacity: 0.5; }
.cmp-og-row.is-open { border: 1.5px solid var(--gold); background: rgba(255,179,64,0.08); }
.cmp-og-medal { font-size: max(var(--text-floor), 1.1rem); line-height: 1; }
.cmp-og-mult { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.cmp-og-state { color: var(--text-dim); text-align: right; font-size: max(var(--text-floor), 0.8rem); }
.cmp-og-state b { color: var(--green-bright); }

/* ---------- Rocket Run tiles ---------- */
.cmp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.5rem; }
.cmp-tile { background: var(--ink); border-radius: 12px; padding: 0.6rem 0.65rem; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.cmp-tile b { font-family: 'Luckiest Guy', 'Rubik', cursive; font-size: max(var(--text-floor), 1.5rem); line-height: 1; color: var(--green-bright); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.cmp-tile span { font-size: max(var(--text-floor), 0.74rem); color: var(--text-dim); line-height: 1.35; }

/* ---------- ⓘ tips: hover or focus shows, tap toggles (mobile has no hover), Esc dismisses, the tip itself can be hovered ---------- */
.cmp-card-head { position: relative; }   /* the tip's containing block: on a phone it spans the card instead of running off-screen */
.cmp-info {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--ctl-fill-lo); background: var(--ctl-fill-lo); color: var(--ctl-ink);
  font-weight: 800; font-size: max(var(--text-floor), 1.05rem); line-height: 1; display: inline-grid; place-items: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.cmp-info:hover, .cmp-info[aria-expanded="true"] { border-color: var(--green); background: var(--green); color: var(--on-green); }
.cmp-info:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.cmp-tip {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(340px, 100%);
  background: var(--ink-2); border: 1.5px solid var(--green); border-radius: 12px;
  padding: 0.65rem 0.8rem; font-size: max(var(--text-floor), 0.8rem); color: var(--text-dim); line-height: 1.5; text-align: left;
  box-shadow: 0 14px 32px rgba(0,0,0,0.55);
  opacity: 0; visibility: hidden; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.3s;   /* the 0.3s hold bridges the pointer crossing the gap */
}
.cmp-tip::before { content: ''; position: absolute; bottom: 100%; right: 12px; border: 7px solid transparent; border-bottom-color: var(--green); }
.cmp-tip::after { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 12px; }   /* invisible bridge so hover is continuous from button to tip */
.cmp-tip b { color: var(--text); }
.cmp-tip i { color: var(--text); font-style: normal; font-weight: 800; }
.cmp-card-head:has(.cmp-info:hover) .cmp-tip, .cmp-card-head:has(.cmp-info:focus-visible) .cmp-tip, .cmp-card-head:has(.cmp-tip:hover) .cmp-tip, .cmp-card-head.is-open .cmp-tip {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; transition-delay: 0s, 0s, 0s;
}
/* Esc parks a hover/focus-shown tip until the pointer or focus leaves the header; must beat the :has() rules above */
.cmp-card-head.is-dismissed .cmp-tip { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; transition-delay: 0s !important; }
@media (max-width: 480px) {
  .cmp-tip { left: 0; right: 0; width: auto; }
  .cmp-tip::before { display: none; }
}

/* ---------- the sandbox on the community race ---------- */
.cmp-sandbox { display: inline-block; margin-left: 0.4rem; font-size: max(var(--text-floor), 0.68rem); font-weight: 900; border-radius: var(--r-pill); padding: 0.1rem 0.45rem; background: rgba(159,224,255,0.12); color: var(--diamond); border: 1px solid rgba(159,224,255,0.4); vertical-align: middle; white-space: nowrap; }
.cmp-fine { margin: 0.5rem 0 0; font-size: max(var(--text-floor), 0.76rem); line-height: 1.5; color: var(--text-dim); }

/* ---------- focus + motion ---------- */
.cmp :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (max-width: 420px) {
  .cmp-card { padding: 0.95rem 0.85rem 1rem; }
  .cmp-ava { width: 38px; height: 38px; font-size: max(var(--text-floor), 1.2rem); }
  .cmp-step--1 .cmp-ava { width: 48px; height: 48px; }
  .cmp-og-row { grid-template-columns: auto 1fr auto; }
  .cmp-og-state { grid-column: 1 / -1; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .cmp-live-pill i, .cmp-bar, .cmp-xpbar > span { animation: none; }
  .cmp-chip, .cmp-info, .cmp-tip, .cmp-prog > span { transition: none; }
  .cmp-chip:hover { transform: none; }
}
/* Rocket Run card: the top of today's Rocket Riders board — a guest grey and plain, with "guest" written beside the name */
.cmp-riders { margin-top: 0.7rem; }
.cmp-riders li.is-guest { background: transparent; border: 1px solid var(--ink-4); }
.cmp-name--guest, .cmp-riders li.is-guest .cmp-rank, .cmp-riders li.is-guest .cmp-val { color: var(--text-dim); font-weight: 400; }
.cmp-guest-tag { font-size: max(var(--text-floor), 0.75rem); line-height: 1.3; padding: 0.05em 0.45em; border-radius: 999px; border: 1px solid var(--edge-ctl); color: var(--text-dim); white-space: nowrap; }
.cmp-riders-none { margin: 0.6rem 0 0; color: var(--text-dim); font-size: max(var(--text-floor), 0.85rem); }
