:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #65717a;
  --line: #d8e0e4;
  --paper: #f6f7f5;
  --panel: #ffffff;
  --panel-soft: #eef5f3;
  --field: #ffffff;
  --table-head: #fbfcfb;
  --selected-row: #f0f7f6;
  --teal: #067b7b;
  --teal-dark: #045e60;
  --amber: #d99417;
  --coral: #d6503f;
  --charcoal: #1f292e;
  --shadow: 0 18px 40px rgba(23, 32, 38, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ecf4f2;
  --muted: #9aa8ae;
  --line: #31424a;
  --paper: #10181c;
  --panel: #18242a;
  --panel-soft: #203537;
  --field: #111d22;
  --table-head: #142025;
  --selected-row: #183234;
  --teal: #11a3a0;
  --teal-dark: #78d8d0;
  --amber: #e2a51f;
  --coral: #ee755f;
  --charcoal: #0d1418;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label.file-button,
.button-link {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover,
label.file-button:hover,
.button-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
}

button:disabled:hover {
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label.file-button:focus-within,
.button-link:focus-visible {
  outline: 3px solid rgba(6, 123, 123, 0.25);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.topbar {
  min-height: 78px;
  padding: 18px clamp(16px, 3vw, 34px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background:
    linear-gradient(90deg, rgba(13, 20, 24, 0.97), rgba(13, 20, 24, 0.91)),
    url("assets/topbar-dragons.png") center 48% / cover;
  color: #fff;
}

.brand-block,
.top-actions,
.comparison-header,
.selection-actions,
.form-title {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #d6503f;
  color: #07090a;
  font-family: "Arial Black", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
  line-height: 0.8;
  text-align: center;
}

.brand-mark span {
  display: block;
  font-size: 1.34rem;
  letter-spacing: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.brand-subtitle {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(0.78rem, 1vw, 0.92rem);
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.topbar h1,
.overview-copy h2,
.comparison-header h2,
.player-form h3 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.top-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-toggle {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.88rem;
  line-height: 1;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.settings-only {
  display: none;
}

.owner-tools-open .settings-only {
  display: inline-flex;
}

.creator-strip .theme-toggle {
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
}

.creator-strip .theme-toggle:hover {
  background: var(--panel-soft);
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 5px;
  color: inherit;
  opacity: 0.72;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

main {
  padding: clamp(14px, 3vw, 34px);
}

.arcade-link-bar {
  margin: 0 0 18px;
  padding: 0;
}

.arcade-link-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.arcade-link-button {
  min-width: 0;
  height: clamp(56px, 7vw, 82px);
  border: 0;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.arcade-link-button:hover {
  transform: translateY(-1px);
  opacity: 0.86;
}

.arcade-link-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.overview-band {
  position: relative;
  overflow: hidden;
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 0.9fr);
  align-items: end;
  gap: 24px;
  padding: clamp(20px, 4vw, 38px);
  border-radius: 8px;
  background: linear-gradient(115deg, rgba(31, 41, 46, 0.95), rgba(6, 123, 123, 0.78));
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-rank-board {
  width: min(620px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  background: rgba(13, 20, 24, 0.42);
  backdrop-filter: blur(10px);
  opacity: 0;
  animation: heroContentFade 1.4s ease 1.2s forwards;
}

.hero-rank-nav {
  width: 30px;
  min-width: 30px;
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.18);
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
}

.hero-rank-nav:hover {
  background: rgba(255, 255, 255, 0.17);
}

.hero-rank-logo-button {
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.hero-rank-logo-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.team-logo.hero,
.hero-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.hero-brand-mark span {
  font-size: 1rem;
}

.hero-rank-details {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.hero-rank-head {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.hero-rank-head > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-rank-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.hero-rank-link {
  min-width: 0;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.hero-rank-link:hover {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.17);
  transform: translateY(-1px);
}

.hero-rank-link span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  font-weight: 950;
}

.hero-rank-link strong {
  min-width: 3ch;
  text-align: left;
  font-size: 0.96rem;
  line-height: 1;
}

.hero-rank-link.empty {
  pointer-events: none;
  opacity: 0.45;
}

.hero-rank-empty {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.74rem;
  font-weight: 800;
}

.overview-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(31, 41, 46, 0.54), rgba(6, 123, 123, 0.42)),
    url("assets/union-terminal-arcade-legacy.jpeg") center 45% / cover;
  opacity: 0.38;
  filter: grayscale(1) contrast(1.08);
}

.overview-band > * {
  position: relative;
  z-index: 1;
}

.overview-copy .view-mode-tabs,
.metric-card,
.freshness-panel {
  opacity: 0;
  animation: heroContentFade 1.4s ease forwards;
}

.overview-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(16px, 3vw, 28px);
  animation-delay: 3.2s;
}

.overview-copy .view-mode-tabs {
  width: min(420px, 100%);
  margin-top: 0;
  animation-delay: 3.2s;
}

.metric-card:nth-child(1) {
  animation-delay: 4.2s;
}

.metric-card:nth-child(2) {
  animation-delay: 5.2s;
}

.freshness-panel {
  animation-delay: 6.2s;
}

@keyframes heroContentFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.overview-side {
  width: min(100%, 760px);
  justify-self: end;
  display: grid;
  gap: 10px;
}

.metric-card,
.stat-card {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}

.metric-card strong,
.stat-card strong {
  display: block;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1;
}

.metric-card span,
.stat-card span {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 750;
}

.freshness-panel {
  min-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
}

.freshness-panel strong,
.freshness-panel span {
  display: block;
}

.freshness-panel strong {
  font-size: 0.98rem;
}

.freshness-panel span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 750;
}

.freshness-panel .secondary-button {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.95);
  color: var(--teal-dark);
}

.freshness-panel .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

:root.standings-compare-active .workspace-grid {
  grid-template-columns: 1fr;
}

:root.standings-compare-active .control-panel {
  display: none;
}

.view-mode-tabs {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-tab {
  min-width: 154px;
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
}

.mode-tab.active {
  border-color: rgba(6, 123, 123, 0.72);
  background: var(--teal);
  color: #fff;
}

.overview-copy .mode-tab {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.overview-copy .mode-tab.active {
  border-color: rgba(255, 255, 255, 0.82);
  background: #fff;
  color: var(--teal-dark);
}

.sponsor-strip {
  margin: 0 clamp(14px, 3vw, 34px) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pincinnati-promo {
  width: min(900px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vw, 30px);
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease;
}

.pincinnati-promo:hover {
  transform: translateY(-1px);
}

.pincinnati-sponsor-logo {
  width: clamp(280px, 44vw, 430px);
  flex: 0 0 clamp(280px, 44vw, 430px);
  max-height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(23, 32, 38, 0.16));
}

.pincinnati-countdown {
  width: 360px;
  flex: 0 0 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.07);
  font-size: clamp(0.88rem, 1.2vw, 1rem);
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.countdown-unit {
  display: inline-block;
}

.countdown-value {
  display: inline-block;
  width: 3ch;
  margin-left: 0.45ch;
  margin-right: 0.25ch;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.sponsor-secondary-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  width: min(900px, 100%);
}

.pinheadz-button {
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #11181c;
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.09);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pinheadz-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(23, 32, 38, 0.13);
}

.pinheadz-button img {
  width: clamp(150px, 20vw, 210px);
  height: 36px;
  object-fit: contain;
}

.mess-button {
  min-height: 56px;
  border: 1px solid #d8e0e4;
  border-radius: 8px;
  padding: 8px 16px 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  color: #07090a;
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.09);
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.mess-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(23, 32, 38, 0.13);
}

.mess-button img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.creator-strip {
  margin: 18px clamp(14px, 3vw, 34px) 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.07);
}

.creator-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 760;
}

.creator-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.owner-tools-toggle {
  min-width: 34px;
  min-height: 34px;
  border-color: var(--line);
  padding: 0;
  background: var(--field);
  color: var(--ink);
  line-height: 1;
}

.creator-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.snow-link {
  min-width: 82px;
  font-size: 1.05rem;
}

.site-footer {
  margin: 12px clamp(14px, 3vw, 34px) 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.07);
}

.site-footer.hidden {
  display: none;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-footer .eyebrow {
  color: var(--muted);
  opacity: 1;
}

.site-footer span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.team-compare-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.07);
}

.team-compare-header,
.chart-actions,
.chart-tabs,
.compare-picker {
  display: flex;
  align-items: center;
}

.team-compare-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.team-compare-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.team-compare-header .eyebrow {
  color: var(--muted);
  opacity: 1;
}

.chart-actions {
  gap: 8px;
}

.compare-picker,
.chart-tabs {
  gap: 8px;
  flex-wrap: wrap;
}

.compare-picker {
  margin-bottom: 12px;
}

.compare-pick,
.chart-tab {
  min-height: 36px;
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
  font-size: 0.82rem;
}

.compare-pick {
  padding-left: 7px;
}

.compare-pick.active,
.chart-tab.active {
  border-color: rgba(6, 123, 123, 0.7);
  background: var(--panel-soft);
  color: var(--teal-dark);
}

.compare-pick.locked {
  cursor: not-allowed;
  opacity: 0.45;
}

.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin-top: 14px;
  align-items: stretch;
}

.team-scorecards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.team-card {
  min-height: 250px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--team-color);
  border-radius: 8px;
  padding: 14px;
  background: var(--field);
}

.team-top-three {
  display: grid;
  gap: 6px;
}

.team-top-three > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.top-player-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.top-player-row b {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--team-color, var(--teal)) 18%, var(--panel-soft));
  color: var(--ink);
  font-size: 0.72rem;
}

.top-player-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-player-row em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.selectable-team,
.selectable-team-row {
  cursor: pointer;
}

.selectable-team:hover,
.selectable-team:focus-visible {
  border-color: color-mix(in srgb, var(--team-color, var(--teal)) 55%, var(--line));
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.11);
  outline: none;
}

.selectable-team-row:hover,
.selectable-team-row:focus-visible {
  background: var(--panel-soft);
  outline: none;
}

.team-card-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.team-card h3 {
  margin: 0;
  font-size: 1rem;
}

.team-card-head span,
.team-stat-line span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.team-stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.team-stat-line strong {
  max-width: 58%;
  text-align: right;
}

.squad-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.squad-strip span {
  border-radius: 8px;
  padding: 7px 8px;
  background: var(--panel-soft);
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.chart-window {
  min-height: 442px;
  border-radius: 8px;
  padding: 16px;
  background: var(--charcoal);
  color: #fff;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.chart-title span {
  font-size: 1.05rem;
  font-weight: 900;
}

.chart-title strong {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.bar-chart {
  display: grid;
  gap: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(88px, 120px) minmax(120px, 1fr) minmax(70px, auto);
  align-items: center;
  gap: 12px;
}

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

.bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.83rem;
  font-weight: 850;
}

.bar-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.bar-fill {
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: var(--team-color);
}

.bar-row > strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pie-layout {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.pie-chart {
  width: min(240px, 100%);
  aspect-ratio: 1;
  border: 10px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
}

.pie-legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.legend-row strong,
.legend-row span:last-child {
  font-size: 0.84rem;
}

.legend-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.score-table {
  min-width: 960px;
}

.score-team-name {
  display: flex;
  align-items: center;
  gap: 9px;
}

.control-panel,
.data-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(23, 32, 38, 0.07);
}

.control-panel {
  position: sticky;
  top: 14px;
  padding: 18px;
}

.panel-section + .panel-section,
.player-form {
  margin-top: 18px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chip-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  min-height: 34px;
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
  font-size: 0.83rem;
  padding-left: 7px;
}

.chip.active {
  border-color: rgba(6, 123, 123, 0.7);
  background: var(--panel-soft);
  color: var(--teal-dark);
}

.team-logo {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--team-color) 82%, transparent);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, var(--team-color), color-mix(in srgb, var(--team-color) 70%, #000 30%));
  color: var(--team-text, var(--team-accent));
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
}

.team-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.team-logo.large {
  width: 54px;
  height: 54px;
  font-size: 0.9rem;
}

.logo-editor {
  display: grid;
  gap: 10px;
}

.option-logo-editor {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.logo-edit-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: end;
  gap: 12px;
}

.logo-preview {
  width: 54px;
  height: 54px;
}

.logo-upload {
  width: 100%;
  border-color: var(--line);
  background: var(--field);
  color: var(--teal-dark);
}

.options-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--table-head);
}

.options-panel.hidden,
.submission-list.hidden,
.modal-backdrop.hidden {
  display: none;
}

.helper-text {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.option-actions,
.owner-review {
  display: grid;
  gap: 8px;
}

.owner-review {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.local-file-button {
  width: 100%;
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.secondary-button {
  border-color: var(--line);
  background: var(--field);
  color: var(--teal-dark);
}

.ghost-button,
.file-button {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
}

.data-area .ghost-button,
.control-panel .ghost-button {
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
}

.full-width {
  width: 100%;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.player-form {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.player-form.hidden {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(23, 32, 38, 0.62);
}

.modal-card {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0;
  font-size: 1.32rem;
}

.modal-card label {
  margin-top: 14px;
}

.form-status {
  min-height: 20px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.form-status.success {
  color: var(--teal-dark);
}

.form-status.error {
  color: var(--coral);
}

.ifpa-search-box {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--table-head);
}

.form-title.compact {
  margin-bottom: 10px;
}

.form-title.compact h3 {
  margin: 0;
  font-size: 1rem;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.ifpa-search-results {
  display: grid;
  gap: 8px;
}

.ifpa-result {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
}

.ifpa-result:hover,
.ifpa-result:focus-visible {
  border-color: rgba(6, 123, 123, 0.5);
  background: var(--panel-soft);
  outline: none;
}

.ifpa-result span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ifpa-result strong,
.ifpa-result small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ifpa-result small {
  color: var(--muted);
  font-size: 0.78rem;
}

.ifpa-result em {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-style: normal;
  font-weight: 900;
}

.submission-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.submission-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--field);
}

.submission-card h4 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.submission-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.submission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.form-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.icon-button {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: var(--line);
  background: var(--field);
  color: var(--muted);
}

.data-area {
  min-width: 0;
  overflow: hidden;
}

.team-detail-view.hidden,
.standings-compare-view.hidden {
  display: none;
}

.standings-compare-view {
  padding: 20px 22px 22px;
}

.standings-compare-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.standings-compare-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.standings-compare-header > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.standings-compare-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.standings-pick {
  min-height: 36px;
  border-color: var(--line);
  background: var(--field);
  color: var(--ink);
  font-size: 0.83rem;
  padding-left: 7px;
}

.standings-pick.active {
  border-color: rgba(6, 123, 123, 0.72);
  background: var(--panel-soft);
  color: var(--teal-dark);
}

.standings-pick.locked {
  opacity: 0.48;
}

.standing-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  align-items: start;
}

.standing-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--team-color) 46%, var(--line));
  border-radius: 8px;
  background: var(--field);
}

.standing-column-head {
  border-bottom: 4px solid var(--team-color);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--table-head);
}

.standing-column-head h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.08;
}

.standing-column-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.standing-list {
  max-height: 720px;
  overflow-y: auto;
  display: grid;
}

.standing-player {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  transition: background 160ms ease;
}

.standing-player:hover {
  background: var(--panel-soft);
}

.standing-player b {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fff;
  font-size: 0.76rem;
}

.standing-player span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.standing-player strong,
.standing-player em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standing-player strong {
  font-size: 0.88rem;
}

.standing-player em,
.standing-player small {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 760;
}

.standing-player small {
  justify-self: end;
}

.comparison-header {
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 12px;
}

.comparison-header .eyebrow {
  color: var(--muted);
  opacity: 1;
}

.selection-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(116px, 0.7fr) repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 22px 18px;
}

.summary-grid .stat-card {
  min-width: 0;
  min-height: clamp(120px, 10vw, 168px);
  border-color: var(--line);
  background: var(--charcoal);
  color: #fff;
}

.summary-grid .stat-card strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(1.15rem, 2.2vw, 1.8rem);
  line-height: 1.02;
}

.summary-grid .stat-card span {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(0.68rem, 0.85vw, 0.78rem);
  line-height: 1.15;
}

.summary-logo-card {
  display: grid;
  place-items: center;
  padding: 14px;
}

.team-logo.summary {
  width: min(100%, 126px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
  border-width: 3px;
  font-size: clamp(1rem, 2.3vw, 1.65rem);
}

.summary-brand-mark {
  width: min(100%, 126px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
}

.summary-brand-mark span {
  font-size: clamp(1.5rem, 3.1vw, 2.25rem);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: var(--table-head);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

tr.selected-row {
  background: var(--selected-row);
}

.select-cell {
  width: 62px;
}

:root:not(.owner-tools-open) .selection-actions,
:root:not(.owner-tools-open) .select-cell,
:root:not(.owner-tools-open) #printPdfButton {
  display: none;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.player-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.player-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.player-page-link {
  color: inherit;
  text-decoration: none;
}

.player-page-link:hover {
  text-decoration: underline;
}

.player-emoji {
  display: inline-block;
  min-width: 1.25em;
  text-align: center;
  transition: opacity 450ms ease;
}

.player-emoji.is-fading {
  opacity: 0;
}

.group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.movement {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
}

.movement.up {
  color: var(--teal-dark);
}

.movement.down {
  color: var(--coral);
}

.movement.flat {
  color: var(--muted);
}

.empty-state {
  padding: 32px 14px;
  color: var(--muted);
  text-align: center;
}

.print-sheet {
  display: none;
}

@media (max-width: 980px) {
  .topbar,
  .overview-band,
  .workspace-grid,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .top-actions {
    margin-left: auto;
    justify-content: flex-end;
  }

  .creator-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .arcade-link-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-panel {
    position: static;
  }

  .summary-grid,
  .metric-strip,
  .team-scorecards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  main {
    padding: 12px;
  }

  .overview-band {
    padding: 22px;
  }

  .freshness-panel,
  .two-col,
  .export-actions,
  .search-row,
  .team-scorecards,
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .overview-copy {
    display: contents;
  }

  .hero-rank-board {
    order: 1;
  }

  .overview-side {
    order: 2;
  }

  .overview-copy .view-mode-tabs {
    order: 3;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 66px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .metric-card strong {
    font-size: clamp(1.35rem, 7vw, 1.85rem);
  }

  .metric-card span {
    margin-top: 4px;
    font-size: 0.7rem;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-logo-card {
    grid-column: 1 / -1;
    min-height: 76px;
  }

  .summary-grid .stat-card {
    min-height: 68px;
    padding: 10px;
  }

  .summary-grid .stat-card strong {
    font-size: clamp(1.15rem, 6.5vw, 1.55rem);
  }

  .summary-grid .stat-card span {
    margin-top: 4px;
    font-size: 0.68rem;
  }

  .summary-grid .stat-card:nth-child(4) {
    display: none;
  }

  .comparison-header,
  .team-compare-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .team-compare-panel {
    padding: 14px;
  }

  .chart-actions {
    width: 100%;
  }

  .creator-actions,
  .footer-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .sponsor-strip {
    flex-direction: column;
    gap: 10px;
  }

  .pincinnati-promo {
    flex-direction: column;
    gap: 8px;
  }

  .pincinnati-sponsor-logo {
    width: min(420px, 92vw);
    flex-basis: auto;
    max-height: 70px;
  }

  .pincinnati-countdown {
    width: min(100%, 360px);
    flex-basis: auto;
    font-size: 0.8rem;
  }

  .sponsor-secondary-row {
    flex-direction: column;
    align-items: center;
  }

  .pinheadz-button,
  .mess-button {
    width: min(100%, 360px);
  }

  .arcade-link-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    width: 100%;
  }

  .arcade-link-button {
    height: 48px;
    justify-content: center;
  }

  .arcade-link-button img {
    max-height: 48px;
  }

  .arcade-link-home {
    order: 1;
  }

  .arcade-link-records {
    order: 2;
  }

  .arcade-link-twitch {
    order: 3;
  }

  .arcade-link-youtube {
    order: 4;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .bar-row > strong {
    text-align: left;
  }

  button,
  label.file-button,
  .button-link {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .top-actions .primary-button {
    width: auto;
  }

  .creator-strip .theme-toggle,
  .owner-tools-toggle {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .snow-link {
    min-width: 0;
  }

  .hero-rank-nav {
    width: 30px;
    min-width: 30px;
  }

  .hero-rank-board {
    width: 100%;
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    gap: 7px;
    padding: 9px;
    position: relative;
    z-index: 1;
  }

  .hero-rank-logo-button {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .team-logo.hero,
  .hero-brand-mark {
    width: 42px;
    height: 42px;
  }

  .hero-rank-links {
    gap: 5px;
  }

  .hero-rank-link {
    padding: 5px 4px;
    gap: 4px;
  }

  .hero-rank-link span {
    font-size: 0.62rem;
  }

  .hero-rank-link strong {
    font-size: 0.82rem;
  }

  .overview-copy .view-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    position: relative;
    z-index: 1;
  }

  .overview-copy .mode-tab {
    min-width: 0;
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell {
    display: none;
  }

  .print-sheet {
    display: block;
    padding: 0;
    color: #172026;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .print-page {
    page-break-after: always;
    min-height: 10in;
    padding: 0.35in;
  }

  .print-hero {
    min-height: 2.1in;
    padding: 0.35in;
    display: flex;
    align-items: flex-end;
    border-radius: 8px;
    color: #fff;
    background:
      linear-gradient(105deg, rgba(23, 32, 38, 0.92), rgba(6, 123, 123, 0.78)),
      url("assets/pinball-table-texture.png") center / cover;
  }

  .print-hero h1 {
    margin: 0;
    font-size: 34pt;
  }

  .print-hero p {
    margin: 0 0 8px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .print-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.12in;
    margin: 0.18in 0;
  }

  .print-stat,
  .print-player {
    border: 1px solid #d8e0e4;
    border-radius: 8px;
    padding: 0.14in;
  }

  .print-stat strong {
    display: block;
    font-size: 19pt;
  }

  .print-stat span,
  .print-player span {
    color: #65717a;
    font-size: 8pt;
    font-weight: 800;
    text-transform: uppercase;
  }

  .print-roster {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.12in;
  }

  .print-player h2 {
    margin: 0.04in 0;
    font-size: 15pt;
  }
}
