/* =============================================================
   Idealnih 11 — FPL-inspired design system
   Deep navy header · light content panels · 3D perspective pitch
   ============================================================= */

:root {
  /* ---- Brand ---- */
  --brand-900:    #0a1430;
  --brand-800:    #131f47;
  --brand-700:    #1c2c5c;
  --brand-600:    #2a3b73;

  --accent:       #00ff87;
  --accent-2:     #02e676;
  --accent-deep:  #04b96a;
  --accent-glow:  rgba(0, 255, 135, 0.35);

  --pos-gk:       #f59e0b;
  --pos-def:      #3b82f6;
  --pos-mid:      #10b981;
  --pos-fwd:      #ef4444;

  --hot:          #ef4444;
  --cool:         #3b82f6;
  --warm:         #f59e0b;

  /* ---- Surfaces (LIGHT default) ---- */
  --bg-page:      #f1f4fa;
  --bg-card:      #ffffff;
  --bg-card-2:    #f7f9fd;
  --bg-sunken:    #eef2f9;
  --line:         #e2e8f2;
  --line-strong:  #c8d2e3;

  --text:         #0a1430;
  --text-soft:    #475569;
  --text-muted:   #7c8aa3;

  --pitch-grass-1: #198a4d;
  --pitch-grass-2: #137a41;
  --pitch-line:    rgba(255, 255, 255, 0.92);

  --hover:         rgba(10, 20, 48, 0.04);
  --hover-strong:  rgba(10, 20, 48, 0.08);

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem;
  --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem;

  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(10, 20, 48, 0.06);
  --shadow:    0 4px 16px rgba(10, 20, 48, 0.08);
  --shadow-lg: 0 16px 40px rgba(10, 20, 48, 0.16);
  --shadow-xl: 0 24px 60px rgba(10, 20, 48, 0.22);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --container: 1200px;
  --header-h:  64px;

  --tr-fast: 120ms cubic-bezier(.2,.7,.3,1);
  --tr:      220ms cubic-bezier(.2,.7,.3,1);
}

/* ----- Dark theme override ----- */
:root[data-theme="dark"] {
  --bg-page:      #070b14;
  --bg-card:      #0f1729;
  --bg-card-2:    #131c33;
  --bg-sunken:    #1a2440;
  --line:         #1f2a44;
  --line-strong:  #2b3a5d;

  --text:         #e8eef9;
  --text-soft:    #aab4cc;
  --text-muted:   #6b7895;

  --hover:        rgba(255, 255, 255, 0.05);
  --hover-strong: rgba(255, 255, 255, 0.10);

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.40);
  --shadow:    0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-gutter: stable; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.container {
  width: 100%; max-width: var(--container);
  margin: 0 auto; padding: 0 var(--sp-4);
}
@media (min-width: 720px) { .container { padding: 0 var(--sp-5); } }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }

/* =============================================================
   Header — always deep navy with white text
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand-900);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); gap: var(--sp-3);
}
.logo { display: flex; align-items: center; gap: var(--sp-3); font-weight: 800; color: #fff; }
.logo-mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--brand-900);
  font-weight: 900; font-size: 14px;
  box-shadow: 0 6px 18px var(--accent-glow);
  letter-spacing: -0.5px;
}
.logo-text { font-size: 1.15rem; letter-spacing: -0.01em; color: #fff; }
.logo-accent { color: var(--accent); }

.primary-nav { display: flex; align-items: center; gap: var(--sp-2); }
.nav-link {
  padding: 0.5rem 0.9rem; border-radius: 999px;
  font-size: 0.95rem; font-weight: 600;
  color: rgba(255,255,255,0.75);
  transition: color var(--tr-fast), background var(--tr-fast);
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-link.is-active { color: var(--brand-900); background: var(--accent); }

.nav-user {
  margin-left: var(--sp-3);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 0.85rem; color: rgba(255,255,255,0.85);
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px; font-weight: 600;
}
.nav-user-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(0,255,135,0.25);
}

.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
  width: 38px; height: 38px; border-radius: 999px;
  display: inline-grid; place-items: center;
  cursor: pointer;
  transition: color var(--tr-fast), background var(--tr-fast), border-color var(--tr-fast);
  flex-shrink: 0;
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
  display: none; background: transparent; border: 0;
  padding: 8px; width: 40px; height: 40px; color: #fff;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: currentColor; margin: 4px auto;
  transition: transform var(--tr), opacity var(--tr);
}

@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .primary-nav {
    position: fixed; inset: var(--header-h) 0 0 0;
    background: var(--brand-900);
    flex-direction: column; align-items: stretch;
    padding: var(--sp-5); gap: var(--sp-2);
    transform: translateX(100%);
    transition: transform var(--tr);
    border-left: 1px solid rgba(255,255,255,0.08);
  }
  .primary-nav.is-open { transform: translateX(0); }
  .nav-link {
    padding: 0.85rem 1rem; border-radius: var(--r);
    font-size: 1.05rem; border: 1px solid rgba(255,255,255,0.10);
    color: #fff;
  }
  .nav-link.is-active { color: var(--brand-900); background: var(--accent); border-color: transparent; }
  .nav-user { margin-top: auto; margin-left: 0; justify-content: center; }
  body.nav-open { overflow: hidden; }
}
body.picker-open { overflow: hidden; }

.site-main { padding-bottom: var(--sp-7); }

/* =============================================================
   Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.7rem 1.2rem;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: transform var(--tr-fast), background var(--tr-fast),
              color var(--tr-fast), border-color var(--tr-fast),
              box-shadow var(--tr-fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent); color: var(--brand-900);
  box-shadow: 0 6px 18px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-2); transform: translateY(-1px);
  box-shadow: 0 10px 24px var(--accent-glow);
}
.btn-ghost {
  background: var(--bg-card); color: var(--text);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-card-2); border-color: var(--text-muted); }
.btn-danger {
  background: rgba(239, 68, 68, 0.10);
  color: var(--hot);
  border-color: rgba(239, 68, 68, 0.35);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.18); }
.btn-lg { padding: 0.95rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.85rem; }

/* =============================================================
   Hero — always dark navy
   ============================================================= */
.hero {
  background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-800) 100%);
  color: #fff;
  padding: var(--sp-6) 0 var(--sp-7);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute;
  top: -150px; right: -150px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner {
  display: grid; gap: var(--sp-6);
  grid-template-columns: 1fr;
  align-items: center; position: relative;
}
@media (min-width: 880px) {
  .hero-inner { grid-template-columns: 1.2fr 0.9fr; gap: var(--sp-7); }
  .hero { padding: var(--sp-7) 0; }
}
.kicker {
  display: inline-block;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(0, 255, 135, 0.35);
  border-radius: 999px;
  background: rgba(0, 255, 135, 0.08);
  margin-bottom: var(--sp-4); font-weight: 700;
}
.hero-text h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 var(--sp-4);
  font-weight: 900; color: #fff;
}
.hero-text .hl { color: var(--accent); }
.hero-text .lead {
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.1rem; max-width: 56ch;
  margin: 0 0 var(--sp-5);
}
.cta-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.hero-stats { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.stat {
  display: flex; flex-direction: column;
  padding-right: var(--sp-5);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.stat:last-child { border-right: 0; padding-right: 0; }
.stat-value { font-size: 1.75rem; font-weight: 900; color: #fff; }
.stat-label { color: rgba(255, 255, 255, 0.65); font-size: 0.85rem; }

.hero-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-xl); padding: var(--sp-5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}
.card-title { margin: 0 0 var(--sp-2); font-size: 1.15rem; letter-spacing: -0.01em; color: #fff; font-weight: 800; }
.card-sub { margin: 0 0 var(--sp-5); color: rgba(255, 255, 255, 0.65); font-size: 0.9rem; }
.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.cd-cell {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r);
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
}
.cd-num {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 1.8rem; font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.cd-lbl {
  display: block; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px; font-weight: 600;
}
.lock-when { margin: 0; color: rgba(255, 255, 255, 0.7); font-size: 0.9rem; }

.how { padding: var(--sp-6) 0; }
.section-title {
  font-size: 1.6rem; letter-spacing: -0.015em;
  margin: 0 0 var(--sp-5) var(--sp-5); font-weight: 800;
}
.steps {
  display: grid; gap: var(--sp-4);
  grid-template-columns: 1fr;
  list-style: none; padding: 0; margin: 0;
}
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5); position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr), box-shadow var(--tr);
}
.steps li:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.step-num {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--brand-900);
  font-weight: 900; margin-bottom: var(--sp-3);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.steps h3 { margin: 0 0 var(--sp-2); font-size: 1.1rem; font-weight: 800; }
.steps p { margin: 0; color: var(--text-soft); }

/* =============================================================
   Footer
   ============================================================= */
.site-footer {
  background: var(--brand-900);
  color: rgba(255, 255, 255, 0.6);
  padding: var(--sp-5) 0;
  margin-top: var(--sp-7);
  font-size: 0.85rem;
}
.footer-inner { display: flex; flex-direction: column; gap: 4px; }
.footer-sub { margin: 0; }

/* =============================================================
   Common page header
   ============================================================= */
.page-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-6) 0 var(--sp-4);
}
.page-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em; font-weight: 900;
}
.page-sub { margin: 4px 0 0; color: var(--text-soft); }
.page-head-meta { color: var(--text-soft); font-size: 0.9rem; }

.lock-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(239, 68, 68, 0.10);
  color: var(--hot);
  padding: 0.3rem 0.7rem; border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(239, 68, 68, 0.30);
  font-weight: 600;
}
.lock-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--hot);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  100% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* =============================================================
   Team builder
   ============================================================= */
.builder-page { padding-bottom: var(--sp-7); }

.groups-panel {
  margin: 0 0 var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.groups-panel summary {
  list-style: none; cursor: pointer;
  padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; user-select: none;
}
.groups-panel summary::-webkit-details-marker { display: none; }
.groups-panel .chev { transition: transform var(--tr); color: var(--text-muted); }
.groups-panel[open] .chev { transform: rotate(180deg); }
.groups-body { padding: 0 var(--sp-4) var(--sp-4); }
.groups-body img {
  width: 100%; border-radius: var(--r);
  border: 1px solid var(--line);
}

.step-block { margin-top: var(--sp-5); }
.step-title {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 1.2rem; margin: 0 0 var(--sp-4);
  letter-spacing: -0.015em; font-weight: 800;
}
.step-pill {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--brand-900);
  font-size: 0.85rem; font-weight: 900;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.formation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
@media (min-width: 540px) { .formation-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 880px) { .formation-grid { grid-template-columns: repeat(7, 1fr); } }

.formation-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-3);
  transition: transform var(--tr-fast), border-color var(--tr-fast),
              background var(--tr-fast), box-shadow var(--tr-fast);
  box-shadow: var(--shadow-sm);
}
.formation-card:hover:not(:disabled) {
  border-color: var(--text-muted);
  transform: translateY(-2px); box-shadow: var(--shadow);
}
.formation-card.is-selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(0, 255, 135, 0.10), rgba(0, 255, 135, 0.02));
  box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.18), var(--shadow);
}
.formation-card .f-name {
  font-weight: 900; font-size: 1.2rem; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.formation-card .f-mini {
  font-size: 0; line-height: 6px;
  display: block; text-align: center;
}
.formation-card .f-mini .dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; margin: 1.5px;
  background: var(--text-muted);
}
.formation-card .f-mini .dot.gk  { background: var(--pos-gk); }
.formation-card .f-mini .dot.def { background: var(--pos-def); }
.formation-card .f-mini .dot.mid { background: var(--pos-mid); }
.formation-card .f-mini .dot.fwd { background: var(--pos-fwd); }
.formation-card:disabled { cursor: not-allowed; opacity: 0.5; }

.builder-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-3);
}
.toolbar-right { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.counter {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-weight: 900; font-size: 1.1rem;
  background: var(--bg-card); border: 1px solid var(--line);
  padding: 0.35rem 0.8rem; border-radius: var(--r);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}
.counter-sep { color: var(--text-muted); margin: 0 1px; font-weight: 600; }
.formation-tag {
  background: var(--accent); color: var(--brand-900); border: 0;
  padding: 0.35rem 0.8rem; border-radius: var(--r);
  font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.formation-tag.sm { font-size: 0.78rem; padding: 0.2rem 0.55rem; }

/* =============================================================
   The pitch — 3D perspective
   ============================================================= */
.pitch-wrap {
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  box-shadow: var(--shadow-lg);
  position: relative;
  background: radial-gradient(ellipse at top, var(--brand-700) 0%, var(--brand-900) 60%);
  overflow: hidden;
}
.pitch-wrap::before {
  content: ""; position: absolute;
  top: -100px; left: 50%; transform: translateX(-50%);
  width: 400px; height: 200px;
  background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none; opacity: 0.6;
}

.pitch-stage {
  perspective: 1400px;
  perspective-origin: 50% 0%;
  width: 100%; display: flex;
  justify-content: center; position: relative;
}

.pitch {
  position: relative;
  width: 100%;
  max-width: 540px;
  aspect-ratio: 0.78 / 1;
  max-height: calc(100vh - 280px);
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      0deg,
      var(--pitch-grass-1) 0 32px,
      var(--pitch-grass-2) 32px 64px
    );
  /* The 3D tilt */
  transform: rotateX(22deg);
  transform-style: preserve-3d;
  transform-origin: 50% 100%;
  box-shadow:
    inset 0 0 0 3px var(--pitch-line),
    0 30px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
@media (min-width: 720px)  { .pitch { max-width: 600px; } }
@media (min-width: 1100px) { .pitch { max-width: 660px; } }
@media (max-height: 800px) and (min-width: 720px) {
  .pitch { max-height: calc(100vh - 130px); }
}

.pitch-line.halfway {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: var(--pitch-line);
}
.pitch-circle {
  position: absolute; left: 50%; top: 50%;
  width: 28%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid var(--pitch-line); border-radius: 50%;
}
.pitch-spot {
  position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--pitch-line);
}
.pitch-box {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 64%; height: 18%;
  border: 2px solid var(--pitch-line);
}
.pitch-box.top    { top: 0;    border-top: 0; }
.pitch-box.bottom { bottom: 0; border-bottom: 0; }
.pitch-box-inner {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 32%; height: 7%;
  border: 2px solid var(--pitch-line);
}
.pitch-box-inner.top    { top: 0;    border-top: 0; }
.pitch-box-inner.bottom { bottom: 0; border-bottom: 0; }
.pitch-arc {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 22%; aspect-ratio: 1;
  border: 2px solid var(--pitch-line); border-radius: 50%;
}
.pitch-arc.top    { top: 11%;    clip-path: inset(50% 0 0 0); }
.pitch-arc.bottom { bottom: 11%; clip-path: inset(0 0 50% 0); }

.slots-layer { position: absolute; inset: 0; }

/* Slot — counter-rotates so jerseys stand up while pitch is tilted */
.slot {
  position: absolute;
  transform: translate(-50%, -50%) rotateX(-22deg);
  transform-origin: 50% 100%;
  width: 20%; max-width: 110px; min-width: 64px;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  transition: filter var(--tr-fast);
  background: transparent; border: 0; padding: 0;
  z-index: 2;
}
.slot:hover {
  transform: translate(-50%, -50%) rotateX(-22deg) scale(1.06);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}
.slot:active {
  transform: translate(-50%, -50%) rotateX(-22deg) scale(0.98);
}

.slot .jersey-wrap {
  position: relative;
  width: 56px; height: 60px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
@media (min-width: 540px) { .slot .jersey-wrap { width: 60px; height: 64px; } }
@media (min-width: 1100px) { .slot .jersey-wrap { width: 68px; height: 72px; } }
.slot .jersey-wrap svg { width: 100%; height: 100%; display: block; }

.slot.is-empty .plus-badge {
  position: absolute;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand-900);
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.2rem;
  bottom: -8px; right: -4px;
  box-shadow: 0 4px 10px var(--accent-glow), 0 0 0 2px var(--brand-900);
}

.slot .info-badge {
  position: absolute;
  top: -2px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 4px;
  background: rgba(10, 20, 48, 0.85);
  color: #fff;
  display: grid; place-items: center;
  font-style: italic; font-weight: 700; font-size: 11px;
  font-family: Georgia, serif;
  z-index: 2;
}

.slot .label {
  margin-top: 6px;
  background: var(--brand-900);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px 4px 0 0;
  max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.slot.is-empty .label {
  background: rgba(10, 20, 48, 0.7);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
}
.slot .sub {
  margin-top: 0;
  background: var(--accent);
  color: var(--brand-900);
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 0 0 4px 4px;
  max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 800;
  text-align: center;
}

@media (min-width: 540px) {
  .slot .label { font-size: 0.75rem; max-width: 110px; }
  .slot .sub   { font-size: 0.65rem; max-width: 110px; }
}

/* =============================================================
   User team (read-only) & Players page additions
   ============================================================= */

/* Read-only slots: no hover lift, no cursor */
.slot.is-readonly {
  cursor: default;
}
.slot.is-readonly:hover {
  transform: translate(-50%, -50%) rotateX(-22deg);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
.slot.is-readonly:active {
  transform: translate(-50%, -50%) rotateX(-22deg);
}

/* Points pill in the sub line under a player on the read-only pitch.
   Reuses the green capsule styling but supports negative styling. */
.slot .sub .pts-pill {
  display: inline-block;
  padding: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.slot .sub .pts-pill.is-neg {
  color: #fff;
}
.slot .sub:has(.pts-pill.is-neg) {
  background: var(--hot);
  color: #fff;
}

/* Locked-state card shown when viewing another user's team before the lock */
.locked-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.locked-card .locked-icon {
  width: 72px; height: 72px;
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(245, 158, 11, 0.12);
  color: var(--warm);
}
.locked-card h2 {
  margin: 0 0 var(--sp-2);
  font-size: 1.4rem;
  letter-spacing: -0.015em;
  font-weight: 800;
}
.locked-card p { margin: 0 0 var(--sp-4); }
.countdown-light {
  max-width: 420px; margin: var(--sp-4) auto;
}
.countdown-light .cd-cell {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
}
.countdown-light .cd-num { color: var(--text); }
.countdown-light .cd-lbl { color: var(--text-muted); }

.points-big {
  color: var(--accent-deep);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: 1.05em;
}

/* Score table — variant of leaderboard table with section headers */
.scores-table .num-col {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  width: 70px;
}
.scores-table .num-col.is-neg {
  color: var(--hot);
}
.scores-table .total-col {
  background: var(--bg-card-2);
  font-weight: 900;
  color: var(--text);
}
.scores-table .pos-head td {
  background: var(--bg-card-2);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  padding-top: var(--sp-3); padding-bottom: var(--sp-3);
}
.scores-table .player-cell {
  font-weight: 700;
}

/* Players page top-scorer table: same look as scores-table */
.players-table .pos-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.players-table .pos-tag.gk  { background: rgba(245, 158, 11, 0.15); color: var(--pos-gk); }
.players-table .pos-tag.def { background: rgba(59, 130, 246, 0.15); color: var(--pos-def); }
.players-table .pos-tag.mid { background: rgba(16, 185, 129, 0.15); color: var(--pos-mid); }
.players-table .pos-tag.fwd { background: rgba(239, 68, 68, 0.15);  color: var(--pos-fwd); }

.players-table .rank-cell {
  width: 60px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; font-weight: 800;
}
.players-table .rank-cell.is-top { color: var(--accent-deep); }

/* Username link in the leaderboard */
.user-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color var(--tr-fast), color var(--tr-fast);
}
.user-link:hover { color: var(--accent-deep); border-bottom-color: var(--accent-deep); }
.user-link.is-locked {
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

@keyframes slotPop {
  0%   { transform: translate(-50%, -50%) rotateX(-22deg) scale(0.7); opacity: 0; }
  60%  { transform: translate(-50%, -50%) rotateX(-22deg) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotateX(-22deg) scale(1);    opacity: 1; }
}
.slot.is-filled:not(.is-readonly) { animation: slotPop 280ms cubic-bezier(.2,.8,.3,1.2); }

.submit-bar {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-2); margin-top: var(--sp-5);
}
.submit-help { color: var(--text-muted); font-size: 0.85rem; margin: 0; text-align: center; }
.submit-help.locked-help {
  margin: var(--sp-5) auto 0;
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text-soft);
}
.submit-help.locked-help { display: flex; justify-content: center; max-width: 480px; }
.saved-pill {
  display: inline-block;
  background: var(--accent);
  color: var(--brand-900);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
}

/* =============================================================
   Picker (modal/drawer)
   ============================================================= */
.picker-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 20, 48, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn var(--tr); overflow: hidden;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 720px) {
  .picker-overlay { align-items: center; padding: var(--sp-4); }
}
.picker {
  width: 100%;
  max-width: min(680px, 100vw);
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--tr);
  min-width: 0; flex-shrink: 1;
  overflow: hidden;
}
@media (min-width: 720px) { .picker { border-radius: var(--r-xl); max-height: 80vh; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.picker-head {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: start; justify-content: space-between;
  gap: var(--sp-3);
  background: var(--brand-900); color: #fff;
  min-width: 0;
}
.picker-head > div { min-width: 0; flex: 1; }
.picker-head h3 { margin: 0; font-size: 1.1rem; font-weight: 800; color: #fff; }
.picker-head p {
  margin: 4px 0 0; font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  word-wrap: break-word; overflow-wrap: break-word;
}
@media (min-width: 540px) { .picker-head { padding: var(--sp-4) var(--sp-5); } }

.picker-close {
  background: transparent; border: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.6rem; line-height: 1; padding: 4px 10px;
  border-radius: 8px; flex-shrink: 0;
}
.picker-close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

.picker-controls {
  padding: var(--sp-3) var(--sp-4);
  display: flex; gap: var(--sp-3); flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  background: var(--bg-card-2);
}
@media (min-width: 540px) { .picker-controls { padding: var(--sp-3) var(--sp-5); } }
.picker-controls input[type="search"] {
  flex: 1 1 100%; min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  border-radius: var(--r);
  font-size: 0.95rem; outline: none;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
@media (min-width: 540px) {
  .picker-controls input[type="search"] { flex: 1 1 auto; min-width: 200px; }
}
.picker-controls input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.picker-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-2) var(--sp-3);
  flex: 1 1 auto; min-height: 0;
  background: var(--bg-card);
}
.picker-team-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-card);
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  display: flex; align-items: center; gap: var(--sp-2);
}
.picker-team-head .mini-jersey {
  width: 16px; height: 17px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}
.player-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r);
  cursor: pointer; transition: background var(--tr-fast);
}
.player-row:hover { background: var(--hover); }
.player-row.is-disabled {
  opacity: 0.45; cursor: not-allowed;
  background: transparent !important;
}
.player-row.is-selected {
  background: rgba(0, 255, 135, 0.10);
  border: 1px solid rgba(0, 255, 135, 0.35);
}
.player-row .pr-jersey {
  width: 36px; height: 38px; flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.player-row .pr-info { min-width: 0; flex: 1; }
.player-row .pr-name { font-weight: 700; color: var(--text); }
.player-row .pr-meta {
  font-size: 0.8rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-row .pr-team-tag {
  font-size: 0.7rem; padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-soft);
  border: 1px solid var(--line);
  flex-shrink: 0; font-weight: 600;
}
.player-row.is-disabled .pr-team-tag {
  background: rgba(239, 68, 68, 0.10);
  color: var(--hot);
  border-color: rgba(239, 68, 68, 0.30);
}

.picker-empty {
  text-align: center; color: var(--text-muted);
  padding: var(--sp-6) var(--sp-4);
}

/* =============================================================
   Leaderboard
   ============================================================= */
.empty-state {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg-card);
}
.empty-state h2 { margin: 0 0 var(--sp-2); font-weight: 800; }
.empty-state p { margin: 0 0 var(--sp-4); color: var(--text-soft); }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.leaderboard { width: 100%; border-collapse: collapse; }
.leaderboard th, .leaderboard td {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.leaderboard tbody tr:last-child td { border-bottom: 0; }
.leaderboard th {
  background: var(--bg-card-2);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}
.leaderboard .num { width: 60px; color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.leaderboard tr.is-me td { background: rgba(0, 255, 135, 0.06); }
.user-cell { display: inline-flex; align-items: center; gap: var(--sp-3); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--brand-900); font-weight: 900;
}
.me-tag {
  font-size: 0.7rem;
  background: var(--accent); color: var(--brand-900);
  padding: 1px 6px; border-radius: 999px;
  margin-left: var(--sp-2); font-weight: 800;
}
.points-cell { color: var(--text-muted); font-style: italic; }

@media (max-width: 600px) {
  .leaderboard th, .leaderboard td { padding: var(--sp-3); }
  .hide-sm { display: none; }
}

/* =============================================================
   Rules
   ============================================================= */
.prose {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  max-width: 76ch;
  box-shadow: var(--shadow-sm);
}
.prose h2 {
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: 1.15rem; letter-spacing: -0.01em;
  font-weight: 800;
}
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { color: var(--text-soft); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose a {
  color: var(--accent-deep);
  border-bottom: 1px dashed currentColor;
  transition: color var(--tr-fast);
}
.prose a:hover { color: var(--text); border-bottom-style: solid; }

/* Two-column scoring layout. Stacks vertically on narrow screens so
   rows with long descriptions remain readable. */
.scoring-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 960px) {
  .scoring-grid { grid-template-columns: 1fr 1fr; }
}
.scoring-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.scoring-table {
  width: 100%;
  border-collapse: collapse;
}
.scoring-table th, .scoring-table td {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.45;
}
.scoring-table tbody tr:last-child td { border-bottom: 0; }
.scoring-table thead th {
  background: var(--bg-card-2);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}
.scoring-table .pts-col {
  width: 70px;
  text-align: left;
  white-space: nowrap;
}
.pts-badge {
  display: inline-block;
  min-width: 36px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-weight: 800;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: -0.01em;
}
.pts-badge.is-plus  { background: var(--accent); color: var(--brand-900); }
.pts-badge.is-minus { background: var(--hot);    color: #fff; }

/* =============================================================
   Toasts
   ============================================================= */
.toast-root {
  position: fixed; left: 0; right: 0; bottom: 18px;
  z-index: 200;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
  padding: 0 var(--sp-3);
}
.toast {
  pointer-events: auto;
  min-width: 240px; max-width: 90vw;
  padding: 0.75rem 1rem; border-radius: var(--r);
  background: var(--brand-900); color: #fff;
  border: 1px solid var(--brand-700);
  box-shadow: var(--shadow-lg);
  font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.6rem;
  animation: toastIn var(--tr); font-weight: 600;
}
.toast.is-success { border-color: var(--accent); }
.toast.is-error   { border-color: rgba(239, 68, 68, 0.6); }
.toast .toast-dot {
  width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.5);
}
.toast.is-success .toast-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(0, 255, 135, 0.2); }
.toast.is-error   .toast-dot { background: var(--hot);    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2); }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.toast.is-leaving { animation: toastOut 200ms forwards; }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }
