/* Rules copied from Morning Hockey's style.css (only the ones used here). */
:root {
  --font-display: "Teko", "Barlow Condensed", Impact, sans-serif;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #F2F2F4;
  --card-bg: #ffffff;
  --text: #0D0D0F;
  --muted: #5E5E68;
  --accent: #A87400;
  --on-accent: #ffffff;
  --border: rgba(13,13,15,0.14);
  
  --hero-shade-strong: rgba(0, 0, 0, 0.35);
  --hero-shade-fade: rgba(0, 0, 0, 0.65);
  --hero-scrim: rgba(0, 0, 0, 0.25);
}

@media (prefers-color-scheme: dark) {
  
  :root:not([data-theme="light"]) {
    --bg: #0D0D0F;
    --card-bg: #19191D;
    --text: #F5F5F7;
    --muted: #A3A3AB;
    --accent: #F5C84C;
    --on-accent: #0D0D0F;
  --border: rgba(255,255,255,0.14);
    --hero-shade-strong: rgba(0, 0, 0, 0.65);
    --hero-shade-fade: rgb(0, 0, 0);
    --hero-scrim: rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: #0D0D0F;
  --card-bg: #19191D;
  --text: #F5F5F7;
  --muted: #A3A3AB;
  --accent: #F5C84C;
  --on-accent: #0D0D0F;
  --border: rgba(255,255,255,0.14);
  --hero-shade-strong: rgba(0, 0, 0, 0.65);
  --hero-shade-fade: rgb(0, 0, 0);
  --hero-scrim: rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --bg: #F2F2F4;
  --card-bg: #ffffff;
  --text: #0D0D0F;
  --muted: #5E5E68;
  --accent: #A87400;
  --on-accent: #ffffff;
  --border: rgba(13,13,15,0.14);
  --hero-shade-strong: rgba(0, 0, 0, 0.35);
  --hero-shade-fade: rgba(0, 0, 0, 0.65);
  --hero-scrim: rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

a {
  color: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.backdrop.open {
  display: block;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  max-width: 80vw;
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.1;
}

.nav-list a.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.main-column {
  flex: 1;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 600;
}

@media (min-width: 860px) {
  .backdrop {
    display: none !important;
  }

  .sidebar {
    position: static;
    transform: none;
    width: 240px;
    min-width: 240px;
    max-width: none;
    height: auto;
    border-right: 1px solid var(--border);
  }

  #sidebar-open,
  #sidebar-close {
    display: none;
  }

  .topbar {
    display: none;
  }

  }

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-note {
  padding: 22px 16px;
  margin: 16px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.empty-note::before {
  content: "";
  display: block;
  margin: 0 auto 14px;
  width: 30px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0.55;
  box-shadow: 0 5px 0 -1px currentColor;
}

.table-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 5px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.toggle-group {
  display: flex;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
}

.toggle-segment {
  flex: 1;
  padding: 11px 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.standings-tab-picker {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: 12px 0 14px;
}

.standings-tab {
  flex: 1;
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 4px;
  cursor: pointer;
  margin-bottom: -1px;
  white-space: nowrap;
}

.standings-tab.active {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--text);
}

/* ---------- xHockey: wide tables ---------- */
.ic { width: 1.1em; height: 1.1em; vertical-align: -0.15em; margin-right: 8px; }
.icon-btn .ic { margin: 0; }
.topbar-title, .brand { font-family: var(--font-display); }
main { max-width: 1200px; margin: 0 auto; padding: 16px 16px 48px; display: flex; flex-direction: column; gap: 12px; }
.page-header { text-align: center; }
.page-header h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 2rem; letter-spacing: 0.03em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.theme-picker { margin-top: auto; padding: 16px 12px 0; color: var(--muted); font-size: 0.85rem; display: flex; gap: 8px; align-items: center; }
.theme-picker select, .table-filters select, .table-filters input[type="text"], .table-filters input[type="search"] {
  font: inherit; font-size: 0.85rem; padding: 6px 12px; background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: 20px; }
.table-filters { align-items: center; justify-content: center; margin: 10px 0 0; }
.filter-panel > summary { list-style: none; width: fit-content; margin: 0 auto; }
.filter-panel > summary::-webkit-details-marker, .multi-select summary::-webkit-details-marker { display: none; }
fieldset.toggle-group { margin: 0; padding: 0; min-width: 0; }
.toggle-group label + label { border-left: 1px solid var(--border); }
.toggle-segment { padding: 7px 12px; text-align: center; position: relative; }
.toggle-segment input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-segment:has(input:checked) { background: var(--accent); color: var(--on-accent); }
.toggle-segment:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -4px; }
.multi-select { position: relative; }
.multi-select summary { list-style: none; }
.multi-select-list { position: absolute; z-index: 15; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); width: 400px; max-width: 90vw; max-height: 420px; overflow-y: auto; padding: 10px 10px 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 4px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; font-size: 0.85rem; }
.multi-select-list button[type="submit"] { grid-column: 1 / -1; position: sticky; bottom: 0; padding: 8px; margin-bottom: 8px; }
.multi-select-list label { display: flex; align-items: center; gap: 4px; min-width: 0; }
.multi-select-list img { object-fit: contain; }
.conf-btn { grid-column: span 2; }
.division { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.division-btn { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; color: var(--accent); background: none; border: none; border-bottom: 1px solid var(--border); padding: 2px 0; cursor: pointer; }
.min-gp { color: var(--muted); font-size: 0.85rem; }
.sort-controls { display: flex; gap: 6px; }
.table-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; }
.standings-tab-picker { margin: 0; }
.standings-tab { text-align: center; text-decoration: none; font-family: var(--font-display); font-size: 1.15rem; }
.side-picker { display: flex; gap: 6px; }
a.filter-btn { text-decoration: none; }

/* Only the wrapper scrolls horizontally; "paitakulma" corner. */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 0 0 24px 0; background: var(--card-bg); }
.porssi-table { --st-stripe: color-mix(in srgb, var(--card-bg) 94%, var(--text)); width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 0.88rem; }
.porssi-table th, .porssi-table td { padding: 8px 8px; text-align: center; background: var(--card-bg); white-space: nowrap; }
.porssi-table thead th { font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: 0.03em; border-bottom: 1px solid var(--border); vertical-align: top; }
.porssi-table thead a { text-decoration: none; display: inline-block; padding: 2px 0; }
.porssi-table tbody tr:nth-child(odd) > * { background: var(--st-stripe); }
.porssi-table .col-rank { position: sticky; left: 0; z-index: 2; box-sizing: border-box; width: 40px; min-width: 40px; max-width: 40px; padding-left: 8px; padding-right: 4px; }
.porssi-table tbody .col-rank { box-shadow: inset 5px 0 0 var(--team); color: var(--muted); }
.porssi-table th:nth-child(2) { position: sticky; left: 40px; z-index: 2; text-align: left; border-right: 1px solid var(--border); }
.team-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.porssi-table td.stat-strong { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1; }
.porssi-table thead th.sort-asc, .porssi-table thead th.sort-desc { color: var(--accent); }
.porssi-table thead th[class^="sort-"] > a::after { content: ""; display: inline-block; margin-left: 4px; vertical-align: middle; border: 4px solid transparent; }
.porssi-table thead th.sort-desc > a::after { border-top-color: var(--accent); border-bottom-width: 0; }
.porssi-table thead th.sort-asc > a::after { border-bottom-color: var(--accent); border-top-width: 0; }
.info-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px 4px; font-size: 0.75rem; vertical-align: top; }
.help-pop { max-width: min(320px, 90vw); padding: 14px 16px; background: var(--card-bg); color: var(--text); border: 1px solid var(--accent); border-radius: 0 0 24px 0;
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 400; letter-spacing: 0; text-align: left; white-space: normal; }
.help-pop p { margin: 6px 0 0; }
.help-pop::backdrop { background: rgba(0, 0, 0, 0.35); }

.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 0 0 24px 0; padding: 12px 16px; }
.stat-card h2, .stat-card h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; border-left: 5px solid var(--accent); padding-left: 8px; }
.stat-card dt { font-weight: 600; margin-top: 10px; }
.stat-card dd { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.site-footer { color: var(--muted); font-size: 0.78rem; text-align: center; margin-top: 16px; }

/* Narrow screens: the team list opens in the flow, a floating one would overflow the page. */
@media (max-width: 859px) {
  .multi-select[open] { flex-basis: 100%; text-align: center; }
  .multi-select-list { position: static; transform: none; width: 100%; max-width: none; margin-top: 6px; text-align: left; }
}

/* Desktop: filters are always visible, sorting happens in the headers. */
@media (min-width: 860px) {
  .filter-panel > summary { display: none; }
  .filter-panel::details-content { content-visibility: visible; display: block; }
  .sort-controls { display: none; }
  .sidebar { display: flex; position: sticky; top: 0; align-self: flex-start; height: 100vh; }
}

/* Logo dark fix */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img[src$="/TBL_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/TBL_dark.svg"); }
  :root:not([data-theme="light"]) img[src$="/TOR_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/TOR_dark.svg"); }
  :root:not([data-theme="light"]) img[src$="/NSH_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/NSH_dark.svg"); }
  :root:not([data-theme]) .spoiler-game .team-detail img[src$="/NSH_light.svg"] { content: normal; }
}
:root[data-theme="dark"] img[src$="/TBL_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/TBL_dark.svg"); }
:root[data-theme="dark"] img[src$="/TOR_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/TOR_dark.svg"); }
:root[data-theme="dark"] img[src$="/NSH_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/NSH_dark.svg"); }
.jersey-card img[src$="/TBL_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/TBL_dark.svg"); }
.jersey-card img[src$="/TOR_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/TOR_dark.svg"); }
.jersey-card img[src$="/NSH_light.svg"] { content: url("https://assets.nhle.com/logos/nhl/svg/NSH_dark.svg"); }
:root[data-theme="light"] .spoiler-game .team-detail img[src$="/NSH_light.svg"] { content: normal; }

/* Overview highlight cards */
.hl-heading { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; text-transform: uppercase; margin: 22px 0 10px; border-bottom: 1px solid var(--border); }
.hl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px; align-items: start; }
.hl-card { margin: 0; }
.hl-card h3 a { color: inherit; text-decoration: none; }
.hl-card h3 a:hover { color: var(--accent); }
.hl-card p { font-size: 0.8rem; opacity: 0.7; margin: 4px 0 10px; }
.hl-card ol { list-style: none; margin: 0; padding: 0; }
.hl-card li { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px 10px; border-top: 1px solid var(--border); box-shadow: inset 4px 0 0 var(--team); }
.hl-card li img { object-fit: contain; }
.hl-who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hl-who small { opacity: 0.7; }
.hl-value { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; }

/* Logo: sticks in the accent colour, puck and name follow the text colour */
.logo { display: inline-flex; align-items: flex-end; gap: 6px; line-height: 0.8; }
.logo svg { width: 1.2em; height: 1.4em; margin-bottom: -0.17em; fill: currentColor; }
.logo path { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
a.brand, a.topbar-title { color: inherit; text-decoration: none; }

.name-short { display: none; }
@media (max-width: 600px) {
  .name-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .name-short { display: inline; }
}
