/* ============================================
   PITCH COUNTER COMPONENT (shared: landing + cloud)
   ============================================ */
.pitch-counter-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}
.pitch-counter-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--counter-color, #f97316);
}

.pitch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.pitch-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.pitch-header-icon {
    color: var(--counter-color, #f97316);
    font-size: 1rem;
    flex-shrink: 0;
}
.pitch-header-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pitch-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.pitch-header-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pitch-header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}
.pitch-counter-card .pitch-exit-fullscreen-btn { display: none; }
.pitch-counter-card.is-fullscreen .pitch-enter-fullscreen-btn { display: none; }
.pitch-counter-card.is-fullscreen .pitch-exit-fullscreen-btn { display: inline-flex; }
.pitch-counter-card.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    max-width: 100%;
    border-radius: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.pitch-counter-card.is-fullscreen::before { border-radius: 0; }
.pitch-counter-card.is-fullscreen .pitch-total-value { font-size: 4.5rem; }
.pitch-counter-card.is-fullscreen .bso-dot { width: 22px; height: 22px; }
.pitch-counter-card.is-fullscreen .pitch-btn { padding: 1rem; font-size: 1rem; }
.pitch-counter-card.is-fullscreen .pitch-outcome-btn { padding: 0.75rem; font-size: 0.875rem; }
.pitch-counter-card.is-fullscreen .pitch-log-list { max-height: 160px; }
@media (min-width: 600px) {
    .pitch-counter-card.is-fullscreen {
        inset: 1rem;
        border-radius: 1rem;
        max-width: 480px;
        margin: 0 auto;
    }
}

.pitch-total {
    text-align: center;
    margin-bottom: 0.75rem;
}
.pitch-total-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.pitch-total-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.pitch-bso {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.75rem;
}
.bso-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
}
.bso-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}
.bso-dots {
    display: flex;
    gap: 0.375rem;
}
.bso-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    transition: all 0.2s ease;
}
.bso-dot.active { border-color: transparent; }
.bso-balls .bso-dot.active {
    background: #22c55e;
    border-color: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}
.bso-strikes .bso-dot.active {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}
.bso-outs .bso-dot.active {
    background: #f59e0b;
    border-color: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.pitch-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.pitch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pitch-btn:active { transform: scale(0.95); }
.pitch-btn-ball { background: #22c55e; color: #fff; }
.pitch-btn-ball:hover { filter: brightness(1.1); }
.pitch-btn-strike { background: #ef4444; color: #fff; }
.pitch-btn-strike:hover { filter: brightness(1.1); }
.pitch-btn-foul {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.pitch-btn-foul:hover {
    background: var(--bg-primary);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

.pitch-actions { display: flex; gap: 0.5rem; }
.pitch-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pitch-action-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}
.pitch-action-btn:active { transform: scale(0.97); }

.pitch-event {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
    pointer-events: none;
    animation: pitchEventFlash 0.8s ease-out forwards;
}
.pitch-event.walk { background: rgba(34, 197, 94, 0.9); }
.pitch-event.strikeout { background: rgba(239, 68, 68, 0.9); }

@keyframes pitchEventFlash {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

.pitch-inning-bar {
    text-align: center;
    padding: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.pitch-info-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 0.375rem;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
}
.pitch-info-label {
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.pitch-info-value {
    flex: 1;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pitch-info-stat {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.pitch-swap-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-tertiary);
    border-radius: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.625rem;
    flex-shrink: 0;
}
.pitch-swap-btn:hover { color: var(--counter-color); border-color: var(--counter-color); }

.pitch-outcome-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.pitch-outcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pitch-outcome-btn:hover { background: var(--bg-primary); color: var(--text-primary); }
.pitch-outcome-btn:active { transform: scale(0.96); }

.pitch-game-log {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}
.pitch-log-header {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pitch-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: 96px;
    overflow-y: auto;
}
.pitch-log-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
    border-radius: 0.25rem;
    background: var(--bg-tertiary);
}
.log-inning { color: var(--text-tertiary); font-weight: 600; min-width: 1.5rem; }
.log-batter { flex: 1; color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-result { font-weight: 700; min-width: 2.5rem; text-align: center; }
.log-pitches { color: var(--text-tertiary); font-variant-numeric: tabular-nums; min-width: 1.5rem; text-align: right; }
.log-walk .log-result { color: #22c55e; }
.log-strikeout .log-result { color: #ef4444; }
.log-out .log-result { color: #f59e0b; }
.pitch-log-empty { text-align: center; padding: 0.5rem; font-size: 0.75rem; color: var(--text-tertiary); }

.pitch-settings-panel {
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    border-radius: 1rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pitch-settings-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}
.pitch-settings-back {
    background: none;
    border: none;
    color: var(--counter-color);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0;
}
.pitch-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}
.pitch-settings-save-btn {
    display: block;
    width: calc(100% - 2rem);
    margin: 0.75rem 1rem;
    padding: 0.625rem;
    background: var(--counter-color, #f97316);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
}
.pitch-settings-save-btn:hover { filter: brightness(1.1); }

.pitch-team-tabs {
    display: flex;
    margin-bottom: 0.75rem;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.pitch-team-tab {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    background: var(--bg-tertiary);
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}
.pitch-team-tab.active { background: var(--counter-color); color: #fff; }

.pitch-field-group { margin-bottom: 0.75rem; }
.pitch-field-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}
.pitch-field-row {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
    align-items: center;
}
.pitch-field-pos {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    width: 1.25rem;
    text-align: right;
    flex-shrink: 0;
}
.pitch-field-input {
    padding: 0.375rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.75rem;
}
.pitch-field-input:focus { outline: none; border-color: var(--counter-color); }
.pitch-field-num { width: 2.5rem; flex-shrink: 0; text-align: center; }
.pitch-field-name { flex: 1; min-width: 0; }
.pitch-dh-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.pitch-dh-row input[type="checkbox"] { accent-color: var(--counter-color); }
.pitch-lineup-note {
    font-size: 0.625rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 0.375rem;
}

.pitch-toast {
    position: fixed;
    bottom: 1.5rem; left: 50%;
    transform: translateX(-50%);
    background: var(--ink, #0a0a0a);
    color: #fff;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.pitch-toast.show { opacity: 1; }

/* Cloud-only sync status pill */
.pitch-sync-status {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.pitch-sync-status.is-saving { color: #f59e0b; }
.pitch-sync-status.is-saved { color: #22c55e; }
.pitch-sync-status.is-error { color: #ef4444; }
