* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1c1c1e;
  background: #fff;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 18px 32px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .lion { width: 46px; height: 46px; display: block; }
.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 32px 64px;
}

.league-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 8px;
}
.league-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.actions { display: flex; gap: 8px; }

.btn {
  background: #1a56db;
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: #1646b8; }

.status {
  color: #6b7280;
  font-size: 13px;
  min-height: 18px;
  margin: 4px 0 12px;
}

.search-wrap { margin-bottom: 12px; }
.search-wrap input {
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
}
.search-wrap input:focus {
  border-color: #1a56db;
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.15);
}

.hidden { display: none; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.table th {
  color: #6b7280;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 12px;
  border-bottom: 2px solid #e5e7eb;
  text-align: center;
}
.table th:nth-child(2) { text-align: left; }

.table td {
  padding: 13px 12px;
  border-bottom: 1px solid #f0f0f2;
  text-align: center;
}
.table tbody tr:nth-child(even) { background: #fafafa; }
.table tbody tr:hover { background: #f5f5ff; }

td.rank { width: 90px; }
td.rank .num { font-weight: 700; }
td.team { text-align: left; }
td.team .mgr {
  color: #6b7280;
  font-style: italic;
}
td.total { font-weight: 700; }
td.empty {
  color: #9ca3af;
  text-align: center;
  padding: 24px;
}

.arrow {
  font-size: 11px;
  margin-right: 6px;
  vertical-align: 1px;
}
.arrow.up { color: #16a34a; }
.arrow.down { color: #dc2626; }

.players-panel { margin-top: 24px; }
.view-toggles {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.view-toggles label {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.subhead {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #360d71;
}

/* Tegnforklaring over matchday-tabellene */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin: 0 0 18px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: #4b5563;
  background: #faf7fd;
  border: 1px solid #ece5f7;
  border-radius: 8px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.legend .pick { width: 22px; height: 22px; }
.legend .legend-xi { background: #94a3b8; }
.legend .legend-bench { background: #94a3b8; opacity: 0.35; }
.legend .pick-cap {
  position: static;
  display: inline-block;
  min-width: 14px;
  height: 13px;
  box-shadow: none;
}
.legend-hint {
  color: #9ca3af;
  font-style: italic;
  margin-left: auto;
}
.matchday-empty {
  padding: 18px;
  text-align: center;
  color: #6b7280;
  background: #faf7fd;
  border: 1px solid #ece5f7;
  border-radius: 8px;
  margin-bottom: 18px;
}
.match-block { margin-bottom: 22px; }
.match-head-row td {
  background: #f3eefa !important;
  border-bottom: 2px solid #d9cff0;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.match-time {
  font-weight: 800;
  color: #360d71;
  margin-right: 10px;
}
.match-teams { font-weight: 600; color: #111827; }
.match-score {
  margin-left: 10px;
  font-weight: 800;
  color: #111827;
}
.match-flag {
  margin-left: 8px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}
.match-flag.live { color: #dc2626; }
.pick-table th { font-size: 13px; }
.pick-table th:first-child { text-align: left; }
.pick-table th:nth-child(2) { text-align: center; }
.pick-table td { padding: 9px 10px; }
/* Diskrete vertikale linjer mellom kolonnene */
.pick-table td,
.pick-table th {
  border-left: 1px solid #dfe0e6;
}
.pick-table td:first-child,
.pick-table th:first-child {
  border-left: none;
}
.pick-table .team .pos {
  display: inline-block;
  min-width: 18px;
  font-weight: 700;
  color: #360d71;
}
.pick-table .team .pts { color: #6b7280; font-weight: 400; }
.pick-cell { width: 64px; }
.pick {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  position: relative;
  vertical-align: middle;
}
.pick.bench { opacity: 0.35; }
.pick .team-badge {
  position: absolute;
  inset: 3px;
  width: 26px;
  height: 26px;
  vertical-align: baseline;
}
.pick-cap {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 13px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: #111827;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

/* Klubb-badges fra Premier League-CDN (fallback: kortkoden forblir) */
.team-badge {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 4px;
  vertical-align: -5px;
  border-radius: 50%;
  position: relative;
  transition: transform 0.15s ease-out;
}
/* Hover: logoen zoomer (kun transform - ingen layout-skift) */
.match-teams .team-badge:hover,
#playersTable .team-badge:hover,
#liveTable .team-badge:hover,
.live-match .tm .team-badge:hover {
  transform: scale(1.5);
  z-index: 10;
}
.pick { transition: transform 0.15s ease-out; }
.pick:hover {
  transform: scale(1.45);
  z-index: 10;
}
.pick.bench:hover { opacity: 0.85; }
/* Sirkelens egen hover hender på .pick - unngå dobbel zoom på logoen */
.pick .team-badge:hover { transform: none; }
.match-teams .team-badge { width: 30px; height: 30px; vertical-align: -9px; margin-right: 4px; }
.live-match .tm .team-badge { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
#playersTable .team-badge { width: 26px; height: 26px; vertical-align: -7px; }

.live-panel {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 2px solid #ece5f7;
}
.live-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.live-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #360d71;
}
.live-meta {
  color: #6b7280;
  font-size: 13px;
}
.live-table { max-width: 620px; }

.live-matches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.live-matches:empty { margin-bottom: 0; }
.live-match {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #faf7fd;
  border: 1px solid #ece5f7;
  border-radius: 8px;
}
.live-match .tm {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #360d71;
}
.live-match .sc {
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: #111827;
}
.live-match .min {
  font-size: 12px;
  color: #6b7280;
  min-width: 30px;
  text-align: right;
}

.live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #dc2626;
  margin-right: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .container { padding: 4px 16px 48px; }
  .league-header { flex-direction: column; align-items: flex-start; }
}
