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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: #333;
}

#app {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    max-width: 800px;
    margin: 0 auto;
}

#game-container {
    background: white;
}

.hidden {
    display: none !important;
}

/* Game List Screen Styles */
#game-list-screen {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
}

#game-list-header {
    text-align: center;
}

#game-list-header h1 {
    color: #495057;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

#game-list-header p {
    color: #6c757d;
    font-size: 1.1rem;
    margin: 0;
}

#game-list-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.primary-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-icon {
    font-size: 1.3rem;
    font-weight: bold;
}

#game-list-screen {
    position: relative;
}

#create-new-game-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

#game-list-actions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#game-list-actions #create-new-game-btn {
    pointer-events: auto;
}

#games-container {
    min-height: 300px;
}

#games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.game-card {
    background: white;
    padding: 16px 0;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.game-card:hover {
    border-color: #2196F3;
}

.game-card-main {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

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

.game-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: #6c757d;
}

.game-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-meta-label {
    font-weight: 500;
}

.game-meta-value {
    color: #495057;
    font-weight: 600;
}

.game-players {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 2px;
}

.game-card-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.game-status.active {
    background: #d4edda;
    color: #155724;
}

.game-status.completed {
    background: #d1ecf1;
    color: #0c5460;
}

.game-date {
    font-size: 0.75rem;
    color: #adb5bd;
    white-space: nowrap;
}

.game-actions {
    opacity: 1;
}

.delete-game-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.delete-game-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #495057;
}

.empty-state p {
    font-size: 1rem;
    margin: 0;
}

#setup-screen, #game-screen {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 48px 20px 20px 20px;
}

#setup-screen h2 {
    text-align: center;
    color: #495057;
    margin-bottom: 20px;
}

#player-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#player-name {
    flex: 1;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
}

#player-name:focus {
    outline: none;
    border-color: #2196F3;
}

.shortcut-text {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    margin: 15px 0 10px 0;
}

#shortcut-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.shortcut-btn {
    background: #e9ecef;
    color: #495057;
    border: 2px solid #dee2e6;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
}

.shortcut-btn:hover {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
    transform: translateY(-1px);
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.remove-btn:hover {
    background: #c82333;
}

#start-game-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.score-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

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

.score-input-row label {
    font-weight: 600;
    flex: 1;
}

.score-input-row input {
    width: 100px;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
}

.score-input-row input:focus {
    outline: none;
    border-color: #2196F3;
}

.scoreboard-table {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.scoreboard-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
    align-items: center;
}

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

.rank {
    font-weight: bold;
    color: #6c757d;
}

.name {
    font-weight: 600;
}

.score {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2196F3;
}

.bak-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.bak-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Different colors for different penalty levels */
.bak-60 {
    background: #721c24;
}

.bak-60:hover {
    background: #5a171c;
}

.bak-45 {
    background: #a71e2a;
}

.bak-45:hover {
    background: #8b1a21;
}

.bak-placeholder {
    width: 1px;
}

.scoreboard-input {
    width: 100px;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
}

.scoreboard-input:focus {
    outline: none;
    border-color: #2196F3;
}

#controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

button {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

#add-player-btn, #start-game-btn, #submit-round-btn {
    background: #28a745;
    color: white;
}

#add-player-btn:hover, #start-game-btn:hover:not(:disabled), #submit-round-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

#game-navigation {
    margin-bottom: 20px;
}

#back-to-homepage-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

#back-to-homepage-link:hover {
    color: #2196F3;
    text-decoration: underline;
}

#round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#round-header h2 {
    margin: 0;
    color: #495057;
}

#toggle-add-player-btn {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 20px;
}

#toggle-add-player-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

#mid-game-player-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

#mid-game-player-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

#mid-game-player-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#mid-game-player-name {
    flex: 1;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
}

#mid-game-player-name:focus {
    outline: none;
    border-color: #2196F3;
}

#add-mid-game-player-btn {
    background: #17a2b8;
    color: white;
    padding: 10px 16px;
    font-size: 0.9rem;
}

#add-mid-game-player-btn:hover {
    background: #138496;
    transform: translateY(-1px);
}

#mid-game-shortcut-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#mid-game-shortcut-buttons .shortcut-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.score-inputs-header {
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 15px 0;
    text-align: center;
}

/* Hide number input spinners while keeping numeric keyboard on mobile */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }
    
    #controls {
        flex-direction: column;
    }
    
    #mid-game-player-input {
        flex-direction: column;
    }
    
    #game-list-header h1 {
        font-size: 2rem;
    }
    
    .game-card-main {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .game-card-right {
        justify-content: space-between;
    }
    
    .game-meta {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .primary-btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
}

/* Floating Submit Button */
.floating-submit-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-submit-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.floating-submit-btn:active {
    transform: translateY(0);
}

.floating-submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.2);
}

.floating-submit-btn:disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.2);
}
