:root {
  color-scheme: light;
  font-family: Arial, sans-serif;
  color: #20352d;
  background: #f4f5ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #244a3b;
  --muted: #78847b;
  --line: #e5e9e1;
  --topbar-height: 64px;
  --page-gutter: clamp(17px, 2vw, 48px);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 82% 8%, rgba(213, 224, 202, .55), transparent 34rem),
    #f4f5ef;
}

button, a { font: inherit; }

.topbar {
  height: var(--topbar-height);
  padding: 0 var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(36, 74, 59, .1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #f4f5ef;
  background: var(--green);
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.brand-divider { padding: 0 4px; color: #a8b0a7; }

.live-tag {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #dde5d8;
  border-radius: 20px;
  color: #48634f;
  background: rgba(255,255,255,.52);
  font-size: 12px;
  font-weight: 600;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #86a77d; }

.page { margin: auto; padding: 24px var(--page-gutter) 20px; }

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.intro > div:first-child { min-width: 0; }

.eyebrow {
  margin: 0 0 14px;
  color: #879481;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-family: Arial, sans-serif;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.06;
  letter-spacing: -.065em;
}

h1 span { color: #72906e; }
.intro-copy { margin-bottom: 0; color: var(--muted); font-size: 13px; }

.summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
  min-width: 230px;
  padding: 4px 0 4px 18px;
  border-left: 1px solid #d9e0d4;
}

.summary strong { grid-row: span 2; font-family: Arial, sans-serif; font-size: 24px; color: var(--green); }
.summary span { color: var(--muted); font-size: 11px; }
.summary button {
  display: block;
  margin-top: 0;
  padding: 0;
  border: 0;
  color: #58744f;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.summary button:disabled { color: var(--muted); cursor: wait; }

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}

.team-card, .club-card {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  padding: 22px 22px 19px;
  border: 1px solid #e5e9e1;
  border-radius: 15px;
  background: rgba(255,255,255,.84);
  text-align: left;
  box-shadow: 0 5px 22px rgba(35, 57, 42, .025);
}

.team-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.team-card:hover, .team-card:focus-visible {
  transform: translateY(-3px);
  border-color: #bdd0b6;
  box-shadow: 0 12px 28px rgba(35, 57, 42, .09);
  outline: none;
}

.card-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.card-heading > div { min-width: 0; overflow-wrap: anywhere; }
.team-label { flex: 0 0 auto; padding: 5px 9px; border-radius: 20px; color: #597152; background: #eef3e9; font-size: 10px; font-weight: 600; }

.team-card h2, .club-card h2 {
  margin: 0 0 3px;
  font-family: Arial, sans-serif;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -.04em;
}

.league-name { margin: 0; color: var(--muted); font-size: 11px; }
.source-error { margin: 10px 0; color: #8a382f; font-size: 11px; }
.card-matches { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 16px; }
.card-matches .card-section { min-width: 0; margin-top: 0; }
.card-matches .card-section:only-child { grid-column: 1 / -1; }
.card-section { margin-top: 16px; }
.card-section h3 { margin: 0 0 7px; color: #879189; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.empty-state {
  padding: 10px 11px;
  border-radius: 8px;
  color: #8b948d;
  background: #f6f7f3;
  font-size: 11px;
}

.empty-state.compact { padding: 8px 0; background: none; }
.match-summary { padding: 9px 11px; border-radius: 8px; background: #f6f7f3; }
.match-date { display: block; margin-bottom: 5px; color: #8b948d; font-size: 10px; }
.match-location { display: block; margin-bottom: 5px; color: #65766a; font-size: 10px; }
.match-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; }
.match-line > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.match-team-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: 11px; }
.match-team-row + .match-team-row { margin-top: 6px; }
.match-team-name { min-width: 0; overflow-wrap: anywhere; }
.match-team-score { font-size: 13px; }
.match-team-row.own-team .match-team-name { color: #355b43; font-weight: 700; }
.own-score { color: #355b43; font-weight: 700; }
.score-missing { flex: 0 0 auto; color: #89928b; font-size: 10px; }

.table-section { margin-top: 15px; }
.table-section h3 { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px; }
.table-section h3 span { letter-spacing: 0; text-transform: none; font-weight: 500; }
.standings { display: grid; gap: 6px; }
.standing-gap { color: var(--muted); font-size: 10px; line-height: .5; }
.standing-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 58px 36px; gap: 7px; align-items: center; font-size: 11px; }
.standing-header { color: var(--muted); font-size: 10px; }
.standing-header > :nth-child(n+3) { text-align: right; }
.standing-rank { color: #9ca59c; }
.standing-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standing-average, .standing-score { color: #65766a; text-align: right; white-space: nowrap; }
.standing-row.own-team .standing-name { color: #355b43; font-weight: 700; }
.standing-row.own-team .standing-average { color: #355b43; font-weight: 700; }

.card-link { display: block; margin-top: auto; padding-top: 12px; color: #58744f; font-size: 11px; font-weight: 700; }
.card-link span { margin-left: 3px; }

.club-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1vw, 24px);
  color: var(--green);
  text-align: center;
}

.club-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.club-logo { width: min(100%, 180px); height: auto; object-fit: contain; }
.club-card h2 { font-size: 16px; }
.club-identity h2 { margin: 0; }
.mobile-share {
  --mobile-qr-size: clamp(112px, 7vw, 160px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: calc(var(--mobile-qr-size) + 18px);
  margin: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green);
  background: #fff;
  text-decoration: none;
  transform: rotate(-8deg);
  box-shadow: 0 5px 16px rgba(35, 57, 42, .12);
}
.mobile-qr { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.mobile-share span { font-size: clamp(11px, .8vw, 14px); font-weight: 700; line-height: 1.3; }
.club-identity:focus-visible, .mobile-share:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 16px;
  color: #919a91;
  font-size: 10px;
}

.page-footer a { color: #60775c; text-decoration: none; }
.page-footer a:hover, .source-link:hover { text-decoration: underline; }
.loading { grid-column: 1 / -1; color: var(--muted); }
.load-error { grid-column: 1 / -1; padding: 16px; border-radius: 9px; color: #8a382f; background: #fff0ed; font-size: 13px; }

.team-dialog {
  width: min(900px, calc(100% - 28px));
  max-height: min(88vh, 920px);
  padding: 36px;
  border: 0;
  border-radius: 18px;
  color: #20352d;
  background: #fbfcf9;
  box-shadow: 0 25px 100px rgba(13, 33, 22, .25);
}

.team-dialog::backdrop { background: rgba(14, 33, 25, .58); backdrop-filter: blur(4px); }
.dialog-close { position: sticky; float: right; top: 0; z-index: 2; width: 34px; height: 34px; margin: -20px -20px 0 0; border: 0; border-radius: 50%; color: #536158; background: #edf1ea; font-size: 22px; cursor: pointer; }
.team-dialog h2 { margin-bottom: 4px; font-family: Arial, sans-serif; font-size: 34px; letter-spacing: -.05em; }
.detail-league { margin-bottom: 23px; color: var(--muted); font-size: 12px; }
.detail-league span { padding: 0 4px; color: #b2b9af; }
.detail-match { margin: 0 0 27px; }
.detail-match .match-line { font-size: 13px; }
.detail-match .match-team-row { font-size: 13px; }
.detail-section { margin-top: 25px; }
.detail-section > h3 { margin-bottom: 12px; font-family: Arial, sans-serif; font-size: 16px; letter-spacing: -.02em; }
.detail-empty { margin: 0; color: #89928b; font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #849087; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
td { color: #435148; }
tbody tr.own-team td { color: #355b43; background: #f0f5ec; font-weight: 700; }
.shooter-averages th:first-child, .shooter-averages td:first-child,
.latest-individuals th:first-child, .latest-individuals td:first-child { width: 48px; text-align: right; }
.matchday-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 17px; }
.latest-individuals > .detail-empty { margin-bottom: 12px; }
.matchday { padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.matchday h3 { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 8px; font-size: 12px; }
.matchday h3 span { color: var(--muted); font-size: 10px; font-weight: 400; }
.source-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; padding-top: 17px; border-top: 1px solid var(--line); }
.source-link { padding: 8px 10px; border-radius: 7px; color: #486947; background: #edf3e9; font-size: 10px; text-decoration: none; }

@media (min-width: 1024px) {
  .page { display: flex; flex-direction: column; min-height: calc(100svh - var(--topbar-height)); }
  .team-grid { flex: 1; grid-auto-rows: minmax(min-content, 1fr); }
  .card-matches { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (min-width: 1024px) and (max-height: 950.98px) {
  :root { --topbar-height: 52px; }
  .page { padding-top: 8px; padding-bottom: 10px; }
  .intro { margin-bottom: 10px; }
  h1 { margin-bottom: 6px; font-size: 32px; }
  .team-grid { gap: 10px; }
  .team-card, .club-card { padding: 12px; border-radius: 12px; }
  .team-card h2 { font-size: 18px; }
  .card-matches { margin-top: 10px; }
  .team-card .card-section h3 { margin-bottom: 4px; line-height: 1.2; }
  .team-card .match-summary { padding: 6px 8px; }
  .team-card .match-date, .team-card .match-location { margin-bottom: 3px; line-height: 1.2; }
  .team-card .match-team-row, .team-card .match-line { line-height: 1.2; }
  .team-card .match-team-row + .match-team-row { margin-top: 3px; }
  .team-card .table-section { margin-top: 10px; }
  .standings { gap: 3px; }
  .standing-row { line-height: 1.2; }
  .card-link { padding-top: 8px; line-height: 1.2; }
  .club-logo { width: min(100%, 140px); }
  .page-footer { padding-top: 8px; }
}

@media (min-width: 1440px) {
  :root { --overview-font-size: clamp(12px, min(.9vw, 1.5vh), 18px); }
  h1 { font-size: clamp(32px, min(2.2vw, 4.5vh), 52px); }
  .intro-copy { font-size: max(13px, var(--overview-font-size)); }
  .summary strong { font-size: calc(var(--overview-font-size) + 13px); }
  .summary span, .summary button { font-size: var(--overview-font-size); }
  .team-card h2 { font-size: calc(var(--overview-font-size) + 8px); }
  .team-label, .team-card .card-section h3 { font-size: calc(var(--overview-font-size) - 1px); }
  .team-card .league-name, .team-card .source-error, .team-card .empty-state,
  .team-card .match-line, .team-card .match-team-row, .card-link { font-size: var(--overview-font-size); }
  .team-card .match-date, .team-card .match-location, .team-card .score-missing { font-size: calc(var(--overview-font-size) - 1px); }
  .team-card .match-team-score { font-size: calc(var(--overview-font-size) + 2px); }
  .standing-row {
    grid-template-columns: calc(var(--overview-font-size) * 1.8) minmax(0, 1fr) calc(var(--overview-font-size) * 5.3) calc(var(--overview-font-size) * 3.3);
    gap: calc(var(--overview-font-size) * .6);
    font-size: var(--overview-font-size);
  }
  .standing-header { font-size: calc(var(--overview-font-size) - 1px); }
  .club-logo { width: min(100%, clamp(140px, min(11vw, 18vh), 260px)); }
  .club-card h2 { font-size: calc(var(--overview-font-size) + 4px); }
  .page-footer { font-size: calc(var(--overview-font-size) - 2px); }
}

@media (min-width: 1440px) and (min-height: 951px) {
  .intro { margin-bottom: 14px; }
  .team-card, .club-card { padding: 16px; }
  .standings { gap: 2px; }
  .page-footer { padding-top: 12px; }
}

@media (max-width: 1023.98px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760.98px) {
  .intro { align-items: stretch; flex-direction: column; gap: 12px; }
  .summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; }
  .summary strong { font-size: 20px; }
  .summary span { flex: 1; min-width: 0; }
  .summary button { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
}

@media (max-width: 650.98px) {
  :root { --topbar-height: 60px; }
  .topbar { padding-inline: 17px; }
  .brand { gap: 8px; font-size: 12px; }
  .brand-mark { width: 30px; height: 30px; }
  .live-tag { padding: 7px 9px; font-size: 10px; }
  .page { padding: 20px 17px; }
  h1 { font-size: clamp(22px, 5.8vw, 32px); }
  .team-grid { grid-template-columns: 1fr; gap: 12px; }
  .team-card { min-height: 0; padding: 18px; }
  .club-card { min-height: 240px; }
  .team-card h2 { font-size: 19px; }
  .card-section { margin-top: 16px; }
  .page-footer { flex-direction: column; gap: 8px; }
  .team-dialog { padding: 27px 19px; }
  .dialog-close { margin: -14px -7px 0 0; }
  .team-dialog h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
