:root {
  --practice-bg: #eef5fb;
  --practice-panel: #ffffff;
  --practice-panel-soft: #eaf3fb;
  --practice-ink: #0d2238;
  --practice-muted: #607286;
  --practice-line: #c9d7e5;
  --practice-blue: #155f9f;
  --practice-blue-2: #2c7fc4;
  --practice-navy: #0d2f50;
  --practice-gold: #f3b64b;
  --practice-red: #c94636;
  --practice-shadow: 0 26px 70px rgb(13 34 56 / 18%);
}

html {
  background: var(--practice-bg);
}

body {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.practice-shell,
.practice-shell * {
  box-sizing: border-box;
}

.practice-shell {
  min-width: 320px;
  min-height: 100vh;
  padding: clamp(12px, 3vw, 34px);
  background:
    radial-gradient(circle at 12% 8%, rgb(44 127 196 / 23%), transparent 26rem),
    radial-gradient(circle at 88% 4%, rgb(243 182 75 / 14%), transparent 22rem),
    linear-gradient(140deg, #f3f8fd 0%, #e8f2fa 48%, #fbfdff 100%);
  color: var(--practice-ink);
  font-family: Arial, Helvetica, sans-serif;
}

.practice-shell button,
.practice-shell input,
.practice-shell select {
  font: inherit;
}

.practice-shell button,
.practice-shell select {
  cursor: pointer;
}

.practice-shell button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.scoreboard {
  width: min(1240px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgb(13 34 56 / 12%);
  border-radius: 8px;
  background: var(--practice-panel);
  box-shadow: var(--practice-shadow);
}

.scoreboard::before {
  display: block;
  height: 10px;
  background:
    linear-gradient(90deg, transparent 0 14%, rgb(255 255 255 / 72%) 14% 17%, transparent 17% 83%, rgb(255 255 255 / 72%) 83% 86%, transparent 86%),
    repeating-linear-gradient(90deg, #0d2f50 0 48px, #155f9f 48px 96px, #2c7fc4 96px 144px);
  content: "";
}

.scoreboard__header,
.setup-view,
.match-view {
  padding: clamp(16px, 3vw, 30px);
}

.scoreboard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--practice-line);
  background: linear-gradient(135deg, #fafdff 0%, #edf5fc 100%);
}

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

.save-status {
  color: var(--practice-muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: clamp(12px, 2.5vw, 22px);
}

.brand-copy {
  min-width: 0;
}

.practice-shell .bjcc-logo {
  display: block !important;
  width: 88px !important;
  max-width: 88px !important;
  height: 88px !important;
  max-height: 88px !important;
  flex: 0 0 auto;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain !important;
  padding: 6px;
  box-shadow: 0 10px 28px rgb(13 34 56 / 10%);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--practice-navy);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--practice-ink);
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.6rem);
  line-height: 1;
}

h2 {
  font-size: 1.05rem;
}

.reset-button,
.save-button,
.start-button,
.switch-button,
.undo-button,
.saved-load-row button,
.replace-row button,
.modal-actions button,
.event-actions button,
.extra-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.reset-button,
.save-button,
.undo-button,
.saved-load-row button:last-child,
.replace-row button,
.modal-actions button:first-child {
  padding: 0 16px;
  background: #dfeaf5;
  color: var(--practice-ink);
}

.save-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  border: 1px solid var(--practice-line);
}

.save-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.setup-view,
.match-view {
  display: grid;
  gap: 16px;
}

.setup-card,
.summary-card,
.scoring-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.setup-card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-card__title span,
.rules-grid small {
  color: var(--practice-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

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

.wide-field {
  grid-column: span 2;
}

.saved-load-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 10px;
}

.saved-load-row label {
  display: grid;
  gap: 7px;
}

.saved-load-row button:first-of-type {
  padding: 0 18px;
  background: var(--practice-blue);
  color: #ffffff;
}

.rules-grid label,
.active-panel label,
.replacement-card label {
  display: grid;
  gap: 7px;
}

.rules-grid label span,
.active-panel label span,
.replacement-card label span,
.saved-load-row label span,
.extras-panel span,
.action-footer span {
  color: var(--practice-muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rules-grid input:not([type="checkbox"], [type="radio"]),
.active-panel select,
.replacement-card select,
.saved-load-row select,
.roster-grid input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--practice-ink);
  padding: 0 12px;
  outline: none;
}

.rules-grid input:focus-visible,
.active-panel select:focus-visible,
.replacement-card select:focus-visible,
.saved-load-row select:focus-visible,
.roster-grid input:focus-visible,
.practice-shell button:focus-visible {
  outline: 3px solid rgb(44 127 196 / 36%);
  outline-offset: 2px;
}

fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  padding: 12px;
}

legend {
  color: var(--practice-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.radio-row,
.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  color: var(--practice-ink);
  font-weight: 800;
}

.radio-row input,
.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--practice-blue);
}

.toggle-row {
  grid-column: span 2;
}

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

.roster-field {
  position: relative;
}

.roster-field span {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: var(--practice-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.roster-field input {
  padding-left: 38px;
}

.start-button {
  background: var(--practice-blue);
  color: #ffffff;
  font-size: 1.05rem;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  background: var(--practice-panel-soft);
}

.score-strip div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--practice-line);
}

.score-strip div:last-child {
  border-right: 0;
}

.score-strip span,
.delivery-log span {
  color: var(--practice-muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.score-strip strong {
  color: var(--practice-ink);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  line-height: 1;
}

.status-pill {
  display: flex;
  align-items: center;
  width: fit-content;
  gap: 10px;
  margin: 0;
  border-radius: 8px;
  background: rgb(243 182 75 / 24%);
  color: #704a0e;
  padding: 9px 12px;
  font-weight: 800;
}

.status-pill button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--practice-gold);
  color: #442b05;
  padding: 0 12px;
  font-weight: 900;
}

.active-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.switch-button {
  min-width: 84px;
  padding: 0 14px;
  background: var(--practice-blue-2);
  color: #ffffff;
}

.replace-row,
.event-actions,
.extra-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.replace-row button {
  border: 1px solid var(--practice-line);
}

.score-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.score-button {
  min-height: clamp(58px, 8vw, 76px);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-size: clamp(1.05rem, 3vw, 1.8rem);
  font-weight: 900;
  line-height: 1;
}

.score-button--run {
  background: var(--practice-blue);
}

.score-button--quiet {
  background: #526b83;
}

.extras-panel {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.amount-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.amount-picker button {
  min-height: 38px;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--practice-ink);
  font-weight: 900;
}

.amount-picker .is-active {
  border-color: var(--practice-blue);
  background: var(--practice-blue);
  color: #ffffff;
}

.extra-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.extra-actions button {
  background: var(--practice-blue-2);
  color: #ffffff;
}

.wicket-button {
  background: var(--practice-red);
  color: #ffffff;
}

.retire-button {
  background: var(--practice-gold);
  color: #442b05;
}

.action-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--practice-line);
  padding-top: 4px;
}

.action-footer div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.delivery-log {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.delivery-log li {
  display: grid;
  grid-template-columns: 84px minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) 66px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--practice-line);
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 12px;
  color: var(--practice-muted);
}

.delivery-log strong {
  color: var(--practice-ink);
}

.delivery-log em {
  justify-self: end;
  color: var(--practice-navy);
  font-style: normal;
  font-weight: 900;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--practice-line);
  padding: 9px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--practice-muted);
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: var(--practice-ink);
  font-weight: 700;
}

.replacement-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(13 34 56 / 52%);
}

.replacement-card {
  display: grid;
  width: min(440px, 100%);
  gap: 14px;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 22%);
}

.replacement-card p {
  margin: 0;
  color: var(--practice-muted);
}

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

.modal-actions button:last-child {
  background: var(--practice-blue);
  color: #ffffff;
}

@media (max-width: 860px) {
  .practice-shell {
    min-height: 100svh;
    padding: 6px;
  }

  .scoreboard {
    border-radius: 6px;
  }

  .scoreboard::before {
    height: 7px;
  }

  .scoreboard__header,
  .setup-view,
  .match-view {
    padding: 12px;
  }

  .scoreboard__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .reset-button {
    flex: 1;
    width: auto;
  }

  .save-status {
    flex: 1;
    min-width: 0;
    white-space: normal;
  }

  .brand-lockup {
    gap: 10px;
  }

  .practice-shell .bjcc-logo {
    width: 54px !important;
    max-width: 54px !important;
    height: 54px !important;
    max-height: 54px !important;
    padding: 4px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 0.64rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  .reset-button {
    min-height: 38px;
  }

  .rules-grid,
  .roster-grid,
  .active-panel,
  .extras-panel,
  .summary-grid,
  .saved-load-row,
  .action-footer {
    grid-template-columns: 1fr;
  }

  .setup-card,
  .summary-card,
  .scoring-panel {
    gap: 10px;
    padding: 12px;
  }

  .toggle-row {
    grid-column: auto;
  }

  .wide-field {
    grid-column: auto;
  }

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

  .score-strip div {
    gap: 3px;
    padding: 8px 6px;
    text-align: center;
  }

  .score-strip span {
    font-size: 0.58rem;
  }

  .score-strip strong {
    font-size: 1.05rem;
  }

  .status-pill {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .active-panel {
    gap: 8px;
  }

  .switch-button {
    width: 100%;
    min-height: 36px;
  }

  .replace-row,
  .event-actions,
  .extra-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .score-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .score-button {
    min-height: 54px;
    border-radius: 6px;
    font-size: 1.22rem;
  }

  .amount-picker {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .action-footer {
    align-items: stretch;
  }

  .delivery-log li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    padding: 8px;
    font-size: 0.86rem;
  }

  .delivery-log li span:nth-of-type(2),
  .delivery-log li span:nth-of-type(3) {
    grid-column: 1;
  }

  table {
    font-size: 0.84rem;
  }
}
