/* ── Reset i baza ────────────────────────────────────────────────────────── */
.pola-app *,
.pola-app *::before,
.pola-app *::after {
    box-sizing: border-box;
}

.pola-app {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
    color: #1d2327;
}

/* ── Ekrany ──────────────────────────────────────────────────────────────── */
.pola-screen {
    display: none;
    animation: polaFadeIn .25s ease;
}
.pola-screen--active {
    display: block;
}
@keyframes polaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Ekran powitalny ─────────────────────────────────────────────────────── */
.pola-welcome {
    text-align: center;
    padding: 48px 24px;
}
.pola-welcome-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}
.pola-welcome h2 {
    font-size: 2rem;
    margin: 0 0 8px;
    color: #1d2327;
}
.pola-welcome p {
    color: #555;
    font-size: 1.05rem;
    margin: 0 0 24px;
}
.pola-task-intro {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px !important;
    font-style: italic;
}

/* ── Formularz imienia ───────────────────────────────────────────────────── */
.pola-name-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 400px;
    margin: 0 auto;
}
.pola-name-form input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    font-size: 1.1rem;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    outline: none;
    transition: border-color .2s;
}
.pola-name-form input:focus {
    border-color: #2271b1;
}

/* ── Przyciski ───────────────────────────────────────────────────────────── */
.pola-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.pola-btn--primary {
    background: #2271b1;
    color: #fff;
}
.pola-btn--primary:hover {
    background: #1a5a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34,113,177,.3);
}
.pola-btn--secondary {
    background: #f0f0f1;
    color: #1d2327;
}
.pola-btn--secondary:hover {
    background: #ddd;
}
.pola-btn--wide {
    width: 100%;
}
.pola-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Lista zadań ─────────────────────────────────────────────────────────── */
.pola-screen-header h2 {
    font-size: 1.4rem;
    margin: 0 0 20px;
}
.pola-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.pola-task-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.pola-task-card:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 16px rgba(34,113,177,.15);
    transform: translateY(-2px);
}
.pola-task-icon {
    font-size: 2.5rem;
    line-height: 1;
}
.pola-task-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1d2327;
}
.pola-task-desc {
    font-size: .85rem;
    color: #777;
    line-height: 1.4;
}
.pola-task-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: .8rem;
}
.pola-task-count {
    color: #999;
}
.pola-task-diff {
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}
.pola-diff-1 { background: #d4edda; color: #155724; }
.pola-diff-2 { background: #fff3cd; color: #856404; }
.pola-diff-3 { background: #f8d7da; color: #721c24; }

/* ── Ilustracje SVG (przyimki) ───────────────────────────────────────────── */
.pola-svg-illustration {
    margin: 0 auto 20px;
    max-width: 280px;
    border-radius: 16px;
    background: #f8fffe;
    border: 2px solid #e0f0e8;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.pola-svg-illustration svg {
    width: 100%;
    height: auto;
    display: block;
}
.pola-svg-loading {
    font-size: 2rem;
    animation: polaPulse 1s ease infinite alternate;
    padding: 24px;
}
@keyframes polaPulse {
    from { opacity: .4; }
    to   { opacity: 1; }
}

/* ── Nagłówek quizu ──────────────────────────────────────────────────────── */
.pola-quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.pola-quiz-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#pola-task-name {
    font-weight: 700;
    font-size: 1.05rem;
}
#pola-child-name-display {
    font-size: .9rem;
    color: #777;
}
.pola-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pola-progress-track {
    width: 140px;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}
.pola-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #36a3f7);
    border-radius: 5px;
    transition: width .4s ease;
}
#pola-progress-text {
    font-size: .85rem;
    color: #777;
    white-space: nowrap;
}

/* ── Karta pytania ───────────────────────────────────────────────────────── */
.pola-question-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.pola-question-text {
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 16px;
    line-height: 1.3;
}
.pola-hint {
    font-size: .9rem;
    color: #f0b429;
    margin-bottom: 20px;
    font-style: italic;
}
.pola-answer-area {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.pola-answer-area input {
    flex: 1;
    max-width: 100%;
    padding: 12px 16px;
    font-size: 1.2rem;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    text-align: center;
    outline: none;
    transition: border-color .2s;
}
.pola-answer-area input:focus {
    border-color: #2271b1;
}

/* ── Feedback (odpowiedź) ────────────────────────────────────────────────── */
.pola-feedback {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.pola-feedback-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.pola-feedback-text {
    font-size: 1.15rem;
    margin-bottom: 16px;
    color: #1d2327;
}
.pola-explanation {
    text-align: left;
    background: #fff8e1;
    border-left: 4px solid #f0b429;
    border-radius: 0 8px 8px 0;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: .95rem;
    color: #444;
    line-height: 1.6;
}
.pola-expl-label {
    font-weight: 700;
    margin-bottom: 6px;
    color: #856404;
}

/* ── Wyniki końcowe ──────────────────────────────────────────────────────── */
.pola-results {
    text-align: center;
    padding: 32px 16px;
}
.pola-results-emoji {
    font-size: 5rem;
    margin-bottom: 12px;
}
.pola-results-title {
    font-size: 1.8rem;
    margin: 0 0 16px;
}
.pola-results-score {
    font-size: 3.5rem;
    font-weight: 700;
    color: #2271b1;
    line-height: 1;
}
.pola-results-percent {
    font-size: 1.4rem;
    color: #777;
    margin-bottom: 16px;
}
.pola-results-msg {
    font-size: 1.1rem;
    color: #444;
    margin-bottom: 24px;
}
.pola-results-bar-wrap {
    background: #e9ecef;
    border-radius: 8px;
    height: 14px;
    max-width: 400px;
    margin: 0 auto 24px;
    overflow: hidden;
}
.pola-results-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 1s ease;
}
.pola-results-bar--good { background: linear-gradient(90deg, #28a745, #5cb85c); }
.pola-results-bar--ok   { background: linear-gradient(90deg, #ffc107, #ffdd57); }
.pola-results-bar--bad  { background: linear-gradient(90deg, #dc3545, #e57373); }

.pola-results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 380px;
    margin: 0 auto;
}

/* ── Stan ładowania ──────────────────────────────────────────────────────── */
.pola-app.pola-loading {
    opacity: .6;
    pointer-events: none;
}

/* ── Animacje ────────────────────────────────────────────────────────────── */
@keyframes polaShake {
    0%,100% { transform: translateX(0); }
    20%,60% { transform: translateX(-8px); }
    40%,80% { transform: translateX(8px); }
}
.pola-shake {
    animation: polaShake .4s ease;
}

/* ── Error ───────────────────────────────────────────────────────────────── */
.pola-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* ── Pusta lista ─────────────────────────────────────────────────────────── */
.pola-empty {
    text-align: center;
    padding: 48px 24px;
    color: #777;
}
.pola-empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Responsywność ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .pola-question-card {
        padding: 20px 12px;
    }
    .pola-quiz-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .pola-progress-track {
        width: 100px;
    }
    .pola-answer-area input {
        max-width: 100%;
    }
}
