  :root{
    --bg:#ffffff;
    --surface:#ffffff;
    --surface-2:#f0f0f0;
    --text:#000000;
    --text-dim:#4a4a4a;
    --line:#000000;
    --line-soft:#d9d9d9;
    --accent:#a9720c;
    --accent-strong:#7a5209;
    --pitch:#3f6b3a;
    --pitch-line:rgba(255,255,255,.55);
    --good:#2f7a4f;
    --bad:#a3402f;
    --chip-bg:#f0f0f0;
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --bg:#000000;
      --surface:#000000;
      --surface-2:#161616;
      --text:#ffffff;
      --text-dim:#b3b3b3;
      --line:#ffffff;
      --line-soft:#2e2e2e;
      --accent:#e0b13a;
      --accent-strong:#f2c869;
      --pitch:#1e3320;
      --pitch-line:rgba(255,255,255,.16);
      --good:#5cc98a;
      --bad:#e07a67;
      --chip-bg:#161616;
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"]{
    --bg:#000000;
    --surface:#000000;
    --surface-2:#161616;
    --text:#ffffff;
    --text-dim:#b3b3b3;
    --line:#ffffff;
    --line-soft:#2e2e2e;
    --accent:#e0b13a;
    --accent-strong:#f2c869;
    --pitch:#1e3320;
    --pitch-line:rgba(255,255,255,.16);
    --good:#5cc98a;
    --bad:#e07a67;
    --chip-bg:#161616;
    color-scheme: dark;
  }

  /* Multi-player "whose turn is it" site theme. While it's a given player's
     turn to draft, the whole page tints to their color (not just their
     score card) so it's unmissable at a glance. !important + the html
     attribute selector guarantees this wins over both the light and dark
     --bg/--accent rules above, whichever the visitor's system prefers.
     These tint backgrounds are always pale, so --text/--text-dim/--line
     are always forced to their LIGHT-mode (dark-on-light) values here too --
     otherwise a visitor whose system is in dark mode keeps white text from
     the dark-mode rules above, which is unreadable on these light tints. */
  html[data-turn="0"]{ --bg:#eaf1ff!important; --surface:#f4f8ff!important; --surface-2:#e3ecff!important; --accent:#2563eb!important; --accent-strong:#1d4ed8!important; --text:#000000!important; --text-dim:#4a4a4a!important; --line:#000000!important; --line-soft:#d9d9d9!important; --chip-bg:#e3ecff!important; }
  html[data-turn="1"]{ --bg:#e9f9ef!important; --surface:#f3fbf6!important; --surface-2:#dff5e7!important; --accent:#16a34a!important; --accent-strong:#15803d!important; --text:#000000!important; --text-dim:#4a4a4a!important; --line:#000000!important; --line-soft:#d9d9d9!important; --chip-bg:#dff5e7!important; }
  html[data-turn="2"]{ --bg:#f2ecff!important; --surface:#f8f4ff!important; --surface-2:#e9defe!important; --accent:#7c3aed!important; --accent-strong:#6d28d9!important; --text:#000000!important; --text-dim:#4a4a4a!important; --line:#000000!important; --line-soft:#d9d9d9!important; --chip-bg:#e9defe!important; }
  html[data-turn="3"]{ --bg:#fff1e6!important; --surface:#fff7f0!important; --surface-2:#ffe6d1!important; --accent:#ea580c!important; --accent-strong:#c2410c!important; --text:#000000!important; --text-dim:#4a4a4a!important; --line:#000000!important; --line-soft:#d9d9d9!important; --chip-bg:#ffe6d1!important; }

  *{box-sizing:border-box;}
  body{
    margin:0;
    background:var(--bg);
    color:var(--text);
    font-family:Inter,system-ui,sans-serif;
    padding-inline:16px;
    padding-block:0 24px;
    transition:background-color .5s ease;
  }
  h1,h2,h3,.display{
    font-family:Anton,Inter,sans-serif;
    font-weight:400;
    letter-spacing:.02em;
    text-transform:uppercase;
    text-wrap:balance;
  }
  a{color:var(--accent-strong);}
  button{font-family:inherit;}

  .wrap{max-width:1080px;margin:0 auto;}

  /* ---------- Top bar ---------- */
  .topbar{
    display:flex;align-items:center;gap:12px;
    padding-block:14px;
    flex-wrap:wrap;
    border-bottom:3px solid var(--line);
    margin-bottom:6px;
  }
  .brand{
    display:flex;align-items:center;gap:10px;
    font-family:Anton,sans-serif;font-size:22px;
    text-transform:uppercase;letter-spacing:.03em;
  }
  .brand .dot{width:10px;height:10px;border-radius:50%;background:var(--accent);}
  .tabs{
    display:flex;gap:4px;margin-left:auto;
    background:var(--surface-2);border:2px solid var(--line);
    border-radius:999px;padding:4px;
  }
  .tab-btn{
    border:none;background:transparent;color:var(--text-dim);
    padding:8px 16px;border-radius:999px;font-size:14px;font-weight:600;
    cursor:pointer;
  }
  .tab-btn[aria-selected="true"]{background:var(--accent);color:#20160a;}

  #lb-mode-tabs{width:100%;}
  #lb-mode-tabs .tab-btn{
    flex:1 1 50%;background:#5a5a5a;color:#ffffff;font-weight:700;padding:12px 16px;
  }
  #lb-mode-tabs .tab-btn[aria-selected="true"]{background:var(--accent);color:#20160a;}

  .view{display:none;}
  .view.active{display:block;}

  /* ---------- Home ---------- */
  .hero{
    background:var(--surface);border:2px solid var(--line);border-radius:20px;
    padding:32px 24px;margin-block:8px 20px;
    display:grid;gap:18px;
  }
  .hero h1{font-size:clamp(28px,5vw,44px);margin:0;font-family:Anton,sans-serif;text-transform:uppercase;letter-spacing:.01em;}
  .hero p.lead{color:var(--text-dim);font-size:16px;max-width:60ch;margin:0;}
  .cta-row{display:flex;gap:12px;flex-wrap:wrap;}
  .btn{
    border:2px solid var(--line);border-radius:10px;padding:12px 22px;font-weight:800;
    font-size:15px;cursor:pointer;text-transform:uppercase;letter-spacing:.02em;
  }
  .btn.primary{background:var(--accent);color:#20160a;border-color:var(--line);}
  .btn.ghost{background:var(--surface-2);color:var(--text);border:2px solid var(--line);}
  .btn:disabled{opacity:.5;cursor:not-allowed;}

  .card{
    background:var(--surface);border:2px solid var(--line);border-radius:16px;
    padding:20px;
  }
  .grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px;}
  @media (max-width:720px){.grid-2{grid-template-columns:1fr;}}

  .section-title{font-size:22px;margin:0 0 12px;}
  .example{
    background:var(--surface-2);border-radius:12px;padding:14px 16px;
    font-size:14px;line-height:1.5;margin-top:10px;
  }
  .example b{color:var(--accent-strong);}

  ol.steps{padding-left:20px;line-height:1.7;}

  /* ---------- Draft view ---------- */
  .draft-top{
    display:flex;justify-content:space-between;align-items:center;
    flex-wrap:wrap;gap:12px;margin-block:14px;
  }
  .pick-counter{font-size:14px;color:var(--text-dim);font-variant-numeric:tabular-nums;}
  .club-banner{
    display:flex;align-items:center;gap:14px;justify-content:center;
    background:var(--surface);border:2px solid var(--line);border-radius:16px;
    padding:22px;margin-bottom:16px;text-align:center;flex-direction:column;
  }
  .club-banner .club-name{font-family:Anton;font-size:30px;text-transform:uppercase;}
  .pool-grid{
    display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
    gap:10px;margin-bottom:20px;
  }
  .player-pool-card{
    background:var(--surface);border:2px solid var(--line);border-radius:12px;
    padding:12px;cursor:pointer;transition:transform .1s;
    display:flex;flex-direction:column;gap:6px;
  }
  .player-pool-card:hover{transform:translateY(-2px);}
  .player-pool-card:hover{border-color:var(--accent);}
  .ppc-top{display:flex;justify-content:space-between;align-items:baseline;}
  .ppc-name{font-weight:700;font-size:14px;}
  .ppc-rating{font-family:Anton;font-size:20px;color:var(--accent-strong);font-variant-numeric:tabular-nums;}
  .ppc-meta{font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.04em;}
  .ppc-honours{font-size:12px;color:var(--text-dim);line-height:1.4;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}

  /* ---------- Board ---------- */
  .board-wrap{display:grid;grid-template-columns:1fr 220px;gap:18px;align-items:start;}
  @media (max-width:820px){.board-wrap{grid-template-columns:1fr;}}
  .pitch{
    position:relative;
    aspect-ratio: 400 / 520;
    background:linear-gradient(180deg,var(--pitch),color-mix(in srgb, var(--pitch) 78%, black));
    border-radius:18px;overflow:hidden;
  }
  .pitch svg{position:absolute;inset:0;width:100%;height:100%;}
  .slot{
    position:absolute;transform:translate(-50%,-50%);
    width:15.5%;aspect-ratio:1/0.82;
    background:rgba(255,255,255,.10);
    border:1.5px solid rgba(255,255,255,.3);
    border-radius:10px;
    display:flex;flex-direction:column;justify-content:center;align-items:center;
    padding:4px 3px;text-align:center;cursor:pointer;color:#fff;
    backdrop-filter:blur(1px);
  }
  .slot.selected{outline:3px solid var(--accent);z-index:2;}
  .slot.filled{background:rgba(0,0,0,.42);}
  .slot .slot-label{font-size:8px;letter-spacing:.04em;text-transform:uppercase;opacity:.75;}
  .slot .slot-name{font-size:11px;font-weight:700;line-height:1.15;margin-top:2px;}
  .slot .slot-rating{font-family:Inter;font-weight:600;font-size:19px;letter-spacing:.06em;font-variant-numeric:tabular-nums;}
  .slot .slot-chem{font-size:9px;color:#ffe08a;margin-top:1px;}

  .bench-row{
    display:grid;grid-template-columns:repeat(5,1fr);gap:8px;
    background:var(--surface-2);border:2px solid var(--line);border-radius:14px;padding:12px;
  }
  .bench-row .slot{
    position:static;transform:none;width:auto;aspect-ratio:auto;min-height:60px;
    background:var(--surface);color:var(--text);border-color:var(--line);
  }
  .bench-row .slot .slot-label{color:var(--text-dim);}

  /* ---------- Mobile: drag-up "Your Team" sheet ---------- */
  #team-sheet-handle{display:none;}
  @media (max-width:760px){
    #draft-active{padding-bottom:70px;}
    #draft-board-wrap:not(.hidden){
      position:fixed;left:0;right:0;bottom:0;z-index:60;
      background:var(--surface);
      border-top-left-radius:18px;border-top-right-radius:18px;
      box-shadow:0 -8px 28px rgba(0,0,0,.4);
      max-height:88vh;
      display:flex;flex-direction:column;
      transform:translateY(calc(100% - 58px));
      transition:transform .28s cubic-bezier(.2,.8,.3,1);
    }
    #draft-board-wrap.sheet-open{transform:translateY(0);}
    #draft-board-wrap.sheet-dragging{transition:none;}
    #team-sheet-handle{
      display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
      height:58px;flex-shrink:0;cursor:grab;touch-action:none;
      border-bottom:1px solid var(--line);
    }
    #team-sheet-handle .bar{width:38px;height:4px;border-radius:2px;background:var(--text-dim);}
    #team-sheet-handle span{font-size:12px;font-weight:700;color:var(--text-dim);letter-spacing:.03em;}
    #draft-board-wrap .sheet-scroll{
      flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:0 16px 20px;
    }
    #draft-board-wrap .sheet-scroll h2{padding-top:4px;margin-bottom:4px;font-size:17px;}
    /* Keep the pitch at its normal, undistorted 400:520 shape -- squashing
       the aspect-ratio or capping its width both backfired earlier. Instead:
       a compact score/chemistry strip up top (visible without scrolling),
       the pitch bled out to the full screen width, and the 5 bench slots
       moved off the horizontal row (which was eating a full extra screen's
       worth of vertical space) into a vertical column down the right edge
       of the pitch, so nothing needs to scroll past the ground itself. */
    #draft-board-wrap .sheet-scroll > p.muted{display:none;}
    #draft-board-wrap .board-wrap{display:flex;flex-direction:column-reverse;gap:10px;margin:0 -16px;}
    #draft-board-wrap .scorepanel{
      position:static;display:grid;grid-template-columns:repeat(4,1fr);gap:8px;
      padding:10px 12px;margin:0 16px;
    }
    #draft-board-wrap .scorepanel .total-box{
      grid-column:1/-1;padding:8px 12px;margin-top:0;flex-direction:row;
    }
    #draft-board-wrap .scorepanel .total-box .val{font-size:24px;}
    #draft-board-wrap .scorepanel .score-row{flex-direction:column;gap:0;font-size:11px;text-align:center;}
    #draft-board-wrap .scorepanel .score-row .val{font-size:15px;}
    /* Pitch + bench, full-bleed row: pitch on the left, bench a narrow
       vertical strip on the right. Both prior attempts (flex-grow+stretch,
       then a 1fr grid track) sized the pitch off its PARENT's box -- and
       something upstream (the fixed-position sheet's own sizing) meant that
       parent width wasn't resolving the way either flex or grid expected,
       so the pitch kept collapsing to zero. Fix: give the pitch an explicit
       width computed straight off the viewport (100vw minus the bench
       column), which needs no parent flex/grid sizing step at all -- just a
       definite length aspect-ratio can size the height from directly. */
    #draft-board-wrap .board-wrap > div:first-child{
      display:flex;align-items:flex-start;gap:5px;
    }
    #draft-board-wrap .pitch{
      flex:none;width:calc(100vw - 81px);border-radius:18px 0 0 18px;
    }
    #draft-board-wrap .slot{width:15%;padding:3px 2px;}
    #draft-board-wrap .slot .slot-label{font-size:6.5px;}
    #draft-board-wrap .slot .slot-name{font-size:9px;}
    #draft-board-wrap .slot .slot-rating{font-size:15px;}
    #draft-board-wrap .slot .slot-chem{font-size:7px;}
    #draft-board-wrap .bench-row{
      display:flex;flex-direction:column;flex:none;width:76px;
      margin:0 16px 0 0!important;padding:6px;gap:6px;border-radius:0 18px 18px 0;
    }
    #draft-board-wrap .bench-row .slot{min-height:56px;width:100%;position:static;transform:none;}
  }

  /* club-colored player cards */
  .player-pool-card{border-left-width:4px;border-left-style:solid;}

  .scorepanel{
    background:var(--surface);border:2px solid var(--line);border-radius:14px;padding:16px;
    display:grid;gap:10px;position:sticky;top:12px;
  }
  .score-row{display:flex;justify-content:space-between;font-size:14px;}
  .score-row .val{font-variant-numeric:tabular-nums;font-weight:700;}
  .total-box{
    background:var(--accent);color:#20160a;border-radius:10px;border:2px solid var(--line);
    padding:14px 16px;display:flex;justify-content:space-between;align-items:baseline;
    margin-top:4px;
  }
  .total-box .label{font-family:Anton;font-size:14px;letter-spacing:.06em;}
  .total-box .val{font-family:Anton;font-size:34px;font-variant-numeric:tabular-nums;line-height:1;color:#20160a;}

  /* ---------- Leaderboard ---------- */
  table.lb{width:100%;border-collapse:collapse;font-size:14px;}
  table.lb th{text-align:left;color:var(--text-dim);font-size:11px;text-transform:uppercase;letter-spacing:.05em;padding:8px;}
  table.lb td{padding:10px 8px;border-top:1px solid var(--line-soft);}
  table.lb tr:not(.lb-perfect):first-of-type td{font-weight:700;color:var(--accent-strong);}
  table.lb tr.lb-perfect td{
    background:linear-gradient(135deg,#fff4c2,#f0c419 45%,#b8860b);
    color:#3a2600;font-weight:800;border-top:1px solid #b8860b;
  }
  table.lb tr.lb-perfect:first-child td{border-top:none;}
  .lb-perfect-badge{letter-spacing:.04em;}
  .lb-perfect-badge::before{content:"✦ ";}

  /* ---------- Share ---------- */
  .share-card{
    background:var(--surface);
    border:2px solid var(--line);border-radius:18px;padding:22px;
  }
  .share-roster{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px;margin-top:14px;}
  .share-slot{background:var(--surface);border:1px solid var(--line-soft);border-radius:10px;padding:8px 10px;font-size:12px;}
  .share-slot .n{font-weight:700;}
  .share-slot .z{color:var(--text-dim);font-size:10px;text-transform:uppercase;}

  .tier-badge{
    display:inline-flex;align-items:baseline;gap:8px;
    font-family:Anton,sans-serif;font-size:26px;letter-spacing:.04em;text-transform:uppercase;
    padding:8px 18px;border-radius:999px;border:2px solid var(--line);margin-bottom:10px;
  }
  .tier-badge.shine{
    box-shadow:0 0 0 3px rgba(240,196,25,.25), 0 2px 10px rgba(184,134,11,.4);
    animation:tier-shine 2.4s ease-in-out infinite;
  }
  .tier-badge .tier-pct{font-family:Inter,sans-serif;font-size:12px;font-weight:700;letter-spacing:.02em;opacity:.85;}
  @keyframes tier-shine{
    0%,100%{ filter:brightness(1); }
    50%{ filter:brightness(1.18); }
  }

  /* ---------- Play gate (Single/Multi-Player) ---------- */
  .play-mode-block{margin-bottom:20px;}
  .play-mode-block:last-child{margin-bottom:0;}
  .play-mode-title{margin:0 0 4px;font-size:17px;}

  /* Flex + wrap instead of a strict grid so a leftover last row (e.g. 3
     across on top, 1 alone underneath for a 4-player game) centers itself
     instead of hugging the left edge the way an unfilled grid row would. */
  .mp-boards-grid{
    display:flex;flex-wrap:wrap;justify-content:center;gap:16px;
  }
  .mp-boards-grid > *{
    flex:1 1 260px;max-width:340px;
  }
  .ladder-card{
    background:var(--surface);border:2px solid var(--line);border-radius:14px;
    padding:6px 18px;margin:0 auto 18px;max-width:420px;
  }
  .ladder-list{list-style:none;margin:0;padding:0;}
  .ladder-list li{
    display:flex;align-items:baseline;gap:10px;padding:10px 0;
    border-bottom:1px solid var(--line-soft);
  }
  .ladder-list li:last-child{border-bottom:none;}
  .ladder-rank{font-family:Anton;font-size:18px;width:22px;flex:none;color:var(--text-dim);}
  .ladder-name{font-weight:700;flex:1;}
  .ladder-score{font-family:Anton;font-size:20px;font-variant-numeric:tabular-nums;}
  .ladder-winner .ladder-rank,.ladder-winner .ladder-score{color:var(--accent-strong);}
  .ladder-winner .ladder-name{color:var(--text);}
  .ladder-winner .ladder-name::after{content:" 🏆";}
  /* Multi-player score box sits between the player's name and their field,
     laid out horizontally (total banner on top, the three breakdown
     figures in a row underneath) instead of the solo sidebar layout. */
  #battle-boards-grid .board-wrap{grid-template-columns:1fr;}
  #battle-boards-grid .scorepanel{
    position:static;margin-bottom:14px;
    display:grid;grid-template-columns:repeat(3,1fr);gap:8px;
  }
  #battle-boards-grid .scorepanel .total-box{
    grid-column:1/-1;margin-top:0;
  }
  #battle-boards-grid .scorepanel .score-row{
    flex-direction:column;gap:0;font-size:11px;text-align:center;
  }
  #battle-boards-grid .scorepanel .score-row .val{font-size:16px;}

  /* Whose-turn tint, applied to the multiplayer club-banner during that
     player's pick -- 4 distinct colors, cycling by player index. */
  .club-banner.turn-p0{background:#2563eb;border-color:#1d4ed8;color:#fff;}
  .club-banner.turn-p1{background:#16a34a;border-color:#15803d;color:#fff;}
  .club-banner.turn-p2{background:#7c3aed;border-color:#6d28d9;color:#fff;}
  .club-banner.turn-p3{background:#ea580c;border-color:#c2410c;color:#fff;}
  .club-banner[class*="turn-p"] .muted{color:rgba(255,255,255,.85);}
  .club-banner[class*="turn-p"] .club-name{color:#fff;}

  .modal-backdrop{
    position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;
    align-items:center;justify-content:center;padding:16px;z-index:100;
  }
  .modal{
    background:var(--surface);border:2px solid var(--line);border-radius:16px;padding:22px;max-width:420px;width:100%;
    display:grid;gap:12px;
    /* The share card can run to 23 roster rows -- without a height cap and
       its own scrollbar it was taller than a phone screen with no way to
       reach the buttons at the bottom. */
    max-height:88vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
  }
  @media (max-width:480px){
    .modal{padding:16px;border-radius:14px;max-height:92vh;}
    .share-roster{grid-template-columns:repeat(auto-fill,minmax(128px,1fr));gap:6px;}
    .share-slot{padding:6px 8px;font-size:11px;}
    .tier-badge{font-size:20px;padding:6px 14px;}
    .tier-badge .tier-pct{font-size:10px;}
  }
  input[type=text]{
    background:var(--surface-2);border:2px solid var(--line);border-radius:8px;
    padding:10px 12px;color:var(--text);font-size:14px;width:100%;
  }
  .hidden{display:none!important;}
  .muted{color:var(--text-dim);font-size:13px;}

  .site-footer{
    margin-top:32px;padding:20px 0 32px;text-align:center;
    color:var(--text-dim);font-size:12px;border-top:1px solid var(--line-soft);
  }
  .site-footer a{color:var(--text-dim);text-decoration:underline;}
  .footer-sep{margin:0 8px;}

  .cookie-banner{
    position:fixed;left:0;right:0;bottom:0;z-index:500;
    background:#15181d;border-top:1px solid var(--line-soft);
    padding:14px 16px;display:flex;flex-wrap:wrap;gap:12px;
    align-items:center;justify-content:space-between;
  }
  .cookie-banner p{margin:0;font-size:13px;color:var(--text-dim);max-width:640px;}
  .cookie-banner a{color:var(--text);}
  .cookie-banner-actions{display:flex;gap:8px;flex-shrink:0;}