/*
 * Cowry League base and component styles.
 *
 * Premium dark competitive presentation on the official Dark Navy, with a
 * metallic-gold hierarchy, per the approved visual blueprint §3 and §7.
 * Mobile and desktop are one design system: the same tokens, cards, CTA
 * hierarchy and meaning at every breakpoint.
 */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(212, 175, 55, 0.10), transparent 60%),
    radial-gradient(900px 500px at 12% 108%, rgba(47, 93, 143, 0.14), transparent 60%),
    var(--cl-navy);
  color: var(--cl-text);
  font-family: var(--cl-font);
  font-size: var(--cl-step-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--cl-font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--cl-step-5); }
h2 { font-size: var(--cl-step-4); }
h3 { font-size: var(--cl-step-3); }
p  { margin: 0 0 var(--cl-space-3); }

:focus-visible {
  outline: 2px solid var(--cl-gold);
  outline-offset: 3px;
  border-radius: var(--cl-radius-sm);
}

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

.cl-skip {
  position: absolute; left: -9999px; top: var(--cl-space-2);
  background: var(--cl-gold); color: var(--cl-text-on-gold);
  padding: var(--cl-space-2) var(--cl-space-4);
  border-radius: var(--cl-radius-sm); font-weight: 600; z-index: 100;
}
.cl-skip:focus { left: var(--cl-space-4); }

/* ── Chrome ────────────────────────────────────────────────────────────── */

.cl-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--cl-space-4);
  padding: var(--cl-space-3) var(--cl-space-5);
  background: rgba(11, 13, 26, 0.86);
  backdrop-filter: blur(var(--cl-blur));
  border-bottom: 1px solid var(--cl-hairline);
}

.cl-brand {
  display: flex; align-items: center; gap: var(--cl-space-3);
  background: none; border: 0; color: inherit; cursor: pointer;
  padding: var(--cl-space-1); min-height: var(--cl-touch);
}
.cl-brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--cl-gold-gradient);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.34);
  flex: none;
}
.cl-brand-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.cl-brand-text strong { font-size: var(--cl-step-1); letter-spacing: 0.14em; }
.cl-brand-text small { font-size: 10px; color: var(--cl-text-dim); letter-spacing: 0.18em; }

.cl-nav-desktop { display: none; gap: var(--cl-space-2); margin-left: auto; }
.cl-nav-link {
  background: none; border: 0; color: var(--cl-text-muted); cursor: pointer;
  padding: var(--cl-space-2) var(--cl-space-3); border-radius: var(--cl-radius-pill);
  font-size: var(--cl-step-1); min-height: var(--cl-touch);
}
.cl-nav-link:hover { color: var(--cl-text); background: var(--cl-surface-2); }

.cl-icon-btn {
  margin-left: auto; background: var(--cl-surface-2); border: 1px solid var(--cl-hairline);
  color: var(--cl-text); border-radius: 50%;
  width: var(--cl-touch); height: var(--cl-touch); cursor: pointer; font-size: 16px;
}
.cl-nav-desktop + .cl-icon-btn { margin-left: 0; }

.cl-nav-mobile {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(11, 13, 26, 0.95);
  border-top: 1px solid var(--cl-hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.cl-nav-tab {
  background: none; border: 0; color: var(--cl-text-dim); cursor: pointer;
  padding: var(--cl-space-3) var(--cl-space-1);
  font-size: 11px; min-height: var(--cl-touch);
}
.cl-nav-tab:hover { color: var(--cl-gold); }

.cl-outlet { display: block; padding-bottom: 84px; min-height: 60vh; }
.cl-outlet:focus { outline: none; }

/* ── Page and section ──────────────────────────────────────────────────── */

.cl-page { max-width: 1180px; margin: 0 auto; padding: var(--cl-space-5) var(--cl-space-4); }
.cl-section { margin-bottom: var(--cl-space-6); }
.cl-grid-2, .cl-grid-3 { display: grid; gap: var(--cl-space-4); }

.cl-heading { margin-bottom: var(--cl-space-4); }
.cl-eyebrow {
  display: block; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cl-gold); margin-bottom: var(--cl-space-1);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.cl-card {
  background: var(--cl-glass);
  border: 1px solid var(--cl-hairline);
  border-radius: var(--cl-radius);
  padding: var(--cl-space-5);
  backdrop-filter: blur(var(--cl-blur));
  box-shadow: var(--cl-shadow);
}

.cl-metric { display: block; font-size: var(--cl-step-5); color: var(--cl-gold); margin: var(--cl-space-2) 0; }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.cl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--cl-space-2);
  min-height: var(--cl-touch); padding: 0 var(--cl-space-5);
  border-radius: var(--cl-radius-pill); border: 1px solid transparent;
  font-size: var(--cl-step-1); font-weight: 600; cursor: pointer; font-family: inherit;
}
.cl-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cl-btn-primary { background: var(--cl-gold-gradient); color: var(--cl-text-on-gold); }
.cl-btn-secondary { background: var(--cl-surface-2); color: var(--cl-text); border-color: var(--cl-hairline-strong); }
.cl-btn-ghost { background: transparent; color: var(--cl-text-muted); border-color: var(--cl-hairline); }
/*
 * The one destructive variant.
 *
 * Outlined rather than filled: a solid red button the size of the primary
 * action invites the tap it should discourage. It reads as serious without
 * competing for the eye.
 */
.cl-btn-danger {
  background: transparent;
  color: var(--cl-status-rejected);
  border-color: var(--cl-status-rejected);
}
.cl-actions { display: flex; flex-wrap: wrap; gap: var(--cl-space-3); margin-top: var(--cl-space-4); }

/* ── Rows, pills, states ───────────────────────────────────────────────── */

.cl-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--cl-space-3);
  padding: var(--cl-space-3) 0; border-bottom: 1px solid rgba(192, 197, 204, 0.09);
}
.cl-row:last-child { border-bottom: 0; }
.cl-row-label { color: var(--cl-text-muted); font-size: var(--cl-step-0); }
.cl-row-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.cl-row-hint { flex-basis: 100%; font-size: var(--cl-step-0); color: var(--cl-text-dim); }
.cl-row-emphasis .cl-row-value { font-size: var(--cl-step-3); color: var(--cl-gold); }
.cl-rule { border: 0; border-top: 1px solid var(--cl-hairline); margin: var(--cl-space-3) 0; }
.cl-note { font-size: var(--cl-step-0); color: var(--cl-text-dim); }
.cl-label { display: block; font-size: var(--cl-step-0); color: var(--cl-text-muted); margin-bottom: var(--cl-space-2); }

.cl-input {
  width: 100%; min-height: var(--cl-touch);
  padding: var(--cl-space-3) var(--cl-space-4);
  background: var(--cl-surface-1-solid); color: var(--cl-text);
  border: 1px solid var(--cl-hairline); border-radius: var(--cl-radius-sm);
  font-size: var(--cl-step-2); font-family: inherit; font-variant-numeric: tabular-nums;
}

.cl-pill {
  display: inline-flex; align-items: center; padding: 4px var(--cl-space-3);
  border-radius: var(--cl-radius-pill); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}
.cl-pill-neutral  { background: rgba(192,197,204,.14); color: var(--cl-silver); }
.cl-pill-pending  { background: rgba(201,162,39,.16);  color: var(--cl-status-pending); }
.cl-pill-clear    { background: rgba(47,169,107,.16);  color: var(--cl-status-clear); }
.cl-pill-positive { background: rgba(47,169,107,.16);  color: var(--cl-status-clear); }
.cl-pill-held     { background: rgba(217,131,36,.18);  color: var(--cl-status-held); }
.cl-pill-rejected { background: rgba(192,57,43,.18);   color: var(--cl-status-rejected); }

.cl-gated, .cl-empty, .cl-error, .cl-loading {
  display: flex; gap: var(--cl-space-3); align-items: flex-start;
  padding: var(--cl-space-4); border-radius: var(--cl-radius);
  border: 1px dashed var(--cl-hairline); background: rgba(23,27,46,.5);
}
.cl-gated p, .cl-empty p, .cl-error p { margin: var(--cl-space-1) 0 0; color: var(--cl-text-muted); font-size: var(--cl-step-0); }
.cl-empty, .cl-loading { flex-direction: column; align-items: center; text-align: center; }
.cl-error { border-style: solid; border-color: rgba(192,57,43,.4); }
.cl-loading { flex-direction: row; align-items: center; justify-content: center; color: var(--cl-text-muted); }
.cl-surface-error { padding: var(--cl-space-6); text-align: center; color: var(--cl-text-muted); }
.cl-skeleton-stack { display: grid; gap: var(--cl-space-3); }

/* ── Verification ──────────────────────────────────────────────────────── */

.cl-verify-head { display: flex; align-items: center; justify-content: space-between; gap: var(--cl-space-3); }
.cl-verify-detail { margin-top: var(--cl-space-3); color: var(--cl-text-muted); }
.cl-verify-progress { display: flex; align-items: center; gap: var(--cl-space-2); color: var(--cl-text-muted); font-size: var(--cl-step-0); }
.cl-verify-clear    { border-color: rgba(47,169,107,.4); }
.cl-verify-held     { border-color: rgba(217,131,36,.45); }
.cl-verify-rejected { border-color: rgba(192,57,43,.45); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.cl-tabs { display: flex; gap: var(--cl-space-2); overflow-x: auto; margin-bottom: var(--cl-space-4); }
.cl-tab {
  background: var(--cl-surface-2); border: 1px solid var(--cl-hairline); color: var(--cl-text-muted);
  border-radius: var(--cl-radius-pill); padding: var(--cl-space-2) var(--cl-space-4);
  min-height: var(--cl-touch); cursor: pointer; white-space: nowrap; font-family: inherit;
}
.cl-tab.is-active { background: var(--cl-gold-gradient); color: var(--cl-text-on-gold); border-color: transparent; }

.cl-ops-list { display: grid; gap: var(--cl-space-3); }
.cl-ops-row-head { display: flex; align-items: center; justify-content: space-between; gap: var(--cl-space-3); margin-bottom: var(--cl-space-2); }

/* ── Hero ──────────────────────────────────────────────────────────────── */

.cl-hero {
  position: relative; border-radius: var(--cl-radius-lg); overflow: hidden;
  padding: var(--cl-space-7) var(--cl-space-5);
  border: 1px solid var(--cl-hairline);
  background: linear-gradient(135deg, rgba(23,27,46,.96), rgba(11,13,26,.9));
  margin-bottom: var(--cl-space-6);
}
.cl-hero-copy { position: relative; z-index: 2; max-width: 620px; }
.cl-hero-title { font-size: var(--cl-step-6); display: flex; flex-direction: column; }
.cl-hero-title em { color: var(--cl-gold); font-style: normal; }
.cl-hero-lede { color: var(--cl-text-muted); font-size: var(--cl-step-2); margin-top: var(--cl-space-4); }
.cl-hero-art {
  position: absolute; inset: 0; z-index: 1; opacity: .5;
  background:
    radial-gradient(520px 320px at 82% 32%, rgba(212,175,55,.20), transparent 62%),
    radial-gradient(420px 300px at 68% 78%, rgba(47,93,143,.26), transparent 66%);
}
.cl-provider-stack { display: grid; gap: var(--cl-space-3); }
.cl-audio-controls { border: 1px solid var(--cl-hairline); border-radius: var(--cl-radius); padding: var(--cl-space-4); }
.cl-audio-row { display: flex; align-items: center; justify-content: space-between; gap: var(--cl-space-4); padding: var(--cl-space-2) 0; }
.cl-audio-row input[type="range"] { flex: 1; max-width: 200px; accent-color: var(--cl-gold); }
.cl-audio-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--cl-gold); }

/* ── Breakpoints ───────────────────────────────────────────────────────── */

@media (min-width: 768px) {
  .cl-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .cl-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .cl-page { padding: var(--cl-space-6) var(--cl-space-5); }
}

@media (min-width: 1024px) {
  .cl-nav-desktop { display: flex; }
  .cl-nav-mobile { display: none; }
  .cl-outlet { padding-bottom: var(--cl-space-6); }
  .cl-hero { padding: 96px var(--cl-space-7); }
}

/* ── Surface modifiers ─────────────────────────────────────────────────── */

/*
 * Form-led surfaces read better narrow. Auth and trade are both a short
 * column of fields and a decision, so they get a measure rather than the
 * full content width.
 */
.cl-auth,
.cl-page-trade { max-width: 640px; }

.cl-landing { max-width: none; padding-inline: 0; }
.cl-landing .cl-section { max-width: 1180px; margin-inline: auto; padding-inline: var(--cl-space-4); }

.cl-briefing { max-width: 760px; }
.cl-page-result { max-width: 820px; }
.cl-page-ops { max-width: 1100px; }

/* Panels that are replaced wholesale as state changes. */
.cl-quote-panel,
.cl-confirm-panel,
.cl-ops-panel { display: block; margin-top: var(--cl-space-4); }

.cl-quote-panel:empty,
.cl-confirm-panel:empty { margin-top: 0; }

/* The lock glyph on a gated notice. Decorative; hidden from assistive tech. */
.cl-gated-mark { font-size: var(--cl-step-3); line-height: 1; flex: none; }

/* ── Reminder bell ────────────────────────────────────────────────────── */

.cl-bell { position: relative; display: inline-flex; align-items: center; }

.cl-bell-count {
  position: absolute; top: -2px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--cl-gold); color: var(--cl-navy);
  font-size: 11px; font-weight: 700; line-height: 1; pointer-events: none;
}
.cl-bell-count[hidden] { display: none; }

.cl-bell-panel {
  position: absolute; top: calc(100% + var(--cl-space-2)); right: 0; z-index: 80;
  width: min(320px, calc(100vw - 2 * var(--cl-space-4)));
  max-height: min(60vh, 420px); overflow-y: auto;
  padding: var(--cl-space-4);
  background: var(--cl-surface-3); border: 1px solid var(--cl-hairline);
  border-radius: var(--cl-radius-lg); box-shadow: var(--cl-shadow);
}
.cl-bell-panel[hidden] { display: none; }

.cl-bell-title { font-size: var(--cl-step-0); margin: 0 0 var(--cl-space-3); }
.cl-bell-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--cl-space-3); }
.cl-bell-item { padding-bottom: var(--cl-space-3); border-bottom: 1px solid var(--cl-hairline); }
.cl-bell-item:last-child { border-bottom: 0; padding-bottom: 0; }
.cl-bell-item-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--cl-space-2); margin-bottom: var(--cl-space-1);
}

/* A dashboard reminder line, restrained to match that surface. */
.cl-reminder-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--cl-space-2); padding: var(--cl-space-2) 0;
}
.cl-reminder-line + .cl-reminder-line { border-top: 1px solid var(--cl-hairline); }

/* ── M14 final correction: handles, reminders and support intake ───── */

/*
 * A dashboard reminder group. The lines inside already carry their own rule,
 * so this only sets the block apart from the card content above it.
 */
.cl-reminders {
  margin-top: var(--cl-space-4);
  padding-top: var(--cl-space-3);
  border-top: 1px solid var(--cl-hairline);
}

/*
 * A competitor's public handle on the leaderboard.
 *
 * It takes the row's flexible column and truncates rather than wraps: a long
 * handle must not push the score out of alignment with the ranks above it.
 * Handles are length-bounded server-side, so this is a guard, not the plan.
 */
.cl-leaderboard-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--cl-text-muted);
}

/* A multi-line support description, sharing the input's frame. */
.cl-textarea {
  min-height: calc(var(--cl-touch) * 3);
  line-height: 1.5;
  resize: vertical;
  font-variant-numeric: normal;
}

/*
 * The result of a support submission: the case reference, or the refusal.
 *
 * It is a live region, so it stays in the document whether or not it has
 * anything to say. What it holds carries its own colour — a card on success,
 * an error state on refusal — so this only spaces it and collapses it when
 * empty rather than leaving a gap under the form.
 */
.cl-support-feedback { margin-top: var(--cl-space-3); font-size: var(--cl-step-0); }
.cl-support-feedback:empty { display: none; }
/* Operations challenge configuration uses the existing navy/gold controls. */
.cl-super-builder { display: grid; gap: 1rem; }
.cl-super-builder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; }
.cl-super-builder-field { display: grid; gap: .4rem; min-width: 0; }
.cl-super-builder-field .cl-input { width: 100%; box-sizing: border-box; }
.cl-ops-preview { overflow: auto; max-height: 28rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-page-super .cl-super-tournament-card { border-color: var(--cl-gold, #cba45b); }

/* PWA install coachmark + notification inbox */
.cl-install-banner {
  width: calc(100% - 2rem);
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(15, 18, 36, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  color: #f4f1e8;
  max-width: 28rem;
  margin: 1rem auto;
}
.cl-install-banner .cl-install-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.cl-bell-unread {
  outline: 1px solid rgba(120, 220, 160, 0.35);
}
.cl-bell-item-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.cl-bell-settings {
  display: grid;
  gap: 0.45rem;
  padding: 0.4rem 0 0.8rem;
}
