:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66716b;
  --green-950: #0b2e25;
  --green-900: #113f32;
  --green-800: #175441;
  --green-100: #e4eee8;
  --green-50: #f0f5f1;
  --gold: #f0b93b;
  --gold-soft: #fff3cf;
  --paper: #f5f3ed;
  --surface: #fffefb;
  --line: #dddcd4;
  --danger: #9f352f;
  --shadow: 0 22px 50px rgba(18, 46, 36, 0.12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-width: 720px;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(240, 185, 59, 0.56);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  min-height: 76px;
  padding: 0 30px;
  background: var(--green-950);
  color: white;
  box-shadow: 0 4px 20px rgba(6, 28, 22, 0.15);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 2px solid var(--gold);
  border-radius: 13px;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -1px;
  transform: rotate(-2deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: #9eb7ad;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.primary-nav {
  display: flex;
  justify-content: center;
  gap: 5px;
  height: 76px;
}

.nav-item {
  position: relative;
  min-width: 90px;
  border: 0;
  background: transparent;
  color: #9eb7ad;
  font-size: 14px;
  font-weight: 650;
}

.nav-item.is-active {
  color: white;
}

.nav-item.is-active::after {
  position: absolute;
  right: 20px;
  bottom: 0;
  left: 20px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--gold);
  content: "";
}

.nav-item:disabled {
  cursor: default;
  opacity: 0.48;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #dce9e3;
  font-size: 12px;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #69d498;
  box-shadow: 0 0 0 4px rgba(105, 212, 152, 0.1);
}

.save-state.is-saving .save-dot {
  background: var(--gold);
  animation: pulse 0.9s infinite alternate;
}

.workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 76px);
}

.team-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  border-right: 1px solid var(--line);
  background: #eceae3;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 12px;
  color: #6b746f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.icon-button,
.close-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
}

.icon-button {
  background: var(--green-100);
  color: var(--green-900);
  font-size: 25px;
  line-height: 1;
}

.team-list {
  display: grid;
  gap: 7px;
}

.team-button {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.team-button:hover {
  background: rgba(255, 255, 255, 0.54);
}

.team-button.is-active {
  border-color: #d6d8cf;
  background: var(--surface);
  box-shadow: 0 7px 20px rgba(20, 48, 39, 0.07);
}

.team-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--green-900);
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.team-button strong,
.team-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-button strong {
  font-size: 13px;
}

.team-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.offline-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 15px;
  border: 1px solid #d7dbd2;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.48);
}

.offline-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gold-soft);
  color: #8c640d;
  font-weight: 900;
}

.offline-note strong,
.offline-note span:not(.offline-icon) {
  display: block;
}

.offline-note strong {
  font-size: 12px;
}

.offline-note div span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.main-content {
  min-width: 0;
  padding: 42px clamp(30px, 4vw, 68px) 64px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-800);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 4vw, 54px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.heading-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.team-code {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--green-100);
  color: var(--green-900);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.heading-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.season-control {
  display: grid;
  gap: 5px;
}

.season-control span,
.field > span,
.choice-field legend {
  color: #5a645e;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.season-control select,
.field input,
.field select,
.search-field input {
  min-height: 46px;
  border: 1px solid #cecfc8;
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
}

.season-control select {
  min-width: 120px;
  padding: 0 34px 0 13px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--green-900);
  background: var(--green-900);
  color: white;
  box-shadow: 0 8px 18px rgba(17, 63, 50, 0.13);
}

.primary-button:hover {
  background: var(--green-800);
}

.secondary-button {
  border: 1px solid #c8cbc3;
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: white;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(22, 50, 41, 0.05);
}

.stat-card {
  min-width: 0;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

.stat-card:last-child {
  border-right: 0;
}

.stat-card span,
.stat-card strong,
.stat-card small {
  display: block;
}

.stat-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  overflow: hidden;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.accent-card {
  background: var(--green-900);
  color: white;
}

.accent-card .stat-label,
.accent-card small {
  color: #b7ccc3;
}

.roster-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(22, 50, 41, 0.05);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 24px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin-bottom: 4px;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 500;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  width: 210px;
  padding: 0 14px 0 38px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--muted);
  font-size: 20px;
  transform: translateY(-50%) rotate(-20deg);
}

.roster-table-wrap {
  min-height: 230px;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
}

.roster-table th,
.roster-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #e8e7e1;
  text-align: left;
  vertical-align: middle;
}

.roster-table th {
  background: #faf9f5;
  color: #717973;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.roster-table tbody tr:last-child td {
  border-bottom: 0;
}

.roster-table tbody tr:hover {
  background: #fbfaf7;
}

.jersey-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--green-50);
  color: var(--green-900);
  font-weight: 850;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}

.player-initials {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid #d9dcd5;
  border-radius: 50%;
  background: #f2f0ea;
  color: #435149;
  font-size: 11px;
  font-weight: 800;
}

.player-cell strong {
  display: block;
  font-size: 13px;
}

.position-badge,
.hand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
}

.position-badge {
  background: var(--gold-soft);
  color: #76550e;
}

.hand-badge {
  background: var(--green-50);
  color: var(--green-900);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.row-button {
  min-width: 44px;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.row-button:hover {
  background: var(--green-50);
  color: var(--green-900);
}

.row-button.remove:hover {
  background: #f8e8e6;
  color: var(--danger);
}

.table-empty {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.table-empty strong {
  margin-bottom: 7px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 500;
}

.table-empty span {
  font-size: 12px;
}

.text-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--green-800);
  font-weight: 800;
}

.empty-state {
  max-width: 520px;
  margin: 9vh auto 0;
  text-align: center;
}

.empty-state h1 {
  font-size: 48px;
}

.empty-state > p:not(.eyebrow) {
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.empty-illustration {
  position: relative;
  width: 210px;
  height: 150px;
  margin: 0 auto 28px;
}

.diamond-line {
  position: absolute;
  top: 12px;
  left: 42px;
  width: 126px;
  height: 126px;
  border: 2px solid #b7c4bb;
  transform: rotate(45deg);
}

.base {
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 3px solid var(--paper);
  background: var(--green-900);
  box-shadow: 0 0 0 1px var(--green-900);
  transform: rotate(45deg);
}

.base-one {
  top: 68px;
  right: 27px;
}

.base-two {
  top: -1px;
  left: 96px;
}

.base-three {
  top: 68px;
  left: 27px;
}

.base.home {
  right: 96px;
  bottom: -2px;
  border-radius: 2px 2px 7px 2px;
  background: var(--gold);
  box-shadow: 0 0 0 1px #b98512;
}

.app-dialog {
  width: min(620px, calc(100vw - 40px));
  padding: 0;
  border: 1px solid #d8d8d0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(8, 27, 21, 0.57);
  backdrop-filter: blur(3px);
}

.app-dialog form {
  padding: 26px;
}

.small-dialog {
  width: min(480px, calc(100vw - 40px));
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dialog-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.close-button {
  flex: 0 0 auto;
  background: #f1f0eb;
  color: #5d665f;
  font-size: 25px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

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

.field input,
.field select {
  width: 100%;
  padding: 0 13px;
}

.field input::placeholder,
.search-field input::placeholder {
  color: #9da39f;
}

.choice-field {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-field legend {
  margin-bottom: 7px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid #d6d7d0;
  border-radius: 12px;
  background: #f0efe9;
}

.segmented-control.three-options {
  grid-template-columns: repeat(3, 1fr);
}

.segmented-control.two-options {
  grid-template-columns: repeat(2, 1fr);
}

.games-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(480px, 1.3fr);
  gap: 22px;
  align-items: start;
}

.game-list-panel,
.game-setup-panel,
.game-placeholder {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(22, 50, 41, 0.05);
}

.compact-heading {
  padding: 18px 20px;
}

.game-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.game-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.game-card:hover,
.game-card.is-active {
  border-color: #d7d9d1;
  background: var(--green-50);
}

.game-date {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 10px;
  background: var(--green-900);
  color: white;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.game-card strong,
.game-card small {
  display: block;
}

.game-card strong {
  font-size: 13px;
}

.game-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.status-badge {
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--gold-soft);
  color: #73520b;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.matchup-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 24px 26px;
  background: var(--green-900);
  color: white;
}

.matchup-banner div {
  min-width: 0;
}

.matchup-banner strong,
.matchup-label {
  display: block;
}

.matchup-banner strong {
  overflow: hidden;
  margin-top: 5px;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matchup-label {
  color: #b9cec5;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matchup-away {
  text-align: right;
}

.versus {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
}

.game-setup-panel form {
  padding: 24px;
}

.setup-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.setup-toolbar h2 {
  margin-bottom: 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.pitcher-field {
  width: min(260px, 48%);
}

.lineup-list {
  display: grid;
  gap: 7px;
}

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

.lineup-row select {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #d6d7d0;
  border-radius: 10px;
  background: #fbfaf7;
  color: var(--ink);
}

.lineup-slot {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-900);
  font-family: Georgia, serif;
  font-weight: 700;
}

.lineup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.lineup-progress {
  display: grid;
  gap: 7px;
  min-width: 190px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.progress-track {
  overflow: hidden;
  height: 5px;
  border-radius: 5px;
  background: #e7e7e1;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 180ms ease;
}

.game-placeholder {
  display: grid;
  place-items: center;
  min-height: 390px;
  padding: 40px;
  text-align: center;
}

.game-placeholder-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--green-100);
  font-size: 27px;
}

.game-placeholder h2 {
  margin: 14px 0 6px;
  font-family: Georgia, serif;
  font-weight: 500;
}

.game-placeholder p {
  max-width: 280px;
  color: var(--muted);
  font-size: 13px;
}

.start-game-panel {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 240px) auto;
  align-items: end;
  gap: 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  background: #f4f0e4;
}

.start-game-panel strong,
.start-game-panel > div span {
  display: block;
}

.start-game-panel > div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.gold-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #cf9311;
  border-radius: 11px;
  background: var(--gold);
  color: #2c260f;
  font-weight: 850;
}

.live-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.live-header h1 {
  font-size: clamp(34px, 4vw, 48px);
}

.live-header > div > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.live-scoreboard {
  display: grid;
  grid-template-columns: repeat(5, 68px);
  overflow: hidden;
  border: 1px solid #244d40;
  border-radius: 15px;
  background: var(--green-950);
  color: white;
}

.test-game-panel, .game-report {
  margin: 20px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  min-width: 0;
}

.test-game-panel p, .report-note { color: var(--muted); line-height: 1.6; }
.report-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.game-report h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.25; }
.game-report h2 { margin: 32px 0 14px; font-size: 21px; }
.report-table-wrap { overflow-x: auto; max-width: 100%; }
.report-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table-wrap th, .report-table-wrap td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.report-table-wrap th { background: #eaf1ec; font-size: 11px; }
.report-table-wrap tbody tr:nth-child(even) { background: #f8faf8; }
.report-note { font-size: 12px; }
#report-game-select { max-width: min(500px, 60vw); }

.live-scoreboard div {
  padding: 11px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.live-scoreboard div:last-child {
  border-right: 0;
}

.live-scoreboard span,
.live-scoreboard strong {
  display: block;
}

.live-scoreboard span {
  color: #a9c2b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-scoreboard strong {
  margin-top: 4px;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
}

.live-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(500px, 1.3fr);
  gap: 22px;
  align-items: start;
}

.matchup-card,
.entry-card,
.pa-finish-card,
.half-transition-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(22, 50, 41, 0.05);
}

.matchup-card {
  padding: 24px;
}

.player-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: var(--green-50);
}

.player-matchup div:last-child {
  text-align: right;
}

.player-matchup span:not(.matchup-arrow),
.player-matchup strong {
  display: block;
}

.player-matchup span:not(.matchup-arrow) {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.player-matchup strong {
  margin-top: 4px;
  font-size: 13px;
}

.matchup-arrow {
  color: var(--gold);
  font-size: 20px;
}

.pitch-sequence {
  display: grid;
  gap: 7px;
  min-height: 140px;
  margin: 18px 0;
}

.pitch-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 9px;
  background: #f1f0eb;
  color: #55615b;
  font-size: 11px;
  text-transform: capitalize;
}

.pitch-chip b {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--green-900);
  color: white;
  font-size: 10px;
}

.sequence-empty {
  place-self: center;
  color: var(--muted);
  font-size: 12px;
}

.undo-button {
  width: 100%;
}

.activity-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.activity-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.activity-heading strong {
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 500;
}

.activity-heading span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.activity-list {
  display: grid;
  gap: 2px;
  max-height: 250px;
  overflow-y: auto;
}

.activity-item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 2px;
  border-bottom: 1px solid #ecebe5;
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-800);
}

.activity-item.is-correction .activity-dot {
  background: var(--gold);
}

.activity-item strong,
.activity-item small {
  display: block;
}

.activity-item strong {
  font-size: 11px;
  font-weight: 750;
}

.activity-item small,
.activity-item time {
  color: var(--muted);
  font-size: 9px;
  text-transform: capitalize;
}

.entry-card,
.pa-finish-card,
.half-transition-card {
  padding: 24px;
}

.entry-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
}

.entry-step:first-child {
  margin-top: 0;
}

.entry-step > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-900);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.entry-step strong,
.entry-step small {
  display: block;
}

.entry-step strong {
  font-size: 13px;
}

.entry-step small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.zone-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.strike-zone {
  position: relative;
  display: block;
  width: 320px;
  height: 320px;
  flex: 0 0 320px;
  padding: 0;
  border: 1px solid #b8c6bc;
  border-radius: 12px;
  background: #e8eee8;
  touch-action: manipulation;
}

.strike-zone .pitch-zone-grid {
  position: absolute;
  left: 25%; top: 25%; width: 50%; height: 50%;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  border: 2px solid var(--green-900); background: #fffef9; pointer-events: none;
}
.pitch-zone-grid > span {
  border: 0.5px solid #bec6c0;
}
.outside-label{position:absolute;color:#536a5c;font-size:11px;font-weight:750;pointer-events:none}
.outside-label.high{top:9%;left:50%;transform:translateX(-50%)}.outside-label.low{bottom:9%;left:50%;transform:translateX(-50%)}
.outside-label.left{left:5%;top:48%}.outside-label.right{right:4%;top:48%}
.zone-wrap>div{min-width:110px;max-width:160px}.zone-wrap small{font-size:10px;color:var(--muted)}
.spray-input{display:block;width:min(100%,360px);aspect-ratio:400/360;padding:0;border:0;background:white;cursor:crosshair;touch-action:manipulation}
.spray-input svg,.spray-history svg{display:block;width:100%;height:100%}.spray-entry{margin-top:14px;border-top:1px solid var(--line);padding-top:12px}.spray-entry summary,.live-spray-panel summary{cursor:pointer;font-weight:700;font-size:13px}.spray-entry p,.spray-caption,.spray-legend{font-size:11px;color:var(--muted);line-height:1.5}
.live-spray-panel{margin:16px 0;border:1px solid var(--line);padding:12px;border-radius:12px;background:#fff}.live-spray-panel .field{margin-top:10px}.live-spray-panel .spray-history svg{max-height:220px}.live-spray-panel .spray-history{margin-top:8px}.matchup-card .pitch-sequence{min-height:65px}

/* Paper sheet is a projection of the same records; the live form stays mounted below it. */
.live-view-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 20px;position:sticky;top:76px;z-index:5;padding:8px 0;background:var(--paper)}.live-view-toolbar>span{font-size:12px;color:var(--muted)}
#pitch-entry-card,#pa-finish-card,#half-transition-card,#live-entry-area,#paper-chart-panel{scroll-margin-top:156px}
.live-view-switch{display:inline-flex;border:1px solid var(--line);border-radius:12px;padding:4px;background:white;gap:4px}.live-view-switch button{border:0;border-radius:8px;background:transparent;padding:11px 20px;color:var(--green-900);font-size:13px;font-weight:700;cursor:pointer;min-height:44px}.live-view-switch button[aria-pressed=true]{background:var(--green-900);color:white}
#paper-chart-panel{margin-bottom:28px;min-width:0}.paper-controls{display:flex;flex-wrap:wrap;align-items:end;gap:12px;margin-bottom:14px}.paper-controls .field{min-width:170px;max-width:260px;flex:1}.paper-controls p{font-size:12px;color:var(--muted);flex-basis:100%;margin:0}
.paper-chart{background:#fff;border:1px solid #8b918d;padding:20px;color:#161d19;font-family:Arial,Helvetica,sans-serif;border-radius:3px}.paper-heading{display:flex;justify-content:space-between;gap:16px;align-items:start}.paper-heading p{font-size:10px;font-weight:800;letter-spacing:2px;margin:0 0 6px}.paper-heading h2{font-size:29px;letter-spacing:.5px;margin:0 0 8px;font-family:Arial,Helvetica,sans-serif}.paper-heading span{font-size:12px}.paper-heading dl{margin:0;min-width:170px;font-size:12px}.paper-heading dl>div{display:flex;gap:8px;border-bottom:1px solid #999;padding:5px 0}.paper-heading dt{font-weight:bold;min-width:42px}.paper-heading dd{margin:0}.paper-legend{display:grid;gap:6px;font-size:10px;line-height:1.5;margin:18px 0 12px}.paper-foul-key{border:1px solid currentColor;border-radius:50%;padding:2px 4px}
.paper-table-scroll{overflow:auto;border:1px solid #343e37;max-width:100%;overscroll-behavior-x:contain}.paper-table{border-collapse:collapse;table-layout:fixed;width:max-content;min-width:100%;font-size:11px}.paper-table th,.paper-table td{border:1px solid #7f8882;padding:0;vertical-align:top}.paper-table thead th{padding:8px 4px;background:#f3f4f1;width:195px;min-width:195px;font-size:10px;text-transform:uppercase;letter-spacing:1px}.paper-table thead th:first-child{width:156px;min-width:156px;position:sticky;left:0;z-index:3}.paper-table .paper-batter{width:156px;min-width:156px;max-width:156px;text-align:left;position:sticky;left:0;z-index:2;background:#fff;padding:10px 8px;box-sizing:border-box}.paper-batter strong{display:block;font-size:12px;line-height:1.4;overflow-wrap:anywhere}.paper-batter>span:not(.paper-slot),.paper-batter small{display:block;font-size:9px;font-weight:normal;line-height:1.5;margin-top:7px}.paper-slot{display:inline-block;min-width:20px;padding:3px;background:#e4e6e2;margin-bottom:8px;font-weight:bold;text-align:center}.paper-pa,.paper-empty-pa{min-width:195px;min-height:136px}.paper-pa-title{display:flex;justify-content:space-between;gap:4px;padding:5px;font-size:9px;border-bottom:1px solid #bbb;min-height:24px;box-sizing:border-box}.paper-pa-title b{text-transform:uppercase;text-align:right;max-width:110px}.paper-current-pa{box-shadow:inset 0 0 0 2px #b08d24;background:#fffef7}.paper-pitch-row{display:flex;height:24px}.paper-pitch-row>span{width:17px;flex:0 0 17px;text-align:center;border-bottom:1px solid #999;padding-top:5px;box-sizing:border-box;font:12px Georgia,serif}.paper-boxes{display:grid;grid-template-columns:repeat(var(--paper-slots),minmax(24px,1fr));flex:1}.paper-pitch-box{border-left:1px solid #aaa;border-bottom:1px solid #999;display:flex;align-items:center;justify-content:center;min-width:24px}.paper-mark{position:relative;display:inline-flex;align-items:center;justify-content:center;border:0;background:transparent;font:700 12px Arial,sans-serif;color:#172d22;min-width:22px;min-height:22px;padding:1px;cursor:pointer}.paper-mark:hover,.paper-mark:focus-visible{background:#e8eee8;outline:2px solid #8b792f;z-index:1}.paper-swing{text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}.paper-foul{border:1px solid #35493c;border-radius:50%;width:20px;height:20px;min-width:20px;min-height:20px}.paper-corrected:after{content:"";width:3px;height:3px;border-radius:50%;background:#a78218;position:absolute;right:0;top:0}.paper-pa-bottom{display:flex;align-items:center;gap:2px;padding:5px 4px}.paper-minizone{width:56px;flex:0 0 56px}.paper-minifield{width:57px;flex:0 0 57px}.paper-minizone svg,.paper-minifield svg{width:100%;height:auto;display:block}.paper-pa-info{display:flex;flex-direction:column;gap:3px;font-size:8px;line-height:1.35;max-width:90px;overflow-wrap:anywhere}.paper-enter{border:0;padding:3px 0;background:transparent;color:var(--green);font-size:10px;font-weight:bold;cursor:pointer;text-align:left}.paper-shared{font-weight:bold}.paper-no-pitch{font-size:9px;border-top:1px dotted #999;padding:3px}.paper-totals{display:flex;flex-wrap:wrap;gap:12px;padding:12px;border:1px solid #7f8882;border-top:0;font-size:12px}.paper-note{font-size:10px;line-height:1.6;color:#5b655e;margin-bottom:0}
@media(max-width:700px){.live-view-toolbar{align-items:start;flex-direction:column}.paper-chart{padding:12px}.paper-heading{flex-direction:column}.paper-heading dl{width:100%}.paper-heading h2{font-size:24px}}

.strike-zone i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--green-950);
  transform: translate(-50%, -50%);
}

.pitch-type-grid,
.pitch-result-grid {
  display: grid;
  gap: 8px;
}

.pitch-type-grid {
  grid-template-columns: repeat(6, 1fr);
}

.pitch-result-grid {
  grid-template-columns: repeat(3, 1fr);
}

.pitch-type-grid button,
.pitch-result-grid button {
  min-height: 48px;
  border: 1px solid #ced1ca;
  border-radius: 11px;
  background: #fbfaf7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.pitch-type-grid button.is-selected {
  border-color: var(--green-900);
  background: var(--green-900);
  color: white;
}

.pitch-result-grid button:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.pa-finish-card h2 {
  margin-bottom: 20px;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  text-transform: capitalize;
}

.pa-finish-card .primary-button {
  width: 100%;
  margin-top: 22px;
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control input:checked + span {
  background: var(--surface);
  color: var(--green-900);
  box-shadow: 0 2px 8px rgba(20, 45, 37, 0.1);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #e4e3dc;
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fae8e5;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}

.dialog-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.danger-eyebrow {
  color: var(--danger);
}

.pitch-log-panel {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.pitch-log-table {
  min-width: 680px;
}

.pitch-log-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.pitch-log-table .corrected-label {
  color: var(--green-800);
  font-weight: 750;
}

.pitch-log-table .row-button {
  min-height: 44px;
  min-width: 64px;
}

.responsibility-note,
#pitch-log-count {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.app-dialog.import-dialog {
  width: min(1000px, calc(100vw - 36px));
  max-width: 1000px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
}

.import-target { font-weight: 750; color: var(--green-800); }
.import-file-row, .import-preview-heading { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.import-file-row .field { flex: 1; min-width: 0; }
.import-file-row input { max-width: 100%; }
.import-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.import-mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.import-mapping-grid select, .import-options select { min-width: 0; width: 100%; }
.import-dialog h3 { margin: 24px 0 10px; font-size: 17px; }
.import-preview-scroll { max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.import-table { min-width: 720px; }
.import-table td { white-space: normal; }
.import-table td:last-child { max-width: 230px; font-size: 12px; }
.import-table input[type="checkbox"] { width: 44px; height: 44px; accent-color: var(--green-800); cursor: pointer; }
.import-table td:first-child { min-width: 52px; text-align: center; }
.import-invalid { background: #fff0ed; }
.import-flagged { background: var(--gold-soft); }
.import-actions { flex-wrap: wrap; align-items: center; }
#import-summary { flex: 1; color: var(--muted); font-size: 12px; min-width: 220px; }

@media (max-width: 700px) {
  .import-file-row { align-items: stretch; flex-direction: column; }
  .import-mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-preview-heading { align-items: flex-start; flex-direction: column; gap: 0; }
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: 360px;
  padding: 14px 17px;
  border-radius: 12px;
  background: var(--green-950);
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
}

@keyframes pulse {
  to {
    opacity: 0.4;
  }
}

@media (min-width: 981px) and (max-width: 1100px) {
  .live-grid {
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
    gap: 16px;
  }

  .matchup-card,
  .entry-card,
  .pa-finish-card,
  .half-transition-card {
    padding: 16px;
    min-width: 0;
  }

  .pitch-type-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .zone-wrap {
    flex-wrap: wrap;
  }

  .live-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

.lineup-team-field {
  margin-top: 12px;
  min-width: 180px;
}

.half-transition-card .primary-button {
  margin-top: 18px;
  width: 100%;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 220px 1fr auto;
    padding: 0 20px;
  }

  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .main-content {
    padding: 34px 26px 50px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .heading-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

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

  .stat-card:nth-child(2) {
    border-right: 0;
  }

  .stat-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

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

@media (max-width: 760px) {
  body {
    min-width: 0;
  }

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

  .primary-nav {
    display: none;
  }

  .workspace {
    display: block;
  }

  .team-rail {
    min-height: auto;
    padding: 13px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .team-list {
    display: flex;
    overflow-x: auto;
  }

  .team-button {
    min-width: 190px;
  }

  .offline-note {
    display: none;
  }

  .main-content {
    padding: 28px 18px 42px;
  }

  .page-heading,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading {
    display: flex;
  }

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

  .search-field input {
    width: 100%;
  }
}
