:root {
  /* Modern "SaaS Dashboard" Color Palette */
  --bg: #f8fafc;         /* Soft slate background instead of harsh white */
  --panel: #ffffff;      /* Pure white for the cards to pop */
  --accent: #3b82f6;     /* Modern, vibrant blue */
  --accent-hover: #2563eb;
  --good: #10b981;       /* Emerald green */
  --bad: #ef4444;        /* Soft coral/red */
  --danger: #f97316;     /* Orange */
  --text: #0f172a;       /* Very dark blue/gray instead of harsh black */
  --muted: #64748b;      /* Slate gray for secondary text */
  --border: #e2e8f0;     /* Soft, subtle borders */
  --field: #d1fae5;
  
  /* Adding reusable shadow variables for depth */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Proportional scaling variables */
  --base-font: clamp(14px, 1.5vw, 18px);
  --card-width: clamp(200px, 25vw, 280px);
  --widget-width: clamp(320px, 95vw, 1100px);
  --pitch-size: clamp(280px, 35vw, 420px);
  --pitch-height: clamp(320px, 40vh, 500px);
}

* {
  box-sizing: border-box;
  transition-property: background, border-color, box-shadow;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased; /* Makes text look sharper and thinner */
}

#app {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Team Selection Screen */
.team-select-screen {
  text-align: center;
  max-width: 1200px;
  width: 100%;
  padding: 40px 20px;
}

.team-select-header {
  margin-bottom: 40px;
}

.team-select-screen h1,
.lineup-header h1 {
  font-size: 52px;
  font-weight: 800; /* Bolder, more modern weight */
  letter-spacing: -1px; /* Tighter letter spacing looks sleeker */
  margin-bottom: 12px;
  color: var(--text);
  background: linear-gradient(90deg, #1e293b 0%, #3b82f6 50%, #1e293b 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-gradient-flow 35s linear infinite;
}

@keyframes logo-gradient-flow {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.loading-screen h1 {
  animation-duration: 4s;
}

@keyframes loading-subtitle-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

.loading-subtitle {
  animation: loading-subtitle-breathe 2.2s ease-in-out infinite;
}

/* ── Stat pill tooltip ── */
.stat-pill[data-tooltip] { cursor: default; }
.stat-pill[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: normal;
  width: 220px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9999;
}
.stat-pill[data-tooltip]:hover::after { opacity: 1; }

/* ── Loading pills ── */
.loading-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.filter-pill-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.pill-pitch  { background-color: #2563eb; }
.pill-velo   { background-color: #dc2626; }
.pill-season { background-color: #16a34a; }

.team-select-screen p {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 16px;
}

.team-select-screen input[type="date"] {
  padding: 12px 16px;
  margin: 8px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px; /* Rounder inputs */
  font-family: inherit;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.team-select-screen input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-width), 1fr));
  gap: clamp(16px, 3vw, 24px);
  max-width: 1000px;
  margin: 0 auto;
}

/* The Cards: Removing heavy borders, adding soft shadows */
.team-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5); /* Glassy border effect */
  border-radius: 20px; /* Much rounder, friendly corners */
  padding: clamp(16px, 3vw, 32px) clamp(12px, 2vw, 24px);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md); /* Soft depth */
}

.team-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 24px -8px rgba(59, 130, 246, 0.6);
}

.team-card-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border); /* Thinner, softer divider */
}

.team-card-stats {
  display: flex;
  justify-content: space-around;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-number.stat-pitches {
  color: #1947ac;
}

.info-bubble {
  background: #3a7fda;
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px; /* More spacing on all-caps makes it look premium */
}

.team-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Premium Buttons */
.team-btn {
  padding: clamp(10px, 1.5vw, 16px) clamp(16px, 3vw, 32px);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: clamp(12px, 1.5vw, 16px);
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.team-btn:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 24px -8px rgba(59, 130, 246, 0.6);
}

/* --- Premium Velocity Slider --- */
input[type="range"]#maxVelocity {
  -webkit-appearance: none;
  appearance: none;
  width: calc(100% - 28px);
  margin: 0 14px;
  height: 12px;
  /* INVERTED GRADIENT: Light blue on the left, Dark Navy on the right */
  background: linear-gradient(to right, #3b82f6 0%, #1e293b 100%); 
  border-radius: 8px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  margin-top: 10px;
}

/* The Draggable "Thumb" (Chrome/Safari/Edge) */
input[type="range"]#maxVelocity::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff; /* Crisp white circle */
  border: 4px solid #3b82f6; /* Blue outer ring */
  cursor: pointer;
  box-shadow: var(--shadow-md); /* Floating drop shadow */
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="range"]#maxVelocity::-webkit-slider-thumb:hover {
  transform: scale(1.15); /* Pops up slightly when hovered */
  box-shadow: var(--shadow-lg);
}

/* The Draggable "Thumb" (Firefox compatibility) */
input[type="range"]#maxVelocity::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid #3b82f6;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="range"]#maxVelocity::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg);
}

/* --- Lineup Grid Screen --- */
.lineup-screen {
  max-width: 1200px;
  width: 100%;
  padding: 20px;
}

.lineup-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

.lineup-header h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  text-align: center;
}

.lineup-header p {
  font-size: 16px;
  color: var(--muted);
}

/* Back/print buttons in lineup header use flex layout — no absolute positioning needed */

/* Upgraded Back/Print Buttons */
.back-btn {
  padding: 10px 20px;
  background: var(--muted);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.back-btn:hover {
  background: #475569;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.print-btn {
  padding: 10px 20px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.print-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* back-btn:hover applies the standard translateY(-2px) lift — no override needed here */

/* ── Roster sort controls ── */
.sort-container {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-radius: 99px;
  padding: 0;
  width: max-content;
  margin: 0 auto 12px;
}

.sort-select option {
  text-align: center;
}

.sort-select {
  background: transparent;
  border: none;
  border-right: 1px solid #e2e8f0;
  border-radius: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  text-align: center;
  text-align-last: center;
  transition: background 0.15s;
}

.sort-select:focus,
.sort-select:hover {
  background: #f1f5f9;
}

.sort-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.sort-toggle-btn:hover {
  background: #f1f5f9;
}

.sort-toggle-btn.active {
  color: var(--accent);
  background: #eff6ff;
}

.sort-toggle-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sort-toggle-btn:disabled:hover {
  background: transparent;
}

.lineup-header__topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.lineup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 20vw, 200px), 1fr));
  gap: clamp(12px, 2vw, 16px);
  margin-bottom: 24px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

/* Upgraded Player Cards */
.mini-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: clamp(12px, 2vw, 20px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 140px;
  box-shadow: var(--shadow-sm);
}

.mini-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(59, 130, 246, 0.6) !important;
}

.mini-card-order {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 8px;
}

.mini-card-name {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.mini-card-hand {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  padding: 4px 12px;
  background: #e6f0fd;
  border-radius: 12px;
}

.mini-card-hand.RHB {
  background: #fee2e2;
  color: #b91c1c;
}

.mini-card-pitches {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.low-data-badge {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 2px 8px;
  letter-spacing: 0.03em;
}

/* --- Flashcard Widget --- */
.widget {
  display: grid;
  grid-template-areas:
    "header header"
    "pitch info";
  grid-template-columns: 1.4fr 0.6fr;
  grid-template-rows: auto auto;
  gap: 0;
  width: var(--widget-width);
  height: auto;
  min-height: 0;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.header {
  grid-area: header;
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.header__title {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.header__title .name {
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.header__title .meta {
  font-size: 20px;
  color: var(--muted);
  font-weight: 500;
}

.header__controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2vw, 16px);
  border-radius: 20px;
  font-size: clamp(12px, 1.5vw, 14px);
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.chip.back-chip {
  background: var(--muted);
}

.chip.back-chip:hover {
  background: #475569;
}

.chip.print-chip {
  background: #10b981; /* Premium Emerald */
}

.chip.print-chip:hover {
  background: #059669;
}

.pitch-zone-section {
  grid-area: pitch;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: #ffffff;
  padding: 0 4px;
  position: relative;
}

.pitch-zone-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
}

.batter-graphic {
  width: clamp(150px, 20vw, 300px);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.batter-graphic img {
  width: 100%;
  height: auto;
  max-height: 100%;
  max-width: 100%;
}

.batter-graphic-left-handed {
  order: 0;
}

.batter-graphic-right-handed {
  order: 2;
}

.pitch-zone {
  width: var(--pitch-size);
  height: var(--pitch-height);
  border: 3px solid #cbd5e1;
  border-radius: 8px;
  position: relative;
  background: #ffffff;
  margin: 0;
  box-shadow: var(--shadow-md);
  order: 1;
}

.pitch-zone::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, transparent calc(33.333% - 0.5px), #e2e8f0 calc(33.333% - 0.5px), #e2e8f0 calc(33.333% + 0.5px), transparent calc(33.333% + 0.5px)),
    linear-gradient(to right, transparent calc(66.666% - 0.5px), #e2e8f0 calc(66.666% - 0.5px), #e2e8f0 calc(66.666% + 0.5px), transparent calc(66.666% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.333% - 0.5px), #e2e8f0 calc(33.333% - 0.5px), #e2e8f0 calc(33.333% + 0.5px), transparent calc(33.333% + 0.5px)),
    linear-gradient(to bottom, transparent calc(66.666% - 0.5px), #e2e8f0 calc(66.666% - 0.5px), #e2e8f0 calc(66.666% + 0.5px), transparent calc(66.666% + 0.5px));
  z-index: 1;
}

.pitch-circle {
  position: absolute;
  width: var(--pitch-circle-size, 32px);
  height: var(--pitch-circle-size, 32px);
  border-radius: 50%;
  font-weight: 700;
  font-size: calc(var(--pitch-circle-size) * 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: 2px solid rgba(255,255,255,0.8);
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  z-index: 2;
}

.pitch-circle:hover {
  transform: translate(-50%, -50%) scale(1.2);
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.pitch-circle__type {
  font-size: calc(var(--pitch-circle-size, 32px) * 0.38);
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  line-height: 1;
}

.pitch-circle__hand {
  font-size: calc(var(--pitch-circle-size, 32px) * 0.28);
  font-weight: 700;
  line-height: 1;
}

.pitch-circle__hand--left {
  color: #ffffff;
  text-shadow:
    -1px -1px 0 #00d8ff,  1px -1px 0 #00d8ff,
    -1px  1px 0 #00d8ff,  1px  1px 0 #00d8ff,
     0px -1px 0 #00d8ff,  0px  1px 0 #00d8ff,
    -1px  0px 0 #00d8ff,  1px  0px 0 #00d8ff;
}

.pitch-circle__hand--right {
  color: #ffffff;
  text-shadow:
    -1px -1px 0 #ff2a7a,  1px -1px 0 #ff2a7a,
    -1px  1px 0 #ff2a7a,  1px  1px 0 #ff2a7a,
     0px -1px 0 #ff2a7a,  0px  1px 0 #ff2a7a,
    -1px  0px 0 #ff2a7a,  1px  0px 0 #ff2a7a;
}

.pitch-circle--good {
  background: linear-gradient(135deg, var(--good) 0%, #059669 100%);
  border-color: #a7f3d0;
}

.pitch-circle--bad {
  background: linear-gradient(135deg, var(--bad) 0%, #dc2626 100%);
  border-color: #fca5a5;
}

.batter-section { display: none; }

.info-section {
  grid-area: info;
  background: var(--bg);
  padding: clamp(12px, 2vw, 16px);
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vw, 16px);
  max-height: calc(100vh - 80px);
}

.info-btn, .settings-btn {
  background: #60a5fa;
  color: #1e40af;
  border: none;
  border-radius: 12px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
  box-shadow: var(--shadow-sm);
}

.info-btn:hover, .settings-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.settings-btn { background: #fdba74; color: #c2410c; }

/* Information & Tendencies Cards */
.tendencies, .power-sequence {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

.tendencies h3, .power-sequence h4 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.tendencies h3 { color: var(--text); }

.tendency-item, .threat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.tendency-item:last-child, .threat-item:last-child {
  border-bottom: none;
}

.tendency-label, .threat-label {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.threat-label {
  font-size: 14px;
  min-width: 52px;
}

.tendency-value, .threat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.threat-value {
  font-size: 14px;
  flex: 1;
  text-align: right;
  padding-left: 10px;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Power Sequence Colors */
.power-sequence.vulnerable-zone { border-left: 4px solid #8b5cf6; }
.power-sequence.vulnerable-zone h4 { color: #8b5cf6; }
.power-sequence.hot-zone { border-left: 4px solid var(--bad); }
.power-sequence.hot-zone h4 { color: var(--bad); }
.power-sequence.stats-box { border-left: 4px solid var(--accent); }
.power-sequence.stats-box h4 { color: var(--accent); }
.power-sequence.threat-box { border-left: 4px solid var(--danger); }
.power-sequence.threat-box h4 { color: var(--danger); }
.power-sequence.out-sequence { border-left: 4px solid #10b981; }
.power-sequence.out-sequence h4 { color: #10b981; }

.power-sequence-text {
  font-size: 18px;
  color: var(--text);
  line-height: 1.4;
  font-weight: 700;
  text-align: center;
}

/* ── Zone hover tooltip ──────────────────────────────── */
.zone-hover-tooltip {
  position: absolute;
  z-index: 9999;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  min-width: 180px;
}

.zone-tooltip-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  border-bottom: 1px solid #334155;
  padding-bottom: 5px;
}

.zone-tooltip-title {
  font-weight: 700;
  font-size: 13px;
  color: #7dd3fc;
}

.zone-tooltip-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.zone-tooltip-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  line-height: 1.4;
}

.zone-tooltip-pill--good {
  background: #16a34a;
  color: #fff;
}

.zone-tooltip-pill--bad {
  background: #dc2626;
  color: #fff;
}

.zone-tooltip-pill--hand {
  background: #3b82f6;
  color: #fff;
}

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

.zone-tooltip-table td {
  padding: 1px 4px;
}

.zone-tooltip-table td:first-child {
  color: #94a3b8;
}

.zone-tooltip-table td:last-child {
  text-align: right;
  font-weight: 600;
}

/* ── Out Pitch outcome breakdown row ─────────────────── */
.out-breakdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
}

.out-breakdown-item {
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.out-breakdown-k-s { background: #fee2e2; color: #b91c1c; }
.out-breakdown-k-l { background: #fef3c7; color: #92400e; }
.out-breakdown-contact { background: #e0f2fe; color: #0369a1; }
.out-breakdown-sep { color: #cbd5e1; font-size: 14px; }

.print-widget .out-breakdown { font-size: 11px; }

/* Overlays & Modals */
.info-overlay, .settings-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

/* ── Info Modal Shell ─────────────────────────────────── */
.info-modal {
  background: #ffffff;
  border-radius: 20px;
  max-width: 520px;
  width: clamp(300px, 85vw, 520px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.30);
  overflow: hidden;
}

.info-modal__header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid #bfdbfe;
  flex-shrink: 0;
  text-align: center;
  background: #eff6ff;
  border-radius: 16px 16px 0 0;
}

.info-modal__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.info-modal__subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.info-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 28px 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.info-modal__body::-webkit-scrollbar { width: 5px; }
.info-modal__body::-webkit-scrollbar-track { background: transparent; }
.info-modal__body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

.info-modal__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.info-modal__close-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.info-modal__close-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ── Info entries ─────────────────────────────────────── */
.info-entry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.info-entry--last {
  border-bottom: none;
}

@keyframes info-highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.6); background: rgba(219,234,254,0.5); }
  50%  { box-shadow: 0 0 0 6px rgba(59,130,246,0); background: rgba(219,234,254,0.15); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); background: transparent; }
}

.info-entry--highlight {
  border-radius: 8px;
  animation: info-highlight-pulse 2s ease-out forwards;
}

.info-entry__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-entry__content {
  flex: 1;
  min-width: 0;
}

.info-entry__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.info-entry__desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.info-threat-row {
  display: block;
  margin-bottom: 2px;
}

/* ── Info modal read-more expand ────────────────────────── */
.info-entry__expanded {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #475569;
  line-height: 1.6;
}

.info-entry__expanded p {
  margin: 0 0 6px 0;
}

.info-entry__expanded p:last-child {
  margin-bottom: 0;
}

.info-read-more-btn {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-read-more-btn:hover {
  color: #1e40af;
}

/* ── Read More / Expandable sections ─────────────────── */
.read-more-area {
  margin-top: 6px;
}

.read-more-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  letter-spacing: 0.02em;
}

.read-more-btn:hover {
  text-decoration: underline;
}

.read-more-expanded {
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 8px 10px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #334155;
  line-height: 1.55;
}

.read-more-expanded ul {
  margin: 6px 0 0 0;
  padding-left: 16px;
}

.read-more-expanded li {
  margin-bottom: 4px;
}

/* ── Section info button (ℹ) ─────────────────────────── */
.section-info-btn {
  background: none;
  border: 1.5px solid #94a3b8;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-info-btn:hover {
  background: #e2e8f0;
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Confidence info expansion ───────────────────────── */
.confidence-info-expand {
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #334155;
  line-height: 1.55;
}

.confidence-info-expand p {
  margin: 0 0 6px 0;
}

.confidence-info-expand ul {
  margin: 0;
  padding-left: 16px;
}

.confidence-info-expand li {
  margin-bottom: 5px;
}

/* Hide read-more buttons in print */
.print-widget .read-more-btn,
.print-widget .read-more-area,
.print-widget .section-info-btn,
.print-widget .confidence-info-expand {
  display: none !important;
}

/* ── Pitch type badge pills ───────────────────────────── */
.pitch-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.pitch-badge {
  font-size: 11px;
  font-weight: 400;
  padding: 3px 8px;
  border-radius: 5px;
  background: #e2e8f0;
  color: #374151;
  cursor: default;
  white-space: nowrap;
}

.pitch-badge strong {
  font-weight: 700;
}

/* ── Settings Modal Shell ─────────────────────────────── */
.settings-modal {
  background: #ffffff;
  border-radius: 20px;
  max-width: 820px;
  width: clamp(300px, 90vw, 820px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.30);
  overflow: hidden;
}

.settings-modal__header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid #fed7aa;
  flex-shrink: 0;
  background: #fff7ed;
  border-radius: 16px 16px 0 0;
}

.settings-modal__title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.settings-modal__subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ── Scrollable body ──────────────────────────────────── */
.settings-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.settings-modal__body::-webkit-scrollbar {
  width: 5px;
}

.settings-modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.settings-modal__body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}

/* ── 2-column grid ────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Section cards ────────────────────────────────────── */
.settings-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.settings-card.full-width {
  grid-column: 1 / -1;
}

.settings-card__header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Setting rows ─────────────────────────────────────── */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.setting-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  flex: 1;
  line-height: 1.3;
}

.setting-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.setting-slider {
  width: 120px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 99px;
  background: #e2e8f0;
  outline: none;
}

.setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}

.setting-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(59,130,246,0.4);
}

.setting-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.setting-number-input {
  width: 62px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: #ffffff;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.setting-number-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-track {
  width: 44px;
  height: 24px;
  border-radius: 24px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.2s;
}

.toggle-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-input:checked + .toggle-track.toggle-green {
  background: #22c55e;
}

.toggle-input:checked + .toggle-track.toggle-red {
  background: #ef4444;
}

.toggle-input:checked + .toggle-track.toggle-yellow {
  background: #f59e0b;
}

.toggle-input:checked + .toggle-track::before {
  transform: translateX(20px);
}

/* ── Sticky footer ────────────────────────────────────── */
.settings-modal__footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.settings-modal__close-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.settings-modal__close-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.settings-modal__reset-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.settings-modal__reset-btn:hover {
  border-color: #94a3b8;
  color: var(--text);
  background: #f1f5f9;
}

/* ── Sidebar: stack setting rows vertically so nothing overflows ── */
.settings-sidebar .setting-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
/* Toggle-only rows: keep inline and center them */
.settings-sidebar .setting-item:has(.toggle-switch) {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.settings-sidebar .setting-input-group {
  width: 100%;
}
.settings-sidebar .setting-slider {
  flex: 1;
  width: 100%;
  min-width: 0;
}
.settings-sidebar .setting-number-input {
  width: 68px;
  flex-shrink: 0;
}
.settings-sidebar .settings-modal__header,
.settings-sidebar .settings-modal__body,
.settings-sidebar .settings-modal__footer {
  padding-left: 16px;
  padding-right: 16px;
}
/* Center header title/subtitle in sidebar, no rounded top corners needed */
.settings-sidebar .settings-modal__header {
  text-align: center;
  border-radius: 0;
}

/* ── Dockable Sidebar ─────────────────────────────────── */
.settings-sidebar {
  width: 300px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.settings-sidebar::-webkit-scrollbar { width: 5px; }
.settings-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* Sidebar lives inside #app as a flex sibling — hugs the widget's left edge */
.app-sidebar-docked {
  display: flex !important;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}
.app-sidebar-docked .settings-sidebar {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  flex-shrink: 0;
}
.app-sidebar-docked .widget {
  flex-shrink: 0;
}

/* Make Team Title Bigger on Mobile */
.lineup-header h2, 
.team-title {
  font-size: 32px !important;
  font-weight: 900 !important;
  text-transform: uppercase;
}

/* Keep print renders completely off-screen to stop UI jumping/freezing */
#print-container, 
#lineup-print-container {
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
  visibility: hidden !important;
  pointer-events: none !important;
  overflow: hidden !important;
  height: 0 !important;
}

/* Disable click animations for Print buttons to prevent UI jumping */
.header__controls button:active {
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

/* Specific override if your button uses a scale effect */
button:active {
  transform: scale(1) !important;
}

/* ── Responsive: collapse to 1 column on small screens ── */
@media (max-width: 720px) {
  /* FORCE HEADER INTO A CENTERED 3-LINE STACK */
  .app-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding-top: 10px !important;
    gap: 12px !important;
  }

  /* Line 1: Name, Handedness, Pitches */
  .header__title {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    order: 1 !important;
  }

  /* Line 2: Tool Icon and Lightbulb Icon */
  .app-header .settings-btn, 
  .app-header .info-btn {
    position: static !important; /* Removes any floating/absolute positioning */
    display: inline-block !important;
    margin: 0 10px !important;
  }
  
  /* We use a pseudo-container via flex-order to group the icons together visually */
  .header-icons-wrapper {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    order: 2 !important;
  }

  /* Line 3: The Pills (Prev, Next, Print, Lineup) */
  .header__controls {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    width: 100% !important;
    gap: 8px !important;
    order: 3 !important;
  }
  .settings-modal {
    max-width: 100%;
    border-radius: 16px;
  }
  .settings-modal__header,
  .settings-modal__body,
  .settings-modal__footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-card.full-width {
    grid-column: 1;
  }
  .setting-slider {
    width: 80px;
  }
}

/* ============================================
   ADDITIONAL RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet landscape */
@media (max-width: 1024px) {
  .widget {
    grid-template-areas: 
      "header"
      "pitch"
      "info";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto 1fr;
    width: 95vw;
    height: auto;
  }
  .pitch-zone { width: 260px; height: 320px; }
  .batter-graphic { width: 60px; }
}

@media (max-width: 600px) {
  .lineup-grid { grid-template-columns: 1fr; }
  .widget { width: 95vw; transform: scaleX(0.70); transform-origin: center center; }
  .pitch-zone { width: 280px; height: 280px; }
  .header__title .name { font-size: 20px; }
  .batter-graphic { width: 50px; }
}

/* Print styles */
#print-container, #lineup-print-container { 
  position: fixed; 
  left: -9999px; 
  top: 0; 
}

.print-page { 
  background: white; 
  margin: 0 auto; 
  width: 1100px; 
  display: flex; 
  justify-content: center; 
  box-sizing: border-box; 
}

/* 1. Lock the Widget Size — row is auto/auto (not 1fr) so no dead whitespace below the zone */
.print-widget {
  width: 1100px !important;
  height: auto;
  min-height: 0 !important;
  grid-template-areas: "header" "pitch" "info";
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
  page-break-inside: avoid;
}

.print-widget .header__controls, 
.print-widget .info-btn, 
.print-widget .settings-btn { 
  display: none !important; 
}

.print-widget .pitch-zone-section { 
  justify-content: center; 
  padding: 16px 0; 
}

/* C1: Restore batter graphic in print — show at a small fixed width */
.print-widget .batter-graphic {
  display: flex !important;
  width: 80px !important;
  height: auto !important;
  flex-shrink: 0 !important;
  align-self: center !important;
}

.print-widget .batter-graphic img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* C3: Pitch zone — larger and dominant */
.print-widget .pitch-zone {
  width: 500px !important;
  height: 500px !important;
  flex-shrink: 0 !important;
  margin: 0 auto !important;
}

/* C3: Pitch zone section — row layout so batter graphic + zone are side by side */
.print-widget .pitch-zone-section {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

/* C3: pitch-zone-container (wraps batter + zone) should be a row */
.print-widget .pitch-zone-container {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
}

@media print {
  /* 1. iOS DARK MODE OVERRIDE */
  :root { color-scheme: light !important; }

  html, body { 
    background-color: #ffffff !important; 
    color: #000000 !important;
    margin: 0 !important; 
    padding: 0 !important;
    width: 100% !important;
    height: auto !important; /* THE MAGIC FIX FOR MULTIPLE PAGES */
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Keep the main app hidden to prevent viewport freezing */
  #app { 
    position: absolute !important;
    visibility: hidden !important; 
    opacity: 0 !important;
    height: 0 !important; 
    overflow: hidden !important;
    z-index: -999 !important;
  }

  /* Ensure print containers can expand to fit all 9 pages */
  #print-container, #lineup-print-container {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important; 
    overflow: visible !important; 
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
  }

  @page { 
    size: letter portrait; 
    margin: 0.3in; 
  }

  .print-page { 
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
    page-break-after: always !important; 
    break-after: page !important; 
  }
  
  .print-page:last-child { 
    page-break-after: auto !important; 
    break-after: auto !important; 
  }

  /* THE iOS DARK MODE NUCLEAR HACK */
  * {
    color-scheme: light !important;
  }

  .print-page, .print-widget {
    width: 100% !important; 
    max-height: 10in !important; 
    display: flex !important;
    flex-direction: column !important;
    
    /* Force white background */
    background-color: #ffffff !important; 
    
    /* Paint over any dark mode inheritance with a massive white inner shadow */
    box-shadow: inset 0 0 0 10000px #ffffff !important; 
    -webkit-box-shadow: inset 0 0 0 10000px #ffffff !important;
    
    border: none !important;
  }

  /* Force the SVG Container to be white too */
  .print-widget .pitch-zone {
    background-color: #ffffff !important;
    box-shadow: inset 0 0 0 1000px #ffffff !important;
    -webkit-box-shadow: inset 0 0 0 1000px #ffffff !important;
  }
  
  /* THE GRID LINE FIX: Solid mid-gray shows up on both Black (iOS) and White (Desktop) backgrounds */
  .print-widget .pitch-zone line,
  .print-widget .zone-grid,
  .print-widget .zone-grid div {
    stroke: #888888 !important; 
    border-color: #888888 !important;
  }

  .print-widget .pitch-zone line {
    stroke-width: 3px !important; 
    opacity: 1 !important;
  }

/* C3: Pitch zone size in print — bigger, uses percentage approach */
  .print-widget .pitch-zone {
    width: 46% !important;
    max-width: 380pt !important;
    aspect-ratio: 3 / 4 !important;
    height: auto !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    border: 2px solid #888888 !important;
  }

  /* C1: Batter graphic in print */
  .print-widget .batter-graphic {
    display: flex !important;
    width: 12% !important;
    max-width: 80pt !important;
    height: auto !important;
    flex-shrink: 0 !important;
    align-self: center !important;
  }

  /* C2: Hide Weakness Confidence tier buttons */
  .print-widget .confidence-widget { display: none !important; }

  /* C5: Much larger info section text — readable under pressure */
  .print-widget .info-section {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8pt !important;
    padding: 8pt !important;
    margin: 0 !important;
    border: none !important;
    border-top: 2pt solid #000 !important;
    background: #ffffff !important;
  }

  .print-widget .info-section * {
    font-size: 16px !important;
    line-height: 1.35 !important;
    color: #000000 !important;
  }

  /* C4+C5: Bigger headings */
  .print-widget .info-section h3,
  .print-widget .info-section h4 {
    font-size: 18px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    margin-bottom: 4px !important;
    border-bottom: 1.5px solid #ccc !important;
    padding-bottom: 2px !important;
  }

  .print-widget .info-section > div {
    padding: 6pt !important;
    margin: 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
  }

  /* C4: Threats & Tendencies bigger, full row */
  .print-widget .threat-box {
    grid-column: 1 / -1 !important;
  }

  .print-widget .threat-item {
    font-size: 17px !important;
    padding: 3px 0 !important;
  }

  .print-widget .threat-label {
    font-weight: 900 !important;
    font-size: 17px !important;
  }

  .print-widget .threat-value {
    font-size: 17px !important;
  }

  /* C5: Power sequence text */
  .print-widget .power-sequence-text {
    font-size: 17px !important;
    font-weight: 700 !important;
  }

  /* C6: Widget uses full page width, not fixed px */
  .print-widget {
    width: 100% !important;
    max-width: 7.9in !important;
  }

  .print-page {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Hide UI Buttons */
  .print-widget .header__controls,
  .print-widget .info-btn,
  .print-widget .settings-btn { display: none !important; }

  /* Pitch Circle Colors */
  .print-widget .pitch-circle--good { background: #10b981 !important; }
  .print-widget .pitch-circle--bad  { background: #ef4444 !important; }
  /* TURN OFF THE OLD CSS GRID FOR PRINTING */
  .print-widget .pitch-zone::after { display: none !important; }
}

.team-btn:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  /* The glowing blue shadow */
  box-shadow: 0 12px 24px -8px rgba(59, 130, 246, 0.6); 
}

/* --- Pitch Filter Toggle Buttons --- */
.pitch-filter-btn {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px; /* Space between text and icon */
}

/* The selected, vibrant blue state */
.pitch-filter-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  border: 1px solid transparent;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

/* The semi-grayed out, inactive state */
.pitch-filter-btn.inactive {
  background: #f1f5f9; 
  color: #64748b; 
  border: 1px solid #cbd5e1;
  box-shadow: none;
}

.pitch-filter-btn.inactive:hover {
  background: #e2e8f0;
  color: #475569;
}

/* Tooltip Icon styling */
.pitch-info-icon {
  font-weight: normal;
  opacity: 0.8;
  cursor: help;
  font-size: 16px;
}

.date-inputs-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

/* ── TABLET (max-width: 1024px) ── */
@media (max-width: 1024px) {
  .widget {
    width: 95vw;
    min-width: 0;
  }
  .team-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .lineup-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* ── MOBILE (max-width: 768px) ── */
@media (max-width: 768px) {
  #app {
    padding: 8px;
    align-items: flex-start;
  }

  /* Widget: fully stacked, no overflow */
  .widget {
    grid-template-areas: "header" "pitch" "info";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    width: 100%;
    min-width: 0;
    height: auto;
    border-radius: 12px;
    transform: none !important;
  }

  /* Header */
  .header {
    padding: 10px 12px;
    gap: 6px;
  }
  .header__title .name { font-size: 20px; }
  .header__title .meta { font-size: 13px; }
  .header__controls { gap: 6px; }

  /* Pitch zone: proportional scaling, no overflow */
  .pitch-zone-section {
    padding: 10px 6px;
    justify-content: center;
  }
  .pitch-zone-container {
    justify-content: center;
    gap: 4px;
  }
  .pitch-zone {
    width: min(78vw, 300px);
    height: calc(min(78vw, 300px) * 1.19);
  }
  .batter-graphic {
    width: 48px;
    height: auto;
  }

  /* Info section scrollable */
  .info-section {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: none;
  }

  /* Stat pills: 2×2 grid on mobile */
  .stat-pills-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* Team & roster cards: fluid 2-column */
  .team-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 0 4px;
  }
  .lineup-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  /* Sidebar docked: stack below widget — !important overrides the base flex-direction:row */
  .app-sidebar-docked {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 8px;
    gap: 8px;
    overflow-x: hidden;
  }
  .app-sidebar-docked .settings-sidebar {
    position: static !important;
    height: auto !important;
    max-height: 60vh;
    width: 100% !important;
    order: 2;
    flex-shrink: 1 !important;
  }
  .app-sidebar-docked .widget {
    width: 100% !important;
    flex-shrink: 1 !important;
  }

  /* Touch targets ≥ 44px */
  .chip, .back-btn, .print-btn, .team-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .info-btn, .settings-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .pitch-filter-btn {
    min-height: 44px;
    padding: 10px 10px;
    min-width: 0;
    flex: 0 1 calc(50% - 5px);
  }

  .date-inputs-row {
    flex-direction: column !important;
  }

  /* Team select screen */
  .team-select-screen {
    padding: 20px 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .team-select-screen h1 {
    font-size: 44px;
  }

  /* Loading screen: center vertically */
  .loading-screen {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 80vh !important;
    text-align: center !important;
  }

  /* Lineup: prevent overflow */
  .lineup-screen {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
  }
  .lineup-header {
    margin-bottom: 16px;
  }
  .lineup-header__topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .lineup-header .back-btn,
  .lineup-header .print-btn {
    position: static;
    transform: none;
  }
  .lineup-header h1 {
    font-size: 22px;
    margin: 0 0 8px;
    text-align: center;
    word-break: break-word;
  }

  /* Settings sidebar → centered modal overlay on mobile */
  .app-sidebar-docked::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  .app-sidebar-docked .settings-sidebar {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 92vw !important;
    max-height: 82vh !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4) !important;
    height: auto !important;
  }

  /* Header title + controls centering */
  .header__title {
    justify-content: center !important;
  }
}

/* FORCE EMOJIS AND TEXT TO CENTER PERFECTLY INSIDE PILLS */
.app-header .settings-btn, 
.app-header .info-btn,
.header__controls button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  line-height: 1 !important;
  padding: 8px 16px !important; /* Standardizes the pill shape */
}

/* Ensure the emoji itself doesn't have weird margins */
.app-header .settings-btn span, 
.app-header .info-btn span {
  display: inline-flex !important;
  align-items: center !important;
}

/* Make the landing page instructions smaller and less distracting */
.empty-state p, 
.placeholder-text, 
.welcome-subtitle {
  font-size: 15px !important;
  font-weight: 400 !important;
  color: #64748b !important; /* Lighter gray so it doesn't fight the title */
  margin-top: 8px !important;
  line-height: 1.4 !important;
}

@media (min-width: 769px) {
  .pitch-zone-section, .pitch-zone-container {
    background-color: transparent !important;
  }

  /* Fix: grid fills section, batter takes remaining space */
  .pitch-zone-section {
    justify-content: center;
    align-items: center;
    padding: 16px;
  }

  .pitch-zone-container {
    width: 100%;
    justify-content: center;
    align-items: stretch;
    gap: 16px;
  }

  .pitch-zone {
    flex: 0 0 auto;
    width: clamp(300px, 52%, 460px);
    height: auto;
    aspect-ratio: 3 / 4;
  }

  .batter-graphic {
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 260px;
  }

  .batter-graphic img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
  }
}