    /* ── FIFA 20 COLOUR PALETTE ── */
    :root {
      --f-bg:          #080d1c;
      --f-surface:     #0d1530;
      --f-surface-2:   #111d40;
      --f-border:      #1a3260;
      --f-border-2:    #243d6e;
      --f-blue:        #1a6cf5;
      --f-blue-lt:     #3a82ff;
      --f-blue-dk:     #0d55d4;
      --f-gold:        #f5a01a;
      --f-gold-dk:     #d4880d;
      --f-green:       #00c875;
      --f-red:         #ff3c50;
      --f-amber:       #f5c518;
      --f-text:        #dde4f0;
      --f-muted:       #6a85a8;
      --f-link:        #7eb8ff;

      --bs-body-color:       #dde4f0;
      --bs-body-color-rgb:   221,228,240;
      --bs-body-bg:          #080d1c;
      --bs-secondary-color:  #6a85a8;
      --bs-border-color:     #1a3260;
      --bs-secondary-bg:     #111d40;
      --bs-tertiary-bg:      #0d1530;
    }

    *, *::before, *::after { font-family: 'Roboto', sans-serif; }

    body { background: var(--f-bg); color: var(--f-text); min-height: 100vh; }

    a { color: var(--f-link); text-decoration: none; }
    a:hover { color: var(--f-link); text-decoration: none; font-weight: 600; }

    /* ── HEADINGS / PAGE TITLE ── */
    h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -.01em; }

    /* ── CARDS ── */
    .card { background: var(--f-surface); border: 1px solid var(--f-border); border-radius: 10px; }
    .card-header { background: var(--f-surface-2); border-bottom: 1px solid var(--f-border); font-weight: 600; letter-spacing: .01em; border-radius: 10px 10px 0 0; overflow: hidden; }

    /* ── NAV TABS ── */
    .nav-tabs { border-bottom: 2px solid var(--f-border); gap: 2px; }
    .nav-tabs .nav-link {
      color: var(--f-muted); border: none; border-bottom: 3px solid transparent;
      border-radius: 0; padding: 8px 18px; margin-bottom: -2px;
      font-weight: 500; letter-spacing: .03em; text-transform: uppercase; font-size: .82rem;
      transition: color .2s, border-color .2s, background .2s;
    }
    .nav-tabs .nav-link:hover { color: var(--f-text); background: rgba(26,108,245,.08); border-color: transparent; }
    .nav-tabs .nav-link.active { background: transparent; color: #fff; border-bottom-color: var(--f-blue); font-weight: 700; }

    /* ── BUTTONS ── */
    .btn {
      font-weight: 600; border-radius: 6px; letter-spacing: .04em; font-size: .85rem;
      text-transform: uppercase; border: none;
      transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    }
    .btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.4); filter: brightness(1.1); }
    .btn:active { transform: translateY(0);    box-shadow: none; filter: brightness(.95); }

    .btn-primary   { background: linear-gradient(135deg, var(--f-blue)  0%, var(--f-blue-dk) 100%); color: #fff; }
    .btn-success   { background: linear-gradient(135deg, #00d984        0%, #009e60         100%); color: #fff; }
    .btn-danger    { background: linear-gradient(135deg, var(--f-red)   0%, #c02030         100%); color: #fff; }
    .btn-warning   { background: linear-gradient(135deg, var(--f-gold)  0%, var(--f-gold-dk)100%); color: #080d1c; }
    .btn-primary:hover, .btn-primary:focus { color: #fff; }
    .btn-success:hover, .btn-success:focus { color: #fff; }
    .btn-danger:hover,  .btn-danger:focus  { color: #fff; }
    .btn-warning:hover, .btn-warning:focus { color: #080d1c; }

    .btn-outline-secondary {
      border: 1px solid var(--f-border-2); color: var(--f-muted);
      background: transparent; text-transform: uppercase;
    }
    .btn-outline-secondary:hover { background: var(--f-surface-2); border-color: var(--f-blue); color: var(--f-text); }

    .btn-outline-danger  { border: 1px solid var(--f-red); color: var(--f-red); background: transparent; text-transform: uppercase; }
    .btn-outline-danger:hover  { background: var(--f-red); color: #fff; }

    .btn-outline-primary { border: 1px solid var(--f-blue); color: var(--f-blue); background: transparent; text-transform: uppercase; }
    .btn-outline-primary:hover { background: var(--f-blue); color: #fff; }

    .btn-sm { font-size: .75rem; padding: .3rem .7rem; }

    /* ── FORMS ── */
    .form-control, .form-select {
      background: var(--f-bg); color: var(--f-text);
      border: 1px solid var(--f-border); border-radius: 6px;
    }
    .form-control:focus, .form-select:focus {
      background: var(--f-bg); color: var(--f-text);
      border-color: var(--f-blue); box-shadow: 0 0 0 3px rgba(26,108,245,.2);
    }
    .form-control::placeholder { color: var(--f-muted); }
    .form-label { font-size: .78rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

    /* ── PLAYER BADGES ── */
    .player-badge {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--f-surface-2); border: 1px solid var(--f-border);
      border-radius: 6px; padding: 4px 10px; margin: 3px; font-size: .85rem;
    }
    .player-badge .remove-btn { background: none; border: none; color: var(--f-muted); cursor: pointer; padding: 0; line-height: 1; font-size: .9rem; }
    .player-badge .remove-btn:hover { color: var(--f-red); }
    .team1-badge { background: rgba(0,200,117,.1); border-color: var(--f-green); color: var(--f-green); }
    .team2-badge { background: rgba(255,60,80,.12); border-color: var(--f-red); color: #ff8090; }

    /* ── TABLE ── */
    .table { color: var(--f-text); }
    .table > thead > tr > th { background: var(--f-surface-2); border-color: var(--f-border); white-space: nowrap; font-weight: 700; letter-spacing: .05em; font-size: .75rem; text-transform: uppercase; color: var(--f-muted); }
    .table > tbody > tr > td { border-color: var(--f-border); }
    .table > tbody > tr:hover > td { background: rgba(26,108,245,.07); }
    .sortable { cursor: pointer; user-select: none; }
    .sortable:hover { color: var(--f-blue-lt); }
    .sort-active { color: var(--f-blue-lt); }
    .page-size-bar { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--f-muted); }
    .page-size-bar a { color: var(--f-muted); text-decoration: none; padding: 1px 4px; border-radius: 4px; }
    .page-size-bar a:hover { color: var(--f-text); }
    .page-size-bar a.pgs-active { color: var(--f-text); font-weight: 700; }

    /* ── MATCH HISTORY ── */
    .match-card { background: var(--f-surface); border: 1px solid var(--f-border); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
    .match-card-header { padding: 10px 14px; border-bottom: 1px solid var(--f-border); }
    .match-result-win1 { color: var(--f-green); font-weight: 700; }
    .match-result-win2 { color: var(--f-red);   font-weight: 700; }
    .match-result-draw { color: var(--f-amber);  font-weight: 700; }
    .match-cost-bar { font-size: .78rem; color: var(--f-muted); padding: 5px 14px; border-bottom: 1px solid var(--f-border); background: var(--f-bg); }
    .match-cost-bar strong { color: var(--f-text); }
    .match-teams { padding: 10px 14px 12px; }
    .hist-player-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: .85rem; }
    .hist-player-name { flex: 1; color: var(--f-text); }

    /* ── WIN BAR ── */
    .win-bar { height: 6px; border-radius: 3px; background: var(--f-border); overflow: hidden; margin-top: 4px; }
    .win-bar-fill { height: 100%; background: linear-gradient(90deg, var(--f-blue), var(--f-green)); transition: width .3s; }

    /* ── STAT BADGES ── */
    .stat-badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: .75rem; font-weight: 700; letter-spacing: .03em; }
    .stat-w { background: rgba(26,108,245,.15); color: #7ab3ff; }
    .stat-d { background: rgba(245,197,24,.12); color: var(--f-amber); }
    .stat-l { background: rgba(255,60,80,.12);  color: #ff8090; }

    .empty-state { color: var(--f-muted); font-size: .9rem; text-align: center; padding: 16px 0; }

    /* ── DRAG & DROP ── */
    .drop-zone { min-height: 52px; border: 2px dashed transparent; border-radius: 8px; padding: 4px; transition: border-color .15s, background .15s; }
    .drop-zone.drag-over              { border-color: var(--f-blue);  background: rgba(26,108,245,.07); }
    .drop-zone.team1-drop.drag-over   { border-color: var(--f-green); background: rgba(0,200,117,.07); }
    .drop-zone.team2-drop.drag-over   { border-color: var(--f-red);   background: rgba(255,60,80,.09); }
    .player-badge[draggable="true"]   { cursor: grab; }
    .player-badge.is-dragging         { opacity: .3; cursor: grabbing; }
    /* ── Teams section ── */
    .teams-table { display: grid; grid-template-columns: 1fr 36px 1fr; grid-template-rows: auto; }
    .teams-table-label { padding: 0 4px 4px; font-size: .78rem; color: var(--f-muted); }
    .teams-table-label.t2-label { text-align: right; }
    .team-drop-col { display: flex; flex-direction: column; }
    .team-slot { height: 36px; min-height: 0; display: flex; align-items: center; padding: 2px 6px;
                 border: none; border-radius: 0; border-bottom: 1px solid var(--f-border); }
    .team-slot:first-child { border-top: 1px solid var(--f-border); }
    .team-slot.drag-over { background: rgba(255,255,255,.04); }
    .team-slot.team1-drop.drag-over { background: rgba(0,200,117,.07); }
    .team-slot.team2-drop.drag-over { background: rgba(255,60,80,.07); }
    .team-slot .player-badge { margin: 0; width: 100%; justify-content: space-between; }
    .team-slot-empty { color: var(--f-muted); font-size: .8rem; opacity: .4; user-select: none; }
    .teams-vs-col { display: flex; flex-direction: column; }
    .teams-vs-item { height: 36px; display: flex; align-items: center; justify-content: center;
                     border-bottom: 1px solid var(--f-border);
                     font-size: .68rem; font-weight: 600; color: var(--f-muted); opacity: .4; letter-spacing: .04em; }
    .teams-vs-item:first-child { border-top: 1px solid var(--f-border); }
    .unassigned-grid { display: grid; grid-template-columns: 1fr 1fr; }
    .unassigned-slot { height: 36px; display: flex; align-items: center; padding: 2px 6px;
                       border-bottom: 1px solid var(--f-border); }
    .unassigned-slot:nth-child(-n+2) { border-top: 1px solid var(--f-border); }
    .unassigned-slot:nth-child(odd)  { border-right: 1px solid var(--f-border); }
    .unassigned-slot.drag-over { background: rgba(255,255,255,.04); }
    .unassigned-slot .player-badge { margin: 0; width: 100%; }
    .teams-actions { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; }

    /* ── ADMIN TOPBAR ── */
    .admin-topbar {
      background: var(--f-surface); border-bottom: 1px solid var(--f-border);
      padding: 12px 24px; display: flex; align-items: center; gap: 12px;
      position: sticky; top: 0; z-index: 10;
    }

    /* ── MODALS ── */
    #pw-modal-backdrop, #merge-modal-backdrop {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,.75); align-items: center; justify-content: center;
    }
    #pw-modal-backdrop    { z-index: 1060; }
    #merge-modal-backdrop { z-index: 1070; }
    #pw-modal-backdrop.open, #merge-modal-backdrop.open { display: flex; }
    #pw-modal-box {
      background: var(--f-surface); border: 1px solid var(--f-border);
      border-radius: 12px; padding: 28px 32px; width: 100%; max-width: 360px;
    }

    /* ── MAPPINGS ── */
    .mapping-row { display: grid; grid-template-columns: 160px 1fr auto auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--f-border); }
    .mapping-row:last-child { border-bottom: none; }
    .discord-id-chip { font-family: monospace; font-size: .8rem; color: var(--f-muted); background: var(--f-bg); border: 1px solid var(--f-border); border-radius: 4px; padding: 2px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .discord-preview         { font-size: .78rem; color: var(--f-green); white-space: nowrap; }
    .discord-preview.loading { color: var(--f-muted); }
    .discord-preview.error   { color: var(--f-red); }

    /* ── SIGN-UP TAB ── */
    .queue-bar { height: 8px; border-radius: 4px; background: var(--f-border); overflow: hidden; margin-top: 6px; }
    .queue-bar-fill { height: 100%; border-radius: 4px; transition: width .4s, background .4s; }
    .signup-player { display: inline-flex; align-items: center; gap: 6px; background: var(--f-surface-2); border: 1px solid var(--f-border); border-radius: 6px; padding: 4px 10px; margin: 3px; font-size: .88rem; }
    .signup-player.si-team1 { background: rgba(0,200,117,.1);  border-color: var(--f-green); color: var(--f-green); }
    .signup-player.si-team2 { background: rgba(255,60,80,.12); border-color: var(--f-red);   color: #ff8090; }
    .signup-remove-btn { background: none; border: none; padding: 0; line-height: 1; font-size: .8rem; color: var(--f-muted); cursor: pointer; transition: color .15s; }
    .signup-remove-btn:hover { color: var(--f-red); }
    .match-info-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--f-border); }
    .match-info-row:last-child { border-bottom: none; }
    .match-info-label { color: var(--f-muted); font-size: .8rem; min-width: 80px; }

    @media (max-width: 576px) { .table { font-size: .8rem; } }

    /* ── PAYMENTS ── */
    .payment-match-card { background: var(--f-surface); border: 1px solid var(--f-border); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
    .payment-match-header { background: var(--f-surface-2); border-bottom: 1px solid var(--f-border); padding: 9px 14px; }
    .payment-match-body { padding: 10px 14px 12px; }
    .payment-team-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
    .team1-pay-label { color: var(--f-green); }
    .team2-pay-label { color: #ff8090; }

    .pay-player-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 5px; margin-bottom: 2px; cursor: pointer; transition: background .1s; }
    .pay-player-row:hover          { background: var(--f-surface-2); }
    .pay-player-row.is-paid        { background: rgba(0,200,117,.06); }
    .pay-player-row.is-unpaid      { background: rgba(255,60,80,.05); }
    .pay-player-row.is-highlighted { outline: 1px solid var(--f-blue); }
    .pay-player-row.fb-player      { cursor: default; opacity: .55; }
    .pay-player-row.fb-player:hover    { background: transparent; }
    .pay-player-row.is-excluded        { background: transparent; opacity: .5; cursor: default; }
    .pay-player-row.is-excluded:hover  { background: var(--f-surface-2); opacity: .65; }

    .pay-checkbox      { accent-color: var(--f-green); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
    .pay-excl-checkbox { width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
    .pay-player-name   { flex: 1; font-size: .88rem; }

    .pay-status-badge { font-size: .7rem; padding: 1px 7px; border-radius: 4px; white-space: nowrap; font-weight: 600; letter-spacing: .03em; }
    .paid-badge   { background: rgba(0,200,117,.15);  color: var(--f-green); }
    .unpaid-badge { background: rgba(255,60,80,.15);   color: var(--f-red); }
    .fb-badge     { background: rgba(106,133,168,.1);  color: var(--f-muted); }
    .excl-badge   { background: rgba(106,133,168,.1);  color: var(--f-muted); }

    .payment-counter { font-size: .8rem; padding: 2px 10px; border-radius: 6px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
    .pay-complete { background: rgba(0,200,117,.15);  color: var(--f-green); }
    .pay-partial  { background: rgba(245,160,26,.15); color: var(--f-gold); }
    .pay-none     { background: rgba(255,60,80,.15);  color: var(--f-red); }

    .payment-cost-bar { font-size: .78rem; color: var(--f-muted); padding: 5px 14px; border-bottom: 1px solid var(--f-border); background: var(--f-bg); }
    .payment-cost-bar strong { color: var(--f-text); }

    .payments-summary-bar { background: var(--f-surface-2); border: 1px solid var(--f-border); border-radius: 6px; padding: 8px 14px; font-size: .85rem; color: var(--f-muted); margin-bottom: 12px; }

    /* ── GENERAL STATS ── */
    .gstat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
    .gstat-tile-wide  { grid-column: 1 / -1; }
    .gstat-tile { background: var(--f-surface-2); border: 1px solid var(--f-border); border-radius: 10px; padding: 16px 14px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
    .gstat-tile .gstat-val  { font-size: 2rem; font-weight: 700; line-height: 1.1; }
    .gstat-tile .gstat-sub  { font-size: .75rem; color: var(--f-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }
    .gstat-tile .gstat-pct  { font-size: .8rem; color: var(--f-muted); margin-top: 2px; }
    .gstat-tile-dates { display: flex; flex-direction: row; align-items: center; gap: 0; grid-column: span 2; padding: 0; overflow: hidden; }
    .gstat-tile-dates .gstat-date-section { flex: 1; padding: 16px 14px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
    .gstat-tile-dates .gstat-date-val { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
    .gstat-tile-dates .gstat-dates-sep { width: 1px; background: var(--f-border); flex-shrink: 0; align-self: stretch; margin: 16px 0; }
    .season-winners-table th, .season-winners-table td { padding: 7px 12px; }
    .season-winner-badge { display: inline-block; background: rgba(245,160,26,.15); border: 1px solid var(--f-gold); border-radius: 20px; padding: 2px 10px; font-size: .85rem; color: var(--f-gold); margin: 2px; }
    .top5-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 4px; }
    .top5-card { background: var(--f-surface-2); border: 1px solid var(--f-border); border-radius: 10px; padding: 14px 16px; }
    .top5-card-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--f-muted); margin-bottom: 10px; white-space: nowrap; }
    .top5-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--f-border); }
    .top5-row:last-child { border-bottom: none; }
    .top5-rank { font-size: .75rem; color: var(--f-muted); flex-shrink: 0; width: 22px; text-align: right; }
    .top5-name { flex: 1; font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--f-link); text-decoration: none; }
    .top5-name:hover { font-weight: 600; }
    .top5-val  { font-size: .75rem; color: var(--f-muted); flex-shrink: 0; }
    .season-podiums { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
    .season-podium-card { background: var(--f-surface-2); border: 1px solid var(--f-border); border-radius: 10px; padding: 14px 16px; }
    .season-podium-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--f-muted); margin-bottom: 10px; }
    .podium-place { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--f-border); }
    .podium-place:last-child { border-bottom: none; }
    .podium-medal { font-size: 1rem; flex-shrink: 0; }
    .podium-players { flex: 1; font-size: .9rem; font-weight: 500; }
    .podium-players a { color: var(--f-link); text-decoration: none; }
    .podium-players a:hover { font-weight: 600; }
    .podium-pts { font-size: .75rem; color: var(--f-muted); flex-shrink: 0; }
    .pitch-wrap { position: relative; border-radius: 8px; overflow: hidden; max-width: 560px; margin: 0 auto; }
    .pitch-svg { width: 100%; display: block; }
    .pitch-bg   { fill: var(--f-bg); }
    .pitch-bg-s { fill: var(--f-surface); }
    .pitch-line { fill: none; stroke: var(--f-muted); stroke-opacity: .35; stroke-width: 0.4; }
    .pitch-spot { fill: var(--f-muted); fill-opacity: .35; }
    .pitch-players { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
    .pp { position: absolute; transform: translate(-50%, calc(-50% - 17px)); width: 34px; height: 34px; overflow: visible; }
    .pp-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.7); box-shadow: 0 1px 4px rgba(0,0,0,.6); }
    .pp-dot-t1 { background: var(--f-green); }
    .pp-dot-t2 { background: var(--f-red); }
    .pp-name { position: absolute; top: 37px; left: 50%; transform: translateX(-50%); font-size: .72rem; font-weight: 700; color: var(--f-text); text-shadow: 0 1px 3px rgba(0,0,0,.9); white-space: nowrap; max-width: 80px; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
    .pitch-legend { display: flex; align-items: center; gap: 6px; padding: 7px 12px; background: var(--f-surface-2); border-top: 1px solid var(--f-border); font-size: .8rem; }
    .pitch-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .pitch-legend-dot.t1 { background: var(--f-green); }
    .pitch-legend-dot.t2 { background: var(--f-red); }

    /* ── AUTOCOMPLETE ── */
    .player-suggest-wrap { position: relative; }
    .player-suggestions { position: absolute; top: 100%; left: 0; right: 0; z-index: 1050; background: var(--f-surface); border: 1px solid var(--f-border); border-top: none; border-radius: 0 0 8px 8px; max-height: 220px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
    .player-suggestion-item { padding: 7px 14px; cursor: pointer; font-size: .875rem; color: var(--f-text); line-height: 1.3; }
    .player-suggestion-item:hover, .player-suggestion-item.focused { background: rgba(26,108,245,.15); color: #fff; }
    .player-suggestion-item:hover .sugg-discord-id,
    .player-suggestion-item.focused .sugg-discord-id { color: rgba(255,255,255,.55); }
    .sugg-discord-id { display: block; font-size: .72rem; color: var(--f-muted); font-family: monospace; }
    .player-suggestion-new { padding: 7px 14px; font-size: .78rem; color: var(--f-muted); font-style: italic; }

    /* ── RESPONSIVE ── */

    /* Ranking sub-tabs: scrollable on mobile instead of wrapping */
    @media (max-width: 575px) {
      #rankingSubTabs, #adminTabs {
        flex-wrap: nowrap; overflow-x: auto;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
      }
      #rankingSubTabs::-webkit-scrollbar, #adminTabs::-webkit-scrollbar { display: none; }
      #rankingSubTabs .nav-link, #adminTabs .nav-link { white-space: nowrap; }
    }

    /* Top-5 grid: 1 column on mobile/tablet, 3 on desktop */
    @media (max-width: 767px) {
      .top5-grid { grid-template-columns: 1fr; }
      .top5-card { min-width: 0; }
      .top5-card-label { white-space: normal; }
    }

    /* General stats grid: 1 column on mobile, reset explicit spans */
    @media (max-width: 575px) {
      .gstat-grid { grid-template-columns: 1fr; }
      .gstat-tile-wide, .gstat-tile-dates { grid-column: auto; }
    }

    /* Teams action buttons: 2×2 on mobile */
    @media (max-width: 575px) { .teams-actions { grid-template-columns: 1fr 1fr; } }

    /* Admin topbar: tighter padding on mobile */
    @media (max-width: 575px) { .admin-topbar { padding: 10px 14px; } }

    /* Modals: reduce horizontal padding on small screens */
    @media (max-width: 479px) {
      #pw-modal-box { padding: 20px 18px; }
      #merge-modal-backdrop > div { padding: 20px 18px !important; }
    }

    /* Mapping rows: shrink the fixed Discord-ID column on mobile */
    @media (max-width: 575px) {
      .mapping-row { grid-template-columns: minmax(70px, 110px) 1fr auto auto; gap: 6px; }
      .discord-id-chip { max-width: 110px; }
    }

    /* Match history left-team column: swap border-right → border-bottom when stacked */
    .hist-team-left { border-right: 1px solid var(--f-border); }
    @media (max-width: 575px) {
      .hist-team-left { border-right: none; border-bottom: 1px solid var(--f-border); }
    }

    /* Page header: shrink title on very small screens */
    @media (max-width: 380px) { h1.fs-3 { font-size: 1.3rem !important; } }

    /* Touch drag handle — hidden on desktop, visible on touch devices */
    .drag-handle {
      display: none; align-items: center; justify-content: center;
      width: 20px; flex-shrink: 0; margin-left: auto;
      color: var(--f-muted); font-size: 1rem; line-height: 1;
      touch-action: none; user-select: none; cursor: grab;
    }
    @media (pointer: coarse) { .drag-handle { display: flex; } }

    /* Ghost element that follows the finger during touch drag */
    .touch-drag-ghost {
      position: fixed; z-index: 9999; pointer-events: none;
      opacity: .85; transform: scale(1.05);
    }

    /* Pitch player dots: scale on mobile */
    @media (min-width: 480px) and (max-width: 575px) {
      .pp      { width: 16px; height: 16px; transform: translate(-50%, calc(-50% - 8px)); }
      .pp-dot  { width: 16px; height: 16px; border-width: 1px; }
      .pp-name { font-size: .52rem; top: 18px; max-width: 44px; }
    }
    @media (max-width: 479px) {
      .pp      { width: 15px; height: 15px; transform: translate(-50%, calc(-50% - 18px)); }
      .pp-dot  { width: 15px; height: 15px; border-width: 1px; }
      .pp-name { font-size: .69rem; top: 18px; max-width: 45px; }
    }
  #scroll-top-btn {
    position: fixed; bottom: 28px; right: 28px; z-index: 9999;
    width: 56px; height: 56px; border-radius: 8px;
    background: var(--f-surface-2); border: 1px solid var(--f-border);
    color: var(--f-text); font-size: 1.4rem; line-height: 1;
    cursor: pointer; display: none; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
    transition: background .15s;
  }
  #scroll-top-btn:hover { background: var(--f-surface-3, #2a2f45); }
  #scroll-top-btn.visible { display: flex; }
