/* CSS Variables */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --border-color: #30363d;
    --border-accent: #f97316;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-orange: #f97316;
    --accent-orange-hover: #ea580c;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --team-a-color: #3b82f6;
    --team-a-bg: rgba(59, 130, 246, 0.1);
    --team-b-color: #ef4444;
    --team-b-bg: rgba(239, 68, 68, 0.1);
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Space Grotesk', sans-serif;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 13px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    background-image: 
        radial-gradient(ellipse at 20% 0%, rgba(249, 115, 22, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

/* App Container */
.app-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0.75rem;
}

/* ==================== HOME SCREEN ==================== */
.home-screen {
    min-height: 100vh;
    padding: 2rem;
}

.home-screen.hidden {
    display: none;
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.home-logo {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-icon-large {
    font-size: 4rem;
    filter: drop-shadow(0 4px 8px rgba(249, 115, 22, 0.3));
}

.home-title h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.home-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Current Games Section */
.current-games-section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.current-games-list {
    display: grid;
    gap: 1rem;
}

.no-current-games {
    text-align: center;
    padding: 2rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
}

.no-current-games .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.no-current-games p {
    color: var(--text-muted);
}

.current-game-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.current-game-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-orange);
}

.current-game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.2);
}

.current-game-time {
    text-align: center;
    min-width: 80px;
}

.current-game-time .time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-orange);
    font-family: var(--font-mono);
}

.current-game-time .date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.current-game-teams {
    flex: 1;
}

.current-game-teams .vs {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.current-game-teams .vs span:nth-child(2) {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.current-game-location {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.current-game-status {
    padding: 0.5rem 1rem;
    background: var(--accent-orange);
    color: white;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.game-time-badge {
    padding: 0.35rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.game-time-badge.live {
    background: #ef4444;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.current-game-card .game-teams {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.current-game-card .game-teams .team-name {
    font-size: 1.1rem;
}

.current-game-card .game-teams .vs {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
}

.current-game-card .game-location {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.current-game-card .open-game-btn {
    white-space: nowrap;
}

.current-game-card.live {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
}

.current-game-card.live::before {
    background: #ef4444;
}

.recent-game-badge.scheduled {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

/* Action Cards */
.home-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.action-card:hover {
    border-color: var(--accent-orange);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-card:active {
    transform: translateY(0);
}

.action-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.action-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.action-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Recent Games */
.recent-games-section {
    margin-bottom: 2rem;
}

.recent-games-list {
    display: grid;
    gap: 0.75rem;
}

.recent-game-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.recent-game-item:hover {
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
}

.recent-game-item.finalized {
    border-left: 3px solid #7c3aed;
}

.recent-game-date {
    min-width: 70px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.recent-game-info {
    flex: 1;
}

.recent-game-teams {
    font-weight: 600;
    font-size: 1rem;
}

.recent-game-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.recent-game-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.recent-game-badge.draft {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-secondary);
}

.recent-game-badge.finalized {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

/* Game Screen */
.game-screen {
    min-height: 100vh;
}

.game-screen.hidden {
    display: none;
}

/* ==================== GLOBAL CATEGORY FILTER ==================== */
.category-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.category-filter label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.category-select-global {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.category-select-global:focus {
    outline: none;
    border-color: var(--accent-orange);
}

/* ==================== TABLES SCREEN ==================== */
.tables-screen {
    min-height: 100vh;
    padding: 1.5rem;
}

.tables-screen.hidden {
    display: none;
}

/* Teams Screen */
.teams-screen {
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--bg-primary);
}

.teams-screen.hidden {
    display: none;
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.screen-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left, .header-right {
    min-width: 150px;
}

.header-right {
    text-align: right;
}

.teams-content {
    max-width: 1400px;
    margin: 0 auto;
}

.teams-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 150px);
}

.teams-list-panel, .team-editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.search-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.teams-list-page {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 0.5rem;
}

.team-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 0.25rem;
}

.team-list-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.team-list-item.active {
    background: rgba(249, 115, 22, 0.1);
    border-color: var(--accent-orange);
}

.team-list-item .team-info {
    flex: 1;
}

.team-list-item .team-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.team-list-item .team-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.team-list-item .team-actions {
    display: flex;
    gap: 0.5rem;
}

.team-list-item .btn-icon {
    padding: 0.375rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.team-list-item .btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.team-list-item .btn-icon.delete:hover {
    color: var(--accent-red);
}

.team-editor-panel {
    display: flex;
    flex-direction: column;
}

/* Hide mobile back button on desktop */
.mobile-back-btn {
    display: none;
}

.team-editor-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.no-team-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.no-team-selected .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.team-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
}

.form-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input {
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.players-section {
    margin-top: 1rem;
}

.players-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.players-section-header h3 {
    margin: 0;
}

.player-form-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.player-form-row {
    display: grid;
    grid-template-columns: 80px 50px 1fr 50px 40px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.player-form-row input {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.player-form-row .remove-player-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
}

.player-form-row .remove-player-btn:hover {
    color: var(--accent-red);
}

/* Gender toggle in player form */
.gender-toggle-field {
    display: flex;
    gap: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.gender-toggle-field .gender-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gender-toggle-field .gender-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.gender-toggle-field .gender-btn:hover {
    background: var(--bg-tertiary);
}

.gender-toggle-field .gender-btn.active {
    background: var(--accent-orange);
    color: white;
}

.team-form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.team-form-actions .btn {
    flex: 1;
}

.no-teams-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.no-teams-message .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-teams-message p {
    margin-bottom: 1rem;
}

.loading-message {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.no-players {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Mobile responsive for teams screen - Master/Detail Pattern */
@media (max-width: 900px) {
    .teams-grid {
        grid-template-columns: 1fr;
        position: relative;
    }
    
    /* On mobile, list panel takes full space by default */
    .teams-list-panel {
        display: block;
    }
    
    .teams-list-page {
        max-height: calc(100vh - 280px);
    }
    
    /* Editor panel is hidden by default on mobile */
    .team-editor-panel {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: var(--bg-primary);
        border-radius: 0;
        border: none;
        overflow-y: auto;
    }
    
    /* When editor is active, show it full screen */
    .team-editor-panel.mobile-active {
        display: flex;
        flex-direction: column;
    }
    
    .team-editor-panel.mobile-active .panel-header {
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    /* Show mobile back button when editor is active */
    .mobile-back-btn {
        display: none;
        align-items: center;
        gap: 0.5rem;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 1rem;
        cursor: pointer;
        padding: 0.5rem;
    }
    
    .mobile-back-btn:hover {
        color: var(--accent-orange);
    }
    
    .team-editor-panel.mobile-active .mobile-back-btn {
        display: flex;
    }
    
    .screen-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .screen-header h1 {
        order: -1;
        width: 100%;
        text-align: center;
        font-size: 1.2rem;
    }
    
    .header-left, .header-right {
        min-width: auto;
    }
    
    /* Player form rows - card style on mobile */
    .player-form-row {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        position: relative;
    }
    
    .player-form-row input {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        background: var(--bg-secondary);
    }
    
    /* Create a grid for license and gender on same row */
    .player-form-row::before {
        content: none;
    }
    
    .player-form-row .remove-player-btn {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        font-size: 1.5rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Use CSS grid for two-column layout within card */
    .player-form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "license gender"
            "name name"
            "number number";
        gap: 0.5rem;
        padding-right: 2.5rem;
    }
    
    .player-form-row input[data-field="license"] { grid-area: license; }
    .player-form-row input[data-field="gender"] { grid-area: gender; }
    .player-form-row input[data-field="name"] { grid-area: name; }
    .player-form-row input[data-field="number"] { grid-area: number; }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .team-form-actions {
        position: sticky;
        bottom: 0;
        background: var(--bg-primary);
        padding: 1rem;
        margin: -1.5rem;
        margin-top: 1rem;
    }
    
    .player-form-list {
        max-height: none;
    }
    
    .players-section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .players-section-header .btn {
        width: 100%;
    }
}

.tables-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tables-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tables-nav h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tables-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Standings Table */
.standings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.standings-table-container {
    overflow-x: auto;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.standings-table th,
.standings-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.standings-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.standings-table th.team,
.standings-table td.team {
    text-align: left;
}

.standings-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.standings-table .rank {
    width: 40px;
    font-weight: 700;
    color: var(--accent-orange);
}

.standings-table .team {
    min-width: 150px;
    font-weight: 600;
}

.standings-table .points {
    font-weight: 700;
    color: var(--accent-blue);
    font-size: 1.1rem;
}

.standings-table .diff.positive {
    color: var(--accent-green);
}

.standings-table .diff.negative {
    color: var(--accent-red);
}

/* Podium styling for top 3 */
.standings-table tbody tr:nth-child(1) .rank {
    color: #ffd700;
}

.standings-table tbody tr:nth-child(2) .rank {
    color: #c0c0c0;
}

.standings-table tbody tr:nth-child(3) .rank {
    color: #cd7f32;
}

/* Top Scorers Section */
.top-scorers-section {
    margin-top: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.top-scorers-section .section-header {
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.top-scorers-section .section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.scorers-table-container {
    overflow-x: auto;
}

.scorers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.scorers-table th,
.scorers-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.scorers-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scorers-table th.player,
.scorers-table td.player {
    text-align: left;
}

.scorers-table th.team,
.scorers-table td.team {
    text-align: left;
}

.scorers-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.scorers-table .rank {
    width: 40px;
    font-weight: 700;
    color: var(--accent-orange);
}

.scorers-table .player {
    min-width: 120px;
    font-weight: 600;
}

.scorers-table .number {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.scorers-table .team {
    min-width: 100px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.scorers-table .points {
    font-weight: 700;
    color: var(--accent-blue);
    font-size: 1.1rem;
}

.scorers-table .avg {
    font-family: var(--font-mono);
    color: var(--accent-green);
}

/* Podium styling for top 3 scorers */
.scorers-table tbody tr:nth-child(1) .rank {
    color: #ffd700;
}

.scorers-table tbody tr:nth-child(2) .rank {
    color: #c0c0c0;
}

.scorers-table tbody tr:nth-child(3) .rank {
    color: #cd7f32;
}

.scorers-table tbody tr.top-three {
    background: rgba(255, 215, 0, 0.05);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stats-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.stats-card.wide {
    grid-column: 1 / -1;
}

.stats-card-header {
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.stats-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats-card-body {
    padding: 1rem 1.25rem;
}

/* Stats List */
.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-row .rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-orange);
}

.stats-row .name {
    flex: 1;
    margin-left: 0.75rem;
    font-weight: 500;
}

.stats-row .value {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-blue);
}

/* Recent Results */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-row {
    display: grid;
    grid-template-columns: 45px 1fr auto 1fr 30px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.result-row.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-row.clickable:hover {
    background: var(--bg-secondary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.result-row .date {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.result-row .team-a {
    text-align: right;
    font-weight: 500;
}

.result-row .score {
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 0.25rem 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.result-row .team-b {
    text-align: left;
    font-weight: 500;
}

.result-row .badge {
    font-size: 0.75rem;
    text-align: center;
}

/* Head to Head */
.h2h-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.h2h-card {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: center;
}

.h2h-teams {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.h2h-record {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.h2h-record .wins {
    color: var(--accent-green);
}

.h2h-record .losses {
    color: var(--accent-red);
}

.h2h-games {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Back Button */
.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Responsive Home */
@media (max-width: 768px) {
    .home-screen {
        padding: 1rem;
    }
    
    .home-header {
        margin-bottom: 2rem;
        padding: 1rem 0;
    }
    
    .home-logo {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .logo-icon-large {
        font-size: 3rem;
    }
    
    .home-title h1 {
        font-size: 1.75rem;
    }
    
    .home-subtitle {
        font-size: 0.9rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .home-actions {
        grid-template-columns: 1fr;
    }
    
    .action-card {
        padding: 1.25rem;
    }
    
    .current-game-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .current-game-time {
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
    }
    
    /* Category Filter - Mobile */
    .category-filter {
        padding: 0.375rem 0.75rem;
    }
    
    .category-filter label {
        display: none;
    }
    
    .category-select-global {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Tables Screen - Mobile */
    .tables-screen {
        padding: 1rem;
    }
    
    .tables-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .tables-nav h1 {
        font-size: 1.1rem;
    }
    
    .standings-table {
        font-size: 0.8rem;
    }
    
    .standings-table th,
    .standings-table td {
        padding: 0.5rem 0.375rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .result-row {
        grid-template-columns: 35px 1fr auto 1fr 25px;
        gap: 0.375rem;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .result-row .date {
        font-size: 0.65rem;
    }
    
    .h2h-grid {
        grid-template-columns: 1fr;
    }
}

/* Control Bar */
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.5));
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--team-a-color);
    border-color: var(--team-a-color);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-accent {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-orange-hover);
    border-color: var(--accent-orange-hover);
}

.btn-warning {
    background: #eab308;
    border-color: #eab308;
    color: #1c1917;
    font-weight: 600;
}

.btn-warning:hover {
    background: #ca8a04;
    border-color: #ca8a04;
}

.btn-warning.finalized {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-warning.finalized:hover {
    background: var(--bg-tertiary);
}

/* Finalized Banner */
.finalized-banner {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
    animation: pulse-glow 2s ease-in-out infinite;
}

.finalized-banner span {
    flex: 1;
}

.finalized-banner .admin-delete-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.5);
    color: white;
    opacity: 0.8;
}

.finalized-banner .admin-delete-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(124, 58, 237, 0.3); }
    50% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.5); }
}

/* Read-only mode */
.readonly {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--bg-tertiary) !important;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.draft {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-secondary);
}

.status-badge.scheduled {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.status-badge.finalized {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

/* Saved Game List Improvements */
.saved-game-item.finalized {
    border-left: 3px solid #7c3aed;
}

.saved-game-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.saved-game-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Scoresheet Main */
.scoresheet {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

/* Sheet Header */
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

.org-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.org-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.org-details {
    display: flex;
    flex-direction: column;
}

.org-name {
    font-weight: 600;
    color: var(--text-primary);
}

.org-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.category-badge {
    position: relative;
}

.category-select {
    appearance: none;
    background: linear-gradient(135deg, var(--accent-orange), #fb923c);
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 2.5rem 1rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.category-select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Match Info */
.match-info {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.info-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.info-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    min-width: 150px;
    color-scheme: dark;
}

.info-input:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.gender-group {
    flex-grow: 1;
}

.gender-options {
    display: flex;
    gap: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="radio"] {
    accent-color: var(--accent-orange);
}

/* Teams & Scores Container */
.teams-scores-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Teams Container */
.teams-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Team Section */
.team-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    position: relative;
}

.team-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.team-a::before {
    background: var(--team-a-color);
}

.team-b::before {
    background: var(--team-b-color);
}

.team-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.team-name-group {
    flex: 1;
    min-width: 150px;
}

.team-name-group label,
.team-color-group label,
.timeout-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.team-name-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
}

.team-a .team-name-input:focus {
    border-color: var(--team-a-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.team-b .team-name-input:focus {
    border-color: var(--team-b-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.color-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    width: 100px;
}

.timeout-boxes {
    display: flex;
    gap: 0.25rem;
}

.timeout-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.timeout-box input {
    display: none;
}

.timeout-box span {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-secondary);
}

.timeout-box:has(input:checked) {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.timeout-box:has(input:checked) span {
    color: white;
}

/* Players Table */
.players-table {
    margin-bottom: 0.75rem;
}

.table-header {
    display: grid;
    grid-template-columns: 120px 60px 1fr 50px 100px 28px;
    gap: 0.5rem;
    padding: 0.625rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
}

.table-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
}

.table-header .col-name {
    text-align: left;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.player-row {
    display: grid;
    grid-template-columns: 120px 60px 1fr 50px 100px 28px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.player-row:hover {
    border-color: var(--border-color);
}

.player-row input[type="text"],
.player-row input[type="number"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 0.5rem 0.625rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    width: 100%;
}

.player-row input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Gender Toggle Switch */
.gender-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    height: 32px;
    min-width: 60px;
}

.gender-toggle input {
    display: none;
}

.gender-toggle label {
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-muted);
    border: none;
}

.gender-toggle label:first-of-type {
    border-right: 1px solid var(--border-color);
}

@media print {
    .gender-toggle label:first-of-type {
        border-right: none !important;
    }
}

.gender-toggle input:checked + label {
    color: white;
}

.gender-toggle input[value="F"]:checked + label {
    background: #ec4899;
}

.gender-toggle input[value="G"]:checked + label {
    background: var(--team-a-color);
}

.fouls-display {
    display: flex;
    gap: 4px;
}

.foul-box {
    width: 18px;
    height: 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.foul-box.active {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.remove-player {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease;
}

.remove-player:hover {
    color: var(--accent-red);
}

.add-player-btn {
    width: 100%;
    padding: 0.375rem;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.add-player-btn:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

/* Coach Section */
.coach-section {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.coach-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.coach-info label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.coach-license,
.coach-name {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.625rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.coach-license {
    width: 80px;
}

.coach-name {
    flex: 1;
}

.signature-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.signature-section label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.signature-container {
    position: relative;
    display: inline-block;
}

.signature-pad {
    width: 150px;
    height: 50px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: crosshair;
}

.clear-signature {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-muted);
    font-size: 0.625rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.clear-signature:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

/* Scoring Container */
.scoring-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Scoring Grid */
.scoring-grid {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

/* Period Tabs (always visible for quick score) */
.period-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: grid;
}

.period-tab {
    padding: 0.75rem 0.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-tab:hover {
    border-color: var(--accent-orange);
    color: var(--text-primary);
}

.period-tab.active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
}

/* Quick Score Panel */
.quick-score-panel {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.quick-score-teams {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.quick-score-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.quick-score-team[data-team="A"] {
    border-color: var(--team-a-color);
    background: var(--team-a-bg);
}

.quick-score-team[data-team="B"] {
    border-color: var(--team-b-color);
    background: var(--team-b-bg);
}

.quick-score-team .team-name-display {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
}

.quick-score-team[data-team="A"] .team-name-display {
    color: var(--team-a-color);
}

.quick-score-team[data-team="B"] .team-name-display {
    color: var(--team-b-color);
}

.point-buttons {
    display: flex;
    gap: 0.5rem;
}

.point-btn {
    padding: 0.75rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.quick-score-team[data-team="A"] .point-btn:hover {
    border-color: var(--team-a-color);
    background: var(--team-a-color);
    color: white;
}

.quick-score-team[data-team="B"] .point-btn:hover {
    border-color: var(--team-b-color);
    background: var(--team-b-color);
    color: white;
}

.point-btn.active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-score-team[data-team="A"] .point-btn.active {
    border-color: var(--team-a-color);
    background: var(--team-a-color);
    color: white;
}

.quick-score-team[data-team="B"] .point-btn.active {
    border-color: var(--team-b-color);
    background: var(--team-b-color);
    color: white;
}

/* Player Selection */
.player-selection {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-orange);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scoreFlash {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--accent-green);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 20px 5px var(--accent-green);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--accent-green);
    }
}

.player-selection.hidden {
    display: none;
}

.player-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.player-selection-header span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-orange);
}

.cancel-selection {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s ease;
}

.cancel-selection:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.jersey-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.jersey-btn {
    min-width: 56px;
    padding: 0.75rem 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.jersey-btn .jersey-number {
    font-size: 1.5rem;
}

.jersey-btn .player-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jersey-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-orange);
    background: var(--accent-orange);
    color: white;
}

.jersey-btn:hover .player-name {
    color: rgba(255, 255, 255, 0.8);
}

.jersey-btn.team-a:hover {
    border-color: var(--team-a-color);
    background: var(--team-a-color);
}

.jersey-btn.team-b:hover {
    border-color: var(--team-b-color);
    background: var(--team-b-color);
}

.period-headers {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.period-label {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scoring-periods {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.period-column {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 0.375rem;
}

.period-team-headers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.period-team-headers span:first-child {
    color: var(--team-a-color);
}

.period-team-headers span:last-child {
    color: var(--team-b-color);
}

.score-rows {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.score-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.score-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    transition: background 0.1s ease;
    min-height: 32px;
}

.score-cell:hover {
    background: var(--bg-card);
}

.score-cell .score-number {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.score-cell .score-mark {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: transparent;
    transition: all 0.1s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.score-cell .score-mark:hover {
    border-color: var(--accent-orange);
}

.score-cell.marked-a .score-mark {
    background: var(--team-a-color);
    border-color: var(--team-a-color);
}

.score-cell.marked-b .score-mark {
    background: var(--team-b-color);
    border-color: var(--team-b-color);
}

.score-cell .player-input {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    width: 28px;
    text-align: center;
    padding: 0px 2px;
    border-radius: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    flex-shrink: 0;
}

.score-cell.marked-a .player-input,
.score-cell.marked-b .player-input {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.score-cell .player-input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.score-cell .player-input::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
}

/* Period Totals */
.period-totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.total-row {
    text-align: center;
}

.total-row span {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.total-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
}

.total-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    color: var(--accent-orange);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    min-height: 42px;
}

/* Results & Officials Container */
.results-officials-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Results Section */
.results-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.scoring-legend {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.5rem;
    padding: 0.375rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.results-table {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.results-header {
    background: linear-gradient(135deg, var(--accent-orange), #fb923c);
    padding: 0.75rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.results-grid {
    padding: 0.5rem;
}

.results-row {
    display: grid;
    grid-template-columns: 1fr 70px 70px;
    gap: 0.625rem;
    padding: 0.25rem 0;
    align-items: center;
}

.results-row.header-row {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.375rem;
    margin-bottom: 0.25rem;
}

.results-row.header-row span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-row.header-row span:nth-child(2) {
    color: var(--team-a-color);
    text-align: center;
}

.results-row.header-row span:nth-child(3) {
    color: var(--team-b-color);
    text-align: center;
}

.results-row span {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.result-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.125rem;
    text-align: center;
    font-weight: 700;
    min-height: 42px;
}

.result-input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.result-input.final {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
    font-weight: 700;
}

.final-row {
    border-top: 1px solid var(--border-color);
    padding-top: 0.375rem;
    margin-top: 0.25rem;
}

.final-row span {
    font-weight: 600;
    color: var(--text-primary);
}

.winner-row {
    margin-top: 0.375rem;
}

.total-points-row {
    margin-top: 0.25rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-color);
}

.total-points-row .result-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.winner-input {
    grid-column: 2 / 4;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.625rem;
    color: var(--accent-green);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

/* Officials Section */
.officials-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.officials-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.625rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.officials-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.official-row {
    display: grid;
    grid-template-columns: 90px 1fr 90px;
    gap: 0.5rem;
    align-items: center;
}

.official-header-row {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

.official-col-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.official-row label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.official-row input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.official-row input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

/* Global Signatures Section */
.global-signatures-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.signatures-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border-color);
}

.signatures-header span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-global-signature {
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-global-signature:hover {
    background: #dc2626;
}

.signatures-canvas-container {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.global-signature-canvas {
    width: 100%;
    height: 120px;
    display: block;
    cursor: crosshair;
    touch-action: none;
}

/* Bottom Save Button */
.bottom-save-section {
    margin-top: 1.5rem;
    padding: 1.5rem 0;
    display: flex;
    justify-content: center;
    border-top: 2px solid var(--border-color);
}

.btn-large {
    font-size: 1.125rem;
    padding: 1rem 2.5rem;
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn-large span {
    font-size: 1.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

.close-modal:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 1rem 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.saved-games-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.saved-game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.saved-game-item:hover {
    border-color: var(--accent-orange);
    background: var(--bg-card);
}

.saved-game-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.saved-game-title {
    font-weight: 600;
    color: var(--text-primary);
}

.saved-game-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-game-actions {
    display: flex;
    gap: 0.5rem;
}

.delete-game-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
}

.delete-game-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.no-games-message {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Team Selector */
.team-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border-color);
}

.team-selector label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.team-select {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
}

.team-select:focus {
    outline: none;
    border-color: var(--accent-orange);
}

/* Team Management Modal */
.modal-large {
    max-width: 700px;
}

.modal-small {
    max-width: 400px;
}

/* Admin styles */
.action-card-admin {
    border: 1px dashed var(--border-color);
    opacity: 0.7;
}

.action-card-admin:hover {
    opacity: 1;
    border-color: var(--accent-red);
}

.admin-warning {
    color: var(--accent-red);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

.error-message {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.error-message.hidden {
    display: none;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Trash styles */
.trash-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.trash-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.trash-tab:hover {
    background: var(--bg-tertiary);
}

.trash-tab.active {
    background: var(--accent-orange);
    color: white;
}

.trash-list {
    max-height: 400px;
    overflow-y: auto;
}

.trash-list.hidden {
    display: none;
}

.trash-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.trash-item-info {
    flex: 1;
}

.trash-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.trash-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.trash-item-actions {
    display: flex;
    gap: 0.5rem;
}

.trash-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Admin delete button for finalized games */
.admin-delete-btn {
    background: transparent;
    border: 1px dashed var(--accent-red);
    color: var(--accent-red);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    opacity: 0.7;
    transition: all 0.15s ease;
}

.admin-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

.team-manager {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.team-list-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-list-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.saved-teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 200px;
    overflow-y: auto;
}

.saved-team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.saved-team-item:hover {
    border-color: var(--accent-orange);
    background: var(--bg-card);
}

.saved-team-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.saved-team-name {
    font-weight: 600;
    color: var(--text-primary);
}

.saved-team-players {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-team-actions {
    display: flex;
    gap: 0.375rem;
}

.edit-team-btn,
.delete-team-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.15s ease;
}

.edit-team-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.delete-team-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.no-teams-message {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
    font-size: 0.875rem;
}

/* Team Editor */
.team-editor {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.team-editor.hidden {
    display: none;
}

.team-editor-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.team-name-edit {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
}

.team-color-edit {
    width: 120px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

.team-editor-coach {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.team-editor-coach label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.team-editor-coach input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.team-editor-coach input:first-of-type {
    width: 100px;
}

.team-editor-coach input:last-of-type {
    flex: 1;
}

.team-editor-players {
    margin-bottom: 1rem;
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.players-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.team-players-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 250px;
    overflow-y: auto;
}

.team-player-row {
    display: grid;
    grid-template-columns: 90px 50px 1fr 50px 30px;
    gap: 0.375rem;
    align-items: center;
    padding: 0.375rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.team-player-row input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 0.375rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.team-player-row .remove-team-player {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    transition: color 0.15s ease;
}

.team-player-row .remove-team-player:hover {
    color: var(--accent-red);
}

.team-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* PDF Mode - Applied via JavaScript for direct PDF download */
body.pdf-mode {
    background: white !important;
    background-image: none !important;
    background-color: white !important;
}

/* Force desktop layout for PDF generation regardless of window size */
body.pdf-force-desktop {
    min-width: 1200px !important;
}

body.pdf-force-desktop .scoresheet {
    width: 100% !important;
    max-width: none !important;
}

body.pdf-force-desktop .team-section {
    flex-direction: row !important;
}

body.pdf-force-desktop .team-panel {
    width: 50% !important;
    min-width: auto !important;
}

body.pdf-force-desktop .players-list {
    max-height: none !important;
    overflow: visible !important;
}

body.pdf-force-desktop .score-table {
    display: block !important;
}

body.pdf-force-desktop .period-column {
    display: block !important;
}

body.pdf-force-desktop .score-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
}

body.pdf-force-desktop .player-row {
    display: grid !important;
    grid-template-columns: 1fr auto 2fr auto auto !important;
}

body.pdf-force-desktop .officials-section {
    display: flex !important;
    flex-direction: row !important;
}

body.pdf-force-desktop .results-section {
    display: block !important;
}

/* Force ALL elements to have white background in PDF mode */
body.pdf-mode * {
    background: white !important;
    background-color: white !important;
    background-image: none !important;
    box-shadow: none !important;
}

/* Exceptions for elements that need colored backgrounds */
body.pdf-mode .checkbox-label input[type="radio"]:checked,
body.pdf-mode .timeout-box:has(input:checked),
body.pdf-mode .foul-box.active,
body.pdf-mode .score-cell.marked-a .score-mark,
body.pdf-mode .score-cell.marked-b .score-mark {
    background: black !important;
    background-color: black !important;
}

body.pdf-mode .app-container {
    background: white !important;
    padding: 0 !important;
    max-width: none !important;
}

body.pdf-mode .scoresheet {
    background: white !important;
    box-shadow: none !important;
    border: none !important;
}

body.pdf-mode .home-screen,
body.pdf-mode .tables-screen,
body.pdf-mode .teams-screen {
    display: none !important;
}

/* Print/PDF Styles - A4 Landscape - Matches Original Paper Layout */
@media print {
    @page {
        size: A4 landscape;
        margin: 4mm;
    }
    
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
        border-color: black !important;
    }
    
    html, body {
        width: 297mm !important;
        height: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 5pt !important;
        background: white !important;
        color: black !important;
        overflow: hidden !important;
    }
    
    .app-container {
        padding: 0 !important;
        max-width: none !important;
        overflow: hidden !important;
    }
    
    .control-bar,
    .team-selector,
    .add-player-btn,
    .clear-signature,
    .remove-player,
    .period-tabs,
    .quick-score-panel,
    .modal,
    .bottom-save-section {
        display: none !important;
    }
    
    .scoresheet {
        box-shadow: none !important;
        border: none !important;
        padding: 1mm !important;
        background: white !important;
        overflow: hidden !important;
    }
    
    /* Hide placeholders completely in print */
    ::placeholder,
    ::-webkit-input-placeholder,
    ::-moz-placeholder,
    :-ms-input-placeholder,
    ::-ms-input-placeholder {
        color: transparent !important;
        opacity: 0 !important;
        -webkit-text-fill-color: transparent !important;
        visibility: hidden !important;
        font-size: 0 !important;
    }
    
    input, select, textarea {
        color: black !important;
        background: white !important;
        border-color: black !important;
    }
    
    /* All names and location in uppercase */
    .player-name,
    .coach-name,
    .team-name-input,
    .winner-input,
    .official-row input,
    #matchLocation {
        text-transform: uppercase !important;
    }
    
    /* ===== HEADER - Ultra Compact Single Line ===== */
    .sheet-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.5mm 0 !important;
        margin-bottom: 0.5mm !important;
        border-bottom: 1pt solid black !important;
        height: 6mm !important;
    }
    
    .org-info {
        display: flex !important;
        align-items: center !important;
        gap: 1mm !important;
        flex-shrink: 0 !important;
    }
    
    .org-logo {
        width: 5mm !important;
        height: 5mm !important;
        border: 1pt solid black !important;
        font-size: 4pt !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .org-details {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .org-name {
        font-size: 5pt !important;
        font-weight: bold !important;
        line-height: 1 !important;
    }
    
    .org-address {
        font-size: 4pt !important;
        line-height: 1 !important;
    }
    
    .category-select {
        border: 1.5pt solid black !important;
        padding: 0.5mm 2mm !important;
        font-size: 12pt !important;
        font-weight: bold !important;
        background: white !important;
    }
    
    /* ===== MATCH INFO - Single Compact Line ===== */
    .match-info {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0.3mm 0 !important;
        margin-bottom: 0.5mm !important;
        border-bottom: 1pt solid black !important;
        height: 4mm !important;
        gap: 0 !important;
    }
    
    .info-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 3mm !important;
        width: 100% !important;
        flex-wrap: nowrap !important;
    }
    
    .info-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 1mm !important;
        flex-shrink: 0 !important;
    }
    
    .info-group label {
        font-size: 4.5pt !important;
        font-weight: bold !important;
        margin: 0 !important;
        white-space: nowrap !important;
        line-height: 1.5 !important;
    }
    
    .info-input {
        border: none !important;
        border-bottom: 1pt solid black !important;
        padding: 0.5mm 0.5mm !important;
        font-size: 6pt !important;
        min-width: 15mm !important;
        height: 4mm !important;
        line-height: 1.5 !important;
    }
    
    .gender-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 1mm !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }
    
    .gender-group > label {
        display: none !important;
    }
    
    .gender-options {
        display: flex !important;
        flex-direction: row !important;
        gap: 2mm !important;
    }
    
    .checkbox-label {
        font-size: 5pt !important;
        gap: 0.5mm !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .checkbox-label input[type="radio"] {
        appearance: none !important;
        -webkit-appearance: none !important;
        width: 2.5mm !important;
        height: 2.5mm !important;
        border: 1pt solid black !important;
        background: white !important;
        margin: 0 !important;
    }
    
    .checkbox-label input[type="radio"]:checked {
        background: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* ===== MAIN LAYOUT - Two Columns ===== */
    .teams-scores-container {
        display: grid !important;
        grid-template-columns: 48% 52% !important;
        gap: 1mm !important;
        height: calc(100% - 10mm) !important;
    }
    
    .teams-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5mm !important;
        height: 100% !important;
    }
    
    /* ===== TEAM SECTIONS ===== */
    .team-section {
        border: 1pt solid black !important;
        padding: 0.5mm !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
    }
    
    .team-section::before {
        display: none !important;
    }
    
    .team-header {
        display: flex !important;
        gap: 1mm !important;
        margin-bottom: 0.3mm !important;
        padding-bottom: 0.3mm !important;
        border-bottom: 1pt solid black !important;
        flex-wrap: nowrap !important;
    }
    
    .team-name-group,
    .team-color-group,
    .timeout-group {
        min-width: auto !important;
    }
    
    .team-name-group label,
    .team-color-group label,
    .timeout-group label {
        font-size: 3.5pt !important;
        margin-bottom: 0 !important;
        padding: 0.2mm !important;
    }
    
    .team-name-input {
        border: none !important;
        border-bottom: 1pt solid black !important;
        font-size: 6pt !important;
        font-weight: bold !important;
        padding: 0.4mm 0.5mm !important;
        width: 38mm !important;
        min-width: 38mm !important;
        max-width: 38mm !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        line-height: 1.3 !important;
    }
    
    .color-input {
        border: none !important;
        border-bottom: 1pt solid black !important;
        font-size: 5pt !important;
        padding: 0.4mm 0.5mm !important;
        width: 12mm !important;
        line-height: 1.3 !important;
    }
    
    .timeout-boxes {
        gap: 0.5mm !important;
    }
    
    .timeout-box {
        width: 3mm !important;
        height: 3mm !important;
        border: 0.5pt solid black !important;
        background: white !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .timeout-box input {
        display: none !important;
    }
    
    .timeout-box span {
        display: none !important;  /* Hide the number */
    }
    
    .timeout-box:has(input:checked) {
        background: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* ===== PLAYERS TABLE - 10 PLAYERS ===== */
    .players-table {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 0.5mm !important;
    }
    
    .table-header {
        display: grid !important;
        grid-template-columns: 14mm 5mm 1fr 8mm 14mm !important;
        font-size: 3.5pt !important;
        padding: 0.5mm 0.3mm !important;
        border-bottom: 1pt solid black !important;
        gap: 0.3mm !important;
        background: white !important;
        align-items: center !important;
    }
    
    .table-header span {
        font-size: 3.5pt !important;
        padding: 0 0.2mm !important;
    }
    
    .players-list {
        flex: 1 !important;
        max-height: none !important;
        overflow: visible !important;
        gap: 0 !important;
    }
    
    .player-row {
        display: grid !important;
        grid-template-columns: 14mm 5mm 1fr 8mm 14mm !important;
        border-bottom: 1pt solid black !important;
        padding: 0.5mm 0.3mm !important;
        gap: 0.5mm !important;
        min-height: 3.5mm !important;
        height: auto !important;
        box-sizing: border-box !important;
        align-items: center !important;
        overflow: visible !important;
        page-break-inside: avoid !important;
    }
    
    /* Show up to 10 players */
    .player-row:nth-child(n+11) {
        display: none !important;
    }
    
    .player-row input {
        border: none !important;
        font-size: 5pt !important;
        padding: 0.3mm 0.5mm !important;
        line-height: 1.3 !important;
        text-transform: uppercase !important;
        height: auto !important;
        vertical-align: middle !important;
    }
    
    /* Make jersey number bigger */
    .player-row .player-number {
        font-size: 7pt !important;
        font-weight: bold !important;
        text-align: center !important;
    }
    
    /* Gender toggle - show only selected letter, no underline */
    .gender-toggle {
        border: none !important;
        border-bottom: none !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        height: auto !important;
        min-width: auto !important;
        background: transparent !important;
        gap: 0 !important;
        outline: none !important;
        box-shadow: none !important;
        text-decoration: none !important;
    }
    
    .gender-toggle * {
        border: none !important;
        border-bottom: none !important;
        text-decoration: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    .gender-toggle label {
        font-size: 5pt !important;
        font-weight: bold !important;
        padding: 0.2mm !important;
        margin: 0 !important;
        display: none !important;
        border: none !important;
        border-bottom: none !important;
        text-decoration: none !important;
        background: transparent !important;
    }
    
    .gender-toggle input {
        display: none !important;
        border: none !important;
    }
    
    .gender-toggle input:checked + label {
        display: inline !important;
        background: transparent !important;
        color: black !important;
        border: none !important;
        border-bottom: none !important;
        text-decoration: none !important;
    }
    
    .fouls-display {
        gap: 1mm !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.5mm 0.8mm !important;
    }
    
    .foul-box {
        width: 2mm !important;
        height: 2mm !important;
        min-width: 2mm !important;
        min-height: 2mm !important;
        max-width: 2mm !important;
        max-height: 2mm !important;
        border: 0.5pt solid black !important;
        background: white !important;
        display: inline-block !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }
    
    .foul-box.active {
        background: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* ===== COACH SECTION ===== */
    .coach-section {
        display: flex !important;
        padding-top: 0.5mm !important;
        border-top: 1pt solid black !important;
        gap: 1mm !important;
        flex-wrap: nowrap !important;
        min-height: 4mm !important;
        height: 5mm !important;
    }
    
    .coach-info {
        flex: 1 !important;
        gap: 0.5mm !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .coach-info label {
        font-size: 3.5pt !important;
        padding: 0.2mm !important;
    }
    
    .coach-license {
        width: 12mm !important;
        border: none !important;
        border-bottom: 1pt solid black !important;
        font-size: 4.5pt !important;
        padding: 0.4mm 0.5mm !important;
        min-height: 2.5mm !important;
        line-height: 1.3 !important;
    }
    
    .coach-name {
        border: none !important;
        border-bottom: 1pt solid black !important;
        font-size: 4.5pt !important;
        padding: 0.4mm 0.5mm !important;
        min-height: 2.5mm !important;
        text-transform: uppercase !important;
        line-height: 1.3 !important;
    }
    
    .signature-section {
        gap: 0.5mm !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .signature-section label {
        font-size: 5pt !important;
    }
    
    .signature-container {
        width: 25mm !important;
        height: 8mm !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1pt solid black !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    .signature-pad {
        max-width: 24mm !important;
        max-height: 7mm !important;
        width: auto !important;
        height: auto !important;
        border: none !important;
        background: white !important;
        object-fit: contain !important;
    }
    
    /* ===== SCORING CONTAINER ===== */
    .scoring-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 1mm !important;
        height: 100% !important;
    }
    
    /* ===== SCORING GRID - 20 POINTS ===== */
    .scoring-grid {
        border: 1pt solid black !important;
        padding: 0.5mm !important;
        flex: 1 !important;
        box-sizing: border-box !important;
    }
    
    .period-headers {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        margin-bottom: 0.25mm !important;
        gap: 0.3mm !important;
    }
    
    .period-label {
        font-size: 4pt !important;
        font-weight: bold !important;
        text-align: center !important;
        border: 1pt solid black !important;
        padding: 0.4mm 0.3mm !important;
        background: white !important;
        line-height: 1.2 !important;
    }
    
    .scoring-periods {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.3mm !important;
    }
    
    .period-column {
        display: block !important;
        border: 1pt solid black !important;
        padding: 0.2mm !important;
        box-sizing: border-box !important;
    }
    
    .period-team-headers {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        font-size: 5pt !important;
        font-weight: bold !important;
        text-align: center !important;
        border-bottom: 1pt solid black !important;
        margin-bottom: 0.2mm !important;
        padding: 0.3mm 0 !important;
        line-height: 1.2 !important;
    }
    
    .score-rows {
        max-height: none !important;
        overflow: visible !important;
        gap: 0 !important;
    }
    
    /* Show all 20 scores */
    .score-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5mm !important;
        margin-bottom: 0.2mm !important;
    }
    
    .score-cell {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        min-height: 3mm !important;
        height: 3mm !important;
        border-bottom: 1pt solid black !important;
        padding: 0.3mm 0.2mm !important;
        gap: 0.3mm !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    .score-cell .score-number {
        font-size: 5pt !important;
        width: 3mm !important;
        text-align: right !important;
        color: black !important;
        padding: 0.2mm !important;
        line-height: 1.3 !important;
    }
    
    .score-cell .score-mark {
        width: 2mm !important;
        height: 2mm !important;
        border: 1pt solid black !important;
        flex-shrink: 0 !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    .score-cell.marked-a .score-mark,
    .score-cell.marked-b .score-mark {
        background: black !important;
    }
    
    .score-cell .player-input {
        font-size: 5pt !important;
        width: 4mm !important;
        border: none !important;
        padding: 0 !important;
        background: white !important;
        color: black !important;
        font-weight: bold !important;
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* ===== PERIOD TOTALS ===== */
    .period-totals {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        border-top: 1pt solid black !important;
        margin-top: 0.3mm !important;
        padding-top: 0.3mm !important;
        gap: 0.3mm !important;
    }
    
    .total-row {
        display: block !important;
        text-align: center !important;
    }
    
    .total-row span {
        font-size: 3pt !important;
        display: block !important;
        margin-bottom: 0.2mm !important;
    }
    
    .total-inputs {
        gap: 0.2mm !important;
    }
    
    .total-input {
        font-size: 5pt !important;
        font-weight: bold !important;
        border: 1pt solid black !important;
        text-align: center !important;
        padding: 0.2mm !important;
    }
    
    /* ===== RESULTS & OFFICIALS - SIDE BY SIDE ===== */
    .results-officials-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5mm !important;
        margin-top: 0.3mm !important;
    }
    
    .results-section {
        border: 1pt solid black !important;
        padding: 0.5mm !important;
        box-sizing: border-box !important;
    }
    
    .scoring-legend {
        font-size: 3pt !important;
        border: 1pt solid black !important;
        padding: 0.3mm !important;
        margin-bottom: 0.3mm !important;
    }
    
    .results-table {
        border: 1pt solid black !important;
    }
    
    .results-header {
        font-size: 4pt !important;
        font-weight: bold !important;
        text-align: center !important;
        border-bottom: 1pt solid black !important;
        padding: 0.2mm !important;
    }
    
    .results-grid {
        padding: 0.125mm !important;
    }
    
    .results-row {
        grid-template-columns: 1fr 6mm 6mm !important;
        border-bottom: 1pt solid black !important;
        padding: 0.15mm 0 !important;
        gap: 0.3mm !important;
        align-items: center !important;
    }
    
    .results-row.header-row span {
        font-size: 3.5pt !important;
        font-weight: bold !important;
        padding: 0.2mm !important;
        line-height: 1.3 !important;
    }
    
    .results-row span {
        font-size: 4pt !important;
        font-weight: 600 !important;
        padding: 0.2mm !important;
        line-height: 1.3 !important;
    }
    
    .result-input {
        font-size: 5pt !important;
        font-weight: bold !important;
        border: 1pt solid black !important;
        text-align: center !important;
        padding: 0.2mm !important;
        min-height: 3mm !important;
        height: 3mm !important;
        width: 100% !important;
        background: white !important;
        color: black !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    
    .result-input.final {
        font-weight: bold !important;
        font-size: 5pt !important;
        height: 3.5mm !important;
    }
    
    .winner-row {
        margin-top: 0.3mm !important;
        padding-top: 0.3mm !important;
        border-top: 1pt solid black !important;
    }
    
    .total-points-row {
        margin-top: 0.3mm !important;
        padding-top: 0.3mm !important;
        border-top: 1pt solid black !important;
    }
    
    .total-points-row .result-input {
        font-size: 5pt !important;
        font-weight: bold !important;
        height: 3mm !important;
    }
    
    .winner-input {
        font-size: 4pt !important;
        border: 1pt solid black !important;
        padding: 0.2mm !important;
        font-weight: 600 !important;
        background: white !important;
        color: black !important;
        width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        line-height: 1.1 !important;
        min-height: 3.5mm !important;
        height: 3.5mm !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
    
    /* ===== OFFICIALS SECTION ===== */
    .officials-section {
        border: 1pt solid black !important;
        padding: 0.5mm !important;
        box-sizing: border-box !important;
    }
    
    .officials-header {
        font-size: 4pt !important;
        font-weight: bold !important;
        border-bottom: 1pt solid black !important;
        margin-bottom: 0.3mm !important;
        padding-bottom: 0.2mm !important;
    }
    
    .officials-grid {
        gap: 1mm !important;
    }
    
    .official-row {
        display: grid !important;
        grid-template-columns: 14mm 1fr 14mm !important;
        padding: 0.5mm 0 !important;
        gap: 0.5mm !important;
        min-height: 4mm !important;
        height: auto !important;
        margin-bottom: 0.5mm !important;
    }
    
    .official-header-row {
        border-bottom: 0.5pt solid black !important;
        padding-bottom: 0.3mm !important;
        margin-bottom: 0.2mm !important;
        min-height: 2mm !important;
        height: 2mm !important;
    }
    
    .official-col-header {
        font-size: 3.5pt !important;
        font-weight: bold !important;
        text-align: center !important;
        text-transform: uppercase !important;
    }
    
    .official-row label {
        font-size: 4pt !important;
        font-weight: bold !important;
        padding: 0.3mm !important;
        line-height: 1.5 !important;
    }
    
    .official-row input {
        border: none !important;
        border-bottom: 1pt solid black !important;
        font-size: 5pt !important;
        padding: 0.5mm 0.5mm !important;
        min-height: 3mm !important;
        height: 3mm !important;
        line-height: 1.5 !important;
    }
    
    /* ===== GLOBAL SIGNATURES SECTION ===== */
    .global-signatures-section {
        border: 1pt solid black !important;
        padding: 0.5mm !important;
        margin-top: 0.5mm !important;
        box-sizing: border-box !important;
    }
    
    .signatures-header {
        font-size: 4pt !important;
        font-weight: bold !important;
        border-bottom: 1pt solid black !important;
        margin-bottom: 0.5mm !important;
        padding: 0.3mm !important;
        line-height: 1.2 !important;
    }
    
    .signatures-header span {
        display: block !important;
    }
    
    .clear-global-signature {
        display: none !important;
    }
    
    .signatures-canvas-container {
        border: 1pt solid black !important;
        width: 100% !important;
        height: 10mm !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: white !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
    
    .global-signature-canvas {
        max-width: 100% !important;
        max-height: 9mm !important;
        width: auto !important;
        height: auto !important;
        background: white !important;
        object-fit: contain !important;
    }
    
    /* ===== PAGE BREAK PREVENTION ===== */
    .scoresheet,
    .teams-scores-container,
    .teams-container,
    .team-section,
    .scoring-container,
    .scoring-grid,
    .results-officials-container {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* ===== ENSURE SINGLE PAGE ===== */
    .scoresheet {
        max-height: 195mm !important;
        overflow: hidden !important;
    }
    
    .teams-scores-container {
        max-height: 180mm !important;
    }
}


/* ===============================================
   RESPONSIVE DESIGN - Mobile First
   =============================================== */

/* Tablet and below */
@media (max-width: 1200px) {
    .teams-scores-container {
        grid-template-columns: 1fr;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    
    .app-container {
        padding: 0.5rem;
    }
    
    /* Control Bar - Mobile */
    .control-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .logo-section h1 {
        font-size: 1.25rem;
    }
    
    .actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }
    
    .btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        justify-content: center;
    }
    
    /* Scoresheet - Mobile */
    .scoresheet {
        padding: 0.75rem;
    }
    
    /* Header - Mobile */
    .sheet-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .category-select {
        padding: 0.75rem 1.5rem;
        font-size: 1.5rem;
    }
    
    /* Match Info - Mobile */
    .info-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .info-group {
        width: 100%;
    }
    
    .info-input {
        width: 100%;
        min-width: unset;
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .gender-options {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .checkbox-label {
        font-size: 1rem;
        padding: 0.5rem 0;
    }
    
    /* Teams - Mobile */
    .teams-container {
        gap: 0.75rem;
    }
    
    .team-section {
        padding: 0.75rem;
    }
    
    .team-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .team-name-input,
    .color-input {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .color-input {
        width: 100%;
    }
    
    .timeout-boxes {
        gap: 0.5rem;
    }
    
    .timeout-box {
        width: 40px;
        height: 40px;
    }
    
    .timeout-box span {
        font-size: 1rem;
    }
    
    /* Players Table - Mobile */
    .table-header {
        display: none;
    }
    
    .players-list {
        gap: 0.5rem;
    }
    
    .player-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem;
        padding: 0.5rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
    }
    
    .player-row input[type="text"],
    .player-row input[type="number"] {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .player-row .player-license {
        width: 80px;
        order: 1;
    }
    
    .player-row .player-name {
        flex: 1;
        min-width: 120px;
        order: 3;
    }
    
    .player-row .player-number {
        width: 50px;
        order: 2;
    }
    
    .player-row .gender-toggle {
        order: 4;
        height: 36px;
        min-width: 70px;
    }
    
    .player-row .gender-toggle label {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .player-row .fouls-display {
        order: 5;
        flex: 1;
        justify-content: flex-start;
        gap: 4px;
    }
    
    .foul-box {
        width: 24px;
        height: 24px;
    }
    
    .player-row .remove-player {
        order: 6;
        width: 30px;
        height: 30px;
        font-size: 1.25rem;
    }
    
    .add-player-btn {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Coach Section - Mobile */
    .coach-section {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .coach-info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .coach-info label {
        width: 100%;
    }
    
    .coach-license {
        width: 100px;
    }
    
    .coach-name {
        flex: 1;
        min-width: 150px;
    }
    
    .coach-license,
    .coach-name {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .signature-pad {
        width: 100%;
        height: 80px;
    }
    
    /* Scoring Grid - Mobile */
    .scoring-grid {
        padding: 0.5rem;
    }
    
    .mobile-only {
        display: grid !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .period-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }
    
    .period-tab {
        padding: 1rem 0.5rem;
        font-size: 1.1rem;
    }
    
    /* Quick Score Panel Mobile */
    .quick-score-panel {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .quick-score-teams {
        gap: 0.75rem;
    }
    
    .quick-score-team {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .quick-score-team .team-name-display {
        font-size: 0.95rem;
    }
    
    .point-buttons {
        gap: 0.375rem;
    }
    
    .point-btn {
        padding: 0.625rem 0.875rem;
        font-size: 1rem;
    }
    
    .player-selection {
        padding: 0.75rem;
    }
    
    .jersey-btn {
        min-width: 48px;
        padding: 0.625rem 0.75rem;
        font-size: 1rem;
    }
    
    .jersey-btn .jersey-number {
        font-size: 1.25rem;
    }
    
    .jersey-btn .player-name {
        font-size: 0.55rem;
        max-width: 60px;
    }
    
    /* Show only active period on mobile */
    .scoring-periods {
        display: block !important;
    }
    
    .period-column {
        display: none;
        padding: 0.5rem;
    }
    
    .period-column.active {
        display: block;
    }
    
    .period-column .period-team-headers {
        font-size: 1rem;
        padding: 0.5rem;
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
        margin-bottom: 0.5rem;
    }
    
    .period-column .period-team-headers span:first-child {
        font-size: 1.1rem;
    }
    
    .period-column .period-team-headers span:last-child {
        font-size: 1.1rem;
    }
    
    .score-rows {
        max-height: none;
        gap: 4px;
    }
    
    .score-row {
        gap: 8px;
    }
    
    .score-cell {
        min-height: 44px;
        gap: 6px;
        padding: 6px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-color);
    }
    
    .score-cell .score-number {
        font-size: 1rem;
        font-weight: 700;
        width: 24px;
    }
    
    .score-cell .score-mark {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }
    
    .score-cell .player-input {
        width: 36px;
        height: 28px;
        font-size: 0.9rem;
        padding: 4px;
    }
    
    /* Period totals - show only active period's total */
    .period-totals {
        display: block !important;
    }
    
    .total-row {
        display: none;
        padding: 0.75rem;
        background: var(--bg-tertiary);
        border-radius: var(--radius-sm);
        margin-top: 0.75rem;
    }
    
    .total-row.active {
        display: block;
    }
    
    .total-row span {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .total-inputs {
        gap: 0.5rem;
    }
    
    .total-input {
        font-size: 1.25rem;
        padding: 0.5rem;
    }
    
    /* Results Section - Mobile */
    .results-section {
        padding: 0.5rem;
    }
    
    .scoring-legend {
        font-size: 0.6rem;
        padding: 0.5rem;
    }
    
    .results-row {
        grid-template-columns: 1fr 60px 60px;
        gap: 0.375rem;
    }
    
    .result-input {
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    /* Officials Section - Mobile */
    .officials-section {
        padding: 0.5rem;
    }
    
    .officials-grid {
        gap: 0.5rem;
    }
    
    .official-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem;
    }
    
    .official-row label {
        width: 100%;
        font-size: 0.75rem;
        font-weight: 600;
    }
    
    .official-row input {
        flex: 1;
        min-width: 100px;
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    /* Team Selector - Mobile */
    .team-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .team-select {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    /* Team Modal - Mobile */
    .modal-large {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .team-editor-header {
        flex-direction: column;
    }
    
    .team-color-edit {
        width: 100%;
    }
    
    .team-editor-coach {
        flex-wrap: wrap;
    }
    
    .team-editor-coach label {
        width: 100%;
    }
    
    .team-editor-coach input:first-of-type {
        width: 100px;
    }
    
    .team-player-row {
        grid-template-columns: 1fr 60px 30px;
        gap: 0.25rem;
    }
    
    .team-player-row input[data-field="license"] {
        grid-column: 1 / -1;
        order: 1;
    }
    
    .team-player-row input[data-field="name"] {
        grid-column: 1 / 2;
        order: 3;
    }
    
    .team-player-row input[data-field="number"] {
        order: 4;
    }
    
    .team-player-row .gender-toggle {
        order: 2;
        grid-column: 2 / 3;
    }
    
    .team-player-row .remove-team-player {
        order: 5;
    }
    
    .team-editor-actions {
        flex-direction: column;
    }
    
    .team-editor-actions .btn {
        width: 100%;
    }
}

/* Small phones */
@media (max-width: 400px) {
    html {
        font-size: 12px;
    }
    
    .actions {
        grid-template-columns: 1fr;
    }
    
    .scoring-periods {
        grid-template-columns: 1fr;
    }
    
    .period-headers {
        grid-template-columns: 1fr;
    }
    
    .period-totals {
        grid-template-columns: 1fr;
    }
    
    .player-row .player-name {
        width: 100%;
        order: 1;
    }
    
    .player-row .player-license {
        order: 2;
    }
    
    .player-row .player-number {
        order: 3;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .score-mark {
        min-width: 24px;
        min-height: 24px;
    }
    
    .foul-box {
        min-width: 28px;
        min-height: 28px;
    }
    
    .timeout-box {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn {
        min-height: 44px;
    }
    
    input, select {
        min-height: 44px;
    }
}

