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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 18% -10%, rgba(28, 74, 56, 0.48), transparent 60%),
    radial-gradient(900px 540px at 90% 10%, rgba(165, 128, 66, 0.14), transparent 55%),
    var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
}

h2 {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0;
}

a {
  color: var(--gold-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.subtitle {
  color: var(--ink-secondary);
  margin-top: 0.25rem;
  font-size: 0.94rem;
}

.eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.hidden {
  display: none !important;
}

.text-win {
  color: var(--emerald-bright);
}

.text-loss {
  color: var(--crimson-bright);
}

.text-gold {
  color: var(--gold-bright);
}

/* Shells */
.shell {
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.shell--narrow {
  max-width: 560px;
}

.shell--medium {
  max-width: 780px;
}

.shell--wide {
  max-width: 1080px;
}

/* Brand Header */
.brand-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0.2rem;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: linear-gradient(145deg, #e5c484, #a98240);
  color: #121713;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.brand-mark--sm {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 1rem;
}

/* Panels */
.panel {
  background: linear-gradient(180deg, rgba(23, 46, 37, 0.94), rgba(14, 29, 23, 0.98));
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel--compact {
  padding: 1rem 1.15rem;
  gap: 0.75rem;
}

.panel--centre {
  text-align: center;
  align-items: center;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Stack & Fields */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.field__label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 520px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.input,
select {
  width: 100%;
  background: var(--bg-input);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.68rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.input:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  background: #0d1c16;
}

.input--code {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  font-size: 1.05rem;
}

.input--short {
  max-width: 140px;
}

.currency-input {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  transition: border-color 0.15s ease;
}

.currency-input:focus-within {
  border-color: var(--gold);
}

.currency-input__prefix {
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 0.35rem;
}

.currency-input input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink-primary);
  padding: 0.68rem 0;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 600;
}

.currency-input input:focus {
  outline: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.68rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #131915;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f2d59d, #dfb975);
}

.btn--secondary {
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-secondary);
  border-color: var(--border-hairline);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-primary);
}

.btn--danger {
  background: linear-gradient(180deg, var(--crimson-bright), var(--crimson));
  color: #fff7f5;
}

.btn--sm {
  padding: 0.45rem 0.78rem;
  font-size: 0.82rem;
}

.btn--lg {
  padding: 0.85rem 1.3rem;
  font-size: 1rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.btn-row--centre {
  justify-content: center;
}

.link-subtle {
  background: none;
  border: none;
  padding: 0;
  color: var(--gold-bright);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

/* Chips & Badges */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  background: var(--bg-input);
  color: var(--ink-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  padding: 0.38rem 0.78rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover:not(:disabled) {
  border-color: var(--border-gold);
  color: var(--ink-primary);
}

.chip--active {
  background: var(--gold-tint);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-badge--open {
  background: var(--emerald-tint);
  color: var(--emerald-bright);
}

.status-badge--locked {
  background: var(--amber-tint);
  color: #f6ba63;
}

.status-badge--live {
  background: var(--crimson-tint);
  color: var(--crimson-bright);
}

.status-badge--settled {
  background: var(--gold-tint);
  color: var(--gold-bright);
}

.clock-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  padding: 0.24rem 0.65rem;
  font-size: 0.8rem;
  color: var(--ink-primary);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.48rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-secondary);
}

.tag--gold {
  background: var(--gold-tint);
  color: var(--gold-bright);
}

.tag--danger {
  background: var(--crimson-tint);
  color: var(--crimson-bright);
}

/* Avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hairline);
}

.avatar svg,
.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar--xs {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.avatar--sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.avatar--md {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.avatar--lg {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

/* Lane Silk Badges */
.lane-silk {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.lane-silk--sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 0.85rem;
}

/* Leaderboards & Tickets */
.leaderboard-list,
.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(8, 18, 14, 0.62);
  border: 1px solid var(--border-hairline);
}

.lb-row--me {
  border-color: var(--border-gold);
  background: rgba(216, 178, 110, 0.08);
}

.lb-row--champ {
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(216, 178, 110, 0.18), rgba(14, 29, 23, 0.8));
}

.lb-rank {
  width: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
}

.lb-name {
  flex: 1;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-align: left;
}

.lb-amounts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.62rem 0.82rem;
  border-radius: var(--radius-sm);
  background: rgba(8, 18, 14, 0.62);
  border: 1px solid var(--border-hairline);
}

.ticket-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ticket-row--won {
  border-color: rgba(44, 163, 107, 0.45);
}

.ticket-row--refunded {
  border-color: var(--border-gold);
}

.refund-notice {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--gold-tint);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  font-size: 0.9rem;
}

.foot-note {
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 1rem;
  top: 4.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(340px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  background: rgba(16, 34, 27, 0.96);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lift);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-color: rgba(63, 196, 133, 0.55);
}

.toast--error {
  border-color: rgba(240, 101, 88, 0.6);
}

.toast--warning {
  border-color: rgba(223, 154, 56, 0.6);
}

/* Shared Challenge & Highlight Reel Components */
.vs-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--gold-tint);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.highlight-reel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  background: rgba(8, 18, 14, 0.72);
  border: 1px solid var(--border-gold);
}

.highlight-reel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.highlight-reel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

@media (max-width: 560px) {
  .highlight-reel__grid {
    grid-template-columns: 1fr;
  }
}

.hl-card {
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(21, 43, 34, 0.94), rgba(12, 26, 20, 0.98));
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hl-card--winner {
  border-color: rgba(63, 196, 133, 0.45);
}

.hl-card--loser {
  border-color: rgba(240, 101, 88, 0.45);
}

.hl-card--challenges {
  grid-column: 1 / -1;
  border-color: var(--border-gold);
}

.hl-person {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hl-person__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.hl-person__meta strong {
  font-size: 1.05rem;
}

.hl-big-num {
  font-size: 1.18rem;
  font-weight: 700;
}

.hl-challenge-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hl-challenge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(8, 18, 14, 0.7);
  border: 1px solid var(--border-hairline);
}

.hl-challenge-fighters {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.hl-fighter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hl-fighter > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.hl-fighter small {
  font-size: 0.7rem;
}

.hl-challenge-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.hl-challenge-title {
  font-weight: 700;
  color: var(--ink-primary);
}
