/* Self-hosted copies of the two Google Fonts the original widget loaded from
   fonts.googleapis.com, so the leaderboard renders offline too. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-var.woff2') format('woff2'); }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 200 700; font-display: swap; src: url('../fonts/oswald-var.woff2') format('woff2'); }

/* Ported verbatim from the live site's embedded leaderboard widget. */
#s4u-board {
    --blue: #0057b7;
    --blue-deep: #003d82;
    --gold: #ffd700;
    --ink: #16233a;
    --ink-soft: #5b6b84;
    --paper: #f6f7fb;
    --line: #e2e6ef;
    --up: #1a8f4c;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
    max-width: 860px;
    margin: 0 auto;
    box-sizing: border-box;
  }
  #s4u-board *, #s4u-board *::before, #s4u-board *::after {
    box-sizing: border-box;
  }

  .s4u-eyebrow {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--blue-deep);
    margin: 0 0 6px;
  }

  /* --- Progress card --- */
  .s4u-progress-card {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
    border-radius: 16px;
    padding: 22px 24px;
    color: #fff;
    margin-bottom: 18px;
  }
  .s4u-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
  }
  .s4u-amount {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 30px;
    line-height: 1;
  }
  .s4u-goal {
    font-size: 13px;
    opacity: 0.85;
  }
  .s4u-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.22);
    overflow: hidden;
  }
  .s4u-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--gold);
    transition: width 0.6s ease;
  }
  .s4u-progress-meta {
    display: flex;
    justify-content: flex-end;
    font-size: 12px;
    opacity: 0.85;
    margin-top: 8px;
  }

  /* --- Table (desktop) / Cards (mobile) --- */
  .s4u-table-wrap { display: none; }
  .s4u-cards-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 1800px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  @media (min-width: 700px) {
    .s4u-table-wrap { display: block; }
    .s4u-cards-wrap { display: none; }
  }

  .s4u-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 700px;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .s4u-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
  }
  .s4u-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 15px;
  }
  .s4u-table thead th {
    text-align: left;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding: 10px;
    background: var(--paper);
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
  }
  .s4u-table th.s4u-col-num, .s4u-table td.s4u-col-num { text-align: right; }
  .s4u-table tbody td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
  }
  .s4u-table tbody tr {
    cursor: pointer;
    transition: background 0.12s ease;
  }
  .s4u-table tbody tr:hover { background: var(--paper); }
  .s4u-table tbody tr:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
  .s4u-table tbody tr:last-child td { border-bottom: none; }

  .s4u-badge {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 12.5px;
    color: #fff;
    background: var(--ink-soft);
  }
  .s4u-badge[data-rank="1"] { background: linear-gradient(135deg, #ffd700, #c99700); color: #4a3a00; }
  .s4u-badge[data-rank="2"] { background: linear-gradient(135deg, #d9dee6, #9aa4b3); color: #2c3646; }
  .s4u-badge[data-rank="3"] { background: linear-gradient(135deg, #d99a5b, #a3662c); color: #3a2200; }
  .s4u-up-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 3px;
    margin-top: 5px;
    font-family: 'Inter', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--up);
    background: #e3f5ea;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.4;
  }
  .s4u-up-pill-arrow {
    font-size: 9px;
    line-height: 1;
  }

  .s4u-flag {
    width: 26px;
    height: 17px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  }

  .s4u-name-cell {
    font-weight: 600;
    font-size: 15px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .s4u-help99-mark {
    color: var(--ink-soft);
    font-weight: 700;
    margin-left: 1px;
  }

  .s4u-amount-cell {
    white-space: nowrap;
  }
  .s4u-amount-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 15px;
  }
  .s4u-delta-desktop {
    display: table-cell;
  }
  .s4u-delta-desktop-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 15px;
  }
  .s4u-donate {
    display: inline-block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--blue-deep);
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 4px 12px;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
  }
  .s4u-donate:hover { background: #eef1f8; border-color: var(--blue); }
  .s4u-donate:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
  .s4u-merch {
    display: inline-block;
    margin-right: 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: #7a4a00;
    background: #fff6e6;
    border: 1px solid #f0d9a8;
    padding: 4px 12px;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
  }
  .s4u-merch:hover { background: #fdecc8; border-color: #d9a83a; }
  .s4u-merch:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

  .s4u-vehicles-cell {
    white-space: nowrap;
  }
  .s4u-vehicles-num {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 19px;
    color: var(--blue-deep);
  }

  .s4u-actions-cell {
    text-align: right;
    white-space: nowrap;
  }
  .s4u-delta-pos { color: var(--up); }
  .s4u-delta-none { color: var(--ink-soft); font-weight: 400; }

  .s4u-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: background 0.12s ease;
  }
  .s4u-card:hover { background: #eef1f8; }
  .s4u-card:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

  .s4u-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
  }
  .s4u-card-name {
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .s4u-card-grid {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }
  .s4u-card-label {
    font-size: 10.5px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }
  .s4u-card-vehicles-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 19px;
    color: var(--blue-deep);
  }
  .s4u-card-amount-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 14px;
  }
  .s4u-card-delta-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 14px;
  }
  .s4u-card-actions {
    display: flex;
    gap: 8px;
  }
  .s4u-card-actions .s4u-donate,
  .s4u-card-actions .s4u-merch {
    flex: 1;
    text-align: center;
    margin-right: 0;
  }

  .s4u-footnote {
    font-size: 11px;
    color: var(--ink-soft);
    margin-top: 10px;
    line-height: 1.4;
  }
  .s4u-footnote p { margin: 0; }
  .s4u-footnote p + p { margin-top: 6px; }
  .s4u-footnote a { color: var(--blue-deep); text-decoration: none; }
  .s4u-footnote a:hover { text-decoration: underline; }

  .s4u-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    font-size: 11.5px;
    color: var(--ink-soft);
  }
  .s4u-footer a { color: var(--blue-deep); text-decoration: none; }
  .s4u-footer a:hover { text-decoration: underline; }

  .s4u-state-msg {
    padding: 30px 16px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
  }
