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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.input-section {
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 0;
}

.player-names {
    margin-bottom: 20px;
}

#playerInputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

#playerInputs input {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

button {
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5568d3;
}

.randomize-bar {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.randomize-bar #randomizeBtn {
    flex: 1;
    width: auto;
}

.undo-btn {
    flex: 0 0 auto;
    width: auto;
    padding: 15px 28px;
    background: #e67e22;
    font-size: 16px;
}

.undo-btn:hover {
    background: #cf6d17;
}

.lineup-section {
    margin-top: 30px;
}

.lineup-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lineup-table thead {
    background: #667eea;
    color: white;
}

.lineup-table th {
    padding: 12px;
    text-align: center;
    font-weight: bold;
}

.lineup-table th:first-child {
    width: 60px;
}

.lineup-table th:nth-child(2) {
    text-align: center;
    width: 80px;
}

.lineup-table th:nth-child(3) {
    text-align: left;
    min-width: 150px;
}

.lineup-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.lineup-table tbody tr:hover {
    background: #f8f9fa;
}

.lineup-table tbody tr:last-child {
    border-bottom: none;
}

.lineup-table td {
    padding: 12px;
    text-align: center;
}

.order-num {
    font-weight: bold;
    color: #667eea;
    text-align: center;
    width: 40px;
}

.lineup-table td.col-num {
    text-align: center;
    white-space: nowrap;
    width: 50px;
    color: #667eea;
    font-size: 13px;
}

.lineup-table td.col-name {
    text-align: left;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
}

.player-name {
    text-align: left;
    color: #333;
    font-weight: 500;
}

.position-cell {
    font-weight: bold;
    color: #764ba2;
}

.position-cell.bench {
    color: #999;
    background: #f5f5f5;
}

.position-cell.pos-fallback {
    background: #fef3c7;
}

.fallback-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 14px;
}

.draggable-row {
    cursor: move;
}

.draggable-row.dragging {
    opacity: 0.5;
    background: #e8e8ff;
}

.draggable-row.drag-over {
    background: #d4d4ff;
    border-top: 3px solid #667eea;
}


.player-input-group {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background: #fafafa;
}

.player-input {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.toggle-all-btn {
    width: 100%;
    padding: 6px 10px;
    background: #764ba2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 8px;
}

.toggle-all-btn:hover {
    background: #6a3f8f;
}

.field-container {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.preferred-hint {
    text-align: center;
    font-size: 0.7rem;
    color: #888;
    margin-top: 2px;
}

/* Preferred Batting Order */
.batting-order-section {
    margin-top: 20px;
}
.batting-order-section > label {
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}
.batting-order-hint {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
}
.batting-order-list {
    max-width: 400px;
}
.bo-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 2px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
}
.bo-row:active { cursor: grabbing; }
.bo-rank {
    font-weight: bold;
    min-width: 22px;
    text-align: center;
    color: #555;
}
.bo-name { flex: 1; }
.bo-hint {
    display: block;
    font-size: 0.72rem;
    color: #999;
    font-style: italic;
    line-height: 1.2;
    margin-top: 1px;
}
.bo-handle {
    color: #aaa;
    font-size: 1.1rem;
}
.bo-dragging { opacity: 0.4; }
.bo-dragover { border-color: #2563eb; background: #e8f0fe; }

.baseball-field {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    overflow: hidden;
}

.position-circle:hover {
    filter: brightness(1.2);
}

.pitcher-selection {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pitcher-select-group {
    flex: 1;
    min-width: 200px;
}

.pitcher-select-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
}

.pitcher-select-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    background: white;
    cursor: pointer;
}

.pitcher-select-group select:focus {
    outline: none;
    border-color: #667eea;
}

.pitcher-select-group.narrow-num {
    min-width: 100px;
}

.pitcher-select-group.narrow-num input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
    height: auto;
}

.pitcher-select-group.narrow-num input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Auth */
.auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.auth-box h1 {
    font-size: 22px;
    margin-bottom: 24px;
    color: #333;
}

.auth-box h2 {
    font-size: 18px;
    color: #667eea;
    margin-bottom: 20px;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.auth-field input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.auth-field input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.3s;
}

.auth-btn:hover {
    background: #5568d3;
}

.auth-error {
    color: #e03030;
    font-size: 13px;
    min-height: 18px;
    margin-bottom: 8px;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.header-bar {
    margin-bottom: 20px;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.header-top-row h1 {
    margin-bottom: 0;
    flex: 1;
    text-align: center;
}

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

#loggedInUser {
    font-size: 14px;
    color: #666;
}

.logout-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #999;
    font-weight: normal;
}

.logout-btn:hover {
    background: #777;
}

.player-name-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.player-number-input {
    width: 52px;
    min-width: 52px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
    flex-shrink: 0;
}

.player-number-input:focus {
    outline: none;
    border-color: #667eea;
}

.player-input {
    flex: 1;
    min-width: 0;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.jersey-num {
    color: #667eea;
    font-weight: bold;
    font-size: 13px;
}

/* Team settings */
.team-settings {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Rules section */
.rules-section {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.rules-section legend {
    font-weight: 600;
    font-size: 1.05em;
    padding: 0 8px;
}
.rules-section .team-settings {
    margin-bottom: 12px;
}
.rules-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rules-checkboxes .gs-checkbox-label {
    font-size: 0.95em;
}
.rules-subgroup {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.rules-subgroup:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.rules-subgroup-title {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rules-subgroup .team-settings {
    margin-bottom: 8px;
}
.rules-subgroup .rules-checkboxes {
    margin-top: 4px;
}

.team-setting-group {
    flex: 0 0 auto;
    min-width: 160px;
}

.team-setting-group.narrow {
    flex: 0 0 180px;
}

.team-setting-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
}

.team-setting-group input[type="text"],
.team-setting-group input[type="number"],
.team-setting-group select {
    height: 38px;
    padding: 0 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
    width: 100%;
    background: white;
}

.team-setting-group input[type="text"]:focus,
.team-setting-group input[type="number"]:focus,
.team-setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.team-name-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 0;
}

.team-name-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Game settings row (game count + pitcher selects + batting order) */
.game-settings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px 20px;
    margin-bottom: 20px;
}

/* Game settings sub-groups */
.gs-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.gs-group {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 14px;
    margin: 0;
    background: #fafbfc;
}
.gs-group legend {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 6px;
}
.gs-group-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
/* Pitcher name + innings pair: always stay together */
.gs-pitcher-pair {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}
.gs-pitcher-pair .pitcher-select-group { flex: 1; min-width: 0; }
.gs-pitcher-pair .pitcher-select-group.narrow-num { flex: 0 0 70px; min-width: 0; }
.gs-group-row .pitcher-select-group {
    flex: 1;
    min-width: 140px;
}
.gs-group-row .pitcher-select-group.narrow-num {
    flex: 0 0 110px;
    min-width: 90px;
}
.gs-pitcher-remaining {
    font-size: 12px;
    color: #f59e0b;
    font-weight: 600;
    margin-top: 6px;
    text-align: center;
}
.gs-pitch-options {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    align-items: flex-start;
}
.gs-pitch-opt-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.gs-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}
.gs-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #059669;
    cursor: pointer;
    flex-shrink: 0;
}
.gs-checkbox-label.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Game info row (date, game#, vis/rec, adversaire) */
.game-info-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.game-info-pair {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.game-settings .pitcher-select-group {
    min-width: 0;
}

/* Presence checkbox */
.presence-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}

.presence-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Spare player rows in table */
.spare-row td {
    color: #999;
    font-style: italic;
}

.spare-row .col-name {
    color: #aaa;
}

/* ── Navigation buttons ── */
.settings-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #667eea;
    font-weight: normal;
}
.settings-btn:hover { background: #5568d3; }

.back-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #999;
    font-weight: normal;
}
.back-btn:hover { background: #777; }

.save-settings-btn {
    background: #27ae60;
    margin-top: 20px;
}
.save-settings-btn:hover { background: #219a52; }

/* ── Main page collapsible cards ── */
.main-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
}
.main-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s;
}
.main-card-header:hover {
    background: #f1f5f9;
}
.main-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}
.main-card-chevron {
    font-size: 14px;
    color: #94a3b8;
    transition: transform 0.2s;
}
.main-card.collapsed .main-card-chevron {
    transform: rotate(-90deg);
}
.main-card.collapsed .main-card-body {
    display: none;
}
.main-card-body {
    padding: 16px;
}

/* Roster card — visually distinct zone */
.roster-card-wrapper {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: #cbd5e1;
}
.roster-card-wrapper .main-card-header {
    background: linear-gradient(90deg, #e2e8f0, #f1f5f9);
    border-bottom-color: #cbd5e1;
}
.roster-card-wrapper .main-card-header:hover {
    background: linear-gradient(90deg, #dbe1ea, #e8ecf2);
}
.roster-card-wrapper .main-card-body {
    padding: 16px 12px;
}

/* Remove old margins — cards handle spacing now */
.main-card .game-settings {
    margin-bottom: 0;
}
.main-card .game-info-row {
    margin-bottom: 0;
}

/* ── Roster list (main page) ── */
.main-card .roster-section {
    margin-bottom: 0;
}

.roster-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.roster-card {
    cursor: pointer;
    transition: opacity 0.2s, filter 0.2s;
}

.roster-card.absent {
    opacity: 0.35;
    filter: grayscale(1);
}

.jersey-label {
    display: block;
    cursor: pointer;
    width: 100px;
}

.jersey-svg {
    width: 100px;
    height: 110px;
    display: block;
    transition: filter 0.2s;
}

.jersey-label:hover .jersey-svg {
    filter: brightness(1.15);
}

.roster-presence-hidden {
    display: none;
}

/* Color pickers */
.color-picker {
    width: 100%;
    height: 42px;
    padding: 2px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    background: white;
}
.color-picker:focus {
    outline: none;
    border-color: #667eea;
}

/* ── Jersey Model Picker ── */
.jersey-model-section {
    margin-bottom: 24px;
}

.jersey-style-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.jersey-style-header > label {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

.color-pair.inline {
    display: flex;
    align-items: center;
    gap: 16px;
}

.color-pair-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-pair-item label {
    font-weight: bold;
    color: #555;
    font-size: 13px;
    white-space: nowrap;
}

.color-pair-item input[type="color"] {
    width: 56px;
    height: 36px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
}

.jersey-model-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.jersey-model-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    padding: 6px;
    transition: border-color 0.2s, background 0.2s;
    background: #f5f5f5;
}

.jersey-model-option:hover {
    border-color: #667eea;
    background: #eef0ff;
}

.jersey-model-option.selected {
    border-color: #667eea;
    background: #e8ebff;
    box-shadow: 0 0 0 2px #667eea44;
}

.jersey-model-option .jersey-svg {
    width: 70px;
    height: 77px;
    pointer-events: none;
}

.jersey-model-label {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    margin-top: 4px;
    text-align: center;
}

/* Color pickers side by side */
.color-pair {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.color-pair-item {
    flex: 1;
}

.color-pair-item label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
}

.color-pair-item .color-picker {
    width: 100%;
}

/* ── Schedule button ── */
.schedule-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #27ae60;
    font-weight: normal;
}
.schedule-btn:hover { background: #219a52; }

/* ── Schedule import (Team Settings) ── */
.schedule-import-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.schedule-import-section > label {
    display: block;
    font-weight: bold;
    color: #555;
    margin-bottom: 10px;
}

.schedule-import-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pdf-upload-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s;
    white-space: nowrap;
}
.pdf-upload-btn:hover { background: #5568d3; }

.pdf-filename {
    font-size: 13px;
    color: #666;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clear-schedule-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
    background: #e74c3c;
    font-weight: normal;
}
.clear-schedule-btn:hover { background: #c0392b; }

.schedule-import-status {
    margin-top: 8px;
    font-size: 13px;
    color: #555;
    min-height: 18px;
}
.schedule-import-status.success { color: #27ae60; font-weight: bold; }
.schedule-import-status.error   { color: #e74c3c; }

/* ── Schedule page ── */
.schedule-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 4px;
}
.schedule-filter-row input[type="checkbox"] {
    accent-color: #2563eb;
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.schedule-filter-label {
    display: inline;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 0;
}

.schedule-content {
    margin-top: 10px;
}

.schedule-empty {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 16px;
}

.schedule-month {
    margin-bottom: 32px;
}

.schedule-month-title {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 4px;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.schedule-table thead {
    background: #667eea;
    color: white;
}

.schedule-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
}

.schedule-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.schedule-table tbody tr:last-child td { border-bottom: none; }

.game-past   { background: #fafafa; color: #888; }
.game-upcoming { background: white; }
.game-win td { background: #f0fff4 !important; }
.game-loss td { background: #fff5f5 !important; }

.game-win .sched-score  { color: #27ae60; font-weight: bold; }
.game-loss .sched-score { color: #e74c3c; font-weight: bold; }

.sched-gamenum { color: #999; font-size: 12px; width: 60px; }
.sched-date    { white-space: nowrap; }
.sched-time    { white-space: nowrap; }
.sched-location { color: #555; font-size: 12px; }
.sched-score   { text-align: center; font-weight: bold; white-space: nowrap; }
.sched-team    { vertical-align: middle; }
.my-team strong { color: #667eea; }

.sched-action { text-align: center; padding: 4px 6px; }
.sched-action { display: flex; gap: 4px; justify-content: center; align-items: center; }
.make-lineup-btn, .find-spares-btn {
    padding: 4px 0;
    width: 110px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
}
.make-lineup-btn { background: #667eea; }
.make-lineup-btn:hover { background: #5a6fd6; }
.find-spares-btn { background: #10b981; }
.find-spares-btn:hover { background: #059669; }

.gameday-schedule-btn {
    padding: 4px 0;
    width: 36px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    background: #f59e0b;
    color: white;
    cursor: pointer;
    text-align: center;
}
.gameday-schedule-btn:hover { background: #d97706; }

/* Lineup history table in modal */
.lineup-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.lineup-history-table th {
    background: #f3f4f6;
    padding: 6px 8px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}
.lineup-history-table td {
    padding: 4px 8px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}
.lineup-history-table td.bench { color: #999; background: #f9f9f9; }
.history-meta {
    margin-top: 10px;
    font-size: 12px;
    color: #888;
    text-align: right;
}
.history-edit-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.history-remove-inning-btn, .history-add-inning-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #999;
    border-radius: 4px;
    background: #e5e7eb;
    color: #333;
    cursor: pointer;
}
.history-remove-inning-btn:hover { background: #fee2e2; border-color: #f87171; }
.history-add-inning-btn:hover { background: #dcfce7; border-color: #4ade80; }
.history-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}
.history-edit-btn, .history-cancel-btn {
    padding: 6px 14px;
    font-size: 13px;
    border: 1px solid #999;
    border-radius: 4px;
    background: #e5e7eb;
    color: #333;
    cursor: pointer;
}
.history-edit-btn:hover { background: #c7d2fe; }
.history-cancel-btn:hover { background: #d1d5db; }
.history-save-btn {
    padding: 6px 14px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}
.history-save-btn:hover { background: #1d4ed8; }
.history-pos-select {
    width: 50px;
    padding: 2px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-align: center;
}

/* Spare availability table */
.spare-avail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.spare-avail-table th {
    background: #f3f4f6;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}
.spare-avail-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
}
.spare-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.spare-status-free .spare-status-badge { background: #d1fae5; color: #065f46; }
.spare-status-maybe .spare-status-badge { background: #fef3c7; color: #92400e; }
.spare-status-playing .spare-status-badge { background: #fee2e2; color: #991b1b; }
.spare-status-unknown .spare-status-badge { background: #f3f4f6; color: #6b7280; }
tr.spare-status-playing { opacity: 0.5; }

/* ── Team Picker Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: white;
    border-radius: 10px;
    padding: 28px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-box h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 18px;
}

.modal-desc {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}

.team-picker-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.team-picker-item {
    width: 100%;
    padding: 10px 14px;
    background: #f5f5f5;
    color: #333;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: normal;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.team-picker-item:hover {
    background: #eef0ff;
    border-color: #667eea;
    color: #667eea;
}

.modal-cancel-btn {
    width: 100%;
    padding: 10px;
    background: #999;
    font-size: 14px;
    font-weight: normal;
}
.modal-cancel-btn:hover { background: #777; }

/* ── Gameday nav button ── */
.gameday-nav-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #059669;
    font-weight: normal;
    white-space: nowrap;
}
.gameday-nav-btn:hover { background: #047857; }

/* ── Spares button ── */
.spares-btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #e67e22;
    font-weight: normal;
}
.spares-btn:hover { background: #ca6f1e; }

/* ── Spares section ── */
.spares-add-form {
    background: #f8f9ff;
    border: 1px solid #e0e4ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 28px;
}

.spares-add-form h3,
.spares-schedules-section h3,
.spares-list-section h3 {
    color: #667eea;
    font-size: 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid #e0e4ff;
    padding-bottom: 6px;
}

.spares-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.spares-field {
    flex: 1;
    min-width: 140px;
}

.spares-field label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

.spares-field input,
.spares-field select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.spares-field-btn {
    flex: 0 0 auto;
    min-width: unset;
}

.spares-field-narrow {
    flex: 0 0 60px;
    min-width: unset;
}

.add-spare-btn {
    width: auto;
    padding: 9px 20px;
    font-size: 14px;
    background: #27ae60;
    font-weight: bold;
}
.add-spare-btn:hover { background: #219a52; }

/* ── Category schedules ── */
.spares-schedules-section {
    margin-bottom: 28px;
}

.category-schedules-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    min-height: 20px;
}

.category-schedule-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #eef0ff;
    border: 1px solid #667eea;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 13px;
    color: #667eea;
    font-weight: bold;
}

.category-schedule-chip .chip-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    width: auto;
    line-height: 1;
}
.category-schedule-chip .chip-remove:hover { color: #e74c3c; }

.spares-import-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.spares-category-select {
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    min-width: 180px;
}

/* ── Spares list ── */
.spares-list-section {
    margin-bottom: 20px;
}

.spares-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.spare-player-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr 0.7fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: white;
    font-size: 14px;
}

.spare-player-row:last-child { border-bottom: none; }
.spare-player-row:nth-child(even) { background: #fafafa; }

.spare-player-row .spare-name { font-weight: bold; color: #333; }
.spare-player-row .spare-email { color: #666; font-size: 13px; }

.spare-player-row .spare-team {
    color: #667eea;
    font-weight: bold;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.spare-player-row .spare-team:hover { color: #5568d3; }
.spare-player-row .spare-team.no-schedule {
    color: #888;
    text-decoration: none;
    cursor: default;
    font-weight: normal;
}

.spare-player-row .spare-category {
    font-size: 12px;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 2px 8px;
    color: #555;
    text-align: center;
}

.spare-delete-btn {
    width: auto;
    padding: 4px 10px;
    font-size: 12px;
    background: #e74c3c;
    font-weight: normal;
    border-radius: 4px;
}
.spare-delete-btn:hover { background: #c0392b; }

.spares-empty {
    padding: 30px;
    text-align: center;
    color: #aaa;
    font-size: 14px;
}

/* ── Spare team schedule modal ── */
.modal-box-wide {
    max-width: 900px;
    width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin-bottom: 0;
}

.modal-close-btn {
    width: auto;
    padding: 4px 10px;
    font-size: 16px;
    background: #999;
    font-weight: normal;
    border-radius: 4px;
}
.modal-close-btn:hover { background: #777; }

.spare-team-modal-content {
    overflow-y: auto;
    max-height: 65vh;
}

/* ── Spare picker in lineup table ── */
.spare-name-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.spare-slot-label {
    font-style: italic;
    color: #aaa;
    font-size: 12px;
}

.coach-roster-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
}

.lr-badge {
    display: inline-block;
    font-size: 10px;
    font-style: normal;
    font-weight: bold;
    color: #c0392b;
    background: #fdecea;
    border: 1px solid #e8b4b0;
    border-radius: 3px;
    padding: 0 3px;
    vertical-align: middle;
    margin-left: 2px;
}

.spare-picker {
    font-size: 13px;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    color: #333;
    cursor: pointer;
    max-width: 200px;
}

.spare-picker:focus {
    outline: none;
    border-color: #667eea;
}

/* ── Editable position cells ── */
.pos-editable {
    cursor: pointer;
    position: relative;
    padding: 0 !important;
}

.pos-label {
    display: block;
    padding: 8px 12px;
    font-weight: bold;
    color: #667eea;
    transition: opacity 0.15s;
}

.pos-picker {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    font-size: 13px;
    font-weight: bold;
    padding: 4px 6px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    color: #333;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 60px;
}

.pos-editable:hover .pos-label,
.pos-editable:focus-within .pos-label {
    opacity: 0.2;
}

.pos-editable:hover .pos-picker,
.pos-editable:focus-within .pos-picker {
    display: block;
}

/* ── Print button & lineup header ── */
.lineup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.lineup-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.print-btn {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.print-btn:hover { background: #1d4ed8; }

/* ── Gameday Mode ── */
#gamedaySection {
    height: 100dvh;
    background: #f8fafc;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}
.gd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #059669;
    color: white;
    flex-shrink: 0;
    z-index: 100;
}
.gd-exit-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-exit-btn:hover { background: rgba(255,255,255,0.3); }
.gd-game-context {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}
.gd-mode-toggle {
    display: flex;
    gap: 0;
    margin: 8px 12px 4px;
    flex-shrink: 0;
}
.gd-mode-btn {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #059669;
    background: white;
    color: #059669;
    cursor: pointer;
    width: auto;
}
.gd-mode-btn:first-child { border-radius: 8px 0 0 8px; }
.gd-mode-btn:last-child { border-radius: 0 8px 8px 0; }
.gd-mode-btn.active {
    background: #059669;
    color: white;
}
.gd-tracking-mode-selector {
    display: flex;
    gap: 0;
    margin: 0 12px 4px;
    flex-shrink: 0;
}
.gd-track-btn {
    flex: 1;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    cursor: pointer;
    width: auto;
}
.gd-track-btn:first-child { border-radius: 6px 0 0 6px; }
.gd-track-btn:last-child { border-radius: 0 6px 6px 0; }
.gd-track-btn.active {
    background: #374151;
    color: white;
    border-color: #374151;
}
.gd-tap-target { min-height: 44px; min-width: 44px; }

/* Pitch Counter */
#gdPitchPanel {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
/* Layout wrapper: stacks vertically by default (portrait), side-by-side in landscape */
.gd-pc-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.gd-pc-controls { flex-shrink: 0; }
.gd-pc-sidebar { flex: 1; min-height: 0; overflow-y: auto; }
.gd-sidebar-toggle {
    background: #e5e7eb;
    border: none;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 16px;
    cursor: pointer;
    width: auto;
    min-height: 24px;
    min-width: 24px;
    line-height: 1;
}
.gd-sidebar-toggle:hover { background: #d1d5db; }
.gd-pc-pitcher {
    font-size: 16px;
    font-weight: 700;
    color: #065f46;
    text-align: center;
    margin-bottom: 6px;
}
.gd-pc-pitcher-btn {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    width: auto;
    display: block;
    margin: 0 auto 6px;
}
.gd-pc-pitcher-btn:hover { background: #1d4ed8; }
.gd-pc-inning-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}
.gd-pc-inning-label {
    font-size: 18px;
    font-weight: 700;
    color: #065f46;
    min-width: 80px;
    text-align: center;
}
.gd-pc-inning-nav button {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 18px;
    cursor: pointer;
    color: #065f46;
    width: auto;
}
.gd-pc-inning-nav button:disabled { opacity: 0.3; cursor: default; }
.gd-pc-counts {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 8px;
}
.gd-pc-sb-counts {
    flex-wrap: wrap;
}
.gd-pc-sb-inline {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}
.gd-sb-group { color: #374151; }
.gd-sb-label { color: #6b7280; font-weight: 500; font-size: 12px; }
.gd-sb-strike { color: #059669; }
.gd-sb-ball { color: #dc2626; }
.gd-pc-count-box {
    text-align: center;
}
.gd-pc-count-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gd-pc-count-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #065f46;
}
.gd-pc-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.gd-pc-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    max-width: 320px;
    margin: 0 auto 8px;
}
/* In Play grid: 2×2, larger buttons for easy tapping on mobile */
.gd-pc-inplay-grid {
    max-width: 100%;
    gap: 10px;
}
.gd-pc-inplay-grid .gd-pc-result {
    padding: 22px 16px;
    font-size: 16px;
}
.gd-pc-plus {
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 32px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    width: auto;
}
.gd-pc-plus:hover { background: #047857; }
.gd-pc-minus {
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    width: auto;
}
.gd-pc-minus:disabled { opacity: 0.3; }
.gd-pc-strike {
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: auto;
}
.gd-pc-strike:hover { background: #047857; }
.gd-pc-ball {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: auto;
}
.gd-pc-ball:hover { background: #b91c1c; }
.gd-pc-undo {
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 14px;
    cursor: pointer;
    width: auto;
}
.gd-pc-undo:disabled { opacity: 0.3; }
.gd-pc-decision {
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-pc-swing, .gd-pc-inplay {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-pc-missfoul {
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-pc-back {
    background: #9ca3af;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-pc-actions-grid .gd-pc-back { grid-column: 1 / -1; }
.gd-pc-result {
    background: #eab308;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-pc-stints {
    margin-top: 12px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px solid #d1fae5;
}
.gd-pc-stint-row {
    font-size: 13px;
    color: #065f46;
    padding: 4px 0;
}
.gd-pc-pitch-log {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    max-height: 150px;
    overflow-y: auto;
}
.gd-pc-log-title, .gd-pc-summary-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.gd-pc-log-entry { font-size: 13px; padding: 3px 6px; border-radius: 3px; margin-bottom: 1px; }
.gd-log-strike { color: #065f46; background: #d1fae5; } /* green — strikes are good */
.gd-log-ball { color: #991b1b; background: #fee2e2; }   /* red — balls are bad */
.gd-log-hit { color: #92400e; background: #fef3c7; }    /* orange — ball hit in play */
.gd-pc-summary {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px solid #d1fae5;
}
/* Basic mode: per-inning pitcher summary table */
.gd-pc-basic-summary { margin-top: 8px; }
.gd-pc-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.gd-pc-summary-table th {
    background: #f3f4f6;
    padding: 4px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}
.gd-pc-summary-table th:first-child { text-align: center; width: 36px; }
.gd-st-name-col { text-align: left !important; }
.gd-pc-summary-table td {
    padding: 4px 6px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}
.gd-st-num { text-align: center; color: #667eea; font-size: 11px; font-weight: 600; }
.gd-st-name { text-align: left !important; font-weight: 600; color: #065f46; }
.gd-st-total { font-weight: 700; color: #065f46; }
.gd-pc-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: #065f46;
}

/* Lineup Editor */
#gdLineupPanel {
    padding: 12px;
    flex: 1 1 0;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.gd-le-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.gd-le-remove-inning, .gd-le-add-inning {
    padding: 8px 14px;
    font-size: 13px;
    border: 1px solid #999;
    border-radius: 6px;
    background: #e5e7eb;
    color: #333;
    cursor: pointer;
    width: auto;
}
.gd-le-remove-inning:disabled { opacity: 0.3; }
.gd-le-table-wrap {
    overflow: auto;
    margin-bottom: 8px;
    flex: 1 1 0;
    min-height: 0;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}
.gd-le-pos-select {
    width: 50px;
    padding: 4px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}
/* Scratch button & scratched row */
.gd-le-name-cell span { vertical-align: middle; }
.gd-le-scratch-btn {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    padding: 2px;
    opacity: 0.4;
    width: auto;
    min-height: auto;
    min-width: auto;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
}
.gd-le-scratch-btn:hover { opacity: 1; }
.gd-le-scratched { opacity: 0.4; }
.gd-le-scratched td { text-decoration: line-through; }
.gd-le-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}
.gd-le-save {
    background: #059669;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.gd-le-save:disabled { background: #d1d5db; color: #9ca3af; cursor: default; }
.gd-le-cancel {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    width: auto;
}
.gd-le-cancel:disabled { background: #d1d5db; color: #9ca3af; cursor: default; }

/* Pitcher Selection Overlay */
.gd-pitcher-select-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.gd-pitcher-select-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.gd-pitcher-select-content h3 {
    margin-bottom: 12px;
    color: #333;
}
.gd-outs-selector {
    margin-bottom: 12px;
}
.gd-outs-selector label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.gd-outs-buttons {
    display: flex;
    gap: 8px;
}
.gd-outs-btn {
    flex: 1;
    padding: 10px;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    cursor: pointer;
    width: auto;
}
.gd-outs-btn.active {
    background: #059669;
    color: white;
    border-color: #059669;
}
.gd-pitcher-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.gd-pitcher-option {
    padding: 12px 16px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    color: #333;
}
.gd-pitcher-option:hover {
    border-color: #059669;
    background: #f0fdf4;
}
.gd-cancel-btn {
    background: #9ca3af;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
}

/* ── Gameday Responsive ── */

/* Mobile portrait (narrow screens) */
@media (max-width: 480px) {
    .gd-header { padding: 6px 10px; }
    .gd-exit-btn { padding: 6px 10px; font-size: 13px; }
    .gd-game-context { font-size: 12px; gap: 4px; }
    .gd-mode-toggle { margin: 6px 8px 4px; }
    .gd-mode-btn { padding: 8px; font-size: 13px; }
    .gd-tracking-mode-selector { margin: 0 8px 4px; }
    .gd-track-btn { padding: 7px; font-size: 12px; }
    #gdPitchPanel, #gdLineupPanel { padding: 8px; }
    .gd-pc-pitcher { font-size: 14px; margin-bottom: 4px; }
    .gd-pc-inning-label { font-size: 16px; }
    .gd-pc-count-value { font-size: 24px; }
    .gd-pc-count-label { font-size: 10px; }
    .gd-pc-counts { gap: 12px; margin-bottom: 6px; }
    .gd-pc-actions { gap: 8px; margin-bottom: 6px; }
    .gd-pc-plus { padding: 10px 20px; font-size: 15px; }
    .gd-pc-strike, .gd-pc-ball { padding: 10px 18px; font-size: 14px; }
    .gd-pc-pitch-log { max-height: 120px; padding: 4px 8px; }
    .gd-pc-log-entry { font-size: 12px; padding: 2px 4px; }
    .gd-pc-summary { padding: 6px 8px; }
    .gd-pc-summary-grid { font-size: 12px; gap: 4px 10px; }
    .gd-pc-sb-inline { font-size: 12px; gap: 10px; }
    .gd-pc-actions-grid { max-width: 280px; }
    .gd-pc-result { padding: 10px 12px; font-size: 12px; }
    .gd-pc-inplay-grid .gd-pc-result { padding: 16px 12px; font-size: 14px; }
    .gd-pc-pitcher-btn { padding: 6px 14px; font-size: 14px; }
    .gd-le-pos-select { width: 42px; padding: 3px; font-size: 12px; }
    .gd-le-toolbar { gap: 4px; }
    .gd-le-remove-inning, .gd-le-add-inning { padding: 6px 10px; font-size: 12px; }
}

/* Mobile landscape (short + wide) */
@media (max-height: 500px) and (orientation: landscape) {
    /* Side-by-side layout: controls left, log/summary right */
    .gd-pc-layout {
        flex-direction: row;
        gap: 12px;
    }
    .gd-pc-controls { flex: 1; min-width: 0; overflow-y: auto; }
    .gd-pc-sidebar { flex: 1; min-width: 0; overflow-y: auto; }
    .gd-pc-pitch-log { max-height: none; }
    .gd-header { padding: 4px 10px; }
    .gd-exit-btn { padding: 4px 8px; font-size: 12px; min-height: 32px; }
    .gd-game-context { font-size: 11px; }
    .gd-mode-toggle { margin: 4px 8px 2px; }
    .gd-mode-btn { padding: 6px; font-size: 12px; min-height: 32px; }
    .gd-tracking-mode-selector { margin: 0 8px 2px; }
    .gd-track-btn { padding: 5px; font-size: 11px; min-height: 28px; }
    #gdPitchPanel, #gdLineupPanel { padding: 6px 8px; }
    .gd-pc-pitcher { font-size: 13px; margin-bottom: 2px; }
    .gd-pc-inning-nav { margin-bottom: 4px; gap: 8px; }
    .gd-pc-inning-label { font-size: 14px; }
    .gd-pc-inning-nav button { padding: 4px 10px; font-size: 14px; min-height: 32px; }
    .gd-pc-counts { gap: 16px; margin-bottom: 4px; }
    .gd-pc-count-value { font-size: 22px; }
    .gd-pc-count-label { font-size: 9px; }
    .gd-pc-actions { gap: 6px; margin-bottom: 4px; }
    .gd-pc-plus { padding: 8px 16px; font-size: 14px; min-height: 36px; }
    .gd-pc-strike, .gd-pc-ball { padding: 8px 14px; font-size: 13px; min-height: 36px; }
    .gd-pc-undo { padding: 8px 12px; font-size: 12px; min-height: 36px; }
    .gd-pc-pitch-log { max-height: 80px; margin-top: 4px; }
    .gd-pc-change-pitcher { margin-bottom: 4px; }
    .gd-pc-sb-inline { font-size: 11px; gap: 8px; }
    .gd-pc-actions-grid { max-width: 260px; gap: 4px; }
    .gd-pc-result { padding: 8px 10px; font-size: 11px; min-height: 32px; }
    .gd-pc-inplay-grid { max-width: 100%; gap: 6px; }
    .gd-pc-inplay-grid .gd-pc-result { padding: 12px 10px; font-size: 13px; min-height: 36px; }
    .gd-pc-pitcher-btn { padding: 4px 12px; font-size: 13px; margin-bottom: 2px; }
    .gd-tap-target { min-height: 32px; min-width: 32px; }
    /* Lineup editor: compact rows + explicit scroll */
    .gd-le-table-wrap { margin-bottom: 4px; }
    .gd-le-table-wrap .lineup-history-table td,
    .gd-le-table-wrap .lineup-history-table th { padding: 2px 4px; font-size: 11px; }
    .gd-le-pos-select { width: 38px; padding: 2px; font-size: 11px; }
    .gd-le-toolbar { margin-bottom: 4px; }
    .gd-le-remove-inning, .gd-le-add-inning { padding: 4px 8px; font-size: 11px; min-height: 28px; }
    .gd-le-save, .gd-le-cancel { padding: 6px 14px; font-size: 12px; min-height: 32px; }
}

/* Desktop / wide screens (>768px) — side-by-side layout */
@media (min-width: 769px) {
    #gamedaySection {
        max-width: 900px;
        margin: 0 auto;
        height: 100dvh;
        border-left: 1px solid #e2e8f0;
        border-right: 1px solid #e2e8f0;
    }
    .gd-pc-layout {
        flex-direction: row;
        gap: 20px;
    }
    .gd-pc-controls { flex: 1; min-width: 0; }
    .gd-pc-sidebar { flex: 1; min-width: 0; overflow-y: auto; }
    .gd-pc-pitch-log { max-height: none; }
    .gd-pc-pitcher { font-size: 20px; }
    .gd-pc-inning-label { font-size: 22px; }
    .gd-pc-count-value { font-size: 40px; }
    .gd-pc-plus { padding: 16px 40px; font-size: 20px; }
    .gd-pc-strike, .gd-pc-ball { padding: 16px 30px; font-size: 18px; }
    .gd-pc-actions-grid { max-width: 500px; margin: 0 auto 16px; }
    .gd-pc-pitch-log { max-height: 250px; }
    .gd-le-table-wrap { max-height: none; }
}

/* ── Game info / print fields ── */
.print-form { margin-top: 8px; }
.print-form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.print-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}
.game-info-row .print-field label { font-size: 12px; font-weight: 600; color: #64748b; }
.modal-box .print-field label { font-size: 12px; font-weight: 600; color: #555; }
.print-field input, .print-field select {
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* ── Coaching staff section ── */
.coaches-section {
    margin-top: 18px;
}
.coaches-section label {
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}
.coach-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}
.coach-row input {
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    flex: 1;
}
.coach-row .coach-num {
    flex: 0 0 52px;
    width: 52px;
    text-align: center;
    padding: 7px 4px;
}

/* ── Language Switcher ── */
.lang-switcher {
    display: inline-flex;
    gap: 2px;
    margin-right: 8px;
    vertical-align: middle;
}
.lang-btn {
    background: rgba(255,255,255,0.1);
    color: #b0b8c8;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}
.lang-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.lang-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}
.auth-lang-switcher {
    position: absolute;
    top: 16px;
    right: 16px;
}
.auth-box {
    position: relative;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — All pages
   Breakpoints:
     - Phone portrait:  max-width 480px
     - Phone landscape: max-width 767px, orientation landscape
     - Tablet:          481px – 768px
     - Desktop:         769px+
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Phone portrait (≤480px) ── */
@media (max-width: 480px) {
    body { padding: 8px; }
    .container { padding: 14px; border-radius: 8px; }
    h1 { font-size: 18px; margin-bottom: 16px; }
    h2 { font-size: 16px; margin-bottom: 12px; }

    /* Header bar */
    .header-bar {
        margin-bottom: 10px;
    }
    .header-top-row {
        margin-bottom: 6px;
    }
    .header-top-row h1 {
        font-size: 14px;
    }
    .header-nav-row {
        background: #f3f4f6;
        border-radius: 8px;
        padding: 6px;
        gap: 4px;
    }
    .header-nav-row button {
        padding: 7px 10px;
        font-size: 12px;
        border-radius: 6px;
    }
    .lang-btn { padding: 4px 6px; font-size: 10px; }
    .logout-btn { padding: 6px 10px; font-size: 12px; }
    #loggedInUser { display: none; }

    /* Roster jerseys */
    .roster-list { gap: 8px; }
    .jersey-svg { width: 70px; height: 77px; }
    .jersey-label { width: 70px; }

    /* Game settings cards */
    .main-card-body { padding: 10px; }
    .gs-group { padding: 8px 10px; }
    .gs-group-row { gap: 8px; }
    .gs-group-row .pitcher-select-group { min-width: 100px; }
    .pitcher-select-group label { font-size: 12px; margin-bottom: 4px; }
    .pitcher-select-group select,
    .pitcher-select-group input[type="number"] { padding: 8px; font-size: 14px; }

    /* Game info */
    .game-info-row { gap: 8px; }
    .print-field input, .print-field select { padding: 6px 8px; font-size: 13px; }

    /* Randomize bar */
    .randomize-bar { flex-direction: column; }
    .randomize-bar #randomizeBtn { font-size: 16px; padding: 12px; }
    .undo-btn { padding: 10px 16px; font-size: 14px; }

    /* Lineup table */
    .lineup-table th, .lineup-table td { padding: 6px 4px; font-size: 12px; }
    .lineup-table th:nth-child(3) { min-width: 80px; }
    .pos-picker { width: 40px; font-size: 11px; }

    /* Team settings */
    .team-settings { gap: 10px; }
    .team-setting-group { min-width: 120px; }
    #playerInputs { grid-template-columns: 1fr; gap: 8px; }
    .player-input-group { padding: 8px; }
    .field-container { max-width: 250px; }

    /* Schedule */
    .schedule-table { font-size: 11px; }
    .schedule-table th, .schedule-table td { padding: 6px 4px; }
    .make-lineup-btn, .find-spares-btn { width: 80px; font-size: 11px; }

    /* Spares */
    .spares-form-row { flex-direction: column; }
    .spares-field { min-width: 100%; }
    .spare-player-row { grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 8px 10px; font-size: 12px; }

    /* Modals */
    .modal-box { padding: 16px; max-width: 95%; }

    /* Pitch options */
    .gs-pitch-options { gap: 6px 12px; }
    .gs-checkbox-label { font-size: 12px; }
    .gs-checkbox-label input[type="checkbox"] { width: 18px; height: 18px; }
}

/* ── Phone landscape (short + wide) ── */
@media (max-height: 500px) and (orientation: landscape) {
    body { padding: 6px; }
    .container { padding: 12px; }
    h1 { font-size: 16px; margin-bottom: 10px; }
    .header-bar { margin-bottom: 10px; }
    .header-nav-row button { padding: 5px 10px; font-size: 12px; }
    .roster-list { gap: 6px; }
    .jersey-svg { width: 60px; height: 66px; }
    .jersey-label { width: 60px; }
    .main-card-body { padding: 8px; }
    .randomize-bar #randomizeBtn { padding: 10px; font-size: 15px; }
}

/* ── Tablet (481px – 768px) ── */
@media (min-width: 481px) and (max-width: 768px) {
    body { padding: 12px; }
    .container { padding: 20px; }
    .header-top-row h1 { font-size: 20px; }
    .header-nav-row button { padding: 7px 12px; font-size: 13px; }
    .roster-list { gap: 10px; }
    .jersey-svg { width: 85px; height: 94px; }
    .jersey-label { width: 85px; }
    #playerInputs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .spare-player-row { font-size: 13px; }
    .schedule-table { font-size: 12px; }
}

/* ── Desktop (≥769px) ── */
@media (min-width: 769px) {
    .container { max-width: 1400px; }
    .lineup-table th:nth-child(3) { min-width: 150px; }
    #playerInputs { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
