* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Zapobiega zoomowi przy fokusie na input na iOS */
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS fix */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

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

h1 {
    text-align: center;
    color: #333;
    margin-bottom: clamp(20px, 4vw, 30px);
    font-size: clamp(1.8em, 5vw, 2.5em);
    line-height: 1.2;
}

/* Strona startowa */
.start-form {
    text-align: center;
}

.start-form p {
    font-size: clamp(1em, 3vw, 1.2em);
    color: #666;
    margin-bottom: clamp(20px, 4vw, 30px);
    line-height: 1.4;
}

.start-form label {
    display: block;
    font-size: clamp(1.1em, 3vw, 1.3em);
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.start-form input[type="number"] {
    width: min(150px, 80vw);
    padding: 15px;
    font-size: clamp(1.2em, 4vw, 1.5em);
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 10px;
    margin-bottom: 20px;
    /* Zapobiega zoomowi na iOS */
    font-size: 16px;
}

.start-form button,
.button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px clamp(30px, 8vw, 40px);
    font-size: clamp(1.1em, 3.5vw, 1.3em);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
    text-decoration: none;
    display: inline-block;
    /* Większy obszar klikania dla mobile */
    min-height: 44px;
    touch-action: manipulation;
}

.start-form button:active,
.button:active {
    transform: scale(0.98);
}

@media (hover: hover) {
    .start-form button:hover,
    .button:hover {
        transform: scale(1.05);
    }
}

/* Postęp gry */
.progress {
    text-align: center;
    font-size: clamp(1.1em, 3vw, 1.3em);
    color: #667eea;
    font-weight: bold;
    margin-bottom: clamp(15px, 3vw, 20px);
}

/* Komunikaty */
.message {
    padding: clamp(12px, 3vw, 15px);
    border-radius: 10px;
    margin-bottom: clamp(15px, 3vw, 20px);
    text-align: center;
    font-size: clamp(1em, 3vw, 1.2em);
    font-weight: bold;
    line-height: 1.4;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* Zegar */
.clock-container {
    display: flex;
    justify-content: center;
    margin: clamp(20px, 4vw, 30px) 0;
}

.clock {
    width: 100%;
    max-width: min(400px, 90vw);
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
    /* Zapobiega przesuwaniu przy dotknięciu */
    touch-action: none;
}

/* Formularz odpowiedzi */
.answer-form {
    display: flex;
    flex-direction: column;
    gap: clamp(15px, 3vw, 20px);
    align-items: center;
}

.time-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 3vw, 15px);
    flex-wrap: wrap;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.time-input input[type="number"] {
    width: clamp(80px, 20vw, 100px);
    padding: clamp(12px, 3vw, 15px) 10px;
    font-size: clamp(1.5em, 5vw, 2em);
    text-align: center;
    border: 3px solid #667eea;
    border-radius: 10px;
    font-weight: bold;
    /* Zapobiega zoomowi na iOS */
    font-size: max(16px, 1.5em);
    /* Większy obszar klikania */
    min-height: 60px;
}

/* Usuwa strzałki w polach number na Chrome/Safari/Edge */
.time-input input[type="number"]::-webkit-outer-spin-button,
.time-input input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Usuwa strzałki w polach number na Firefox */
.time-input input[type="number"] {
    -moz-appearance: textfield;
}

.input-wrapper label {
    font-size: clamp(0.8em, 2.5vw, 0.9em);
    color: #666;
    text-align: center;
}

.time-input .colon {
    font-size: clamp(2em, 6vw, 3em);
    font-weight: bold;
    color: #333;
    margin: 0 clamp(3px, 1vw, 5px);
    margin-bottom: clamp(15px, 4vw, 25px);
}

.answer-form button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px clamp(40px, 10vw, 60px);
    font-size: clamp(1.1em, 3.5vw, 1.3em);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 10px;
    /* Większy obszar klikania dla mobile */
    min-height: 50px;
    touch-action: manipulation;
}

.answer-form button:active {
    transform: scale(0.98);
}

@media (hover: hover) {
    .answer-form button:hover {
        transform: scale(1.05);
    }
}

/* Wyniki */
.result-box {
    text-align: center;
    padding: clamp(25px, 5vw, 40px);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    margin-bottom: clamp(20px, 4vw, 30px);
}

.score {
    font-size: clamp(2em, 6vw, 3em);
    color: #333;
    margin-bottom: clamp(15px, 3vw, 20px);
}

.score-number {
    font-weight: bold;
    color: #667eea;
}

.percentage {
    font-size: clamp(2em, 5vw, 2.5em);
    color: #666;
    margin-bottom: clamp(15px, 3vw, 20px);
}

.rating {
    font-size: clamp(1.8em, 5vw, 2.5em);
    font-weight: bold;
    padding: clamp(15px, 3vw, 20px);
    border-radius: 10px;
    margin-top: clamp(15px, 3vw, 20px);
    line-height: 1.3;
}

.rating.super {
    background: #d4edda;
    color: #155724;
}

.rating.good {
    background: #d1ecf1;
    color: #0c5460;
}

.rating.ok {
    background: #fff3cd;
    color: #856404;
}

.rating.try-again {
    background: #f8d7da;
    color: #721c24;
}

.actions {
    text-align: center;
}

/* Responsywność dla bardzo małych ekranów */
@media (max-width: 400px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    .time-input {
        gap: 8px;
    }

    .time-input input[type="number"] {
        min-width: 70px;
    }
}

/* Landscape mode dla mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
        align-items: flex-start;
    }

    .container {
        margin: 10px auto;
    }

    .clock-container {
        margin: 15px 0;
    }

    .clock {
        max-width: 250px;
    }

    h1 {
        margin-bottom: 15px;
        font-size: 1.5em;
    }

    .message {
        padding: 10px;
        margin-bottom: 10px;
    }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 900px) {
    .clock {
        max-width: 350px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Można dodać dark mode w przyszłości */
}
