/* ============================================================
   VM-tipset 2026 — styles
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1a1d24;
  --text-muted: #5a6270;
  --text-faint: #9aa3af;
  --accent: #1f6feb;
  --accent-hover: #1858c4;
  --accent-soft: #e7f0fe;
  --success: #1f7a4d;
  --success-soft: #e3f5eb;
  --error: #c0341c;
  --error-soft: #fde8e3;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 100px; /* space for sticky submit-bar */
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 6px;
  margin-left: 8px;
}

.nav-links a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.nav-links a:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.nav-links a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.counter {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.counter #picksCount {
  font-weight: 600;
  color: var(--text);
}

/* ---------- Container ---------- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

.intro {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 20px;
}

/* ---------- Banner + välkomstkort ---------- */

.banner-link {
  display: block;
  margin: 0 0 20px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}

.banner-link:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.banner {
  display: block;
  width: 100%;
  height: auto;
}

.welcome {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  line-height: 1.55;
}

.welcome p {
  margin: 0 0 10px;
  color: var(--text);
}

.welcome p:last-child {
  margin-bottom: 0;
}

.welcome a {
  font-weight: 500;
}

@media (max-width: 640px) {
  .welcome {
    padding: 16px;
    font-size: 13px;
  }

  .banner-link {
    margin-bottom: 16px;
  }
}

/* ---------- Identity card ---------- */

.identity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.field input {
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Rounds ---------- */

.round {
  margin-bottom: 32px;
}

.round h2 {
  font-size: 18px;
  margin: 0 0 12px;
  padding-left: 4px;
}

.match-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.match-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.match-table thead {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.match-table th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 12px;
  white-space: nowrap;
}

.match-table th.col-pick {
  text-align: center;
  width: 88px;
}

.match-table th.col-date { width: 70px; }
.match-table th.col-group { width: 56px; }
.match-table th.col-home { text-align: right; padding-right: 18px; }
.match-table th.col-away { text-align: left; padding-left: 18px; }

.match-table tbody tr {
  border-top: 1px solid var(--border);
  transition: background-color 0.1s;
}

.match-table tbody tr:first-child {
  border-top: none;
}

.match-table tbody tr.group-break {
  border-top: 2px solid var(--border-strong);
}

.match-table tbody tr:hover {
  background: var(--surface-muted);
}

.match-table tbody tr.picked {
  background: rgba(31, 111, 235, 0.02);
}

.match-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.match-table .date {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  line-height: 1.25;
}

.match-table .date .d-day {
  display: block;
}

.match-table .date .d-time {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.match-table .group {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}

.match-table .home, .match-table .away {
  white-space: nowrap;
  font-weight: 500;
  width: 50%;
}

.match-table .home {
  text-align: right;
  padding-right: 18px;
}

.match-table .home-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.match-table .away {
  text-align: left;
  padding-left: 18px;
}

.match-table .away-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.match-table .flag {
  width: 26px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

/* Pick cells (1/X/2 with points) */

.match-table .pick {
  text-align: center;
  cursor: pointer;
  user-select: none;
  width: 86px;
  height: 52px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  transition: background-color 0.12s, color 0.12s, transform 0.06s;
  position: relative;
  padding: 6px;
}

@media (hover: hover) {
  .match-table .pick:hover {
    background: var(--accent-soft);
  }

  .match-table .pick.selected:hover {
    background: var(--accent-hover);
  }
}

.match-table .pick:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.match-table .pick .points {
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.match-table .pick .unit {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: 2px;
}

.match-table .pick.selected {
  background: var(--accent);
  color: white;
}

.match-table .pick.selected .points,
.match-table .pick.selected .unit {
  color: white;
}

.match-table .pick.selected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 11px;
  opacity: 0.9;
}

/* ---------- Tiebreaker ---------- */

.tiebreaker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.tiebreaker-card h2 {
  font-size: 18px;
  margin: 0 0 4px;
}

.tiebreaker-card p {
  color: var(--text-muted);
  margin: 0 0 12px;
  font-size: 14px;
}

.tiebreaker-card input {
  width: 120px;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.tiebreaker-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Status message ---------- */

.status-message {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.status-message.hidden {
  display: none;
}

.status-message.success {
  background: var(--success-soft);
  border-color: rgba(31, 122, 77, 0.2);
  color: var(--success);
}

.status-message.error {
  background: var(--error-soft);
  border-color: rgba(192, 52, 28, 0.2);
  color: var(--error);
}

/* ---------- Submit bar (sticky bottom) ---------- */

.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -4px 10px rgba(15, 23, 42, 0.04);
}

.submit-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.submit-hint {
  flex: 1;
  font-size: 14px;
  color: var(--text-muted);
}

.submit-hint.ready {
  color: var(--success);
  font-weight: 500;
}

#submitBtn {
  padding: 12px 28px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.06s;
  white-space: nowrap;
}

#submitBtn:hover:not(:disabled) {
  background: var(--accent-hover);
}

#submitBtn:active:not(:disabled) {
  transform: translateY(1px);
}

#submitBtn:disabled {
  background: var(--border-strong);
  color: var(--text-faint);
  cursor: not-allowed;
}

/* ---------- Leaderboard (Excel-stil med sticky-kolumner) ---------- */

.container--wide {
  max-width: 1600px;
}

.lb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.lb-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.lb-card-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.lb-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.lb-card-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.lb-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.lb-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lb-search {
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  min-width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lb-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.lb-table tbody tr.filtered-out {
  display: none;
}

.legend-bar {
  display: inline-block;
  width: 8px;
  height: 12px;
  border-radius: 1px;
}

.legend-bar.b1 { background: #2ea043; }
.legend-bar.bx { background: #3a3a3a; }
.legend-bar.b2 { background: #f59f00; }

.refresh-btn {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: background-color 0.12s;
}

.refresh-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.leaderboard-status {
  padding: 12px 24px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.leaderboard-status.hidden {
  display: none;
}

.leaderboard-status.error {
  background: var(--error-soft);
  color: var(--error);
}

/* Loading-state (visas tills första fetch är klar) */
.lb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.lb-loading.hidden {
  display: none;
}

.lb-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lb-spin 0.7s linear infinite;
}

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

.lb-table-wrapper {
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 180px);
}

.lb-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lb-table th,
.lb-table td {
  padding: 6px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.lb-table thead th {
  border-bottom: 2px solid var(--border-strong);
  vertical-align: bottom;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-muted);
}

/* Sticky columns (horisontell stickiness inom wrapper) */
.lb-table .sticky-col {
  position: sticky;
  background: var(--surface);
  z-index: 2;
}

/* Corner cells: sticky både vertikalt OCH horisontellt — högsta z-index */
.lb-table thead .sticky-col {
  background: var(--surface-muted);
  z-index: 4;
}

.lb-table .col-rank {
  left: 0;
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-table .col-name {
  left: 50px;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
}

.lb-table .col-points {
  left: 230px;
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
}

.lb-table .col-next {
  left: 310px;
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  border-right: 2px solid var(--border-strong);
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
}

/* Tbody sticky cells (override för body-cells) */
.lb-table tbody .sticky-col {
  font-weight: 500;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.lb-table tbody .rank {
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.lb-table tbody .name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.lb-table tbody .points {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  text-align: center;
}

.lb-table tbody .next {
  color: var(--text);
  font-size: 12px;
  border-right: 2px solid var(--border-strong);
}

/* Match columns */
.lb-table .match-col {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
  text-align: center;
  vertical-align: bottom;
  padding-bottom: 6px;
}

.lb-table .match-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 36px;
  margin-bottom: 2px;
}

.lb-table .match-bars .b {
  width: 18px;
  min-height: 1px;
  background: #ccc;
  border-radius: 2px 2px 0 0;
}

.lb-table .match-bars .b1 { background: #2ea043; }
.lb-table .match-bars .bx { background: #3a3a3a; }
.lb-table .match-bars .b2 { background: #f59f00; }

.lb-table .match-bar-labels {
  display: flex;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.lb-table .match-bar-labels span {
  width: 18px;
  text-align: center;
}

.lb-table .match-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-table tbody .match-cell {
  text-align: center;
  font-size: 11px;
  color: var(--text);
  border-left: 1px solid var(--border);
}

.lb-table tbody .match-cell.correct {
  background: #d4edda;
  color: #155724;
}

.lb-table tbody .match-cell.wrong {
  background: #f8d7da;
  color: #721c24;
}

.lb-table tbody tr.empty td.empty-cell {
  text-align: center;
  padding: 32px 12px;
  color: var(--text-muted);
  background: var(--surface);
  position: static;
}

/* ---------- Responsive: Tablet (≤ 768px) ---------- */

@media (max-width: 768px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar h1 {
    font-size: 15px;
  }

  .nav-links a {
    padding: 5px 10px;
    font-size: 13px;
  }

  .counter {
    font-size: 13px;
    width: 100%;
    margin-left: 0;
    text-align: right;
  }

  .container {
    padding: 16px 12px;
  }

  .identity-card {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .match-table {
    font-size: 13px;
  }

  .match-table th,
  .match-table td {
    padding: 8px 6px;
  }

  .match-table .pick {
    width: 64px;
    height: 48px;
  }

  .match-table .home,
  .match-table .away {
    gap: 6px;
  }

  .match-table .flag {
    width: 22px;
  }

  .match-table th.col-pick {
    width: 64px;
  }

  .submit-bar-inner {
    padding: 10px 12px;
  }

  .submit-hint {
    font-size: 12px;
  }

  #submitBtn {
    padding: 10px 18px;
    font-size: 14px;
  }

  .leaderboard-card {
    padding: 16px;
  }

  /* Topplistan: krympa sticky-kolumnerna, dölj "Nästa match" på mobil */
  .container--wide {
    padding: 12px 8px;
  }

  .lb-card-header {
    padding: 14px 16px;
  }

  .lb-card-header h2 { font-size: 17px; }
  .lb-subtitle { font-size: 12px; }
  .lb-legend { font-size: 11px; gap: 8px; }

  .lb-table .col-rank {
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    padding: 6px 4px;
  }

  .lb-table .col-name {
    left: 34px;
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    padding: 6px 6px;
  }

  .lb-table .col-points {
    left: 142px;
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    padding: 6px 4px;
    border-right: 2px solid var(--border-strong);
  }

  .lb-table .col-next {
    display: none;
  }

  .lb-table tbody .name {
    font-size: 12px;
    white-space: normal;
    line-height: 1.25;
  }

  .lb-table tbody .points { font-size: 13px; }
  .lb-table tbody .rank { font-size: 12px; }

  .lb-table .match-col {
    width: 86px;
    min-width: 86px;
    max-width: 86px;
  }

  .lb-table .match-bars { height: 28px; gap: 3px; }
  .lb-table .match-bars .b { width: 14px; }
  .lb-table .match-bar-labels { gap: 3px; font-size: 9px; }
  .lb-table .match-bar-labels span { width: 14px; }
  .lb-table .match-name { font-size: 10px; }
  .lb-table tbody .match-cell { font-size: 10px; padding: 4px 4px; }
}

/* ---------- Responsive: Phone (≤ 640px) — card-layout för matcher ---------- */

@media (max-width: 640px) {
  body {
    padding-bottom: 96px;
  }

  .topbar-inner {
    padding: 10px 14px;
    gap: 8px 12px;
  }

  .topbar h1 {
    font-size: 15px;
    line-height: 1.25;
    flex: 1 1 auto;
  }

  .nav-links {
    margin-left: 0;
  }

  .counter {
    font-size: 12px;
  }

  .container {
    padding: 16px 12px;
  }

  .intro {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .round {
    margin-bottom: 24px;
  }

  .round h2 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  /* Card-layout: gör om varje matchrad till ett kort */
  .match-table-wrapper {
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .match-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
  }

  .match-table thead {
    display: none;
  }

  .match-table,
  .match-table tbody {
    display: block;
    width: 100%;
  }

  .match-table tbody tr {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-areas:
      "date date date date date  group"
      "home home home away away  away"
      "p1   p1   pX   pX   p2    p2";
    column-gap: 4px;
    row-gap: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }

  .match-table tbody tr:first-child,
  .match-table tbody tr.group-break {
    border-top: 1px solid var(--border);
  }

  .match-table tbody tr.group-break {
    margin-top: 16px;
  }

  .match-table tbody tr:hover,
  .match-table tbody tr.picked {
    background: var(--surface);
  }

  .match-table tbody tr.picked {
    border-color: var(--accent);
    background: rgba(31, 111, 235, 0.03);
  }

  .match-table td {
    display: block;
    padding: 0;
    border: 0;
    border-left: 0;
  }

  .match-table .date {
    grid-area: date;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.3;
  }

  .match-table .date .d-day {
    display: inline;
    font-weight: 600;
    color: var(--text);
  }

  .match-table .date .d-time {
    display: inline;
    margin-left: 8px;
    color: var(--text-muted);
    font-size: 13px;
  }

  .match-table .group {
    grid-area: group;
    align-self: center;
    justify-self: end;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface-muted);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .match-table .group::before {
    content: "Grupp ";
  }

  .match-table .home,
  .match-table .away {
    padding: 0;
    width: auto;
    white-space: normal;
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .match-table .home {
    grid-area: home;
    justify-content: flex-start;
  }

  .match-table .away {
    grid-area: away;
    justify-content: flex-end;
  }

  .match-table .home-inner,
  .match-table .away-inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-direction: row-reverse;
    min-width: 0;
  }

  .match-table .team-name {
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
  }

  .match-table .flag {
    width: 20px;
    flex-shrink: 0;
  }

  /* Pick-celler placeras i botten av kortet, inline-layout */
  .match-table tr > td.pick:nth-child(5) { grid-area: p1; }
  .match-table tr > td.pick:nth-child(6) { grid-area: pX; }
  .match-table tr > td.pick:nth-child(7) { grid-area: p2; }

  .match-table .pick {
    width: auto;
    height: auto;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
  }

  /* Utfall (1/X/2) stort + fett, vertikal divider, sedan poäng som meta */
  .match-table .pick::before {
    content: attr(data-choice);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    padding-right: 8px;
    margin-right: 8px;
    border-right: 1px solid var(--border-strong);
    line-height: 1;
  }

  .match-table .pick .points {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
  }

  .match-table .pick .unit {
    font-size: 11px;
    color: var(--text-faint);
    margin-left: 2px;
  }

  .match-table .pick.selected {
    border-color: var(--accent);
  }

  .match-table .pick.selected::before {
    color: white;
    border-right-color: rgba(255, 255, 255, 0.4);
  }

  .match-table .pick.selected .points,
  .match-table .pick.selected .unit {
    color: rgba(255, 255, 255, 0.85);
  }

  /* Kryssmarkering är onödig när hela cellen är blå */
  .match-table .pick.selected::after {
    display: none;
  }

  /* Tiebreaker, status, submit-bar */
  .tiebreaker-card {
    padding: 16px;
  }

  .tiebreaker-card h2 {
    font-size: 16px;
  }

  .tiebreaker-card p {
    font-size: 13px;
  }

  .tiebreaker-card input {
    width: 100%;
    max-width: 160px;
  }

  .submit-bar-inner {
    padding: 10px 12px;
    gap: 10px;
  }

  .submit-hint {
    font-size: 12px;
    line-height: 1.35;
  }

  #submitBtn {
    padding: 10px 16px;
    font-size: 14px;
  }

  /* Topplistan på mobil — dölj sekundära kolumner, kompaktare layout */
  .leaderboard-card {
    padding: 12px;
  }

  .leaderboard-header h2 {
    font-size: 17px;
  }

  .refresh-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .leaderboard-table {
    font-size: 13px;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 8px;
  }

  .leaderboard-table th.col-tiebreak,
  .leaderboard-table th.col-dev,
  .leaderboard-table tbody td.tiebreak,
  .leaderboard-table tbody td.dev {
    display: none;
  }

  .leaderboard-table .rank {
    width: 40px;
    padding-right: 4px;
  }

  .leaderboard-table .team {
    font-weight: 600;
    color: var(--text);
  }

  .leaderboard-table .name {
    color: var(--text-muted);
    font-size: 12px;
  }

  .leaderboard-table .points {
    font-size: 15px;
  }
}

/* ---------- Responsive: Small phone (≤ 380px) — extra trångt ---------- */

@media (max-width: 380px) {
  .topbar h1 {
    font-size: 14px;
    flex: 1 1 100%;
  }

  .counter {
    width: 100%;
    text-align: left;
  }

  .match-table tbody tr {
    padding: 10px;
    gap: 6px;
  }

  .match-table .pick {
    min-height: 48px;
  }

  .match-table .flag {
    width: 20px;
  }

  /* På riktigt små telefoner: dölj även Namn-kolumnen i topplistan */
  .leaderboard-table th.col-name,
  .leaderboard-table tbody td.name {
    display: none;
  }
}
