/* ============================================
   HUŚTAWKA ORTOGRAFICZNA — Style
   ============================================ */

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.3);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-green: #22c55e;
    --accent-green-glow: rgba(34, 197, 94, 0.3);
    --accent-rose: #f43f5e;
    --accent-rose-glow: rgba(244, 63, 94, 0.3);
    --accent-purple: #a855f7;

    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-soft: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-glow-green: 0 0 30px var(--accent-green-glow);
    --shadow-glow-rose: 0 0 30px var(--accent-rose-glow);
    --shadow-glow-amber: 0 0 30px var(--accent-amber-glow);

    --font-primary: 'Fredoka', 'Outfit', sans-serif;
    --font-display: 'Outfit', 'Fredoka', sans-serif;

    --seesaw-tilt: 0deg;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
    display: none;
    min-height: 100dvh;
    animation: fadeIn 0.4s ease;
}
.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   EKRAN STARTOWY
   ============================================ */
.start-container {
    width: 100%;
    max-width: 700px;
    padding: 40px 24px;
    text-align: center;
}

.logo-area {
    margin-bottom: 48px;
}

.seesaw-icon {
    margin-bottom: 16px;
}
.seesaw-svg-logo {
    width: 100px;
    height: 50px;
}
.seesaw-bar-logo {
    animation: seesawRock 2.5s ease-in-out infinite;
    transform-origin: 60px 51px;
}
@keyframes seesawRock {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

.game-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.title-accent {
    background: linear-gradient(135deg, var(--accent-amber), #fb923c, var(--accent-rose));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Level selector */
.level-heading {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.level-card {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    color: var(--text-primary);
    font-family: var(--font-primary);
    position: relative;
    overflow: hidden;
}
.level-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(168,85,247,0.05));
    opacity: 0;
    transition: opacity 0.3s;
}
.level-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft), 0 0 20px var(--accent-blue-glow);
}
.level-card:hover::before {
    opacity: 1;
}
.level-card:active {
    transform: translateY(-1px) scale(0.98);
}

.level-emoji {
    font-size: 2.8rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}
.level-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}
.level-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* ============================================
   EKRAN GRY
   ============================================ */
#screen-game.active {
    align-items: flex-start;
}
.game-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100dvh;
}

/* Top bar */
.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    padding: 8px 0;
}

.btn-back {
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-back:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

.score-display {
    display: flex;
    gap: 16px;
}
.score-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
}
.score-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 800;
}
.score-correct .score-icon {
    background: var(--accent-green);
    color: #fff;
}
.score-wrong .score-icon {
    background: var(--accent-rose);
    color: #fff;
}

.progress-info {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-card);
    padding: 6px 14px;
    border-radius: 20px;
}

/* Word Image */
.word-image-container {
    position: relative;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.image-glow {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-amber-glow), transparent 70%);
    filter: blur(20px);
    z-index: 0;
    animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0.9; }
}
.word-image {
    width: 160px;
    height: 160px;
    object-fit: contain;
    border-radius: var(--radius-xl);
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
    transition: transform 0.3s ease;
}

/* Hint */
.hint-area {
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.3s;
}
.hint-area.visible {
    opacity: 1;
}
.hint-label {
    color: var(--accent-amber);
    font-weight: 600;
    margin-right: 6px;
}
.hint-text {
    color: var(--text-secondary);
}

/* ============================================
   HUŚTAWKA — Seesaw
   ============================================ */
.seesaw-wrapper {
    width: 100%;
    max-width: 540px;
    margin-bottom: 24px;
    perspective: 600px;
}

.seesaw-scene {
    position: relative;
    width: 100%;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.seesaw-beam {
    position: absolute;
    top: 20px;
    width: 94%;
    height: 72px;
    background: linear-gradient(180deg, #334155, #1e293b);
    border-radius: 14px;
    border: 2px solid #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transform-origin: center bottom;
    transform: rotate(var(--seesaw-tilt));
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 30px rgba(0,0,0,0.4);
    z-index: 2;
}

.word-option {
    flex: 1;
    margin: 6px;
    height: 56px;
    border: 2px solid #475569;
    border-radius: var(--radius-md);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}
.word-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.word-option:hover:not(:disabled) {
    border-color: var(--accent-blue);
    box-shadow: 0 0 14px var(--accent-blue-glow);
    transform: scale(1.03);
}
.word-option:hover:not(:disabled)::before {
    opacity: 1;
}
.word-option:disabled {
    cursor: default;
}

/* Stany po odpowiedzi */
.word-option.correct {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.15);
    box-shadow: var(--shadow-glow-green);
}
.word-option.wrong {
    border-color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.15);
    box-shadow: var(--shadow-glow-rose);
    opacity: 0.7;
}

/* Wyróżnione litery */
.highlight-letter {
    color: var(--accent-amber);
    text-shadow: 0 0 8px var(--accent-amber-glow);
    font-weight: 900;
    position: relative;
}
.correct .highlight-letter {
    color: var(--accent-green);
    text-shadow: 0 0 8px var(--accent-green-glow);
}
.wrong .highlight-letter {
    color: var(--accent-rose);
    text-shadow: 0 0 8px var(--accent-rose-glow);
}

/* Podstawa */
.seesaw-base {
    position: relative;
    z-index: 1;
    width: 100px;
}
.seesaw-triangle {
    width: 100%;
    filter: drop-shadow(0 4px 12px rgba(245, 158, 11, 0.3));
}

/* ============================================
   FEEDBACK
   ============================================ */
.feedback-area {
    min-height: 52px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 440px;
}
.feedback-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.35s ease;
}
.feedback-content.visible {
    opacity: 1;
    transform: translateY(0);
}
.feedback-content.is-correct {
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.25);
}
.feedback-content.is-wrong {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.25);
}
.feedback-icon {
    font-size: 1.4rem;
}

/* Next button */
.btn-next {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    border: none;
    padding: 14px 40px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}
.btn-next.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}
.btn-next:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
}

/* ============================================
   EKRAN WYNIKÓW
   ============================================ */
.results-container {
    width: 100%;
    max-width: 600px;
    padding: 40px 24px;
    text-align: center;
}

.results-crown {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: crownBounce 0.6s ease;
}
@keyframes crownBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.results-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-amber), #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.results-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 36px;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}
.stat-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid;
}
.stat-correct {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.08);
}
.stat-wrong {
    border-color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.08);
}
.stat-percent {
    border-color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.08);
}
.stat-number {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 900;
}
.stat-correct .stat-number { color: var(--accent-green); }
.stat-wrong .stat-number { color: var(--accent-rose); }
.stat-percent .stat-number { color: var(--accent-amber); }
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Results details */
.results-details {
    max-width: 450px;
    margin: 0 auto 32px;
    text-align: left;
}
.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
}
.result-row.was-correct {
    background: rgba(34, 197, 94, 0.07);
    border-left: 3px solid var(--accent-green);
}
.result-row.was-wrong {
    background: rgba(244, 63, 94, 0.07);
    border-left: 3px solid var(--accent-rose);
}
.result-word {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.result-status {
    font-size: 1.2rem;
}

/* Actions */
.results-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-play-again, .btn-change-level {
    padding: 14px 30px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
}
.btn-play-again {
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-green-glow);
}
.btn-play-again:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 24px var(--accent-green-glow);
}
.btn-change-level {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid #475569;
}
.btn-change-level:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

/* ============================================
   CONFETTI / PARTICLES
   ============================================ */
.confetti-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 1.5s ease-out forwards;
}
@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* Star burst on correct answer */
.star-burst {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}
.star-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-amber);
    animation: starBurst 0.6s ease-out forwards;
}
@keyframes starBurst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 520px) {
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .level-card {
        padding: 18px 10px;
    }
    .level-emoji {
        font-size: 2.2rem;
    }
    .word-image {
        width: 120px;
        height: 120px;
    }
    .image-glow {
        width: 130px;
        height: 130px;
    }
    .seesaw-beam {
        height: 64px;
    }
    .word-option {
        height: 48px;
        font-size: 1rem;
    }
    .stat-circle {
        width: 90px;
        height: 90px;
    }
    .stat-number {
        font-size: 1.4rem;
    }
    .results-stats {
        gap: 14px;
    }
}

@media (max-width: 360px) {
    .level-grid {
        grid-template-columns: 1fr;
    }
    .game-title {
        font-size: 1.8rem;
    }
}
