/* style-overrides.css — cross-cutting overrides (light-theme bridging, modal bridging, responsive, animations, sharp edges).
   Split out of style.css; loaded right after it, in this order: style.css, style-areas.css,
   style-overrides.css. The order is the cascade, so keep the three links together. */

/* ---------------- LIGHT MODE BRIDGING FOR TAILWIND UTILITIES ------------------------ */
html[data-theme="light"] .bg-slate-950,
html[data-theme="light"] .bg-slate-900,
html[data-theme="light"] .bg-slate-900\/95,
html[data-theme="light"] .bg-slate-900\/80,
html[data-theme="light"] .bg-slate-900\/60,
html[data-theme="light"] .bg-slate-900\/40,
html[data-theme="light"] .bg-slate-800 {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="light"] .bg-slate-800\/80,
html[data-theme="light"] .bg-slate-800\/60,
html[data-theme="light"] .bg-slate-800\/40,
html[data-theme="light"] .bg-slate-700,
html[data-theme="light"] .bg-slate-700\/60,
html[data-theme="light"] .bg-slate-700\/40 {
  background-color: var(--bg-card) !important;
}

html[data-theme="light"] .text-white,
html[data-theme="light"] .text-slate-100,
html[data-theme="light"] .text-slate-200,
html[data-theme="light"] .text-slate-300 {
  color: var(--text-primary) !important;
}

html[data-theme="light"] .text-slate-400,
html[data-theme="light"] .text-slate-500 {
  color: var(--text-secondary) !important;
}

/* Preserve high-contrast auth hero copy in light mode */

/* Some marketing/hero panels are intentionally dark-only (literal slate-950/900
   gradients that never flip light) so their light/white body copy must NOT be
   caught by the blanket ".text-white -> dark" rule above, or it goes dark-on-dark
   and disappears. Mark the panel with .always-dark-panel to reassert the
   original Tailwind color inside it, regardless of page theme. */
html[data-theme="light"] .always-dark-panel .text-white {
  color: #fff !important;
}
html[data-theme="light"] .always-dark-panel .text-slate-100 {
  color: #f1f5f9 !important;
}
html[data-theme="light"] .always-dark-panel .text-slate-200 {
  color: #e2e8f0 !important;
}
html[data-theme="light"] .always-dark-panel .text-slate-300 {
  color: #cbd5e1 !important;
}
html[data-theme="light"] .always-dark-panel .text-slate-400 {
  color: #94a3b8 !important;
}
html[data-theme="light"] .always-dark-panel .text-slate-500 {
  color: #64748b !important;
}

/* Light theme: Tailwind accent -300/-400 text is tuned for dark grounds (about 2:1 on white).
   Darken to the -700 step (>=4.5:1 on --bg-card). .always-dark-panel keeps the original. */
html[data-theme="light"] :is(.text-purple-300,.text-purple-400,.hover\:text-purple-300:hover):not(.always-dark-panel *){color:#7e22ce}
html[data-theme="light"] :is(.text-violet-300,.text-violet-400,.hover\:text-violet-300:hover):not(.always-dark-panel *){color:#6d28d9}
html[data-theme="light"] :is(.text-fuchsia-300,.text-fuchsia-400,.hover\:text-fuchsia-300:hover):not(.always-dark-panel *){color:#a21caf}
html[data-theme="light"] :is(.text-pink-300,.text-pink-400,.hover\:text-pink-300:hover):not(.always-dark-panel *){color:#be185d}
html[data-theme="light"] :is(.text-rose-300,.text-rose-400,.hover\:text-rose-300:hover):not(.always-dark-panel *){color:#be123c}
html[data-theme="light"] :is(.text-red-300,.text-red-400,.hover\:text-red-300:hover):not(.always-dark-panel *){color:#b91c1c}
html[data-theme="light"] :is(.text-orange-300,.text-orange-400,.hover\:text-orange-300:hover):not(.always-dark-panel *){color:#c2410c}
html[data-theme="light"] :is(.text-amber-300,.text-amber-400,.hover\:text-amber-300:hover):not(.always-dark-panel *){color:#b45309}
html[data-theme="light"] :is(.text-yellow-300,.text-yellow-400,.hover\:text-yellow-300:hover):not(.always-dark-panel *){color:#a16207}
html[data-theme="light"] :is(.text-lime-300,.text-lime-400,.hover\:text-lime-300:hover):not(.always-dark-panel *){color:#4d7c0f}
html[data-theme="light"] :is(.text-green-300,.text-green-400,.hover\:text-green-300:hover):not(.always-dark-panel *){color:#15803d}
html[data-theme="light"] :is(.text-emerald-300,.text-emerald-400,.hover\:text-emerald-300:hover):not(.always-dark-panel *){color:#047857}
html[data-theme="light"] :is(.text-teal-300,.text-teal-400,.hover\:text-teal-300:hover):not(.always-dark-panel *){color:#0f766e}
html[data-theme="light"] :is(.text-cyan-300,.text-cyan-400,.hover\:text-cyan-300:hover):not(.always-dark-panel *){color:#0e7490}
html[data-theme="light"] :is(.text-sky-300,.text-sky-400,.hover\:text-sky-300:hover):not(.always-dark-panel *){color:#0369a1}
html[data-theme="light"] :is(.text-blue-300,.text-blue-400,.hover\:text-blue-300:hover):not(.always-dark-panel *){color:#1d4ed8}
html[data-theme="light"] :is(.text-indigo-300,.text-indigo-400,.hover\:text-indigo-300:hover):not(.always-dark-panel *){color:#4338ca}

/* Light theme: KEEP white text/icons on colored (brand-filled) controls.
   The blanket ".text-white -> dark" rule above is for body copy on light
   grounds; it must NOT darken white text sitting on a colored button, badge,
   avatar, gradient chip, or solid modal header. These exceptions re-assert
   white on those surfaces (gradient/brand fills are dark enough for white).
   Ghost/outline/danger buttons are excluded — they are transparent/light. */
html[data-theme="light"] .esports-btn:not(.esports-btn-ghost):not(.esports-btn-outline):not(.esports-btn-danger),
html[data-theme="light"] .esports-btn:not(.esports-btn-ghost):not(.esports-btn-outline):not(.esports-btn-danger) .text-white,
html[data-theme="light"] .esports-btn:not(.esports-btn-ghost):not(.esports-btn-outline):not(.esports-btn-danger) i,
html[data-theme="light"] .esports-btn-cyan,
html[data-theme="light"] .esports-btn-cyan .text-white,
html[data-theme="light"] .esports-btn-cyan i,
/* Gradient-filled CTAs and avatars/chips (the .text-white is ON the filled
   element, or inside a link/button) — scoped to a/button/self so it can NOT
   reach heading copy inside gradient hero SECTIONS that the blanket rule is
   meant to darken in light mode. */
html[data-theme="light"] a[class*="bg-gradient-to"].text-white,
html[data-theme="light"] button[class*="bg-gradient-to"].text-white,
html[data-theme="light"] div[class*="bg-gradient-to"].text-white,
html[data-theme="light"] a[class*="bg-gradient-to"] .text-white,
html[data-theme="light"] button[class*="bg-gradient-to"] .text-white,
html[data-theme="light"] a[class*="bg-gradient-to"] > i,
html[data-theme="light"] button[class*="bg-gradient-to"] > i,
html[data-theme="light"] #feedbackModal .text-white,
html[data-theme="light"] #feedbackModal .text-white i,
html[data-theme="light"] #bugReportModal .text-white,
html[data-theme="light"] #bugReportModal .text-white i {
  color: var(--neutral-0) !important;
}

html[data-theme="light"] .border-slate-800,
html[data-theme="light"] .border-slate-700,
html[data-theme="light"] .border-purple-900\/30,
html[data-theme="light"] .border-purple-900\/20,
html[data-theme="light"] .border-purple-900\/10 {
  border-color: rgba(var(--legacy-scrim-rgb), 0.14) !important;
}

html[data-theme="light"] .from-purple-900\/60 {
  --tw-gradient-from: rgba(15, 118, 110, 0.22) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(15, 118, 110, 0) var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] .to-slate-900,
html[data-theme="light"] .to-slate-900\/60 {
  --tw-gradient-to: rgba(226, 232, 240, 0.55) var(--tw-gradient-to-position) !important;
}

html[data-theme="light"] .shadow-xl,
html[data-theme="light"] .shadow-2xl {
  --tw-shadow-color: rgba(var(--legacy-scrim-rgb), 0.18) !important;
}

/* ---------------- POPUP/MODAL THEME BRIDGING -------------------------------------------------------------------------------------------------------------------------------------------------------- */
#sidebar-overlay {
  background: var(--overlay-backdrop) !important;
  backdrop-filter: blur(3px) !important;
}

#regModalBackdrop,
#openRegBackdrop,
.rte-img-dialog-backdrop {
  background: var(--overlay-backdrop) !important;
  backdrop-filter: blur(5px);
}

#regModalPanel,
#openRegPanel,
.rte-img-dialog {
  background: var(--overlay-panel-bg) !important;
  border-color: var(--overlay-panel-border) !important;
  box-shadow: var(--overlay-panel-shadow) !important;
  color: var(--text-primary);
}

#regModalClose,
#openRegClose {
  color: var(--text-muted) !important;
}

#regModalClose:hover,
#openRegClose:hover {
  color: var(--text-primary) !important;
  background: rgba(var(--neutral-500-rgb), 0.14) !important;
}

.rte-img-dialog {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

html[data-theme="light"] #regModalPanel > div:first-child,
html[data-theme="light"] #openRegPanel .open-reg-header {
  border-bottom-color: rgba(var(--legacy-scrim-rgb), 0.14) !important;
  background: linear-gradient(
    180deg,
    rgba(var(--neutral-500-rgb), 0.28),
    rgba(var(--neutral-500-rgb), 0.1)
  ) !important;
}

html[data-theme="light"] #regModalPanel .reg-team-option {
  border-color: rgba(var(--legacy-scrim-rgb), 0.16) !important;
  background: linear-gradient(
    135deg,
    rgba(226, 232, 240, 0.98),
    rgba(241, 245, 249, 0.96)
  ) !important;
}

html[data-theme="light"] #regModalPanel .reg-team-option:hover {
  border-color: rgba(15, 118, 110, 0.42) !important;
  background: linear-gradient(
    135deg,
    rgba(220, 252, 231, 0.96),
    rgba(226, 232, 240, 0.96)
  ) !important;
}

html[data-theme="light"] #regModalPanel .reg-team-option.is-selected {
  border-color: rgba(5, 150, 105, 0.45) !important;
  background: linear-gradient(
    135deg,
    rgba(187, 247, 208, 0.96),
    rgba(220, 252, 231, 0.94)
  ) !important;
}

html[data-theme="light"] #regModalPanel #regSelectStep,
html[data-theme="light"] #regModalPanel #regDetailToolbar,
html[data-theme="light"] #regModalPanel .reg-team-details-panel,
html[data-theme="light"] #regModalPanel .reg-team-details-actions,
html[data-theme="light"] #regModalPanel .reg-team-details-scroll {
  background: rgba(226, 232, 240, 0.92) !important;
  border-color: rgba(var(--legacy-scrim-rgb), 0.14) !important;
}

html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-0)"],
html[data-theme="light"] #regModalPanel [style*="color:var(--text-primary)"],
html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-200)"],
html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-300)"],
html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-0"],
html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-100"],
html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-200"],
html[data-theme="light"] #regModalPanel [style*="color:var(--neutral-300"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-0)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--text-primary)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-200)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-300)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-0"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-100"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-200"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-300"],
html[data-theme="light"] #regModalPanel .sx-color-text-primary,
html[data-theme="light"] #regModalPanel .sx-color-neutral-200,
html[data-theme="light"] #regModalPanel .sx-color-neutral-300,
html[data-theme="light"] #regModalPanel .sx-color-neutral-200-2,
html[data-theme="light"] #regModalPanel .sx-color-neutral-300-2,
html[data-theme="light"] #openRegPanel .sx-color-text-primary,
html[data-theme="light"] #openRegPanel .sx-color-neutral-200,
html[data-theme="light"] #openRegPanel .sx-color-neutral-300,
html[data-theme="light"] #openRegPanel .sx-color-neutral-200-2,
html[data-theme="light"] #openRegPanel .sx-color-neutral-300-2 {
  color: var(--text-primary) !important;
}

html[data-theme="light"] #regModalPanel [style*="color:var(--text-muted)"],
html[data-theme="light"] #regModalPanel [style*="color:var(--text-secondary)"],
html[data-theme="light"] #regModalPanel [style*="color:var(--text-muted"],
html[data-theme="light"] #regModalPanel [style*="color:var(--text-secondary"],
html[data-theme="light"] #regModalSubtitle,
html[data-theme="light"] #openRegPanel [style*="color:var(--text-muted)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--text-secondary)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-600)"],
html[data-theme="light"] #openRegPanel [style*="color:var(--text-muted"],
html[data-theme="light"] #openRegPanel [style*="color:var(--text-secondary"],
html[data-theme="light"] #openRegPanel [style*="color:var(--neutral-600"],
html[data-theme="light"] #regModalPanel .sx-color-text-muted,
html[data-theme="light"] #regModalPanel .sx-color-text-secondary,
html[data-theme="light"] #regModalPanel .sx-color-text-muted-2,
html[data-theme="light"] #regModalPanel .sx-color-text-secondary-2,
html[data-theme="light"] #openRegPanel .sx-color-text-muted,
html[data-theme="light"] #openRegPanel .sx-color-text-secondary,
html[data-theme="light"] #openRegPanel .sx-color-text-muted-2,
html[data-theme="light"] #openRegPanel .sx-color-text-secondary-2 {
  color: var(--text-secondary) !important;
}

html[data-theme="light"]
  #openRegPanel
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not(
    [type="button"]
  ),
html[data-theme="light"] #openRegPanel select,
html[data-theme="light"] #openRegPanel textarea {
  background: var(--neutral-0) !important;
  color: var(--text-primary) !important;
  border-color: rgba(var(--legacy-scrim-rgb), 0.2) !important;
}

html[data-theme="light"] #openRegPanel input::placeholder,
html[data-theme="light"] #openRegPanel textarea::placeholder {
  color: var(--text-muted) !important;
}

html[data-theme="light"] #openRegPanel .open-reg-roster-row {
  border-top-color: rgba(var(--legacy-scrim-rgb), 0.09) !important;
  background: rgba(241, 245, 249, 0.74) !important;
}

html[data-theme="light"] #openRegPanel .open-reg-roster-table thead tr {
  background: rgba(15, 118, 110, 0.12) !important;
}

html[data-theme="light"] input[style*="background:var(--neutral-800)"],
html[data-theme="light"] input[style*="background: var(--neutral-800)"],
html[data-theme="light"] input[style*="background:var(--neutral-900)"],
html[data-theme="light"] input[style*="background: var(--neutral-900)"],
html[data-theme="light"] input[style*="background:rgba(15,23,42"],
html[data-theme="light"] input[style*="background: rgba(15,23,42"],
html[data-theme="light"] input[style*="background:var(--neutral-800"],
html[data-theme="light"] input[style*="background: var(--neutral-800"],
html[data-theme="light"] input[style*="background:var(--neutral-900"],
html[data-theme="light"] input[style*="background: var(--neutral-900"],
html[data-theme="light"] textarea[style*="background:var(--neutral-800)"],
html[data-theme="light"] textarea[style*="background: var(--neutral-800)"],
html[data-theme="light"] textarea[style*="background:var(--neutral-900)"],
html[data-theme="light"] textarea[style*="background: var(--neutral-900)"],
html[data-theme="light"] textarea[style*="background:rgba(15,23,42"],
html[data-theme="light"] textarea[style*="background: rgba(15,23,42"],
html[data-theme="light"] textarea[style*="background:var(--neutral-800"],
html[data-theme="light"] textarea[style*="background: var(--neutral-800"],
html[data-theme="light"] textarea[style*="background:var(--neutral-900"],
html[data-theme="light"] textarea[style*="background: var(--neutral-900"],
html[data-theme="light"] select[style*="background:var(--neutral-800)"],
html[data-theme="light"] select[style*="background: var(--neutral-800)"],
html[data-theme="light"] select[style*="background:var(--neutral-900)"],
html[data-theme="light"] select[style*="background: var(--neutral-900)"],
html[data-theme="light"] select[style*="background:rgba(15,23,42"],
html[data-theme="light"] select[style*="background: rgba(15,23,42"],
html[data-theme="light"] select[style*="background:var(--neutral-800"],
html[data-theme="light"] select[style*="background: var(--neutral-800"],
html[data-theme="light"] select[style*="background:var(--neutral-900"],
html[data-theme="light"] select[style*="background: var(--neutral-900"] {
  background: var(--neutral-0) !important;
  color: var(--text-primary) !important;
  border-color: rgba(var(--legacy-scrim-rgb), 0.2) !important;
}

html[data-theme="light"] input[style*="background:var(--neutral-800)"]::placeholder,
html[data-theme="light"] input[style*="background: var(--neutral-800)"]::placeholder,
html[data-theme="light"] input[style*="background:var(--neutral-900)"]::placeholder,
html[data-theme="light"] input[style*="background: var(--neutral-900)"]::placeholder,
html[data-theme="light"] input[style*="background:rgba(15,23,42"]::placeholder,
html[data-theme="light"] input[style*="background: rgba(15,23,42"]::placeholder,
html[data-theme="light"] input[style*="background:var(--neutral-800"]::placeholder,
html[data-theme="light"] input[style*="background: var(--neutral-800"]::placeholder,
html[data-theme="light"] input[style*="background:var(--neutral-900"]::placeholder,
html[data-theme="light"] input[style*="background: var(--neutral-900"]::placeholder,
html[data-theme="light"] textarea[style*="background:var(--neutral-800)"]::placeholder,
html[data-theme="light"] textarea[style*="background: var(--neutral-800)"]::placeholder,
html[data-theme="light"] textarea[style*="background:var(--neutral-900)"]::placeholder,
html[data-theme="light"] textarea[style*="background: var(--neutral-900)"]::placeholder,
html[data-theme="light"]
  textarea[style*="background:rgba(15,23,42"]::placeholder,
html[data-theme="light"]
  textarea[style*="background: rgba(15,23,42"]::placeholder,
html[data-theme="light"]
  textarea[style*="background:var(--neutral-800"]::placeholder,
html[data-theme="light"]
  textarea[style*="background: var(--neutral-800"]::placeholder,
html[data-theme="light"]
  textarea[style*="background:var(--neutral-900"]::placeholder,
html[data-theme="light"]
  textarea[style*="background: var(--neutral-900"]::placeholder {
  color: var(--text-muted) !important;
}

/* ---------------- RESPONSIVE ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
@media (max-width: 1024px) {
  .team-detail-grid,
  .tournament-detail-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .hero-floating-icon {
    opacity: 0.45;
  }

  .hero-floating-icon:nth-child(n + 7) {
    display: none;
  }
}

@media (max-width: 768px) {
  .navbar-links {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem;
    z-index: 99;
    gap: 0.25rem;
  }

  .navbar-links.open {
    display: flex;
  }

  .hamburger {
    display: flex;
  }

  .hero {
    padding: 4rem 1rem 3rem;
  }

  .team-banner-overlay,
  .tournament-banner-overlay {
    padding: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .room-main {
    flex-direction: column;
  }

  .room-judge-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .h2h-header {
    flex-direction: column;
  }

  .hero-floating-layer {
    inset: 0 0 8% 0;
  }

  .hero-floating-icon {
    width: calc(var(--icon-size, 88px) * 0.78);
    height: calc(var(--icon-size, 88px) * 0.78);
    border-radius: 14px;
    opacity: 0.36;
  }

  .hero-floating-fallback {
    font-size: 1.4rem;
  }

  .hero-floating-icon:nth-child(n + 5) {
    display: none;
  }

  .lineup-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .lineup-back-btn,
  .lineup-save-btn {
    width: 100%;
    justify-content: center;
  }

  .lineup-slot-row {
    flex-direction: column;
  }

  .lineup-refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .lineup-slot-card {
    padding: 0.875rem !important;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 1.5rem 1rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .admin-nav-grid {
    grid-template-columns: 1fr;
  }

  .hero-floating-icon:nth-child(n + 4) {
    display: none;
  }

  .hero-floating-icon {
    opacity: 0.3;
  }

  .lineup-page-header {
    gap: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-floating-icon {
    animation: none;
    transform: rotateX(var(--rot-x, -10deg)) rotateY(var(--rot-y, 30deg))
      rotateZ(var(--rot-z, 58deg));
  }
}

/* ------ ALTCHA CAPTCHA WIDGET --------------------------------------------------------------------------------------------------------- */

/*
 * Correct altcha v3 CSS custom property names (from source):
 *   --altcha-color-base          --- widget background
 *   --altcha-color-base-content  --- text on base background  (THE text color)
 *   --altcha-color-neutral       --- border / neutral elements
 *   --altcha-color-neutral-content --- text on neutral
 *   --altcha-color-primary       --- checkbox accent / primary
 *   --altcha-color-primary-content --- text on primary
 *   --altcha-color-error         --- error state
 *   --altcha-border-color        --- border (defaults to --altcha-color-neutral)
 *   --altcha-border-radius       --- corner radius
 *   --altcha-max-width           --- widget max-width
 */

/* Dark theme --- explicit hex values override the light-dark() defaults */
altcha-widget {
  color-scheme: dark;
  --altcha-color-base: var(--legacy-gray-900);
  --altcha-color-base-content: var(--neutral-50);
  --altcha-color-neutral: rgba(var(--brand-secondary-rgb), 0.5);
  --altcha-color-neutral-content: var(--neutral-50);
  --altcha-color-primary: var(--brand-secondary);
  --altcha-color-primary-content: var(--neutral-0);
  --altcha-color-error: var(--legacy-red-500);
  --altcha-color-error-content: var(--neutral-0);
  --altcha-color-success: var(--status-live);
  --altcha-color-success-content: var(--neutral-0);
  --altcha-border-radius: 10px;
  --altcha-max-width: 340px;
  --altcha-shadow: drop-shadow(0 8px 24px rgba(var(--shadow-color), 0.55));
}

.altcha-widget-container {
  /* Positioned via JavaScript above submit button */
  box-shadow: 0 12px 32px rgba(var(--shadow-color), 0.45);
  border-radius: 12px;
  animation: altcha-slide-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: calc(100vw - 24px);
}

@keyframes altcha-slide-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Hide "Protected by ALTCHA" footer/branding completely */
altcha-widget::part(footer),
altcha-widget [part="footer"],
altcha-widget .altcha-footer,
altcha-widget footer {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Floating widget --- slide-up + fade entrance animation */
@keyframes altcha-slide-up {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

altcha-widget[data-state="verifying"],
altcha-widget[data-state="verified"],
altcha-widget[data-state="error"],
altcha-widget[data-state="unverified"] {
  animation: altcha-slide-up 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Mobile: keep floating popup inside viewport */
@media (max-width: 640px) {
  altcha-widget {
    --altcha-max-width: calc(100vw - 32px);
  }
}

/* Light theme --- restore light palette when toggled */
html[data-theme="light"] altcha-widget {
  color-scheme: light;
  --altcha-color-base: var(--neutral-0);
  --altcha-color-base-content: var(--neutral-900);
  --altcha-color-neutral: rgba(109, 40, 217, 0.35);
  --altcha-color-neutral-content: var(--neutral-800);
  --altcha-color-primary: var(--brand-secondary-dark);
  --altcha-color-primary-content: var(--neutral-0);
  --altcha-shadow: drop-shadow(0 4px 16px rgba(var(--shadow-color), 0.15));
}

@media (prefers-reduced-motion: reduce) {
  altcha-widget[data-state] {
    animation: none;
  }
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   GAME ICON SHIMMER  (.gi-wrap / .gi-shimmer)
   Applied automatically by gameIconHtml() helper.
   Dark theme default; light theme overrides below.
   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
@keyframes gi-shimmer-slide {
  0% {
    background-position: 200% center;
  }

  100% {
    background-position: -200% center;
  }
}

.gi-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* inherits sizing from children --- no explicit width/height */
}

.gi-shimmer {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(var(--neutral-800-rgb), 0) 0%,
    rgba(51, 65, 85, 0.55) 38%,
    rgba(var(--text-muted-rgb), 0.3) 52%,
    rgba(var(--neutral-800-rgb), 0) 100%
  );
  background-size: 200% 100%;
  animation: gi-shimmer-slide 1.6s ease-in-out infinite;
  pointer-events: none;
}

/* Once the image has loaded, remove the shimmer */
.gi-wrap.gi-loaded .gi-shimmer {
  display: none;
}

/* Light theme variant */
html[data-theme="light"] .gi-shimmer {
  background: linear-gradient(
    90deg,
    rgba(241, 245, 249, 0) 0%,
    rgba(209, 213, 219, 0.65) 38%,
    rgba(226, 232, 240, 0.45) 52%,
    rgba(241, 245, 249, 0) 100%
  );
  background-size: 200% 100%;
  animation: gi-shimmer-slide 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .gi-shimmer {
    animation: none;
  }
}

/* ------ Game filter chip button (templates page & similar filter forms) ------ */
.tour-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--text-muted-rgb), 0.25);
  background: rgba(var(--legacy-scrim-rgb), 0.55);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.34rem 0.76rem;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s,
    transform 0.18s;
  white-space: nowrap;
  font-family: inherit;
}

.tour-chip-btn:hover {
  transform: translateY(-1px);
  color: var(--neutral-200);
  border-color: rgba(var(--brand-secondary-rgb), 0.5);
}

.tour-chip-btn.tg-active {
  color: var(--neutral-200);
  border-color: rgba(var(--brand-secondary-rgb), 0.7);
  background: rgba(var(--brand-secondary-rgb), 0.18);
  box-shadow: 0 0 0 1px rgba(var(--brand-secondary-rgb), 0.22);
}

html[data-theme="light"] .tour-chip-btn {
  background: rgba(241, 245, 249, 0.9);
  color: var(--neutral-600);
  border-color: rgba(var(--text-muted-rgb), 0.3);
}

html[data-theme="light"] .tour-chip-btn:hover {
  color: var(--neutral-800);
  border-color: rgba(var(--brand-secondary-rgb), 0.5);
}

html[data-theme="light"] .tour-chip-btn.tg-active {
  color: var(--brand-secondary-dark);
  background: rgba(var(--brand-secondary-rgb), 0.1);
  border-color: rgba(var(--brand-secondary-rgb), 0.6);
}

/* -- Lazy-load pulse skeleton ----------------------------------------------- */
.ui-img-wrap {
  display: inline-block;
  position: relative;
  overflow: hidden;
  background: #1e2640;
}

.ui-img-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #1e2640;
  animation: ui-pulse 1.4s ease-in-out infinite;
  z-index: 1;
  transition: opacity 0.25s;
}

.ui-img-wrap.ui-loaded::before {
  opacity: 0;
  pointer-events: none;
}

@keyframes ui-pulse {
  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 0.8;
  }
}

.ui-img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 2;
}

/* CSS-only fallback --- shown when image is missing or fails to load.
   Uses an inline SVG photo icon; no external PNG required. */
.ui-img-wrap.ui-error {
  background: #1a2035;
}

.ui-img-wrap.ui-error::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #1a2035
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374163' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='m21 15-5-5L5 21'/%3E%3C/svg%3E")
    center/40% no-repeat;
}

.ui-img-wrap.ui-error::before {
  opacity: 0;
  pointer-events: none;
}

/* ------ Scroll-triggered Animations ------------------------------------------------------------------------------------------------------------------------------------ */
/* Base: elements start hidden, transition to visible when .is-visible added   */
[data-reveal] {
  opacity: 0;
  transition:
    opacity 0.55s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

[data-reveal="fade"] {
  opacity: 0;
}

[data-reveal="up"] {
  transform: translateY(28px);
  opacity: 0;
}

[data-reveal="down"] {
  transform: translateY(-20px);
  opacity: 0;
}

[data-reveal="left"] {
  transform: translateX(-28px);
  opacity: 0;
}

[data-reveal="right"] {
  transform: translateX(28px);
  opacity: 0;
}

[data-reveal="scale"] {
  transform: scale(0.93);
  opacity: 0;
}

[data-reveal="zoom"] {
  transform: scale(0.88) translateY(16px);
  opacity: 0;
}

[data-reveal].is-visible {
  opacity: 1 !important;
  transform: none !important;
}

/* Stagger children --- parent gets [data-reveal-stagger], each child delays */
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-reveal-stagger].is-visible > * {
  opacity: 1;
  transform: none;
}

[data-reveal-stagger].is-visible > *:nth-child(1) {
  transition-delay: 0ms;
}

[data-reveal-stagger].is-visible > *:nth-child(2) {
  transition-delay: 60ms;
}

[data-reveal-stagger].is-visible > *:nth-child(3) {
  transition-delay: 120ms;
}

[data-reveal-stagger].is-visible > *:nth-child(4) {
  transition-delay: 180ms;
}

[data-reveal-stagger].is-visible > *:nth-child(5) {
  transition-delay: 240ms;
}

[data-reveal-stagger].is-visible > *:nth-child(6) {
  transition-delay: 300ms;
}

[data-reveal-stagger].is-visible > *:nth-child(7) {
  transition-delay: 360ms;
}

[data-reveal-stagger].is-visible > *:nth-child(8) {
  transition-delay: 420ms;
}

[data-reveal-stagger].is-visible > *:nth-child(n + 9) {
  transition-delay: 480ms;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ------ Counter animation (number count-up) ------------------------------------------------------------------------------------------------------------ */

/* ------ Parallax shimmer on hero sections ------------------------------------------------------------------------------------------------------------------ */
.hero-shimmer {
  position: relative;
  overflow: hidden;
}

.hero-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(var(--legacy-teal-200-rgb), 0.06) 50%,
    transparent 60%
  );
  animation: hero-shimmer-move 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes hero-shimmer-move {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

/* ------ Pulse ring on live indicators --------------------------------------------------------------------------------------------------------------------------- */

@keyframes pulse-ring-anim {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }

  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* ------ Adaptive logo theme styles (black to white) May 30, 2026 ----------------------------- */
.logo-adaptive-fill {
  fill: #000000;
  transition: fill 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dynamic swap when parent theme toggled to dark, or OS prefers dark mode */
html[data-theme='dark'] .logo-adaptive-fill {
  fill: var(--neutral-0) !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .logo-adaptive-fill {
    fill: var(--neutral-0);
  }
}

/* Stroke-based variant for the "eS" monogram (uses currentColor on strokes) */

/* ------ Uploaded site logos: theme-based visibility (mirrors .logo-adaptive-fill) --
   Staff/admin can upload a dark-theme and a light-theme logo. When only one is
   uploaded it carries the .site-logo-both class and is always visible. When both
   exist, we render both <img>s and show the one matching the active theme. */
.site-logo-img { object-fit: contain; }

/* Default = light theme: show the light logo, hide the dark one. */
.site-logo-light { display: inline-block; }
.site-logo-dark  { display: none; }

/* Explicit dark theme: swap. */
html[data-theme='dark'] .site-logo-dark  { display: inline-block !important; }
html[data-theme='dark'] .site-logo-light { display: none !important; }

/* OS dark preference when the user hasn't forced a theme. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .site-logo-dark  { display: inline-block; }
  html:not([data-theme='light']) .site-logo-light { display: none; }
}

/* ==========================================================================
   SHARP EDGES GLOBAL OVERRIDE
   Replaces all rounded corners with sharp corners across the entire platform
   ========================================================================== */

/* 1. Global reset for all elements containing tailwind rounded classes */
[class*="rounded"] {
  border-radius: 0px !important;
}

/* 2. Specific semantic element overrides to cover all components, buttons, forms, and cards */
button,
input,
select,
textarea,
img,
pre,
code,
iframe,
.esports-btn,
.angular-card,
.db-card,
.card,
.btn,
.form-input,
.form-select,
.form-textarea,
.badge,
.modal,
.dialog,
.toast,
.dropdown,
.tooltip,
.avatar,
.avatar img,
.skeleton {
  border-radius: 0px !important;
}

/* 3. Redefine border-radius CSS variables to be safe */
:root,
html,
body,
html[data-theme="light"] {
  --radius-xs: 0px !important;
  --radius-sm: 0px !important;
  --radius-md: 0px !important;
  --radius-lg: 0px !important;
  --radius-xl: 0px !important;
  --radius-pill: 0px !important;
  --radius-shadcn: 0px !important;
}

/* ============================================================
   ICON SELECT  (partials/game-picker, country-picker + icon-select.js)
   Progressive-enhancement dropdown with an icon/flag left of each row.
   Native <select> shows for no-JS; JS hides it and reveals .icon-select.
   ============================================================ */
.icon-select-hidden { display: none !important; }

.icon-select { position: relative; --isel-accent: 148, 163, 184; } /* fallback slate; games set --gc-rgb */

/* trigger (closed state) */
.icon-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.icon-select-trigger:hover { border-color: rgba(var(--brand-primary-rgb), .5); }
.icon-select.is-open .icon-select-trigger {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px var(--brand-primary) inset;
}
.icon-select-value {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  font-weight: 600;
}
.icon-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-select-caret {
  flex-shrink: 0;
  font-size: .7rem;
  color: var(--text-muted);
  transition: transform .18s ease;
}
.icon-select.is-open .icon-select-caret { transform: rotate(180deg); }

/* icon slot — a tinted chip using the game's own accent (--gc-rgb), or a flag */
.icon-select-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  flex-shrink: 0;
  background: rgba(var(--gc-rgb, var(--isel-accent)), .14);
  box-shadow: inset 0 0 0 1px rgba(var(--gc-rgb, var(--isel-accent)), .28);
}
.icon-select-icon .icon-select-imgwrap,
.icon-select-icon img { width: 1.15rem; height: 1.15rem; }
.icon-select-icon img { object-fit: contain; }
.icon-select-icon .fi { width: 1.35rem; height: 1.35rem; border-radius: 2px; background-size: cover; }

/* dropdown list */
@keyframes iconSelectIn { from { opacity: 0; transform: translateY(-.35rem); } to { opacity: 1; transform: translateY(0); } }
.icon-select-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  margin: 0;
  padding: .3rem;
  list-style: none;
  max-height: 18rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .35) transparent;
}
.icon-select-list::-webkit-scrollbar { width: 8px; }
.icon-select-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .3); border-radius: 0; }
.icon-select.is-open .icon-select-list { display: block; animation: iconSelectIn .16s ease; }
.icon-select.is-up .icon-select-list { top: auto; bottom: calc(100% + 6px); }
@media (prefers-reduced-motion: reduce) {
  .icon-select.is-open .icon-select-list { animation: none; }
  .icon-select-caret, .icon-select-trigger { transition: none; }
}

.icon-select-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .6rem;
  cursor: pointer;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.icon-select-optval {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.icon-select-option.is-active,
.icon-select-option:hover {
  background: rgba(var(--gc-rgb, var(--isel-accent)), .12);
  border-left-color: rgb(var(--gc-rgb, var(--isel-accent)));
  color: var(--text-primary);
}
.icon-select-option[aria-selected="true"] { color: var(--text-primary); font-weight: 600; }
.icon-select-option[aria-selected="true"]::after {
  content: "\2713";
  margin-left: auto;
  padding-left: .5rem;
  color: var(--brand-primary);
  font-weight: 700;
}

/* mobile: render the list as a bottom sheet (kept last so it overrides is-up) */
@media (max-width: 30rem) {
  @keyframes iconSelectSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .icon-select.is-open .icon-select-list {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    max-height: 65vh;
    padding-bottom: calc(.3rem + env(safe-area-inset-bottom, 0px));
    border-left: 0; border-right: 0; border-bottom: 0;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .5);
    animation: iconSelectSheet .2s ease;
  }
  .icon-select-option { padding: .8rem .75rem; }
}

/* ============================================================
   ROSTER SIZE PILLS  (teams/create + teams/manage — FC Mobile league size)
   ============================================================ */

/* ============================================================
   REFEREE DASHBOARD  --  views/referees/dashboard.ejs, all-matches.ejs,
   _ops-panel.ejs. Everything is scoped under .ref-* / .refops-* so it
   cannot leak into other pages. Colors come from the semantic tokens only
   (never the theme-invariant slate ramp) so both themes stay legible.
   ============================================================ */

.ref-dash { display: flex; flex-direction: column; gap: 1.25rem; }

.ref-page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: 1rem; border-bottom: 1px solid var(--border-subtle);
}
.ref-page-title {
  font-family: "Rajdhani", "Oxanium", sans-serif;
  font-size: 2rem; font-weight: 700; margin: 0; line-height: 1.15;
  color: var(--text-primary); text-wrap: balance;
}
.ref-eyebrow {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-muted); margin: 0;
}
.ref-sub { color: var(--text-secondary); font-size: .85rem; margin: .15rem 0 0; }
.ref-note { color: var(--text-muted); font-size: .78rem; margin: 0 0 .5rem; }
.ref-strong { color: var(--text-primary); font-weight: 600; }
.ref-panel-title { display: flex; align-items: center; gap: .5rem; }

/* Stat rail */
.ref-stat-rail {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.ref-stat { padding: .9rem 1rem; }
.ref-stat .stat-card-num { font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.ref-stat .ref-stat-word { font-size: 1.05rem; }
.ref-stat-live {
  border-color: rgba(var(--brand-primary-rgb), .4);
  background: rgba(var(--brand-primary-rgb), .07);
}
.ref-stat-live .stat-card-num { color: var(--brand-primary); }

/* Filter pills -- the active one sits on the brand gradient, so its label is a
   theme-constant #fff, never var(--text-primary) (which flips near-black in light). */
.ref-filter-bar {
  display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.ref-pill {
  padding: .4rem .85rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border-subtle); color: var(--text-secondary);
  background: transparent; text-decoration: none; line-height: 1.3;
  transition: background .18s, color .18s, border-color .18s;
}
.ref-pill:hover { background: var(--bg-elevated); color: var(--text-primary); }
.ref-pill[aria-current="true"] {
  background: var(--grad-primary, var(--brand-primary));
  color: #fff; border-color: transparent;
}

/* Match list */
.ref-group + .ref-group { margin-top: 1.5rem; }
.ref-group-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem;
}
.ref-group-title { color: var(--brand-primary); }
.ref-match-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.ref-match {
  background: var(--bg-inset); border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--border-default);
  border-radius: var(--radius-lg, .625rem); padding: .85rem 1rem;
}
.ref-match-pending { border-left-color: var(--st-warning, #f59e0b); }
.ref-match-done { font-size: .875rem; }
.ref-match-clickable { cursor: pointer; transition: background .15s, border-color .15s; }
.ref-match-clickable:hover { background: var(--bg-elevated); border-color: var(--border-default); }
.ref-match-chevron {
  color: var(--text-muted); font-size: .78rem; padding: .3rem .35rem;
  transition: transform .18s;
}
.ref-match-clickable:hover .ref-match-chevron { color: var(--text-secondary); }
/* Rotates once the ops panel below is expanded. :has() is unsupported only on very old
   browsers, where the chevron simply stays static -- the row still opens/closes fine. */
.ref-match-clickable:has(.refops-grid:not(.hidden)) .ref-match-chevron {
  transform: rotate(180deg); color: var(--brand-primary);
}
.ref-fixture { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.ref-score {
  font-family: "Rajdhani", "Oxanium", sans-serif;
  font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.ref-meta { font-size: .82rem; color: var(--text-muted); margin: .35rem 0 0; }
.ref-meta-inline { font-size: .82rem; color: var(--text-muted); }
.ref-badge-sm { font-size: .65rem; margin-left: .3rem; }

/* Copy modal */
.ref-modal { display: flex; flex-direction: column; gap: 1rem; box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.45)); }
.ref-modal-head {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding-bottom: .75rem; border-bottom: 1px solid var(--border-subtle);
}
.ref-modal-title {
  font-family: "Rajdhani", "Oxanium", sans-serif;
  font-size: 1.25rem; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: .5rem; color: var(--brand-primary);
}
.ref-modal-close {
  background: none; border: 0; cursor: pointer; line-height: 1;
  font-size: 1.5rem; color: var(--text-muted); padding: 0 .25rem;
}
.ref-modal-close:hover { color: var(--text-primary); }
.ref-copy-area {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .78rem; line-height: 1.6; background: var(--bg-inset); resize: vertical;
}
.ref-toast {
  font-size: .78rem; font-weight: 600; color: var(--st-success, #10b981);
  display: flex; align-items: center; gap: .4rem;
}

/* -- Ops panel ============================================================ */
.refops-grid {
  margin-top: .9rem; padding-top: .9rem;
  border-top: 1px solid var(--border-subtle);
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.refops-grid.hidden { display: none; }
.refops-sec { padding: .9rem; background: var(--bg-secondary); }
.refops-sec-wide { grid-column: 1 / -1; }
.refops-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem;
}
.refops-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-muted); margin: 0;
}
.refops-team { font-weight: 700; font-size: .88rem; margin: 0 0 .4rem; color: var(--text-primary); }
.refops-note { color: var(--text-muted); font-size: .78rem; margin: 0 0 .5rem; }
.refops-muted { color: var(--text-muted); }
.refops-strong { color: var(--text-primary); font-weight: 600; }
.refops-score {
  font-family: "Rajdhani", "Oxanium", sans-serif;
  font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.refops-format { font-size: .7rem; font-weight: 600; color: var(--text-muted); }

/* Roster table -- compact override of the sitewide .esports-table padding. */
.refops-roster { font-size: .82rem; min-width: 560px; }
.refops-roster thead th { padding: .5rem .7rem; white-space: nowrap; }
.refops-roster tbody td { padding: .5rem .7rem; white-space: nowrap; color: var(--text-secondary); }
.refops-slot { color: var(--text-muted); font-size: .75rem; }
.refops-ign { font-weight: 700; color: var(--text-primary); }
.refops-mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums; color: var(--text-muted);
}

/* Device column -- the hardware each player declared at registration. Tinted and
   ruled off so it reads as its own check during a lobby sweep. Device is required
   at registration, so an empty cell is a real gap, not a neutral blank. */
.refops-device-col {
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  background: rgba(var(--brand-secondary-rgb), .05);
}
.refops-device { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-secondary); }
.refops-device i { color: var(--brand-secondary); font-size: .85em; }
.refops-device-missing { color: var(--st-warning, #f59e0b); font-style: italic; font-size: .78rem; }

/* Contact rows */
.refops-contact {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; padding: .5rem 0; border-top: 1px solid var(--border-subtle);
}
.refops-contact:first-of-type { border-top: none; }
.refops-contact p { margin: 0; }
.refops-contact-name { font-weight: 600; font-size: .86rem; color: var(--text-primary); }
.refops-contact-role { font-size: .74rem; color: var(--text-muted); }

@media (max-width: 640px) {
  .ref-page-title { font-size: 1.6rem; }
  .ref-filter-bar form { margin-left: 0; width: 100%; }
}

/* ---------------- NEWS ARTICLE PAGE (views/news/show.ejs) ---------------------------------------------------------------- */
.news-read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 70;
  background: var(--brand-primary);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}
.news-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 340px;
  background: var(--bg-inset);
  overflow: hidden;
}
.news-hero.is-plain {
  min-height: 0;
  background: linear-gradient(120deg, var(--bg-inset), rgba(var(--brand-primary-rgb), 0.16));
}
.news-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.news-hero:not(.is-plain)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-card) 8%, color-mix(in srgb, var(--bg-card) 55%, transparent) 55%, transparent);
}
.news-hero-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px clamp(16px, 4vw, 40px);
  max-width: 900px;
}
.news-hero-title {
  margin: 0;
  font: 700 clamp(1.7rem, 4vw, 2.9rem)/1.12 "Oxanium", "Space Grotesk", sans-serif;
  color: var(--text-primary);
  text-wrap: balance;
}
.news-hero-dek {
  margin: 0;
  max-width: 65ch;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  border-top: 1px solid var(--border-subtle);
}
.news-main {
  padding: clamp(18px, 4vw, 40px);
  min-width: 0;
}
.news-main .news-story-prose {
  max-width: 70ch;
}
.news-aside {
  padding: 24px 20px;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-inset);
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}
@media (min-width: 1024px) {
  .news-aside > :last-child { position: sticky; top: 88px; }
}
.news-share {
  display: flex;
  gap: 8px;
}
.news-share a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
}
.news-share a:hover {
  color: var(--text-primary);
  border-color: rgba(var(--brand-primary-rgb), 0.6);
}
.news-toc {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}
.news-toc a {
  color: var(--text-secondary);
  text-decoration: none;
}
.news-toc a:hover {
  color: var(--brand-primary);
}
.news-toc .is-sub {
  padding-left: 12px;
  font-size: 0.78rem;
}
.news-modbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
}
@media (max-width: 900px) {
  .news-layout { grid-template-columns: 1fr; }
  .news-aside { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .news-hero { min-height: 260px; }
}

.news-serp {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: Arial, sans-serif;
  min-width: 0;
}
.news-serp-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-serp-title {
  font-size: 1.02rem;
  color: var(--brand-secondary, var(--text-primary));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-serp-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Editor colour swatches show the real text colour (views/partials/rte-legacy.ejs) */
.rte-color-swatch.news-story-prose {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  font: 700 0.8rem/1 "Oxanium", sans-serif;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  cursor: pointer;
}
.rte-color-swatch.news-story-prose::after { display: none; }
.rte-color-swatch.news-story-prose:hover { border-color: var(--brand-primary); }
.rte-btn[aria-pressed="true"] { color: var(--brand-primary); }
