/* Custom Fonts */
@font-face {
    font-family: 'LidlFontScript';
    src: url('fonts/LidlFontScriptPro.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'LidlFontCond';
    src: url('fonts/LidlFontCondPro-Book.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
    background-color: #0050AA; /* Rich blue background */
    color: white;
    min-height: 100vh;
}

h1 {
    margin: auto;
    position: relative;
    top: 30vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0 10px;
}

#mc-logo {
    height: 42px;
}

#lidl-logo {
    height: 50px;
    border-radius: 5px;
    padding: 5px;
}

/* Main content styles */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 0;

    @media (min-width: 768px) {
        gap: 20px;
    }
}

.product-container {
    position: relative;
    display: flex;
    width: 100%;
    justify-content: center;
    margin: 20px 0 14px;
    max-width: 290px;

}

#product-image {
    width: 100%;
    height: auto;
}

/* Badge styles - commented out since it's in the image */
.badge {
    position: absolute;
    bottom: 50px;
    right: 20%;
    background-color: #FFF000; /* Yellow badge */
    color: #2450AA;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    line-height: 1;
    padding: 5px;
    transform: rotate(5deg);
}

.badge .number {
    font-size: 42px;
    font-weight: 900;
}

h1 {
    font-size: 42px;
    margin-bottom: 5px;
    font-weight: 800;
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;

    @media (min-width: 768px) {
        font-size: 60px;
    }
}

.description {
    font-size: 24px;
    margin-bottom: 15px;
    max-width: 880px;
    line-height: 1.5;
    color: #FFF000;
}

#play-button {
    background-color: #FFF000; /* Yellow button */
    color: #2450AA;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 20px;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

#play-button:hover {
    background-color: white;
}

/* Hidden input field for mobile keyboard */
#mobile-input {
    position: absolute;
    opacity: 0;
    height: 1px;
    width: 1px;
    z-index: 100;
    pointer-events: auto;
    border: none;
    padding: 0;
    margin: 0;
    top: 50%;
    left: 50%;
}

/* Game container styles */
.game-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.instruction-text {
    font-size: 24px;
    color: #FFF000;
    margin-bottom: 20px;
    position: relative;
    top: 70px;
    font-weight: bold;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

.feature-display {
    font-size: 75px;
    font-weight: 800;
    margin-bottom: 20px;
    min-height: 80px;
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
    width: 100%;
    text-align: center;
}

.mc-prefix {
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
    color: #FFF000;
    font-size: 22px;
    margin-bottom: 5px;
}

.feature-display .typed {
    color: #FFF000; /* Yellow color for typed text */
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
    opacity: 1; /* Ensure full opacity for typed text */
}

.feature-display .untyped {
    color: white; /* White color for untyped text */
    opacity: 0.5; /* 50% opacity */
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
}

.feature-display .success {
    color: white;
    opacity: 1; /* Ensure full opacity for success text */
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
}

.feature-display .failure {
    color: white;
    opacity: 1; /* Ensure full opacity for failure text */
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: white;
    border-radius: 5px;
    margin-bottom: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #FFF000; /* Yellow by default */
    width: 100%; /* Start at 100% */
    transition: width 0.1s linear; /* Smoother transition */
}

.progress-bar.success {
    background-color: #4CAF50; /* Green for success */
    transition: background-color 0.5s ease;
}

.progress-bar.failure {
    background-color: #f44336; /* Red for failure */
    transition: background-color 0.5s ease;
}

.timer {
    font-size: 30px;
    margin-top: 15px;
    margin-bottom: 30px;
    color: white;
    font-weight: 700;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

/* Special styling for countdown timer */
.timer.countdown {
    font-size: 72px;
    font-weight: 800;
    color: white;
    margin: 40px 0;
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
    text-transform: uppercase;
}

#restart-button {
    background-color: white;
    margin: 0 auto;
    color: #2450AA;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

#restart-button:hover {
    background-color: #FFF000;
}

/* Keyboard recovery button for mobile */
#keyboard-button {
    background-color: #FFF000;
    color: #2450AA;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    margin: 10px auto 20px;
    display: none; /* Hidden by default, shown via JS */
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
    position: relative;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Form styles */
.form-container {
    background-color: #0050AA;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    margin: 0 auto;
    color: white;
    text-align: center;
}

.form-container h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #FFF000;
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
}

.form-container p {
    font-size: 18px;
    margin-bottom: 20px;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

.unique-code {
    background-color: white;
    color: #0050AA;
    font-family: monospace;
    font-size: 28px;
    font-weight: bold;
    padding: 15px 20px;
    border-radius: 5px;
    margin: 0 auto 20px;
    letter-spacing: 2px;
    max-width: 300px;
}

.code-instruction {
    font-size: 16px;
    color: #FFF000;
    margin-bottom: 15px;
    font-style: italic;
}

.button-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
    flex-wrap: wrap;
}

#copy-button {
    background-color: white;
    color: #0050AA;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

#copy-button:hover {
    background-color: #e6e6e6;
    transform: scale(1.05);
}

#competition-button {
    background-color: #FFF000;
    color: #2450AA;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

#competition-button:hover {
    background-color: white;
    transform: scale(1.05);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

.form-container input {
    width: 100%;
    padding: 12px;
    border-radius: 21px !important;
    border: none;
    background-color: #78A6DB !important;
    font-size: 16px;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

.form-container button[type="submit"] {
    background-color: #FFF000;
    color: #2450AA;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin-top: 20px;
    width: auto;
    min-width: 180px;
    font-family: 'LidlFontCond', 'Nunito', Arial, Helvetica, sans-serif;
}

.form-container button[type="submit"]:hover {
    background-color: white;
    transform: scale(1.05);
}

#claim-form {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Footer styles */
footer {
    margin-top: auto;
    text-align: center;
    font-size: 12px;
    padding: 10px 0;
}

.legal {
    opacity: 0.8;
}

.legal-link {
    text-decoration: underline;
    color: #FFF000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 32px;
        margin: auto;
        text-wrap: balance;
    }

    .mc-prefix {
        font-size: 16px;
    }
    
    .description {
        font-size: 18px;
    }
    .product-container {
        max-width: 400px;
    }
    
    .badge {
        width: 90px;
        height: 90px;
        font-size: 14px;
        bottom: 30px;
        right: 10%;
    }
    
    .badge .number {
        font-size: 32px;
    }
    
    .feature-display {
        font-size: 70px;
    }
    
    .instruction-text {
        font-size: 20px;
    }
    
    .timer {
        font-size: 20px;
    }
    
    .timer.countdown {
        font-size: 48px;
        margin: 30px 0;
    }
}

@media (max-width: 480px) {
    .product-container {
        max-width: 210px;
    }
        .feature-display {
        font-size: 50px;
    }

    .description {
        font-size: 14px;
    }
}

/* Stocks Last Badge */
.stocks-badge {
    position: absolute;
    bottom: 30px;
    right: -110px;
    width: 55%; /* Use percentage width based on container */
    aspect-ratio: 1/1; /* Ensure perfect circle */
    background-color: #FFF000; /* Lidl yellow */
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: 'LidlFontScript', 'Madimi One', sans-serif;
    color: #0050AA; /* Lidl blue */
    transform: rotate(345deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    padding: 5px;
    padding-left: 13%;
    line-height: 1.1;
}

.stocks-badge span {
    display: block;
    font-size: 38px;
    font-weight: bold;
    align-self: flex-start;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* Adjust badge position for different screen sizes */
@media (max-width: 768px) {
    .stocks-badge {
        bottom: 30px;
        right: -120px;
        width: 55%;
    }

    .stocks-badge span {
        font-size: 50px;
    }
}

@media (max-width: 480px) {
    .stocks-badge {
        bottom: 25px;
        right: -50px;
        width: 50%;
    }

    .stocks-badge span {
        font-size: 22px;
    }
}

@media (max-width: 580px) {
    /* Safari-specific fixes */
    @supports (-webkit-touch-callout: none) {
        .product-container {
            max-width: 210px !important;
            width: 210px !important; /* Force width for Safari */
            left: 0 !important;
            right: 0 !important;
        }
        
        /* Ensure images inside don't overflow */
        .product-container img {
            max-width: 100% !important;
            height: auto !important;
        }

        .stocks-badge {
            bottom: 25px;
            right: -50px;
            width: 50%;
        }
    
        .stocks-badge span {
            font-size: 22px;
        }
    }
}