* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== MOBILE PWA FIXES ===== */
html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    -webkit-overflow-scrolling: touch;
}

body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.4;
    font-size: 16px;
}

#main-content {
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Prevent zoom on input focus (iOS fix) */
input, 
select, 
textarea, 
button {
    font-size: 16px !important;
}

/* Fix for mobile keyboards pushing content */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}
/* ===== END MOBILE PWA FIXES ===== */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
}

/* COMPACT HEADER - Max 40px */
.header {
    background-color: #1e3a5f;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.header h2 {
    font-size: 20px;
    margin-bottom: 3px;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

.game-info h2 {
    margin-bottom: 3px;
}

.game-title {
    font-size: 16px;
    font-weight: bold;
}

.game-date {
    font-size: 13px;
    opacity: 0.8;
}

/* FORMS - Compact */
.setup-form {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1e3a5f;
    font-size: 16px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #1e3a5f;
}

/* BUTTON GROUPS */
.button-group {
    display: flex;
    gap: 10px;
}

.button-group input[type="radio"] {
    display: none;
}

.button-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.button-group-horizontal {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

/* Large tappable button option (new style, replaces radio buttons) */
.btn-option {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background-color: #1e3a5f;
    color: white;
    border: 3px solid #1e3a5f;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-option input[type="radio"] {
    display: none;
}

.btn-option .btn-text {
    display: block;
    width: 100%;
}

.btn-option:hover {
    background-color: #2d5a8f;
    border-color: #2d5a8f;
}

.btn-option:active {
    transform: scale(0.98);
}

.btn-option input[type="radio"]:checked + .btn-text {
    font-weight: 700;
}

.btn-option:has(input[type="radio"]:checked) {
    background-color: #2ecc71;
    border-color: #27ae60;
}

/* Old btn-choice style (kept for backward compatibility) */
.btn-choice {
    flex: 1;
    padding: 10px;
    background-color: #e8e8e8;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-choice:hover {
    background-color: #d8d8d8;
}

input[type="radio"]:checked + .btn-choice {
    background-color: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

/* BUTTONS - Compact 50px height */
.btn-primary {
    width: 100%;
    padding: 10px 20px;
    background-color: #1e3a5f;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    min-height: 50px;
    margin-top: 8px;
}

.btn-primary:hover {
    background-color: #2d5a8f;
}

.btn-secondary {
    width: 100%;
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    min-height: 50px;
    text-decoration: none;
    display: block;
    text-align: center;
    line-height: 1.4;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* END GAME BUTTONS */
.btn-end-game {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 15px;
    min-height: 36px;
    font-weight: 600;
}

.btn-end-game:hover {
    background-color: #c82333;
}

.btn-end-game-secondary {
    width: 100%;
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    min-height: 50px;
    font-weight: 500;
    margin-top: 10px;
}

.btn-end-game-secondary:hover {
    background-color: #5a6268;
}

.end-game-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.or-divider {
    color: #999;
    font-size: 14px;
    margin-bottom: 10px;
}

/* AT-BAT INFO - Compact */
.atbat-info {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.atbat-info h1 {
    color: #1e3a5f;
    font-size: 24px;
    margin-bottom: 10px;
}

/* COUNT DISPLAY - Compact */
.count-display {
    background-color: #1e3a5f;
    color: white;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.count-label {
    font-size: 16px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.count-value {
    font-size: 36px;
    font-weight: bold;
    display: block;
}

/* PITCH SECTIONS - Compact */
#pitch-type-section,
#pitch-result-section {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#pitch-type-section h3,
#pitch-result-section h3 {
    color: #1e3a5f;
    margin-bottom: 12px;
    text-align: center;
    font-size: 18px;
}

.pitch-reminder {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

/* BUTTON GRID - 3 columns for at-bat results */
.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.button-grid-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* PITCH BUTTONS - Compact 50px */
.btn-pitch-type,
.btn-pitch-result {
    padding: 10px;
    background-color: #e8e8e8;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 50px;
}

.btn-pitch-type:hover,
.btn-pitch-result:hover {
    background-color: #d8d8d8;
    transform: scale(1.02);
}

.btn-pitch-type.selected {
    background-color: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.btn-chased {
    background-color: #f39c12 !important;
    color: white !important;
    border-color: #e67e22 !important;
}

.btn-chased:hover {
    background-color: #e67e22 !important;
}

/* AT-BAT RESULT BUTTONS - Compact */
.btn-atbat-result {
    padding: 10px;
    background-color: #e8e8e8;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 50px;
    text-align: center;
}

.btn-atbat-result:hover {
    background-color: #d8d8d8;
    transform: scale(1.02);
}

.action-buttons {
    margin-top: 10px;
}

/* CENTERED CONTENT - Compact */
.centered-content {
    background: white;
    padding: 20px 15px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.current-pitcher-info {
    margin-bottom: 15px;
}

.info-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.pitcher-name {
    font-size: 18px;
    font-weight: bold;
    color: #1e3a5f;
}

.question {
    font-size: 18px;
    color: #1e3a5f;
    margin-bottom: 15px;
    font-weight: 600;
}

/* STATS DISPLAY - Compact */
.stats-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: 16px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    color: #1e3a5f;
    font-weight: bold;
}

.stat-number {
    font-size: 32px;
    color: #1e3a5f;
    font-weight: bold;
}

#notation-group {
    margin-top: 10px;
}

/* GAME STATE DISPLAY - Compact */
.game-state-display {
    background: white;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.baserunner-diamond {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.base {
    width: 40px;
    height: 40px;
    background-color: #ddd;
    border: 2px solid #999;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: #666;
    transition: all 0.3s;
}

.base.occupied {
    background-color: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.base-row {
    display: flex;
    gap: 40px;
}

.game-stats {
    display: flex;
    gap: 8px;
}

.stat-box {
    text-align: center;
    min-width: 60px;
}

/* BASERUNNER SETUP - Compact */
.baserunner-setup-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 15px;
}

.instruction-text {
    font-size: 18px;
    color: #1e3a5f;
    text-align: center;
    margin-bottom: 15px;
    font-weight: 600;
}

.diamond-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.interactive-diamond {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.interactive-base {
    width: 70px;
    height: 70px;
    background-color: #e8e8e8;
    border: 3px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.interactive-base:hover {
    background-color: #d8d8d8;
    transform: scale(1.05);
}

.interactive-base.selected {
    background-color: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.outs-selection {
    margin: 20px 0;
}

.outs-selection h4 {
    font-size: 16px;
    color: #1e3a5f;
    margin-bottom: 10px;
    text-align: center;
}

.outs-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-outs {
    width: 60px;
    height: 50px;
    background-color: #e8e8e8;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-outs:hover {
    background-color: #d8d8d8;
}

.btn-outs.selected {
    background-color: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.score-inputs {
    margin: 20px 0;
}

.score-inputs h4 {
    font-size: 16px;
    color: #1e3a5f;
    margin-bottom: 10px;
    text-align: center;
}

.score-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.score-field {
    flex: 1;
}

.score-field label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.score-field input {
    width: 100%;
    padding: 10px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

/* TRAJECTORY & CONTACT BUTTONS - Compact */
.quality-selection {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quality-selection h3 {
    font-size: 18px;
    color: #1e3a5f;
    margin-bottom: 12px;
    text-align: center;
}

.btn-quality {
    padding: 10px;
    background-color: #e8e8e8;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 50px;
}

.btn-quality:hover {
    background-color: #d8d8d8;
}

.btn-quality.selected {
    background-color: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

/* RUNS SCORED - Compact */
.runs-container {
    background: white;
    padding: 20px 15px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.runs-container h2 {
    font-size: 20px;
    color: #1e3a5f;
    margin-bottom: 15px;
}

.runner-count-display {
    background-color: #e3f2fd;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.runner-count-display p {
    font-size: 16px;
    color: #1e3a5f;
    font-weight: 600;
}

.runs-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
}

.btn-runs {
    padding: 10px;
    background-color: #e8e8e8;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 50px;
}

.btn-runs:hover {
    background-color: #d8d8d8;
}

/* RBI CREDIT - Compact */
.rbi-container {
    background: white;
    padding: 20px 15px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.rbi-container h2 {
    font-size: 20px;
    color: #1e3a5f;
    margin-bottom: 10px;
}

.runs-info {
    background-color: #fff3cd;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.runs-info p {
    font-size: 16px;
    color: #856404;
    font-weight: 600;
}

/* HEAT MAP & PITCH LOCATION VISUALIZATIONS */
.strike-zone-visuals {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.viz-column {
    flex: 1;
    min-width: 0;
}

.heat-map-container {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background-color: #e0e0e0;
    padding: 2px;
    border-radius: 4px;
}

.heat-map-row {
    display: flex;
    gap: 2px;
}

.heat-map-zone {
    flex: 1;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Barlow Condensed', sans-serif;
    border-radius: 2px;
    transition: transform 0.1s ease;
}

.heat-map-zone:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.zone-count {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.zone-pct {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}

.pitch-zone-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-radius: 4px;
    margin: 0 auto;
}

.strike-zone-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.grid-line {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.15);
}

.grid-horizontal {
    height: 1px;
    left: 0;
    right: 0;
}

.grid-vertical {
    width: 1px;
    top: 0;
    bottom: 0;
}

.strike-zone-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(30, 58, 95, 0.4);
    pointer-events: none;
    border-radius: 4px;
}

.pitch-dot {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.85;
    border: 1px solid white;
    pointer-events: none;
}

/* RESPONSIVE - Mobile optimized */
@media (max-width: 768px) {
    .strike-zone-visuals {
        flex-direction: column;
        gap: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header {
        padding: 8px 12px;
    }

    .header h1 {
        font-size: 22px;
    }

    .button-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stats-display {
        grid-template-columns: 1fr 1fr;
    }
}/* ===== ADDITIONAL MOBILE COMPACTNESS ===== */

@media (max-width: 480px) {
    /* Tighter overall spacing */
    #main-content {
        padding: 0;
    }

    .container {
        padding: 5px;
        min-height: auto;
    }

    /* Compact headers */
    .header {
        padding: 6px 10px;
        margin-bottom: 6px;
    }

    .header h1 {
        font-size: 20px;
        margin-bottom: 3px;
    }

    .header h2 {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .header p {
        font-size: 13px;
    }

    /* Compact forms and sections */
    .setup-form,
    .quality-selection,
    .centered-content,
    #pitch-type-section,
    #pitch-result-section,
    .atbat-info {
        padding: 10px;
        margin-bottom: 6px;
    }

    /* Tighter form groups */
    .form-group {
        margin-bottom: 10px;
    }

    .form-group label {
        margin-bottom: 4px;
        font-size: 15px;
    }

    /* Smaller headings */
    h1 {
        font-size: 20px !important;
        margin-bottom: 6px;
    }

    h2 {
        font-size: 18px !important;
        margin-bottom: 6px;
    }

    h3 {
        font-size: 16px !important;
        margin-bottom: 8px;
    }

    /* Compact buttons */
    .btn-primary,
    .btn-secondary,
    .btn-pitch-type,
    .btn-pitch-result,
    .btn-quality,
    .btn-atbat-result {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 15px;
        margin-top: 4px;
    }

    .btn-option {
        min-height: 50px;
        padding: 10px;
    }

    /* Tighter button grids */
    .button-grid,
    .button-grid-3col {
        gap: 6px;
    }

    .button-group-vertical {
        gap: 8px;
        margin-bottom: 10px;
    }

    /* Compact count display */
    .count-display {
        padding: 8px;
        margin: 6px 0;
    }

    .count-label {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .count-value {
        font-size: 32px;
    }

    /* Compact stats */
    .stats-display {
        gap: 6px;
        margin-bottom: 10px;
    }

    .stat-item {
        padding: 10px;
    }

    .stat-label {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-number {
        font-size: 28px;
    }

    /* Reduce vertical spacing everywhere */
    .pitch-reminder,
    .question,
    .info-label {
        margin-bottom: 6px;
        font-size: 15px;
    }

    /* Compact game state display */
    .game-state-display {
        padding: 6px;
        margin-bottom: 6px;
        gap: 6px;
    }

    .base {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
}

/* ===== UNIFIED BACK BUTTON STYLING ===== */

.back-btn {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 40px) !important;
    max-width: 400px !important;
    padding: 12px 20px !important;
    background: #1e3a5f !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 1000 !important;
}

.back-btn:hover {
    background: #2a5f8f !important;
}

@media (max-width: 480px) {
    .back-btn {
        bottom: 15px !important;
        width: calc(100% - 20px) !important;
        padding: 10px 15px !important;
        font-size: 15px !important;
    }
}