/* scoreboard.css — unified layout + polish */

/* ===== Theme & base ===== */
:root {
  --gap: 0.75rem;
  --panel: #272727;
  --panel-b: #eeeeee;
  --faint-opacity: 0.2; /* updated by Settings */
  /* --hr-alpha-fill: #999 ;  /* default fallback */
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: #111;
  color: #eee;
}

/* ===== Main layout: two full-height halves touching in the middle ===== */
.scoreboard-grid {
  display: grid;
  grid-template-columns: 1fr 0 1fr;
  padding: 0;
  column-gap: 0;
  width: 100vw;
  height: 100vh; /* fallback */
  min-height: 100vh;
  align-items: stretch;
  position: relative;
  overflow: hidden;
}

/* On modern mobile browsers (including Chrome on Android),
   use the *small* viewport height so content never becomes taller
   than the visible area when the address bar moves around. */
@supports (height: 100svh) {
  .scoreboard-grid {
    height: 100svh;
    min-height: 100svh;
  }
}

.team-box {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
}

.team-name {
  min-width: 0;
  display: block;
  width: 100%;
  text-align: center;
  font-size: 7vh;
  font-weight: 600;
  margin: 0;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  z-index: 5;
  user-select: none;
  color: var(--team-fg, #fff);
}

.scorebox {
  container-type: size;
  position: relative;
  display: grid;
  place-items: center;
  background-clip: padding-box;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  z-index: 0;
}

.scorebox:active,
.scorebox:focus,
.scorebox:focus-visible {
  outline: none;
  box-shadow: none;
  transform: none;
}
@media (hover: hover) {
  .scorebox:hover {
    box-shadow: none;
  }
}

.score-value {
  font-size: 80vh;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  text-align: center;
}
/* .score-value {
  transform: translateY(-0.12em);
  line-height: 0.85;
} */

@supports (font-size: 1cqh) {
  .score-value {
    font-size: 80cqh;
  }
}

.logo-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
}
.team-logo {
  width: 80%;
  height: 80%;
  object-fit: contain;
  object-position: center;
  display: block;
  user-select: none;
}

/* ===== Center column pinned widgets ===== */

.center-column {
  position: static;
}
/* Generic box — must come before nth-of-type rules so specificity wins without !important */
.center-column .box {
  display: grid;
  place-items: center;
  gap: 0.25;
  min-width: 9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 5rem;
  background: #fff;
  color: #111;
}
.center-column .label {
  font-weight: 700;
  font-size: 5vh;
  letter-spacing: -0.05em;
}
.center-column .value {
  font-weight: 800;
  line-height: 1;
}
/* INNING box */
.center-column .box:nth-of-type(1) {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  user-select: none;
  cursor: cell;
  border: 3px solid var(--inning-color);
  border-top: 0;
  border-radius: 0 0 5vmin 5vmin;
}
.center-column .box:nth-of-type(1) .label {
  color: var(--inning-color);
}
/* OUT box */
.center-column .box:nth-of-type(2) {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  user-select: none;
  cursor: cell;
  border: 3px solid var(--out-color); /* set all sides first */
  border-bottom: 0; /* remove the bottom */
  border-radius: 8vmin 8vmin 0 0;
}
.center-column .box:nth-of-type(2) .label {
  color: var(--out-color);
}
.center-column .box:nth-of-type(1) .value {
  font-family: "Oswald", ui-sans-serif, system-ui, sans-serif;
  font-size: 20vh;
}
.center-column .box:nth-of-type(2) .value {
  font-family: "Bebas Neue", ui-sans-serif, system-ui, sans-serif;
  font-size: 15vh;
}

/* Tighten spacing between INNING label and number only */
.center-column #inningNumber {
  margin-top: -1.5rem;
}
/* When half-inning mode is enabled */
.center-column .box.is-half {
  padding-top: 0.75rem;
  padding-bottom: 1.5rem;
}

/* ===== HR chips ===== */
#hrAwayContainer {
  position: absolute;
  left: var(--gap);
  bottom: var(--gap);
  z-index: 2;
  cursor: cell;
}
#hrHomeContainer {
  position: absolute;
  right: var(--gap);
  bottom: var(--gap);
  z-index: 2;
  cursor: cell;
}
.hrbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border-radius: 0.6rem;
  padding: 0.35rem 0.6rem;
  user-select: none;
}

.hr-label {
  font-size: 6vh;
  font-weight: 700;
  color: var(--hr-text-color, #fff);
}
.hr-value {
  font-size: 12vh;
  line-height: 1;
  color: var(--hr-text-color, #fff);

  /* Fixed-ish width so the HR area doesn't "jump" as balls are added.
     Overflow stays visible so negative letter-spacing can overlap glyphs. */
  display: inline-block;
  width: clamp(6rem, 22vh, 16rem);
  overflow: visible;
}
.hrbox .hr-value {
  white-space: nowrap;
  line-height: 1;
}
.hrbox .hr-value .hr-ball {
  color: var(--hr-text-color, #fff);
  text-shadow:
    3px 0 0 #000,
    -3px 0 0 #000,
    0 3px 0 #000,
    0 -3px 0 #000,
    3px 3px 0 #000,
    -3px 3px 0 #000,
    3px -3px 0 #000,
    -3px -3px 0 #000;
}
.hrbox[data-team-id="home"] {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
.hrbox[data-team-id="home"] .hr-value {
  direction: rtl;
  text-align: right;
}
.hrbox[data-team-id="home"] .hr-label {
  direction: rtl;
}

/* ===== Info button ===== */
.info-btn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  background: var(--panel);
  border: 1px solid var(--panel-b);
  color: #eee;
  padding: 0.45rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
  cursor: help;
  font-size: 3vh;
}

/* ===== Fainting ===== */
.is-zero {
  opacity: var(--faint-opacity, 0.2);
}

/* Smooth fade for INNING, OUT, HR, and Info */
.center-column .box,
.hrbox,
.info-btn {
  transition: opacity 0.2s ease;
}

/* INNING + OUT boxes: full opacity on hover/focus */
.center-column .box:hover,
.center-column .box:focus-visible {
  opacity: 1;
}

#inningNumber {
  display: grid;
  place-items: center;
}

#inningNumber .inning-tri-svg {
  transform: translateY(15px); /* tweak this for arrow position*/
}

#inningNumber .inning-tri-shape {
  fill: var(--inning-arrow-fill, #000);
  stroke: #000;
  stroke-width: 2;
  stroke-linejoin: round;
  transform-origin: 50px 50px;
}

#inningNumber.is-bottom .inning-tri-shape {
  transform: rotate(180deg);
}

#inningNumber .inning-tri-text.white-text {
  stroke: #000;
  stroke-width: 2px;
  paint-order: stroke fill;
}

#inningNumber .inning-tri-text.black-text {
  stroke: #fff;
  stroke-width: 2px;
  paint-order: stroke fill;
}

#inningNumber .inning-tri-text {
  fill: var(--inning-arrow-text, #fff);
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 56px;
  text-anchor: middle;
  dominant-baseline: middle;
  transform: translateY(var(--inning-text-shift, 14px));
  transform-origin: 50px 50px;
}

/* default (▲ / top) */
#inningNumber {
  --inning-text-shift: 16px;
}

/* bottom (▼) */
#inningNumber.is-bottom {
  --inning-text-shift: -16px;
}

#inningNumber .inning-tri-text {
  transform: translateY(var(--inning-text-shift));
}

/* Arrow "fill" color (JS sets this var). Default: black or gray. */
:root {
  --inning-arrow-fill: #777;
}
.opacity-title {
  white-space: nowrap;
}

.opacity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.opacity-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#settingFaintOpacityRange {
  width: min(250px, 55vw);
}

.opacity-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  padding: 0.5rem 0;

  margin: 0.4rem 0; /* balanced spacing above & below */
  line-height: 1.2; /* prevents tall text box */
  min-height: 2.4rem;
}

.inning-half {
  margin-left: auto; /* pushes it to the far right */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap; /* prevents wrapping */
}

.checkline {
  width: auto;
  flex: 0 0 auto;
}
.counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.75rem 0 0;
  padding: 0;
  border: none;
}

.counter-left {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap; /* allows inputs to wrap if needed */
}

.counter-left label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0;
}

.wrap-note {
  white-space: nowrap;
  text-align: right;
  margin-left: auto;
}

/* HR boxes: full opacity on hover/focus */
.hrbox:hover,
.hrbox:focus-visible {
  opacity: 1;
}

.info-btn.is-faint-info {
  opacity: var(--faint-opacity);
}

.info-btn.is-hidden-info {
  opacity: 0;
}

/* Info button: full opacity on hover/focus */
.info-btn:hover,
.info-btn:focus-visible {
  opacity: 1;
}

/* ===== Team picker ===== */
.team-select {
  position: absolute;
  top: 100%;

  margin-top: 0.25rem;
  z-index: 6;

  /* stop centering math */
  left: 50%;
  right: auto;
  transform: translateX(-50%);

  min-width: 14rem;
  max-height: 60vh;
  overflow: auto;
  background: #1b1b1b;
  border: 1px solid #333;
  border-radius: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.team-select .option {
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  cursor: auto;
}
.team-select .option + .option {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.team-select .thumb-wrap {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.4rem;
  overflow: hidden;
}
.team-select .thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 120ms ease-out;
}
.team-select .label {
  font-weight: 600;
}

/* Anchor */
.team-name-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Base icon */
.home-plate {
  padding: 0.1rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  width: 4rem; /* icon pill size */
  height: 4rem;
  display: inline-flex;

  border: 3px solid var(--team-text-color, #000); /* outline matches text color */
  border-radius: 1rem; /* rounded rectangle pill */
  /*  border-radius: 999px; /* full round pill */
  align-items: center;
  justify-content: center;
  background: var(--team-color, transparent);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;

  z-index: 10; /* ensure it overlays text */

  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.home-plate img {
  display: block;
  width: 80%;
  height: 80%;
  transform: translateY(0.1rem);
}

.home-plate.is-on {
  opacity: 1;
  pointer-events: auto;
}

/* Away team */
.team-name-wrap--away .home-plate {
  left: 0.5rem;
}

/* Home team */
.team-name-wrap--home .home-plate {
  right: 0.5rem;
}

/* SVG look */
.home-plate svg {
  width: 100%;
  height: 100%;
  display: block;
}

.home-plate path {
  fill: #fff;
  stroke: #000;
  stroke-width: 6;
  stroke-linejoin: round;
}

/* ===== Dialog polish (do NOT style #confirmDialog here; shared/styles.css owns it) ===== */
#infoDialog,
#settingsDialog,
#busyDialog {
  color: #eee;
  border: 1px solid #333;
  border-radius: 0.8rem;
  background: #1e1e1e;
  padding: 1rem 1.2rem;
}

#infoDialog::backdrop,
#settingsDialog::backdrop,
#busyDialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

#infoDialog form button,
#settingsDialog form button,
#busyDialog form button,
.info-links a[role="button"] {
  background: #666666;
  border: 1px solid #3a3a3a;
  color: #ffffff;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

/* Settings dialog — yellow title banner, flush to edges */
#settingsDialog .dialog-title {
  margin: -1rem -1.2rem 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--nav-settings-bg);
  color: var(--nav-settings-fg);
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 0.8rem 0.8rem 0 0;
}

/* Danger button — yellow, same as Settings accent */
button.danger,
#settingsDialog form button.danger,
#confirmResetDialog form button.danger {
  background: var(--nav-settings-bg);
  color: var(--nav-settings-fg);
  border-color: #888888;
}

/* Reset dialog — uses confirm-surface pattern from styles.css */
#confirmResetDialog {
  --ss-accent-bg: var(--nav-settings-bg);
  --ss-accent-fg: var(--nav-settings-fg);
  border: none;
  background: transparent;
  padding: 0;
}

#confirmResetDialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

#confirmResetDialog .confirm-surface {
  width: 600px;
  max-width: 92vw;
}

#confirmResetDialog .confirm-actions button[value="confirm"] {
  background: var(--nav-settings-bg);
  color: var(--nav-settings-fg);
  border: none;
}

.confirm-reset-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.25rem 0.75rem;
}

.confirm-reset-options label {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: #111;
  cursor: pointer;
}

.confirm-reset-options small {
  opacity: 0.65;
  font-size: 0.8rem;
}

/* --- unified “green” buttons (colors defined in styles.css :root) --- */
:root {
  --action-button-min: 14rem; /* base width for equal buttons */
}

.btn.btn-green,
.btn-green,
#settingsDialog form button.btn-green {
  background: var(--action-exportimport-bg);
  color: var(--action-exportimport-fg);
  border-color: transparent;
  font-weight: 650;
}

/* Remove underline for link-buttons used as buttons */
.info-links a[role="button"] {
  text-decoration: none;
}

/* Group of Import/Export buttons fills width, equal sizes */
.btn-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* always 5 inline */
  gap: 0.5rem;
  width: 100%;
}
.btn-group > button {
  width: 100%;
}

/* ===== Accessibility ===== */
[aria-live="polite"] {
  outline: none;
}

/* ===== HR overlay ===== */

#hrFx.fadeout {
  animation: hrFade 0.3s linear forwards;
}
@keyframes hrFade {
  to {
    opacity: 0;
  }
}

/* HR overlay to top */
#hrFx {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  display: none;
}
#hrFx.show {
  display: flex;
  align-items: center;
  justify-content: center;
}
#hrFxInner {
  width: 100vw;
  height: 100vh;
}

#hrFxInner {
  position: relative;
  isolation: isolate;
}
#hrFxInner .hr-fill {
  position: absolute;
  inset: 0;
  background: var(--hr-alpha-fill, #111);
  z-index: 0;
}
#hrFx img,
#hrFx video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
}

/* Settings: dirty field highlight */
.settings-dirty {
  outline: 2px solid var(--btn-green);
  outline-offset: 2px;
  border-radius: 0.35rem;
}

/* ===== NEW: 3-column settings grid & counters ===== */

.settings-grid .enable label.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-align: left;
}

/* Put title and input on the same line, right-aligned */
.settings-grid .label,
.settings-grid .max {
  display: grid;
  grid-template-columns: max-content max-content; /* title | input */
  align-items: center;
  justify-content: end;
  column-gap: 8px;
}

.settings-grid .label .title,
.settings-grid .max .title {
  display: inline;
  text-align: right;
  margin: 0;
  font-weight: 600;
}
.input-with-count {
  position: relative;
}
.input-with-count > input {
  width: auto;
  padding-right: 2.2em;
}
.input-with-count .count {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #444;
  opacity: 0.5;
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

/* stack on small screens */
@media (max-width: 520px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid .label .title,
  .settings-grid .max .title {
    text-align: left;
  }
}

/* Number inputs: visually 2 digits wide */
input.digits-2 {
  width: 2rem;
}

/* Compact, spinnerless number inputs */
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* pill */
.settings-dirty-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4ch;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.9rem;
  color: #ffd666;
  background: #3b2d10;
  border: 1px solid #5a4312;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset;
  white-space: nowrap;
}
.settings-dirty-pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ffd666;
  opacity: 0.9;
}

.is-hidden {
  display: none !important;
}

/* pushes everything after it to the right in a flex row */
.push-left {
  margin-right: auto;
}

.center-column .box.disabled,
.hrbox.disabled {
  pointer-events: none;
  opacity: var(--faint-opacity, 0.2);
}

/* === Settings row “pill” starting at Enable === */
.settings-grid {
  display: grid;
  grid-template-columns: auto 1fr auto; /* Enable | Label | Max */
  gap: 10px 16px;
  align-items: center;
  --pill-bg: #262626;
  --col-gap: 16px;
  align-items: stretch;
  column-gap: var(--col-gap);
}
.settings-grid .enable,
.settings-grid .label,
.settings-grid .max {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--pill-bg);
  padding: 0.5rem 0.75rem;
}
.settings-grid .enable {
  border-radius: 0.5rem 0 0 0.5rem;
}
.settings-grid .max {
  border-radius: 0 0.5rem 0.5rem 0;
}
.settings-grid .enable::after,
.settings-grid .label::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(-1 * var(--col-gap));
  width: var(--col-gap);
  background: var(--pill-bg);
  pointer-events: none;
}
.settings-grid .label::before,
.settings-grid .max::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * var(--col-gap));
  width: var(--col-gap);
  background: var(--pill-bg);
  pointer-events: none;
}
.settings-grid .checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.settings-grid .checkline input[type="checkbox"] {
  margin: 0;
}

/* HR animations: 2-col pill row (Enable | Duration → right-aligned) */
.hr-anim-grid {
  --col-gap: 16px;
  --pill-bg: #262626; /* #262626 to match other pills */
  grid-template-columns: auto 1fr;
  align-items: stretch;
  column-gap: var(--col-gap);
}
.hr-anim-grid .enable,
.hr-anim-grid .max {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--pill-bg);
  padding: 0.5rem 0.75rem;
}
.hr-anim-grid .enable {
  border-radius: 0.5rem 0 0 0.5rem;
}
.hr-anim-grid .max {
  border-radius: 0 0.5rem 0.5rem 0;
  justify-content: flex-end;
  gap: 8px;
}
.hr-anim-grid .enable::after,
.hr-anim-grid .max::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--col-gap);
  background: var(--pill-bg);
  pointer-events: none;
}
.hr-anim-grid .enable::after {
  right: calc(-1 * var(--col-gap));
}
.hr-anim-grid .max::before {
  left: calc(-1 * var(--col-gap));
}
.hr-anim-grid .checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.hr-anim-grid .checkline input[type="checkbox"] {
  margin: 0;
}

/* ========================================================= */
/* Info + Settings modals: button shape + explicit colors    */
/* ========================================================= */
.info-links .btn-equal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-weight: 700;
  text-decoration: none;
}
.btn--settings {
  background: var(--nav-settings-bg);
  color: var(--nav-settings-fg);
}
.btn--teams {
  background: var(--nav-teams-bg);
  color: var(--nav-teams-fg);
  border-color: transparent;
}
.btn--animations {
  background: var(--nav-animations-bg);
  color: var(--nav-animations-fg);
  border-color: transparent;
}
/* === Force colors for Tutorial + Settings modals (wins over generic link styles) === */
#infoDialog .info-links .btn-equal,
#settingsDialog .info-links .btn-equal {
  height: 44px;
  padding: 0 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

/* Settings = yellow */
#infoDialog .info-links .btn--settings,
#settingsDialog .info-links .btn--settings {
  background: var(--nav-settings-bg);
  color: var(--nav-settings-fg);
}

/* Teams = blue (cover both classed + id-ed anchors) */
#infoDialog .info-links .btn--teams,
#settingsDialog .info-links .btn--teams,
#infoDialog .info-links #goTeams,
#settingsDialog .info-links a[href*="teams.html"] {
  background: var(--nav-teams-bg);
  color: var(--nav-teams-fg);
  border-color: transparent;
}

/* Animations = red (cover both classed + id-ed anchors) */
#infoDialog .info-links .btn--animations,
#settingsDialog .info-links .btn--animations,
#infoDialog .info-links #goAnimations,
#settingsDialog .info-links a[href*="animations.html"] {
  background: var(--nav-animations-bg);
  color: var(--nav-animations-fg);
  border-color: transparent;
}

/* container keeps the clipping + rounding */
.scorebox .logo-wrap {
  display: grid;
  place-items: center;
  border-radius: 12px; /* your radius */
  overflow: hidden; /* clip anything that bleeds */
  user-select: none;
}

/* image is 80% of the scorebox, but still rounded */
.scorebox .logo-wrap img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  border-radius: inherit; /* <-- keeps corners rounded even when smaller */
  display: block;
}

.scorebox,
.score-value {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

/* Overlay technique: outline span sits behind, fill span covers the inward bleed */
.score-value {
  position: relative;
  display: grid;
  place-items: center;
}
.score-value .score-outline {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  -webkit-text-stroke: 4px var(--score-stroke);
  color: transparent;
  pointer-events: none;
}
.score-value .score-fill {
  position: relative;
  -webkit-text-stroke: 0;
  color: inherit;
  pointer-events: none;
}

/* Force the HR row to be a 2-column pill — uses specificity, not !important */
#settingsDialog .settings-grid.hr-anim-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--col-gap);
  --pill-bg: #262626;
  margin-block-start: var(--row-gap, 8px);
}

/* (Optional) ensure consistent spacing between any two rows, just in case */
.settings-grid + .settings-grid {
  margin-top: var(--row-gap, 8px);
}

/* Dialog nav buttons: equal width, fill the row, keep space above Close */
#infoDialog .info-links,
#settingsDialog .info-links {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(10rem, 1fr)
  ); /* equal per row */
  gap: 0.75rem; /* space between the three buttons */
  margin-bottom: 1rem; /* space above the Close button */
}

#infoDialog .info-links .btn,
#settingsDialog .info-links .btn,
#infoDialog .info-links .btn-equal,
#settingsDialog .info-links .btn-equal {
  width: 100%; /* stretch to the grid cell */
  min-width: 0; /* avoid overflow clipping */
  justify-content: center; /* center labels */
}

/* Settings dialog: make the new Scoreboard button white like other pages */
#settingsDialog .btn--scoreboard {
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

/* keep keyboard ring consistent */
#settingsDialog .btn--scoreboard:focus-visible {
  outline: 2px solid var(--focus, #66afe9);
  outline-offset: 2px;
}

/* Settings dialog: unify button height + padding */
#settingsDialog .info-links .btn-equal,
#settingsDialog .info-links a[role="button"],
#settingsDialog form button {
  font-size: 1rem;
  line-height: 1.1;
  padding: 0.625rem 1rem; /* same as Animations page */
  border-radius: 6px; /* keep corners consistent */
}

/* Quick Tutorial (Info dialog): center all text except lists */
#infoDialog {
  text-align: center;
}

/* Keep lists left-aligned (while the block itself is centered) */
#infoDialog ul,
#infoDialog ol {
  text-align: left;
  display: inline-block; /* centers the list block, but its contents are left-aligned */
  margin: 0.75rem auto;
  padding-left: 1.25rem; /* normal list indent */
  list-style-position: outside;
}

/* Ensure nested items stay left-aligned */
#infoDialog li {
  text-align: left;
}

/* Ghost link: same color as text until hover/focus */
.ghost-link,
.ghost-link:visited {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent; /* subtle underline only on hover/focus */
  transition:
    border-color 120ms ease,
    text-decoration-color 120ms ease;
}

/* Reveal only on hover and keyboard focus */
.ghost-link:hover,
.ghost-link:focus-visible {
  border-bottom-color: currentColor;
  /* OR if you prefer an underline instead of border-bottom:
     text-decoration: underline;
     text-underline-offset: 0.2em;
  */
}

/* Don’t show mouse-focus outline; keep keyboard focus visible via the underline */
.ghost-link:focus {
  outline: none;
}

/* =========================================================
   SCOREBOARD – SIMPLE VH CONTROL PANEL (v2)
   Paste at END of scoreboard.css
   Everything below only affects .scoreboard-grid
   ========================================================= */

.scoreboard-grid {
  /* ===============================
     SCORE
     =============================== */
  --score-value-vh: 75vh;
  --score-value-y: -0.12em;

  /* ===============================
     INNING (pill)
     =============================== */
  --inning-label-vh: 5vh;
  --inning-value-vh: 20vh;

  --inning-pad-x-vh: 1.6vh;
  --inning-pad-y-vh: 0.8vh;

  /* Two bottom padding extras:
     - no triangle (normal inning)
     - with triangle (half inning) */
  --inning-pad-bottom-normal: 0vh;
  --inning-pad-bottom-half: 3vh;

  /* ===============================
     INNING TRIANGLE (half mode)
     =============================== */
  --tri-size-vh: 20vh;
  --tri-text-vh: 8vh;
  --tri-y-vh: 2.2vh; /* triangle up/down */

  /* Two number shifts inside triangle:
     top inning (▲) and bottom inning (▼) */
  --tri-text-y-top: 2vh;
  --tri-text-y-bottom: -2vh;

  /* ===============================
     OUT
     =============================== */
  --out-label-vh: 5vh;
  --out-value-vh: 15vh;

  --out-pad-x-vh: 0vh;
  --out-pad-y-vh: 0.8vh;

  --out-dot-spacing: 0.18em; /* space between dots */
  --out-value-y: 0vh; /* move dots up/down */

  /* Pill width scaling:
     Use min(vh-based, vw-based) so pills shrink when the window narrows. */
  --pill-minw-vh: 14vh;
  --pill-minw-vw: 28vw;

  /* ===============================
     HR
     =============================== */
  --hr-label-vh: 6vh;
  --hr-value-vh: 12vh;

  /* ===============================
     HOME BADGE
     =============================== */
  --home-badge-vh: 10vh;
}

/* =========================================================
   SCORE
   ========================================================= */
.scoreboard-grid .score-value {
  font-size: var(--score-value-vh) !important;
  transform: translateY(var(--score-value-y)) !important;
}

/* =========================================================
   INNING PILL
   ========================================================= */

/* INNING + OUT pill shared width behavior */
.scoreboard-grid .center-column .box {
  min-width: min(var(--pill-minw-vh), var(--pill-minw-vw)) !important;
}

.scoreboard-grid .center-column .box:nth-of-type(1) {
  padding: var(--inning-pad-y-vh) var(--inning-pad-x-vh) !important;
  padding-bottom: calc(
    var(--inning-pad-y-vh) + var(--inning-pad-bottom-normal)
  ) !important;
}

/* When your JS adds .is-half to the INNING box, use the half padding */
.scoreboard-grid .center-column .box:nth-of-type(1).is-half {
  padding-bottom: calc(
    var(--inning-pad-y-vh) + var(--inning-pad-bottom-half)
  ) !important;
}

.scoreboard-grid .center-column .box:nth-of-type(1) .label {
  font-size: var(--inning-label-vh) !important;
}

.scoreboard-grid .center-column .box:nth-of-type(1) .value {
  font-size: var(--inning-value-vh) !important;
}

/* =========================================================
   INNING TRIANGLE (HALF MODE)
   ========================================================= */
.scoreboard-grid #inningNumber .inning-tri-svg {
  width: var(--tri-size-vh) !important;
  height: var(--tri-size-vh) !important;
  transform: translateY(var(--tri-y-vh)) !important;
}

.scoreboard-grid #inningNumber .inning-tri-text {
  font-size: var(--tri-text-vh) !important;
  /* default (▲) */
  transform: translateY(var(--tri-text-y-top)) !important;
}

/* bottom inning (▼): JS toggles #inningNumber.is-bottom */
.scoreboard-grid #inningNumber.is-bottom .inning-tri-text {
  transform: translateY(var(--tri-text-y-bottom)) !important;
}

/* =========================================================
   OUT PILL
   ========================================================= */
.scoreboard-grid .center-column .box:nth-of-type(2) {
  padding: var(--out-pad-y-vh) var(--out-pad-x-vh) !important;
}

.scoreboard-grid .center-column .box:nth-of-type(2) .label {
  font-size: var(--out-label-vh) !important;
}

/* Centering dots correctly:
   1) use flex to center the value area
   2) put spacing into a pseudo "gap" by using padding-inline via indent trick
*/
.scoreboard-grid .center-column .box:nth-of-type(2) .value {
  font-size: var(--out-value-vh) !important;

  display: flex;
  justify-content: center;
  align-items: center;

  /* spacing between dots */
  letter-spacing: var(--out-dot-spacing);

  /* re-center the run (letter-spacing otherwise drifts) */
  text-indent: var(--out-dot-spacing);

  position: relative;
  top: var(--out-value-y);
}

/* =========================================================
   HR
   ========================================================= */
.scoreboard-grid .hr-label {
  font-size: var(--hr-label-vh) !important;
}

.scoreboard-grid .hr-value {
  font-size: var(--hr-value-vh) !important;
}

/* =========================================================
   HOME BADGE
   ========================================================= */
.scoreboard-grid .home-plate {
  width: var(--home-badge-vh) !important;
  height: var(--home-badge-vh) !important;
}
