:root {
  --bg: #05090d;
  --panel: #171b23;
  --panel-2: #11161d;
  --line: #202731;
  --text: #ffffff;
  --muted: #9fb1c2;
  --blue: #22c55e;
  --amber: #ffc20a;
  --red: #ff4655;
  --green: #2bd160;
  --field: #15803d;
  --dirt: #b87531;
  --shadow: rgba(0, 0, 0, 0.5);
  --step--2: clamp(0.68rem, 0.62rem + 0.22vw, 0.78rem);
  --step--1: clamp(0.78rem, 0.72rem + 0.24vw, 0.9rem);
  --step-0: clamp(0.92rem, 0.86rem + 0.24vw, 1rem);
  --step-1: clamp(1.08rem, 0.98rem + 0.42vw, 1.28rem);
  --step-2: clamp(1.32rem, 1.12rem + 0.72vw, 1.72rem);
  --step-3: clamp(1.85rem, 1.42rem + 1.65vw, 2.85rem);
  --step-4: clamp(2.35rem, 1.64rem + 3.2vw, 4.2rem);
  --tap: clamp(44px, 3.2vw, 52px);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: var(--step-0);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(12px, 2vw, 28px);
  background: rgba(7, 11, 15, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 30px var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #05080b;
  border: 2px solid var(--green);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark::after {
  content: "";
  width: 24px;
  height: 10px;
  background: var(--green);
  transform: skewX(-22deg);
  border-radius: 999px;
  box-shadow: 0 9px 0 #b8ff47;
}

.brand h1 {
  margin: 0;
  font-size: var(--step-1);
  line-height: 1;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 8px 12px;
  background: var(--panel);
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: 86px 1fr;
  min-width: 0;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #0b1016;
  padding: 24px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.sidebar-logo {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.sidebar-logo.active .brand-mark {
  box-shadow: 0 0 0 10px rgba(47, 214, 109, 0.12), 0 8px 20px rgba(47, 214, 109, 0.18);
}

.small-mark {
  width: 46px;
  height: 46px;
}

.small-mark::after {
  width: 24px;
  height: 8px;
  box-shadow: 0 8px 0 #b8ff47;
}

.nav-button {
  width: 58px;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 0;
}

.nav-button strong {
  font-size: 0;
  line-height: 1;
}

.nav-icon::before {
  display: block;
  font-size: clamp(1.25rem, 2.1vw, 1.6rem);
  line-height: 1;
}

.nav-icon-home::before {
  content: "⌂";
}

.nav-icon-teams::before {
  content: "+";
  font-size: clamp(2rem, 3.4vw, 2.45rem);
  font-weight: 300;
}

.nav-icon-gameday::before {
  content: "⌁";
  font-size: clamp(1.55rem, 2.5vw, 1.9rem);
}

.nav-icon-analytics::before {
  content: "▥";
}

.nav-icon-score::before {
  content: "~";
}

.nav-icon-sheet::before {
  content: "#";
}

.nav-icon-setup::before {
  content: "⚙";
}

.nav-button.active {
  border-color: var(--green);
  color: var(--text);
  background: rgba(47, 214, 109, 0.15);
  box-shadow: 0 8px 20px rgba(47, 214, 109, 0.18);
}

.nav-button[data-view="teams"] {
  width: 66px;
  min-height: 66px;
  color: #06110a;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 7px 0 #020507, 0 14px 28px rgba(43, 209, 96, 0.24);
}

.nav-button[data-view="teams"].active {
  color: #06110a;
  background: var(--green);
  box-shadow: 0 7px 0 #020507, 0 18px 32px rgba(43, 209, 96, 0.34);
}

.main {
  min-width: 0;
  padding: clamp(12px, 2vw, 24px);
}

body:has(.home-view.active) .topbar {
  display: none;
}

body:has(.home-view.active) .main {
  padding: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.panel h3 {
  margin: 0;
  font-size: var(--step-2);
  line-height: 1.1;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.back-button {
  min-height: 38px;
  margin: 0 0 14px;
  border: 1px solid rgba(43, 209, 96, 0.28);
  border-radius: 999px;
  background: rgba(43, 209, 96, 0.1);
  color: var(--green);
  padding: 8px 14px;
  font-size: var(--step--2);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.back-button:hover,
.back-button:focus-visible {
  background: rgba(43, 209, 96, 0.18);
  color: var(--text);
}

.grid {
  display: grid;
  gap: 14px;
}

.dashboard-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.home-dashboard {
  max-width: 1100px;
  margin-inline: auto;
}

.home-view {
  min-height: 100vh;
  background: #05090d;
}

.home-shell {
  width: min(1100px, calc(100vw - 150px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.home-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 22px;
  margin-bottom: 28px;
}

.home-kicker,
.section-link-row span {
  color: #a9c2d7;
  font-size: var(--step--2);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.home-hero h2 {
  margin: 8px 0 14px;
  color: var(--text);
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: 0;
}

.home-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #c9d7e2;
  font-size: var(--step-0);
}

.home-focus strong {
  color: var(--text);
}

.season-pill,
.calendar-pill,
.section-link-row button {
  border: 0;
  border-radius: 999px;
  background: rgba(43, 209, 96, 0.12);
  color: var(--green);
  min-height: 38px;
  padding: 8px 14px;
  font-size: var(--step--2);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.season-pill strong {
  margin-left: 8px;
  color: var(--green);
  letter-spacing: 0;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-pill {
  min-height: 48px;
  padding-inline: 18px;
  background: var(--panel);
  color: var(--text);
}

.home-team-badge {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--green);
  color: var(--text);
  background: #11161d;
  font-weight: 1000;
}

.install-banner {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 16px 20px;
  border: 1px solid rgba(43, 209, 96, 0.22);
  border-radius: 22px;
  background: #0e2a1c;
}

.install-banner strong,
.install-banner span {
  display: block;
}

.install-banner span {
  color: #bed0c8;
  font-size: var(--step--1);
}

.install-close {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.7rem;
}

.section-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 4px 14px;
}

.section-link-row button {
  background: transparent;
  padding-inline: 6px;
}

.team-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 34px;
  padding: 8px 17px 8px 10px;
  border-radius: 999px;
  background: var(--green);
  color: #041109;
  font-weight: 1000;
}

.chip-badge {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #10161d;
  color: var(--green);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 1000;
}

.home-empty-card {
  min-height: 212px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 28px;
  border: 1px dashed rgba(159, 177, 194, 0.16);
  border-radius: 22px;
  background: #0f1319;
  text-align: center;
}

.home-empty-card strong {
  font-size: var(--step-1);
  line-height: 1.2;
}

.home-empty-card span {
  color: #aec0cf;
  font-size: var(--step--1);
}

.empty-trophy {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.5rem;
}

.standings-title,
.recent-title {
  margin-top: 6px;
}

.home-standings {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 26px;
}

.home-stat {
  min-height: clamp(88px, 9vw, 110px);
  display: grid;
  align-content: center;
  gap: 8px;
  padding: clamp(14px, 2vw, 20px) clamp(16px, 2.4vw, 24px);
  border-radius: 18px;
  background: #171b23;
}

.home-stat strong {
  font-size: var(--step-3);
  line-height: 1;
  letter-spacing: 0;
}

.home-stat span {
  color: #b6c7d5;
  font-size: var(--step--2);
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-stat.green strong {
  color: var(--green);
}

.home-stat.amber strong {
  color: var(--amber);
}

.home-stat.red strong {
  color: var(--red);
}

.recent-results {
  display: grid;
  overflow: hidden;
  border-radius: 20px;
  background: #151920;
}

.recent-row {
  min-height: clamp(72px, 8vw, 82px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.recent-row:last-child {
  border-bottom: 0;
}

.recent-row strong,
.recent-row span {
  display: block;
}

.recent-row span {
  color: #aebfcd;
  font-size: var(--step--1);
}

.result-pill {
  min-width: 84px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 194, 10, 0.18);
  color: var(--amber);
  border: 1px solid rgba(255, 194, 10, 0.36);
  font-weight: 1000;
}

.result-pill.w {
  background: rgba(43, 209, 96, 0.18);
  color: var(--green);
  border-color: rgba(43, 209, 96, 0.36);
}

.result-pill.l {
  background: rgba(255, 70, 85, 0.18);
  color: var(--red);
  border-color: rgba(255, 70, 85, 0.36);
}

.game-day-card {
  max-width: 1100px;
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  background: #151922;
}

.game-day-scoreboard {
  max-width: 1100px;
  margin: 0 auto 18px;
}

.game-day-scoreboard .classic-scoreboard {
  max-width: none;
  margin: 0;
}

.game-day-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.game-day-card h2 {
  margin: 4px 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
}

.game-day-card p {
  margin: 0;
  color: var(--muted);
}

.game-day-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-game-day {
  min-height: 260px;
}

.setup-wide {
  grid-column: 1 / -1;
}

.two-col {
  grid-template-columns: minmax(290px, 0.85fr) minmax(320px, 1.15fr);
}

.management-grid {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  align-items: start;
}

.manage-hero {
  max-width: 1100px;
  margin: 10px auto 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-radius: 28px;
  background: #151922;
}

.club-badge {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--green);
  background: #080c11;
  color: var(--text);
  font-weight: 1000;
}

.manage-hero span,
.manage-title span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
  text-transform: uppercase;
}

.manage-hero strong {
  display: block;
  font-size: var(--step-2);
  line-height: 1.1;
}

.add-pill,
.compact-add {
  border-radius: 999px;
}

.manage-title {
  max-width: 1100px;
  margin-inline: auto;
}

.management-tree {
  max-width: 1100px;
  margin-inline: auto;
  display: grid;
  gap: 14px;
}

.tree-card {
  overflow: hidden;
  border-radius: 24px;
  background: #151922;
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px var(--shadow);
}

.tree-row,
.tree-game {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.tree-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
}

.tree-main strong,
.game-opponent strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--step-0);
}

.tree-main span,
.game-opponent small {
  color: var(--muted);
  font-size: var(--step--1);
}

.tree-caret,
.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: #202630;
  color: var(--text);
}

.icon-btn.danger {
  background: rgba(255, 63, 79, 0.13);
  color: var(--red);
}

.tree-icon {
  min-width: var(--tap);
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(47, 214, 109, 0.13);
  color: var(--green);
  font-size: var(--step--2);
  font-weight: 1000;
}

.team-icon {
  border: 2px solid var(--green);
  background: #080c11;
  color: var(--text);
}

.season-icon {
  border-radius: 16px;
}

.tournament-icon {
  color: var(--green);
}

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

.record-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.record-badges span {
  min-width: 36px;
  min-height: 22px;
  display: grid;
  place-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1d2330;
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
}

.record-badges .win {
  background: rgba(47, 214, 109, 0.16);
  color: var(--green);
}

.record-badges .draw {
  background: rgba(245, 178, 27, 0.17);
  color: var(--amber);
}

.record-badges .loss {
  background: rgba(255, 63, 79, 0.17);
  color: var(--red);
}

.tree-branch {
  margin-left: 28px;
  border-left: 2px solid rgba(47, 214, 109, 0.25);
}

.season-branch {
  margin-left: 56px;
}

.season-row,
.tournament-row {
  background: rgba(8, 12, 17, 0.26);
}

.game-stack {
  margin-left: 84px;
  display: grid;
}

.tree-game {
  grid-template-columns: 1fr auto;
  padding: 12px 20px;
  background: #111720;
}

.tree-game.active-game {
  background: rgba(47, 214, 109, 0.09);
  box-shadow: inset 3px 0 0 var(--green);
}

.game-opponent {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
}

.game-opponent span {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #080c11;
  border: 2px solid var(--text);
  color: var(--green);
  font-weight: 1000;
}

.empty-row {
  padding: 14px 20px;
  color: var(--muted);
}

.next-game-card {
  max-width: 1100px;
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  background: #151922;
}

.next-game-card span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
  text-transform: uppercase;
}

.next-game-card strong {
  display: block;
  margin-top: 3px;
  font-size: var(--step-1);
  line-height: 1.15;
}

.next-game-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.roster-builder {
  max-width: 1100px;
  margin-inline: auto;
  grid-template-columns: minmax(250px, 0.85fr) minmax(260px, 0.9fr) minmax(340px, 1.25fr);
  align-items: start;
}

.player-pool {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.pool-player {
  grid-template-columns: auto 1fr auto;
}

.roster-lineup-panel {
  min-height: 420px;
}

.roster-lineup-panel .lineup {
  grid-template-columns: 1fr;
}

.roster-player-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.roster-player-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-row {
  gap: 8px;
}

.compact-row .btn {
  min-height: 40px;
  padding: 8px 10px;
}

.panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 28px var(--shadow);
}

.panel {
  padding: 16px;
}

.metric {
  min-height: 132px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span {
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: var(--step-3);
  line-height: 0.95;
}

.metric small {
  color: var(--muted);
}

.blue {
  border-color: var(--blue);
}

.amber {
  border-color: var(--amber);
}

.red {
  border-color: var(--red);
}

.green {
  border-color: var(--green);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f141a;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  padding: 10px 14px;
  font-weight: 800;
}

.btn.primary {
  background: var(--green);
  color: #031008;
  border-color: var(--green);
}

.btn.blue {
  background: var(--green);
  color: #051018;
}

.btn.amber {
  background: var(--amber);
  color: #211600;
}

.btn.red {
  background: var(--red);
  color: #250000;
}

.btn.ghost {
  background: transparent;
}

.team-list,
.player-list,
.roster-list,
.feed {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151d25;
}

.player-list-item {
  grid-template-columns: auto auto 1fr auto;
}

.touch-check {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.touch-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.touch-check span {
  width: 32px;
  height: 32px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: #0c1117;
}

.touch-check input:checked + span {
  border-color: var(--green);
  background: radial-gradient(circle at center, var(--green) 0 44%, #0c1117 46%);
  box-shadow: 0 0 0 6px rgba(47, 214, 109, 0.12);
}

.bulk-assign-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
}

.bulk-assign-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.compact-row {
  margin-top: 10px;
}

.compact-row .btn {
  min-height: 40px;
  padding: 7px 10px;
}

.list-item.selected-item {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(41, 182, 246, 0.45);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.item-actions .btn {
  min-height: clamp(38px, 3vw, 44px);
  padding: 7px 10px;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--text);
  background: var(--panel-2);
  object-fit: cover;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.mini {
  color: var(--muted);
  font-size: var(--step--1);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.classic-scoreboard {
  margin-bottom: 14px;
  border: 4px solid #cfcab8;
  background: #365f52;
  box-shadow: 0 12px 24px var(--shadow);
  color: var(--text);
  overflow-x: auto;
  max-width: 980px;
}

.scoreboard-main {
  min-width: 820px;
  display: grid;
  grid-template-columns: 44px 168px repeat(10, 34px) repeat(3, 42px);
  gap: 7px;
  align-items: center;
  padding: 10px 14px 8px;
}

.scoreboard-pitcher {
  display: grid;
  place-items: center;
  font-size: var(--step-2);
  font-weight: 1000;
  color: #e7e1cf;
}

.scoreboard-team-head {
  min-height: 28px;
}

.scoreboard-head {
  text-align: center;
  color: #e7e1cf;
  font-size: var(--step-1);
  line-height: 1;
  font-weight: 1000;
}

.scoreboard-head.total,
.scoreboard-cell.total {
  color: var(--text);
}

.scoreboard-team {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #10181f;
  color: var(--text);
  font-size: var(--step-0);
  line-height: 1;
  font-weight: 1000;
  text-transform: uppercase;
}

.scoreboard-cell {
  min-height: 32px;
  display: grid;
  place-items: center;
  background: #10181f;
  color: var(--text);
  font-size: var(--step-0);
  line-height: 1;
  font-weight: 1000;
}

.scoreboard-icon {
  width: 31px;
  height: 31px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 4px;
  background: #142027;
  border: 2px solid #263b40;
}

.scoreboard-icon i {
  display: block;
  border: 1px solid #40565a;
  background: #10181f;
}

.scoreboard-strip {
  min-width: 820px;
  display: grid;
  grid-template-columns: 44px 168px 92px 116px 78px 38px 38px 44px;
  gap: 7px;
  align-items: center;
  padding: 9px 14px 10px;
  border-top: 4px solid #cfcab8;
  background: #365f52;
}

.scoreboard-strip span {
  display: block;
  color: #e7e1cf;
  font-size: var(--step-0);
  line-height: 1;
  font-weight: 1000;
  text-transform: uppercase;
}

.scoreboard-strip strong {
  color: var(--text);
  font-size: var(--step--1);
  font-weight: 1000;
}

.scoreboard-atbat {
  min-height: 32px;
}

.count-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 18px;
  padding-top: 6px;
}

.count-dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #10181f;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.count-dots i.on.ball-dot {
  background: var(--blue);
}

.count-dots i.on.strike-dot {
  background: var(--amber);
}

.count-dots i.on.out-dot {
  background: var(--red);
}

.score-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.score-tile span {
  color: var(--muted);
  display: block;
}

.score-tile strong {
  font-size: var(--step-3);
}

.game-status-panel {
  margin-bottom: 14px;
}

.game-status-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
}

.game-status-head > div {
  display: grid;
  gap: 4px;
}

.game-status-head span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 900;
  text-transform: uppercase;
}

.game-status-head strong {
  font-size: var(--step-1);
}

.game-status-head small {
  color: var(--muted);
}

.status-warning {
  color: var(--amber);
}

.status-actions .btn {
  min-width: 118px;
}

.pitching-summary {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.pitching-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.pitching-title span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
  text-transform: uppercase;
}

.pitching-title strong {
  color: var(--green);
}

.pitching-lines {
  display: grid;
  gap: 8px;
}

.pitching-line {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) repeat(6, minmax(46px, auto));
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101820;
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 900;
}

.pitching-line.active {
  border-color: rgba(47, 214, 109, 0.7);
}

.pitching-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.pitching-line span:first-of-type {
  color: var(--amber);
}

.scorekeeper-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.scorekeeper-grid.score-layout {
  grid-template-columns: minmax(340px, 1fr) minmax(300px, 0.72fr);
}

.score-left-stack {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.quick-panel {
  align-self: start;
}

.quick-panel h3 {
  font-size: var(--step-1);
}

.quick-panel .count-btn {
  min-height: clamp(54px, 5vw, 64px);
  font-size: var(--step-0);
}

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

.quick-panel .action {
  min-height: clamp(50px, 5vw, 62px);
}

.diamond-panel {
  display: grid;
  place-items: center;
  min-height: 430px;
  overflow: hidden;
  background: var(--panel);
}

.diamond {
  width: min(74vw, 420px);
  aspect-ratio: 1;
  position: relative;
  overflow: visible;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 122, 58, 0.94), rgba(31, 122, 58, 0.42) 62%, transparent 63%);
}

.diamond::before {
  content: none;
}

.diamond::after {
  content: none;
}

.infield {
  position: absolute;
  inset: 22%;
  transform: rotate(45deg);
  background: var(--dirt);
  border: 5px solid #e3c08b;
}

.infield::before,
.infield::after {
  content: none;
}

.base {
  position: absolute;
  z-index: 4;
  width: 64px;
  height: 64px;
  border: 3px solid var(--text);
  border-radius: 8px;
  background: #e8e2d8;
  color: #111;
  display: grid;
  place-items: center;
  font-weight: 1000;
  box-shadow: 0 8px 20px var(--shadow);
}

.base.active {
  background: var(--blue);
  color: #00131f;
}

.base.steal-pickable {
  background: var(--amber);
  color: #171000;
  box-shadow: 0 0 0 4px rgba(255, 179, 0, 0.28);
}

.home {
  left: 50%;
  bottom: 1%;
  transform: translateX(-50%) rotate(45deg);
}

.first {
  right: 1%;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.second {
  top: 1%;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.third {
  left: 1%;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.base span {
  transform: rotate(-45deg);
  font-size: 1rem;
}

.pitcher {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--amber);
  color: #211600;
  display: grid;
  place-items: center;
  font-weight: 1000;
}

.field-mode-badge {
  position: absolute;
  z-index: 11;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 112px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--blue);
  border-radius: 999px;
  background: rgba(18, 24, 31, 0.96);
  color: var(--text);
  font-size: var(--step--1);
  font-weight: 1000;
  text-transform: uppercase;
  box-shadow: 0 8px 18px var(--shadow);
}

.batter-field-card {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%);
  min-width: 172px;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid var(--amber);
  border-radius: 8px;
  background: rgba(18, 24, 31, 0.94);
  box-shadow: 0 10px 22px var(--shadow);
  pointer-events: none;
}

.batter-field-card img,
.batter-field-card > div {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--text);
  background: var(--panel-2);
  color: var(--text);
  object-fit: cover;
  display: grid;
  place-items: center;
  font-weight: 1000;
}

.batter-field-card span {
  color: var(--amber);
  font-size: var(--step--2);
  font-weight: 900;
  text-transform: uppercase;
}

.batter-field-card strong {
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: var(--step--1);
}

.defender {
  position: absolute;
  z-index: 9;
  border: 2px solid var(--text);
  min-width: 86px;
  max-width: 120px;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(18, 24, 31, 0.9);
  color: var(--text);
  box-shadow: 0 8px 18px var(--shadow);
  pointer-events: none;
}

.defender.pickable {
  border-color: var(--amber);
  pointer-events: auto;
  cursor: pointer;
}

.defender strong {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--bg);
  font-size: var(--step--2);
}

.defender span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--step--2);
  font-weight: 900;
}

.pos-1 {
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
}

.pos-2 {
  left: 50%;
  bottom: -7%;
  transform: translateX(-50%);
}

.pos-3 {
  right: 12%;
  top: 39%;
}

.pos-4 {
  right: 26%;
  top: 28%;
}

.pos-5 {
  left: 12%;
  top: 39%;
}

.pos-6 {
  left: 25%;
  top: 28%;
}

.pos-7 {
  left: 8%;
  top: 16%;
}

.pos-8 {
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
}

.pos-9 {
  right: 8%;
  top: 16%;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 10px;
}

.out-flow {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 2px solid var(--red);
  border-radius: 8px;
  background: rgba(255, 82, 82, 0.12);
}

.out-flow > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.out-flow span {
  color: var(--muted);
}

.error-flow {
  border-color: var(--amber);
  background: rgba(255, 179, 0, 0.14);
}

.steal-flow {
  border-color: var(--blue);
  background: rgba(41, 182, 246, 0.14);
}

.defender.error-pickable {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 179, 0, 0.22);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.action {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--step-0);
  font-weight: 1000;
}

.action.hit {
  border-color: var(--blue);
}

.action.walk {
  border-color: var(--green);
}

.action.out {
  border-color: var(--red);
}

.count-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.count-btn {
  min-height: 74px;
  border: 0;
  border-radius: 8px;
  color: #061018;
  font-size: var(--step-1);
  font-weight: 1000;
}

.count-btn.ball {
  background: var(--blue);
}

.count-btn.strike {
  background: var(--amber);
}

.count-btn.out {
  background: var(--red);
  color: #250000;
}

.lineup {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.live-form-panel {
  padding: 0;
  overflow: hidden;
  margin-top: 14px;
}

.live-form-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #10181f;
}

.live-form-head span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
  text-transform: uppercase;
}

.live-form-head h3 {
  margin: 2px 0 0;
}

.live-form-carousel {
  max-height: clamp(240px, 32vh, 360px);
  display: grid;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  padding: 12px;
}

.live-form-card {
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 44px minmax(175px, 260px) minmax(320px, 440px) minmax(520px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151b23;
}

.live-form-card.active {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 2px rgba(255, 194, 10, 0.72);
}

.live-form-card.opponent-card {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(41, 182, 246, 0.55);
}

.live-form-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: #080c11;
  color: var(--text);
  overflow: hidden;
  font-weight: 1000;
}

button.live-form-avatar {
  cursor: pointer;
}

.live-form-avatar img,
.live-form-avatar span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
}

.live-player-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 1px;
}

.live-player-main span {
  color: var(--amber);
  font-size: var(--step--2);
  font-weight: 1000;
  text-transform: uppercase;
}

.live-player-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--step--1);
}

.live-player-main small,
.live-card-note {
  color: var(--muted);
  font-size: var(--step--2);
}

.live-card-note,
.live-inning-strip {
  grid-column: auto;
}

.player-history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(42px, 1fr));
  gap: 5px;
}

.player-history-stats span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(47, 214, 109, 0.1);
  color: var(--muted);
  border: 1px solid rgba(47, 214, 109, 0.22);
  font-size: var(--step--2);
  font-weight: 1000;
}

.player-history-stats strong {
  color: var(--green);
  font-size: var(--step--1);
}

.live-inning-strip {
  display: grid;
  grid-template-columns: repeat(10, minmax(34px, 1fr));
  gap: 5px;
  overflow: visible;
  padding-bottom: 0;
}

.live-inning-cell {
  min-width: 0;
  min-height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: var(--text);
  scroll-snap-align: start;
}

.live-inning-cell.current {
  border-color: var(--green);
}

.live-inning-cell.filled {
  background: rgba(41, 182, 246, 0.14);
  border-color: rgba(41, 182, 246, 0.7);
}

.live-inning-cell span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
}

.live-inning-cell strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--step--1);
}

.substitute-btn {
  justify-self: end;
  min-height: 38px;
  padding-inline: 12px;
}

.play-history-panel {
  margin-top: 14px;
}

.play-history-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.play-history-head h3 {
  margin: 0;
}

.play-history-panel .feed {
  max-height: 280px;
  overflow-y: auto;
}

.score-form-panel {
  padding: 0;
  overflow: hidden;
}

.score-form-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: stretch;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #10181f;
}

.score-form-meta div {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.score-form-meta span {
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 900;
  text-transform: uppercase;
}

.score-form-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-form-wrap {
  overflow-x: auto;
  padding: 14px;
}

.score-form-grid {
  min-width: 1280px;
  display: grid;
  grid-template-columns: 48px 210px 64px repeat(10, 84px) repeat(6, 56px);
  align-items: stretch;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.sheet-head,
.sheet-label,
.sheet-total,
.sheet-summary-label,
.sheet-summary-cell {
  min-height: 46px;
  display: grid;
  align-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: #111920;
}

.sheet-head {
  place-items: center;
  color: var(--muted);
  font-size: var(--step--2);
  font-weight: 1000;
  text-transform: uppercase;
}

.sheet-label {
  font-weight: 900;
}

.sheet-label.order,
.sheet-label.pos,
.sheet-total,
.sheet-summary-cell {
  place-items: center;
}

.sheet-head.order,
.sheet-head.player,
.sheet-head.pos,
.sheet-label.order,
.sheet-label.player,
.sheet-label.pos,
.sheet-summary-label {
  position: sticky;
  z-index: 3;
}

.sheet-head.order,
.sheet-label.order {
  left: 0;
}

.sheet-head.player,
.sheet-label.player {
  left: 48px;
}

.sheet-head.pos,
.sheet-label.pos {
  left: 258px;
}

.sheet-head {
  top: 0;
  z-index: 4;
}

.sheet-cell {
  min-height: 72px;
  display: grid;
  align-content: start;
  gap: 4px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #18232d;
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.sheet-cell.filled {
  background: rgba(41, 182, 246, 0.14);
}

.sheet-cell strong {
  display: inline-grid;
  width: fit-content;
  min-width: 34px;
  min-height: 26px;
  place-items: center;
  padding: 3px 7px;
  border-radius: 6px;
  background: #ffffff;
  color: #12181F;
  font-weight: 1000;
}

.sheet-cell span {
  display: block;
  color: var(--muted);
  font-size: var(--step--2);
  line-height: 1.15;
}

.empty-cell {
  place-self: center;
  color: #6f7f8b !important;
  font-weight: 900;
  text-transform: uppercase;
}

.sheet-player-button {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 8px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.sheet-player-button img,
.sheet-player-button span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--text);
  background: var(--panel-2);
  color: var(--text);
  display: grid;
  place-items: center;
  object-fit: cover;
  font-size: var(--step--2);
  font-weight: 1000;
}

.sheet-player-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-total {
  background: #0f171e;
  font-size: var(--step-0);
  font-weight: 1000;
}

.sheet-summary-label {
  left: 0;
  place-items: center start;
  background: #23342f;
  color: var(--text);
  font-weight: 1000;
  text-transform: uppercase;
}

.sheet-summary-cell {
  background: #17221f;
  font-weight: 1000;
}

.sheet-summary-cell.muted {
  background: #10181f;
}

.player-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151d25;
}

.player-card.active {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 2px var(--amber);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

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

th {
  color: var(--muted);
  font-size: var(--step--2);
  text-transform: uppercase;
}

.supabase-box {
  display: grid;
  gap: 10px;
}

.notice {
  border: 1px solid var(--amber);
  border-radius: 8px;
  background: rgba(255, 179, 0, 0.12);
  color: var(--text);
  padding: 12px;
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .two-col,
  .management-grid,
  .roster-builder,
  .scorekeeper-grid {
    grid-template-columns: 1fr;
  }

  .scorekeeper-grid.score-layout {
    grid-template-columns: 1fr;
  }

  .quick-panel .action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .live-form-card {
    grid-template-columns: 40px minmax(140px, 220px) minmax(240px, 340px) minmax(300px, 1fr);
  }

  .live-card-note,
  .substitute-btn {
    grid-column: 1 / -1;
  }

  .live-form-avatar {
    width: 40px;
    height: 40px;
  }

  .player-history-stats {
    grid-template-columns: repeat(4, minmax(30px, 1fr));
  }

  .player-history-stats span {
    min-height: 34px;
  }

  .live-inning-strip {
    grid-template-columns: repeat(10, minmax(26px, 1fr));
    gap: 4px;
  }

  .live-inning-cell {
    min-height: 42px;
  }

  .pitching-line {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pitching-line strong {
    grid-column: 1 / -1;
  }

  .score-form-meta {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .home-shell,
  .manage-hero,
  .manage-title,
  .management-tree,
  .next-game-card,
  .game-day-card,
  .game-day-scoreboard,
  .roster-builder,
  .home-dashboard {
    max-width: 960px;
  }
}

@media (max-width: 920px) {
  .manage-hero,
  .next-game-card,
  .game-day-card,
  .tree-row,
  .tree-game {
    grid-template-columns: 1fr;
  }

  .game-day-actions {
    justify-content: flex-start;
  }

  .tree-actions {
    justify-content: flex-start;
  }

  .home-shell {
    width: calc(100vw - 122px);
    padding-top: 28px;
  }

  .home-hero,
  .install-banner,
  .recent-row {
    grid-template-columns: 1fr;
  }

  .home-actions {
    justify-content: space-between;
  }

  .home-standings {
    grid-template-columns: repeat(7, minmax(132px, 1fr));
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
  }

  .home-stat {
    scroll-snap-align: start;
  }

  .game-day-actions {
    justify-content: center;
  }

  .tree-branch,
  .season-branch,
  .game-stack {
    margin-left: 16px;
  }
}

@media (max-width: 760px) {
  :root {
    --step--2: 0.66rem;
    --step--1: 0.76rem;
    --step-0: 0.9rem;
    --step-1: 1.02rem;
    --step-2: 1.22rem;
    --step-3: 1.7rem;
    --step-4: 2.25rem;
    --tap: 48px;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11;
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    justify-content: space-around;
    overflow-x: auto;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .home-shell {
    width: calc(100vw - 24px);
    padding: 18px 0 110px;
  }

  .main {
    order: 1;
    padding: 14px 12px 112px;
  }

  .nav-button {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .nav-button[data-view="teams"] {
    width: 58px;
    min-width: 58px;
    min-height: 58px;
    transform: translateY(-10px);
  }

  .sidebar-logo {
    display: none;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    padding: 12px;
  }

  body:has(.home-view.active) .main {
    padding: 0 12px 112px;
  }

  body:has(.home-view.active) .topbar {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-mark::after {
    width: 20px;
    height: 7px;
    box-shadow: 0 7px 0 #b8ff47;
  }

  .home-hero,
  .home-actions,
  .section-head,
  .manage-hero,
  .next-game-card,
  .game-day-card {
    gap: 12px;
  }

  .manage-hero {
    border-radius: 18px;
    padding: 14px;
  }

  .tree-card {
    border-radius: 16px;
  }

  .tree-row,
  .tree-game {
    padding: 14px;
  }

  .record-badges {
    width: 100%;
    overflow-x: auto;
  }

  .status-pill {
    display: none;
  }

  .dashboard-grid,
  .scoreboard,
  .form-grid,
  .game-status-head,
  .count-row {
    grid-template-columns: 1fr;
  }

  .quick-panel .count-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .scoreboard-main,
  .scoreboard-strip {
    min-width: 720px;
  }

  .scoreboard-main {
    grid-template-columns: 36px 128px repeat(10, 29px) repeat(3, 34px);
  }

  .scoreboard-team,
  .scoreboard-cell {
    min-height: 29px;
  }

  .scoreboard-strip {
    grid-template-columns: 36px 128px 82px 100px 68px 32px 32px 36px;
    gap: 7px;
  }

  .diamond-panel {
    min-height: clamp(330px, 92vw, 430px);
  }

  .diamond {
    width: min(88vw, 390px);
  }

  .base {
    width: clamp(48px, 13vw, 56px);
    height: clamp(48px, 13vw, 56px);
  }

  .batter-field-card {
    bottom: 9%;
    min-width: 148px;
    min-height: 52px;
  }

  .batter-field-card img,
  .batter-field-card > div {
    width: 36px;
    height: 36px;
  }

  .defender {
    min-width: clamp(58px, 17vw, 76px);
    max-width: clamp(76px, 22vw, 92px);
    min-height: 38px;
    padding: 4px 5px;
    gap: 4px;
  }

  .defender strong {
    width: 22px;
    height: 22px;
  }

  .defender span {
    font-size: 0.6rem;
  }

  .live-form-head {
    grid-template-columns: 1fr;
  }

  .live-form-carousel {
    max-height: 360px;
  }

  .live-form-card {
    grid-template-columns: 40px minmax(96px, 1fr) minmax(132px, 1fr);
    border-radius: 12px;
  }

  .live-inning-strip {
    grid-column: 1 / -1;
  }

  .substitute-btn {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .live-form-avatar {
    width: 40px;
    height: 40px;
  }

  .player-history-stats {
    grid-template-columns: repeat(4, minmax(34px, 1fr));
  }

  .player-history-stats span {
    min-height: 34px;
  }

  .play-history-head {
    grid-template-columns: 1fr;
  }

  .score-form-meta {
    grid-template-columns: 1fr;
  }

  .score-form-grid {
    min-width: 1080px;
    grid-template-columns: 40px 168px 52px repeat(10, 70px) repeat(6, 48px);
  }

  .sheet-head.player,
  .sheet-label.player {
    left: 42px;
  }

  .sheet-head.pos,
  .sheet-label.pos {
    left: 208px;
  }
}

@media (max-width: 420px) {
  :root {
    --step-4: 2rem;
    --step-3: 1.55rem;
  }

  .home-shell {
    width: calc(100vw - 18px);
  }

  .home-standings {
    grid-template-columns: repeat(7, minmax(112px, 1fr));
  }

  .home-stat {
    min-height: 88px;
    padding: 13px 14px;
  }

  .recent-row {
    padding: 14px;
  }

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

  .count-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .count-btn,
  .action {
    min-height: 60px;
  }

  .quick-panel .count-btn,
  .quick-panel .action {
    min-height: 56px;
  }

  .live-inning-cell {
    min-height: 38px;
  }
}
