:root {
  --navy: #102a56;
  --navy-2: #173b73;
  --blue: #2f67aa;
  --blue-2: #5b8fca;
  --sky: #eaf2fb;
  --ice: #f5f8fc;
  --paper: #ffffff;
  --ink: #17233a;
  --muted: #66738a;
  --line: #dce5f0;
  --line-soft: #edf2f7;
  --danger: #a63d47;
  --warning: #a97824;
  --success: #35705b;
  --shadow: 0 10px 30px rgba(25, 52, 90, .08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ice);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; }

.hero {
  background:
    radial-gradient(circle at 85% 10%, rgba(91,143,202,.25), transparent 34%),
    linear-gradient(145deg, #0d244b 0%, var(--navy) 48%, #183c73 100%);
  color: #f8fbff;
  border-bottom: 4px solid #6fa2dc;
}
.hero-inner {
  min-height: 180px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 0 30px;
}
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #b9d0eb; }
.hero h1 { margin: 5px 0 4px; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(34px, 6vw, 58px); line-height: 1; letter-spacing: -.035em; }
.hero p { margin: 0; max-width: 620px; color: #cbd9e9; font-size: 15px; }
.leader-box { text-align: right; min-width: 170px; }
.leader-box span { display:block; color:#acc4df; font-size:11px; text-transform:uppercase; letter-spacing:.08em; font-weight:700; }
.leader-box strong { display:block; margin-top:5px; font-family:"Source Serif 4", Georgia, serif; font-size:24px; }
.leader-box small { color:#dce8f5; font-weight:600; }

.main-shell { padding-bottom: 48px; }
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 18px 0;
  padding: 4px;
  background: #e5edf7;
  border-radius: 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display:none; }
.tab-btn {
  flex: 1 0 auto;
  min-height: 43px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #51627a;
  font-weight: 700;
  cursor: pointer;
  padding: 9px 15px;
}
.tab-btn.active { background: var(--paper); color: var(--navy); box-shadow: 0 2px 8px rgba(36,62,96,.08); }
.tab-panel { display:none; }
.tab-panel.active { display:block; animation: panelIn .18s ease; }
@keyframes panelIn { from{opacity:.4; transform:translateY(3px)} to{opacity:1; transform:none} }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head { min-height: 72px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:15px 17px; border-bottom:1px solid var(--line); }
.card-head h2, .sim-actions h2 { margin:0; font-family:"Source Serif 4", Georgia, serif; font-size:20px; letter-spacing:-.015em; }
.card-head p, .sim-actions p { margin:3px 0 0; color:var(--muted); font-size:12.5px; }
.compact-head { min-height: 64px; }

.result-layout { display:grid; grid-template-columns:minmax(0, 1fr) 300px; gap:18px; align-items:start; }
.stats-stack { display:grid; gap:18px; }

.btn {
  min-height: 40px;
  border-radius: 9px;
  border:1px solid var(--line);
  padding:8px 13px;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  white-space:nowrap;
}
.btn.primary { color:#fff; background:var(--navy); border-color:var(--navy); }
.btn.primary:hover { background:var(--navy-2); }
.btn.secondary { color:var(--navy); background:#fff; }
.btn.secondary:hover { border-color:#9eb9d9; background:#f8fbff; }
.btn:disabled { opacity:.55; cursor:not-allowed; }

.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
table.standings { width:100%; border-collapse:collapse; font-size:13px; }
table.standings th { padding:9px 7px; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.045em; text-align:right; border-bottom:1px solid var(--line); white-space:nowrap; }
table.standings th.left, table.standings td.left { text-align:left; }
table.standings td { padding:9px 7px; text-align:right; border-bottom:1px solid var(--line-soft); white-space:nowrap; }
table.standings tbody tr:last-child td { border-bottom:0; }
table.standings tbody tr:hover { background:#f8fbff; }
td.pos { position:relative; width:36px; padding-left:14px !important; font-weight:800; color:#718198; }
.pos-bar { position:absolute; left:0; top:4px; bottom:4px; width:4px; border-radius:4px; }
td.team { font-weight:700; max-width:205px; overflow:hidden; text-overflow:ellipsis; }
.team-wrap { display:flex; align-items:center; gap:8px; min-width:0; }
.team-logo { width:20px; height:20px; object-fit:contain; flex:none; }
.team-name { overflow:hidden; text-overflow:ellipsis; }
td.pts { font-size:14px; font-weight:800; color:var(--navy); }
.gd-pos { color:var(--success); font-weight:650; }
.gd-neg { color:var(--danger); font-weight:650; }
.move { display:inline-block; margin-left:5px; font-size:10px; vertical-align:1px; font-weight:800; }
.move.up { color:var(--success); }
.move.down { color:var(--danger); }
.form { display:flex; gap:2px; }
.form i { width:16px; height:16px; display:grid; place-items:center; border-radius:4px; color:#fff; font-style:normal; font-size:8px; font-weight:800; }
.form .W { background:#4b806c; } .form .D { background:#ae8b46; } .form .L { background:#a7575f; }

.legend { display:flex; flex-wrap:wrap; gap:10px 14px; padding:11px 16px; border-top:1px solid var(--line); font-size:10.5px; color:var(--muted); }
.legend-mark { width:8px; height:8px; display:inline-block; border-radius:2px; margin-right:5px; }
.champion { background:#254f87; } .europe { background:#6794c8; } .playoff { background:#b98b38; } .relegation { background:#a64a53; }

.rank-list { list-style:none; margin:0; padding:7px 9px 10px; }
.rank-list li { display:grid; grid-template-columns:24px 32px minmax(0,1fr) auto; align-items:center; gap:8px; padding:9px 7px; border-bottom:1px solid var(--line-soft); }
.rank-list li:last-child { border-bottom:0; }
.rank-no { font-family:"Source Serif 4", Georgia, serif; font-weight:700; color:var(--blue); }
.player-photo, .player-placeholder { width:30px; height:30px; border-radius:50%; background:#e8eef6; object-fit:cover; }
.player-name { font-size:12.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.player-team { margin-top:1px; color:var(--muted); font-size:10.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.player-val { font-family:"Source Serif 4", Georgia, serif; font-size:18px; font-weight:700; color:var(--navy); }
.empty-list { padding:16px !important; color:var(--muted); font-size:12px; display:block !important; }

.sim-actions { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:15px 17px; margin-bottom:18px; }
.sim-actions > div:first-child { max-width:620px; }
.action-buttons { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.simulation-layout { display:grid; grid-template-columns:minmax(0, 1.15fr) minmax(360px, .85fr); gap:18px; align-items:start; }
.sim-table-card { position:sticky; top:10px; }

.round-block { border-bottom:1px solid var(--line); }
.round-block:last-child { border-bottom:0; }
.round-title { width:100%; border:0; background:#f8fbff; color:var(--ink); display:flex; justify-content:space-between; align-items:center; gap:12px; padding:11px 14px; font-size:12px; font-weight:800; cursor:pointer; text-align:left; }
.round-title span:last-child { color:var(--muted); font-size:10.5px; font-weight:600; }
.round-title .arrow { margin-right:6px; display:inline-block; transition:transform .15s ease; color:var(--blue); }
.round-title.open .arrow { transform:rotate(90deg); }
.round-matches { display:none; padding:5px 8px 10px; }
.round-matches.open { display:block; }
.fixture-row { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:7px; padding:9px 6px; border-radius:9px; }
.fixture-row + .fixture-row { border-top:1px solid var(--line-soft); }
.fixture-row.live { background:#f4f8fd; }
.fx-team { display:flex; align-items:center; gap:6px; min-width:0; font-size:12px; font-weight:700; }
.fx-team.away { justify-content:flex-end; text-align:right; }
.fx-team img { width:18px; height:18px; object-fit:contain; flex:none; }
.fx-team span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pick-group { display:flex; gap:3px; }
.pick-btn { width:34px; height:31px; border-radius:7px; border:1px solid var(--line); background:#fff; color:#5c6a7f; font-size:12px; font-weight:800; cursor:pointer; }
.pick-btn.sel-1 { background:var(--navy); color:#fff; border-color:var(--navy); }
.pick-btn.sel-x { background:#8a713c; color:#fff; border-color:#8a713c; }
.pick-btn.sel-2 { background:var(--blue); color:#fff; border-color:var(--blue); }
.score-inputs { display:flex; align-items:center; gap:4px; }
.score-inputs input { width:38px; height:31px; border:1px solid var(--line); border-radius:7px; text-align:center; font-weight:800; color:var(--ink); background:#fff; }
.score-inputs input:focus { outline:2px solid #80a8d4; outline-offset:1px; }
.score-inputs .sep { color:var(--muted); font-weight:700; }
.match-status { min-width:70px; text-align:center; color:var(--blue); font-size:10px; font-weight:800; }
.match-status strong { display:block; color:var(--navy); font-size:13px; }
.no-fixtures { padding:26px 16px; text-align:center; color:var(--muted); font-size:13px; }

.message { margin:0 0 15px; padding:11px 13px; border:1px solid #bfd0e4; border-radius:10px; background:#eef5fc; color:#29486d; font-size:12.5px; }
.message.error { border-color:#e1b9bd; background:#fff1f2; color:#7e3138; }
.hidden { display:none !important; }
.loading-row td { text-align:center !important; color:var(--muted); padding:28px !important; }
footer { margin-top:28px; text-align:center; color:#7b8798; font-size:11px; }

@media (max-width: 920px) {
  .result-layout { grid-template-columns:1fr; }
  .stats-stack { grid-template-columns:1fr 1fr; }
  .simulation-layout { grid-template-columns:1fr; }
  .sim-table-card { position:static; order:0; }
  .fixtures-card { order:1; }
}

@media (max-width: 640px) {
  .shell { width:min(100% - 20px, 1180px); }
  .hero-inner { min-height:150px; padding:25px 0 23px; align-items:flex-end; }
  .hero h1 { font-size:36px; }
  .hero p { font-size:13px; max-width:360px; }
  .leader-box { min-width:0; }
  .leader-box strong { font-size:17px; }
  .leader-box span { font-size:9px; }
  .tabs { margin:12px 0; }
  .tab-btn { min-height:40px; padding:8px 11px; font-size:12.5px; }
  .card { border-radius:12px; box-shadow:0 6px 20px rgba(25,52,90,.06); }
  .card-head { min-height:62px; padding:12px 12px; }
  .card-head h2, .sim-actions h2 { font-size:17px; }
  .card-head p, .sim-actions p { font-size:11px; }
  .stats-stack { grid-template-columns:1fr; gap:12px; }
  .sim-actions { align-items:stretch; flex-direction:column; padding:13px; margin-bottom:12px; }
  .action-buttons { display:grid; grid-template-columns:1fr 1fr; justify-content:stretch; gap:7px; }
  .action-buttons .primary { grid-column:1 / -1; }
  .btn { width:100%; min-height:42px; font-size:12px; }
  table.standings { font-size:11.5px; table-layout:auto; }
  table.standings th, table.standings td { padding:8px 5px; }
  table.standings th:nth-child(4), table.standings td:nth-child(4),
  table.standings th:nth-child(5), table.standings td:nth-child(5),
  table.standings th:nth-child(6), table.standings td:nth-child(6),
  table.standings th:nth-child(7), table.standings td:nth-child(7),
  table.standings th:nth-child(8), table.standings td:nth-child(8),
  table.standings th:nth-child(11), table.standings td:nth-child(11) { display:none; }
  td.pos { width:28px; padding-left:11px !important; }
  td.team { max-width:none; min-width:135px; }
  .team-logo { width:18px; height:18px; }
  td.pts { font-size:13px; }
  .legend { font-size:9.5px; gap:8px 11px; padding:9px 12px; }
  .round-title { padding:10px 11px; }
  .round-matches { padding:3px 5px 7px; }
  .fixture-row { gap:4px; padding:9px 3px; }
  .fx-team { font-size:10.5px; gap:4px; }
  .fx-team img { width:16px; height:16px; }
  .pick-btn { width:30px; height:30px; font-size:11px; }
  .score-inputs input { width:34px; height:30px; }
  .match-status { min-width:60px; font-size:9px; }
  .match-status strong { font-size:12px; }

  .combo-controls {
    min-width: 122px;
    gap: 5px;
  }

  .combo-topline {
    gap: 4px;
  }

  .exact-toggle {
    min-width: 44px;
    height: 30px;
    font-size: 9.5px;
    padding: 0 5px;
  }

}

@media (max-width: 400px) {
  .hero-inner { gap:10px; }
  .hero p { display:none; }
  .leader-box { max-width:125px; }
  .leader-box strong { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  td.team { min-width:118px; }
}


/* ---------- KOMBINERAD SPEKULERA ---------- */
.combined-fixture-row {
  align-items: start;
}

.combo-controls {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 142px;
}

.combo-topline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.exact-toggle {
  min-width: 50px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 7px;
}

.exact-toggle.active {
  background: #edf5ff;
  border-color: #9eb9d9;
  color: var(--navy);
}

.combo-score {
  display: none;
}

.combo-score.open {
  display: flex;
}


/* ---------- SLUTSTRIDEN ---------- */
.race-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.race-card.wide {
  grid-column: 1 / -1;
}

.race-list {
  padding: 8px 10px 11px;
}

.race-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 7px;
  border-bottom: 1px solid var(--line-soft);
}

.race-row:last-child {
  border-bottom: 0;
}

.race-row.muted {
  opacity: .72;
}

.race-team {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.race-team img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: none;
}

.race-team strong {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.race-team small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10.5px;
}

.race-pos {
  width: 22px;
  color: var(--blue);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  flex: none;
}

.race-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.race-meta .form {
  margin-left: 1px;
}

.need-pill {
  min-width: 82px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.need-pill.tight {
  background: #fff6df;
  color: var(--warning);
}

.need-pill.hard {
  background: #fff1f2;
  color: var(--danger);
}

.key-fixtures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.key-fixture {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: #f8fbff;
}

.key-fixture strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.key-fixture small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.key-fixture span {
  flex: none;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e5edf7;
  color: var(--navy);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.key-fixture.highlight {
  border-color: #9eb9d9;
  background: linear-gradient(135deg, #f8fbff 0%, #eaf2fb 100%);
  box-shadow: 0 8px 20px rgba(25, 52, 90, .08);
}

.key-fixture.highlight span {
  background: var(--navy);
  color: #fff;
}

.remaining-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.remaining-team {
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: #f8fbff;
}

.remaining-team strong {
  display: block;
  margin-bottom: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--navy);
  font-size: 13px;
}

.remaining-team ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.remaining-team li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.remaining-team li + li {
  margin-top: 5px;
}

.remaining-team li span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.mini-section-label {
  margin: 10px 7px 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}


.math-note {
  margin: 2px 7px 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.race-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 920px) {
  .race-layout {
    grid-template-columns: 1fr;
  }

  .key-fixtures,
  .remaining-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .race-layout {
    gap: 12px;
  }

  .race-list {
    padding: 6px 8px 9px;
  }

  .race-row {
    align-items: flex-start;
    padding: 9px 4px;
  }

  .race-team strong {
    max-width: 150px;
    font-size: 12px;
  }

  .race-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 10.5px;
  }

  .need-pill {
    min-width: 74px;
    padding: 5px 7px;
    font-size: 11px;
  }

  .key-fixtures,
  .remaining-grid {
    padding: 8px;
  }

  .key-fixture {
    align-items: flex-start;
    padding: 10px;
  }

  .key-fixture strong {
    white-space: normal;
  }

  .key-fixture span {
    font-size: 9.5px;
  }
}
