:root {
  font-family: "Helvetica Neue", "Helvetica", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
  --border: color-mix(in srgb, currentColor 18%, transparent);
  --row-alt: color-mix(in srgb, currentColor 5%, transparent);
  --muted: color-mix(in srgb, currentColor 55%, transparent);
}

body {
  margin: 0;
  background: Canvas;
  color: CanvasText;
  line-height: 1.4;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  position: relative;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  min-height: 56px;
}

/* Selected-team logo: absolute-positioned anchor inside .container so it
 * can span both the header row and the controls row (top of crest to
 * bottom of dropdowns) and sit centered over the stats columns of the
 * table below, instead of being inline-flex-flush-right. When no team is
 * selected, link.hidden (display: none) takes the element out of render. */
.app-header > #team-logo-link {
  position: absolute;
  top: 32px;
  height: 130px;
  right: 134px;
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.nhl-crest {
  height: 1.6em;
  width: auto;
}

.team-logo {
  height: 100%;
  width: auto;
  max-height: 130px;
  object-fit: contain;
}

.controls {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  gap: 6px;
}

.controls select {
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: CanvasText;
  padding: 8px 10px;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: Canvas;
}

.status {
  min-height: 1.4em;
  margin: 8px 0 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.loading::before {
  content: "⏳ ";
}

.status.error {
  color: #b00020;
}

.picks {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.picks thead th {
  position: sticky;
  top: 0;
  background: Canvas;
  text-align: left;
  border-bottom: 2px solid var(--border);
  padding: 10px 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.picks thead th.stats-sub {
  top: 38px;
  text-align: right;
  font-size: 0.75rem;
  padding: 6px 6px;
}

.picks thead th.stats-group {
  text-align: center;
  border-left: 1px solid var(--border);
  letter-spacing: 0.08em;
  font-weight: 600;
}

.picks thead th[data-key] {
  cursor: pointer;
  user-select: none;
}

.picks thead th[data-key]:hover {
  color: CanvasText;
}

.picks thead th.sort-asc::after,
.picks thead th.sort-desc::after {
  font-size: 0.65em;
  margin-left: 0.35em;
  color: CanvasText;
}
.picks thead th.sort-asc::after  { content: "▲"; }
.picks thead th.sort-desc::after { content: "▼"; }

.picks tbody td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}

.picks tbody tr:not(.round-divider):not(.year-divider):hover {
  background: color-mix(in srgb, currentColor 9%, transparent);
}

.picks tbody a {
  color: inherit;
  text-decoration: none;
}

.picks tbody a:hover {
  text-decoration: underline;
}

.picks tbody tr:nth-child(even) {
  background: var(--row-alt);
}

.picks td:first-child {
  font-weight: 600;
}

/* Right-align the two pick-number columns (Overall / Round). They're numeric
 * and read more cleanly aligned with the stats block to the right. */
.picks th:nth-child(-n+2),
.picks td:nth-child(-n+2) {
  text-align: right;
  width: 4em;
}

/* Player column: hold a comfortable width without flexing to the edge.
 * Slightly heavier weight so names stand out from the numeric columns. */
.picks th:nth-child(4),
.picks td:nth-child(4) {
  min-width: 14em;
  padding-right: 24px;
}
.picks td:nth-child(4) {
  font-weight: 500;
}

.logo-cell {
  width: 2.5em;
  padding-right: 0 !important;
}

.flag-cell {
  width: 2em;
  padding-right: 0 !important;
}

.row-flag {
  width: 24px;
  height: auto;
  vertical-align: middle;
  display: block;
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  border-radius: 2px;
}

.stats-cell {
  text-align: right;
  width: 3em;
  padding-left: 6px !important;
  padding-right: 6px !important;
  font-variant-numeric: tabular-nums;
}

/* Visual separator at the start of the stats block (column 7 = GP). */
.picks tbody td:nth-child(7),
.picks thead th.stats-sub:first-of-type {
  border-left: 1px solid var(--border);
}

.row-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  display: block;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 24px !important;
}

.picks tbody tr.round-divider,
.picks tbody tr.year-divider {
  background: var(--row-alt);
}
.picks tbody tr.round-divider td,
.picks tbody tr.year-divider td {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding: 10px 8px;
}
