@font-face {
    font-family: 'Cursed Timer';
    src: url('fonts/CursedTimerUlil-Aznm.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a3a2e;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    padding: 40px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: #1a3a2e;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    font-size: 1.2em;
    color: #666;
    font-weight: 600;
}

.stats span span {
    color: #4dd21d;
}

/* Hide stats on loading screen */
.container:has(.loading-screen:not(.hidden)) .stats {
    display: none;
}

.match-info {
    text-align: center;
    margin-bottom: 30px;
}

.league-badge {
    background: #2d5a3d;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.league-logo {
    height: 30px;
    width: auto;
    vertical-align: middle;
}

.match-date {
    color: #666;
    font-size: 0.9em;
}

.teams {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 40px 0;
    gap: 20px;
}

.team {
    text-align: center;
    flex: 1;
}

.team-logo {
    font-size: 4em;
    margin-bottom: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-badge {
    max-width: 100px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.badge-loader {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4dd21d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.team h2 {
    color: #1a3a2e;
    font-size: 1.5em;
}

.vs {
    font-size: 1.5em;
    font-weight: bold;
    color: #1a3a2e;
    padding: 0 20px;
}

.guess-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.actual-score-inline {
    background: #f8f9fa;
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
}

.actual-score-inline h3 {
    color: #1a3a2e;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.input-group input:read-only {
    background: #e9ecef;
    cursor: not-allowed;
    border-color: #1a3a2e;
}

.guess-section h3 {
    color: #1a3a2e;
    margin-bottom: 12px;
}

.score-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    color: #666;
    font-weight: 600;
    font-size: 0.9em;
}

.input-group input {
    width: 80px;
    height: 60px;
    font-size: 2em;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-weight: bold;
    color: #1a3a2e;
    font-family: 'Cursed Timer', monospace;
}

.input-group input::placeholder {
    color: #bdbdbd;
    opacity: 1;
    font-weight: bold;
}

.input-group input:focus {
    outline: none;
    border-color: #ffd166;
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

.separator {
    font-size: 2em;
    font-weight: bold;
    color: #999;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(77, 210, 29, 0.9), rgba(45, 90, 61, 0.9)), url('grass.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    border: 2px solid #4dd21d;
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(45, 90, 61, 0.95), rgba(26, 58, 46, 0.95)), url('grass.jpg');
    background-size: cover;
    background-position: center;
    border-color: #4dd21d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(77, 210, 29, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffd166, #ff9800);
    background-size: cover;
    background-position: center;
    color: #1a3a2e;
    border: 2px solid #ff9800;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 209, 102, 0.4);
}

.result-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
}

.actual-score {
    margin-bottom: 20px;
}

.actual-score h3 {
    color: #1a3a2e;
    margin-bottom: 10px;
}

.score-display {
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
    font-family: 'Cursed Timer', monospace;
}

/* Score display color matches feedback */
.actual-score-inline.excellent .score-display {
    background: linear-gradient(135deg, #4dd21d, #2d5a3d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.actual-score-inline.very-good .score-display,
.actual-score-inline.good .score-display,
.actual-score-inline.okay .score-display {
    background: linear-gradient(135deg, #ff9800, #ffd166);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.actual-score-inline.poor .score-display {
    background: linear-gradient(135deg, #1a3a2e, #0d1f17);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.points-earned {
    font-size: 1.3em;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
    word-wrap: break-word;
    line-height: 1.4;
}

.points-earned.excellent {
    background: linear-gradient(135deg, #4dd21d, #2d5a3d);
    color: white;
}

.points-earned.very-good {
    background: linear-gradient(135deg, #ff9800, #ffd166);
    color: white;
}

.points-earned.good {
    background: linear-gradient(135deg, #ff9800, #ffd166);
    color: white;
}

.points-earned.okay {
    background: linear-gradient(135deg, #ff9800, #ffd166);
    color: white;
}

.points-earned.poor {
    background: linear-gradient(135deg, #1a3a2e, #0d1f17);
    color: white;
}

/* Screen transitions */
.loading-screen,
.league-selection,
.team-selection,
#game-container,
.game-over {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Pop-up animations for containers */
.league-card {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.team-card {
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.team-badge {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.points-earned:not(.invisible),
.actual-score-inline:not(.invisible) {
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden !important;
}

.loading-screen {
    text-align: center;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.crazy-score {
    font-family: 'Cursed Timer', monospace;
    font-size: 6em;
    font-weight: bold;
    color: #1a3a2e;
}

.loading-screen p {
    color: #666;
    font-size: 1.2em;
    font-weight: 600;
}

.game-over {
    text-align: center;
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    min-height: 60vh;
}

.game-over h2 {
    color: #1a3a2e;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.game-over p {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 15px;
}

#final-score {
    color: #4dd21d;
    font-weight: bold;
    font-size: 1.5em;
}

#performance-message {
    color: #1a3a2e;
    font-weight: 600;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: auto;
    padding-top: 20px;
}

/* League Selection Screen */
.league-selection {
    text-align: center;
    padding: 20px 0;
}

.league-selection h2 {
    color: #1a3a2e;
    font-size: 2.2em;
    margin-bottom: 10px;
}

.league-selection .subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 40px;
}

.league-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.league-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.league-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    border-color: #4dd21d;
}

.league-card.all-leagues {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a3a2e 100%);
    color: white;
}

.league-card.all-leagues h3,
.league-card.all-leagues .league-country,
.league-card.all-leagues .match-count {
    color: white;
}

.league-card.all-leagues:hover {
    border-color: white;
}

.league-badge-container {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.league-badge-select {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.league-flag {
    font-size: 3.5em;
}

.league-card h3 {
    color: #1a3a2e;
    font-size: 1.4em;
    margin-bottom: 8px;
}

.league-country {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 12px;
}

.match-count {
    display: inline-block;
    background: rgba(77, 210, 29, 0.1);
    color: #2d5a3d;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.league-card.all-leagues .match-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Team Selection Screen */
.team-selection {
    text-align: center;
    padding: 20px 0;
}

.team-selection h2 {
    color: #1a3a2e;
    font-size: 2.2em;
    margin-bottom: 10px;
}

.team-selection .subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

#selected-league-name {
    color: #2d5a3d;
    font-weight: 600;
}

.team-options {
    margin-bottom: 30px;
}

.btn-play-all {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a3a2e 100%);
    color: white;
    border: 2px solid #4dd21d;
    padding: 18px 40px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(45, 90, 61, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-play-all:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(77, 210, 29, 0.4);
}

.all-teams-icon {
    font-size: 1.5em;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.team-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #4dd21d;
}

.team-card-badge {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.team-card-name {
    font-size: 0.9em;
    color: #1a3a2e;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
}

.btn-back {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    body {
        padding: 8px;
        min-height: 100vh;
        display: flex;
    }

    .container {
        padding: 12px;
        min-height: calc(100vh - 16px);
        height: 100%;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* When game container is active, prevent scrolling and fit everything */
    .container:has(#game-container:not(.hidden)) {
        height: calc(100vh - 16px);
        max-height: calc(100vh - 16px);
        overflow: hidden;
    }

    header {
        margin-bottom: 2vh;
    }

    .container:has(#game-container:not(.hidden)) header {
        margin-bottom: 1vh;
        flex-shrink: 0;
    }

    header h1 {
        font-size: clamp(1em, 4vw, 1.3em);
        margin-bottom: 6px;
    }

    .stats {
        flex-direction: row;
        gap: 5vw;
        font-size: clamp(0.75em, 3vw, 0.9em);
    }

    .match-info {
        flex-shrink: 0;
        margin-bottom: 1vh;
    }

    .league-badge {
        padding: 5px 15px;
        font-size: clamp(0.75em, 3vw, 0.9em);
        margin-bottom: 4px;
    }

    .league-logo {
        height: clamp(18px, 4vw, 24px);
    }

    .match-date {
        font-size: clamp(0.7em, 2.5vw, 0.8em);
    }

    /* Game container - fit all content without scrolling */
    #game-container {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .container:has(#game-container:not(.hidden)) #game-container {
        flex: 1;
    }

    .teams {
        flex-direction: row;
        gap: 2vw;
        margin: 2vh 0 1.5vh 0;
        align-items: center;
        flex: 1;
        min-height: 0;
    }

    .team {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .team-logo {
        height: 18vh;
        min-height: 70px;
        max-height: 120px;
        width: 100%;
        margin-bottom: 1vh;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .team-badge {
        max-width: 85%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .vs {
        font-size: clamp(1em, 4vw, 1.3em);
        padding: 0 1vw;
        transform: none;
        margin: 0;
        flex-shrink: 0;
    }

    .team h2 {
        font-size: clamp(0.85em, 3.5vw, 1em);
        line-height: 1.1;
        text-align: center;
    }

    .guess-section {
        padding: 2vh 3vw;
        margin-top: 0;
        flex-shrink: 0;
    }

    .guess-section h3 {
        font-size: clamp(0.85em, 3.5vw, 1em);
        margin-bottom: 1.2vh;
    }

    .score-inputs {
        gap: 3vw;
        margin-bottom: 1.5vh;
    }

    .input-group {
        gap: 0.3vh;
    }

    .input-group label {
        font-size: clamp(0.65em, 2.8vw, 0.8em);
    }

    .input-group input {
        width: 20vw;
        min-width: 55px;
        max-width: 85px;
        height: 8vh;
        min-height: 48px;
        max-height: 70px;
        font-size: clamp(1.4em, 5.5vw, 1.9em);
    }

    .separator {
        font-size: clamp(1.4em, 5.5vw, 1.9em);
    }

    .btn-primary, .btn-secondary {
        padding: 1.8vh 5vw;
        font-size: clamp(0.9em, 3.8vw, 1.05em);
        width: 100%;
        max-width: 300px;
    }

    .result-section {
        padding: 1.5vh 3vw;
        margin-top: 0.5vh;
        flex-shrink: 0;
    }

    .actual-score {
        margin-bottom: 0.8vh;
    }

    .actual-score h3 {
        font-size: clamp(0.8em, 3.2vw, 0.95em);
        margin-bottom: 0.4vh;
    }

    .score-display {
        font-size: clamp(1.3em, 5.5vw, 1.8em);
        margin: 0.8vh 0;
    }

    .points-earned {
        font-size: clamp(0.75em, 3.2vw, 0.9em);
        padding: 1.2vh 2vw;
        margin-bottom: 0.8vh;
    }

    .league-selection h2 {
        font-size: 1.6em;
    }

    .league-selection .subtitle {
        font-size: 0.95em;
    }

    .league-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .league-card {
        padding: 25px 15px;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .game-over-buttons button {
        width: 100%;
    }

    .team-selection h2 {
        font-size: 1.6em;
    }

    .team-selection .subtitle {
        font-size: 0.95em;
    }

    .btn-play-all {
        font-size: 1em;
        padding: 15px 30px;
    }

    .team-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 12px;
    }

    .team-card {
        padding: 15px 10px;
    }

    .team-card-badge {
        width: 50px;
        height: 50px;
    }

    .team-card-name {
        font-size: 0.85em;
    }
}
