/* Bright cheerful mamosta-like overrides (loaded after base game styles) */

:root {
    --mamosta-cream: #fffaf3;
    --mamosta-sand: #ffe9c8;
    --mamosta-wood: #e0a86a;
    --mamosta-wood-deep: #c47a3a;
    --mamosta-ink: #5c3824;
    --mamosta-gold: #ffd24a;
    --mamosta-sky: #fff0d0;
    --mamosta-mint: #7ed9a0;
    --mamosta-coral: #ff8f6b;
    --mamosta-sky-blue: #6ec8ff;
}

body.mamosta-bright {
    background: linear-gradient(165deg, #fff9ee 0%, #ffe9c4 40%, #ffd9a0 100%) !important;
}

body.mamosta-bright::before {
    background:
        linear-gradient(180deg, rgba(255, 252, 245, 0.82) 0%, rgba(255, 240, 210, 0.62) 50%, rgba(255, 230, 185, 0.78) 100%),
        url('/images/kurdish/carpet-pattern.svg') center / 140px 140px repeat,
        linear-gradient(145deg, #fff6e8 0%, #ffe4b8 100%) !important;
    opacity: 1;
}

body.mamosta-bright::after {
    background:
        radial-gradient(ellipse at 50% 6%, rgba(255, 215, 0, 0.35) 0%, transparent 44%),
        radial-gradient(ellipse at 12% 88%, rgba(255, 140, 100, 0.22) 0%, transparent 42%),
        radial-gradient(ellipse at 88% 78%, rgba(90, 200, 140, 0.18) 0%, transparent 42%) !important;
}

body.mamosta-bright .card-mamosta {
    background: linear-gradient(180deg, #fffefb 0%, #fff6e8 100%) !important;
    border: 3px solid rgba(230, 170, 90, 0.4) !important;
    box-shadow:
        0 16px 40px rgba(160, 100, 40, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.75) inset !important;
}

body.mamosta-bright .card-mamosta::before,
body.mamosta-bright .card-mamosta::after {
    color: rgba(200, 140, 60, 0.18) !important;
}

body.mamosta-bright .header-persian {
    background:
        linear-gradient(135deg, #ffc85a 0%, #ffd978 38%, #ffb14a 72%, #ff9a3c 100%) !important;
    border-bottom: 3px solid rgba(255, 220, 100, 0.65) !important;
    padding: 0.85rem 1rem 0.7rem;
    padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

body.mamosta-bright .game-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
}

body.mamosta-bright .game-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

body.mamosta-bright .game-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    color: #5c3824;
    box-shadow: 0 2px 8px rgba(140, 80, 30, 0.12);
}

body.mamosta-bright .game-back-btn i {
    font-size: 1.25rem;
    line-height: 1;
}

body.mamosta-bright .game-back-btn:active {
    transform: scale(0.94);
    background: rgba(255, 255, 255, 0.8);
}

body.mamosta-bright .game-brand h1 {
    color: #5c3824 !important;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4) !important;
    font-size: clamp(1.05rem, 4.2vw, 1.65rem) !important;
    letter-spacing: 1px !important;
}

body.mamosta-bright .game-brand h1 i {
    color: #fff8e8 !important;
    filter: drop-shadow(0 2px 4px rgba(120, 70, 20, 0.25));
}

body.mamosta-bright .game-chapter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.55rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 4px 12px rgba(140, 80, 30, 0.1);
    animation: chapterBarIn 0.45s ease-out;
}

body.mamosta-bright .chapter-label {
    font-weight: 800;
    color: #6d4224;
    font-size: clamp(0.78rem, 3.4vw, 0.95rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

body.mamosta-bright .chapter-label i {
    color: #e8a020;
    margin-left: 0.2rem;
}

body.mamosta-bright .chapter-level-pill {
    flex-shrink: 0;
    font-weight: 900;
    font-size: clamp(0.72rem, 3vw, 0.85rem);
    color: #5c3824;
    background: linear-gradient(135deg, #fff8e8, #ffe4a8);
    border: 1px solid rgba(240, 180, 60, 0.55);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
}

@keyframes chapterBarIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

body.mamosta-bright .badge-custom {
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(6px);
    font-weight: 800 !important;
}

body.mamosta-bright .badge-custom.bg-warning {
    background: rgba(255, 255, 255, 0.62) !important;
    color: #b8860b !important;
}

body.mamosta-bright .badge-custom.bg-success {
    background: rgba(255, 255, 255, 0.62) !important;
    color: #1f8a4c !important;
}

body.mamosta-bright .badge-custom.bg-coin,
body.mamosta-bright .badge-custom.bg-info {
    background: linear-gradient(135deg, rgba(255, 236, 160, 0.9), rgba(255, 210, 90, 0.85)) !important;
    color: #8a5a10 !important;
    border-color: rgba(240, 180, 40, 0.55) !important;
    box-shadow: 0 2px 8px rgba(200, 140, 20, 0.2);
}

body.mamosta-bright .hint-cost-pill {
    display: inline-block;
    margin-right: 0.35rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72em;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.55);
    color: #8a5a10;
    border: 1px solid rgba(255, 220, 120, 0.7);
}

body.mamosta-bright .kurdish-table-scene {
    background:
        linear-gradient(180deg, rgba(255, 250, 235, 0.35) 0%, rgba(230, 180, 110, 0.18) 100%),
        url('/images/kurdish/wood-table.svg') center / cover no-repeat !important;
    box-shadow:
        0 12px 26px rgba(140, 80, 30, 0.16),
        inset 0 1px 0 rgba(255, 245, 210, 0.65),
        inset 0 0 0 2px rgba(220, 160, 80, 0.28),
        inset 0 0 0 5px rgba(255, 210, 80, 0.22) !important;
}

body.mamosta-bright .kurdish-table-scene::after {
    opacity: 0.85 !important;
    filter: drop-shadow(0 2px 8px rgba(255, 200, 60, 0.5)) !important;
}

body.mamosta-bright .tray-container {
    background:
        radial-gradient(ellipse at 45% 40%, rgba(255, 244, 220, 0.7) 0%, rgba(245, 210, 150, 0.45) 55%, rgba(220, 170, 100, 0.45) 100%),
        url('/images/kurdish/tray-rim.svg') center / 108% 108% no-repeat !important;
    box-shadow:
        0 10px 22px rgba(140, 80, 30, 0.18),
        0 2px 0 rgba(200, 140, 60, 0.3),
        inset 0 0 28px rgba(255, 255, 255, 0.35) !important;
}

body.mamosta-bright .word-display {
    background: rgba(255, 253, 248, 0.97) !important;
    border-color: rgba(220, 160, 80, 0.4) !important;
    color: #5c3824 !important;
    box-shadow: 0 6px 18px rgba(140, 80, 30, 0.12) !important;
    letter-spacing: 0 !important;
}

body.mamosta-bright .word-display .word-display-text {
    color: #1f8a4c !important;
}

body.mamosta-bright .word-display .word-display-text.already-solved {
    color: #2a6fad !important;
}

body.mamosta-bright .word-display .word-display-text.bonus-found {
    color: #0d7a45 !important;
}

body.mamosta-bright .word-display .char-slot {
    color: #5c3824 !important;
    border-bottom-color: rgba(200, 140, 70, 0.4) !important;
}

body.mamosta-bright .word-display .char-slot.filled {
    color: #1f8a4c !important;
    border-bottom-color: #28a745 !important;
}

body.mamosta-bright .letter-cell {
    background: radial-gradient(ellipse at 30% 28%, #ffe8c0, #f0c070 55%, #e0a040) !important;
    color: #5c3824 !important;
    border-color: rgba(200, 130, 50, 0.4) !important;
    box-shadow:
        0 4px 0 rgba(180, 110, 40, 0.4),
        0 8px 16px rgba(140, 80, 30, 0.16),
        inset 0 0 0 2px rgba(255, 255, 255, 0.4) !important;
    text-shadow: none !important;
}

body.mamosta-bright .letter-cell.dragging {
    background: radial-gradient(ellipse at 30% 30%, #fff4d0, #ffd978) !important;
    border-color: #ffd24a !important;
    box-shadow: 0 0 0 3px #ffe066, 0 8px 20px rgba(255, 200, 40, 0.4) !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

body.mamosta-bright .letter-cell.used {
    opacity: 0.35 !important;
    filter: grayscale(0.35) !important;
}

body.mamosta-bright .word-box {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 2px solid rgba(230, 180, 110, 0.4) !important;
    box-shadow: 0 4px 12px rgba(140, 80, 30, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

body.mamosta-bright .word-box .letter-slot {
    color: #b09070 !important;
    border-bottom-color: rgba(200, 150, 90, 0.35) !important;
}

body.mamosta-bright .word-box .letter-slot.filled,
body.mamosta-bright .word-box.completed .letter-slot {
    color: #1f8a4c !important;
    border-bottom-color: #28a745 !important;
}

body.mamosta-bright .word-box .letter-slot.hint-letter {
    color: #d49200 !important;
    border-bottom-color: #f0c000 !important;
    animation: hintLetterPop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes hintLetterPop {
    from { transform: scale(0.6); opacity: 0.4; }
    to { transform: scale(1); opacity: 1; }
}

body.mamosta-bright .word-box.completed {
    background: rgba(80, 200, 120, 0.12) !important;
    border-color: rgba(60, 180, 100, 0.45) !important;
}

body.mamosta-bright .btn-mamosta {
    background: linear-gradient(135deg, #ffc85a, #ff9f43) !important;
    border: 1px solid rgba(255, 210, 120, 0.7) !important;
    color: #5c3824 !important;
    box-shadow: 0 5px 0 #e88820, 0 8px 16px rgba(220, 130, 40, 0.22) !important;
    font-weight: 800 !important;
}

body.mamosta-bright .btn-mamosta:active {
    box-shadow: 0 2px 0 #e88820 !important;
}

body.mamosta-bright .btn-outline-mamosta {
    background: #fffefb !important;
    border: 2px solid #e0b070 !important;
    color: #7b4a2e !important;
    font-weight: 800 !important;
}

body.mamosta-bright .btn-outline-mamosta:active {
    background: #ffe9c8 !important;
}

body.mamosta-bright .feedback {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(230, 180, 110, 0.35) !important;
    color: #5c3824;
    border-radius: 1rem;
}

body.mamosta-bright .feedback.alert-success { color: #1f8a4c !important; }
body.mamosta-bright .feedback.alert-danger { color: #c0392b !important; }
body.mamosta-bright .feedback.alert-warning { color: #b8860b !important; }
body.mamosta-bright .feedback.alert-info { color: #0d7ea8 !important; }

body.mamosta-bright .loading-overlay {
    background: rgba(255, 248, 235, 0.97) !important;
}

body.mamosta-bright .loading-text {
    color: #7b4a2e !important;
}

body.mamosta-bright .loading-spinner {
    border-color: rgba(220, 160, 80, 0.2) !important;
    border-top-color: #ffd24a !important;
    border-right-color: #ff9f43 !important;
}

body.mamosta-bright .install-banner {
    background: rgba(255, 252, 245, 0.98) !important;
    border-top: 1px solid rgba(230, 180, 110, 0.35) !important;
}

body.mamosta-bright .install-banner .install-text {
    color: #7b4a2e !important;
}

body.mamosta-bright .kurdish-ornament {
    color: rgba(200, 140, 60, 0.35) !important;
}

body.mamosta-bright .music-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.55);
    color: #5c3824;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(140, 80, 30, 0.12);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

body.mamosta-bright .music-toggle:active {
    transform: scale(0.92);
}

body.mamosta-bright .register-modal-backdrop {
    background: rgba(255, 248, 235, 0.94) !important;
}

body.mamosta-bright .register-modal-backdrop > div {
    background: #fffefb !important;
    border: 1px solid rgba(230, 180, 110, 0.4) !important;
    box-shadow: 0 20px 50px rgba(140, 80, 30, 0.16) !important;
}

body.mamosta-bright .register-modal-backdrop h3 {
    color: #5c3824 !important;
}

body.mamosta-bright .register-modal-backdrop p,
body.mamosta-bright .register-modal-backdrop a {
    color: #8b6b52 !important;
}

body.mamosta-bright .text-secondary-emphasis,
body.mamosta-bright p[style*="color:#6a5a4a"] {
    color: #8b6b52 !important;
}

body.mamosta-bright h6.text-secondary {
    color: #9a7048 !important;
}

@media (hover: none) {
    body.mamosta-bright .btn-mamosta:hover {
        background: linear-gradient(135deg, #ffc85a, #ff9f43) !important;
    }

    body.mamosta-bright .btn-outline-mamosta:hover {
        background: #fffefb !important;
        border-color: #e0b070 !important;
        color: #7b4a2e !important;
    }
}

/* ===== Mobile polish ===== */
@media (max-width: 576px) {
    body.mamosta-bright {
        padding: 0 !important;
        align-items: stretch !important;
    }

    body.mamosta-bright .app-container {
        padding: 0 !important;
        max-width: none !important;
    }

    body.mamosta-bright .card-mamosta {
        border-radius: 0 !important;
        border-width: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    body.mamosta-bright .header-persian {
        padding: 0.7rem 0.75rem 0.55rem !important;
    }

    body.mamosta-bright .game-header-top {
        gap: 0.35rem;
    }

    body.mamosta-bright #headerStats {
        width: auto;
        justify-content: flex-end;
        gap: 0.35rem !important;
        flex-wrap: nowrap;
    }

    body.mamosta-bright .badge-custom {
        font-size: 0.72rem !important;
        padding: 0.28rem 0.5rem !important;
    }

    body.mamosta-bright .music-toggle {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    body.mamosta-bright .game-chapter-bar {
        margin-top: 0.45rem;
        padding: 0.35rem 0.55rem;
    }

    body.mamosta-bright .p-3 {
        padding: 0.75rem !important;
    }

    body.mamosta-bright .btn-mamosta,
    body.mamosta-bright .btn-outline-mamosta {
        min-height: 46px;
        font-size: 0.9rem;
        padding: 0.55rem 0.9rem;
    }

    body.mamosta-bright .kurdish-table-scene {
        max-width: 100% !important;
        margin-top: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.mamosta-bright .tray-container {
        max-width: 100% !important;
    }

    body.mamosta-bright .level-end-overlay {
        background: rgba(40, 22, 10, 0.45) !important;
    }

    body.mamosta-bright .level-end-card {
        background: linear-gradient(180deg, #fffefb 0%, #ffe8b8 100%) !important;
    }
}

/* ===== First-time tutorial (mobile coach marks) ===== */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
}

.tutorial-overlay:not([hidden]) {
    pointer-events: auto;
}

.tutorial-cutout {
    position: absolute;
    inset: 0;
    z-index: 12001;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.tutorial-cutout.is-on {
    opacity: 1;
    visibility: visible;
}

.tutorial-shade {
    position: absolute;
    /* Dim only — no blur; cutout target must stay crisp */
    background: rgba(28, 16, 8, 0.42);
    pointer-events: none;
}

.tutorial-shade[data-side="t"] { left: 0; right: 0; top: 0; height: 0; }
.tutorial-shade[data-side="b"] { left: 0; right: 0; bottom: 0; height: 0; }
.tutorial-shade[data-side="l"] { left: 0; width: 0; top: 0; height: 0; }
.tutorial-shade[data-side="r"] { right: 0; width: 0; top: 0; height: 0; }

.tutorial-ring {
    position: absolute;
    box-sizing: border-box;
    border: 2.5px solid #ffd24a;
    border-radius: 14px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.4) inset,
        0 0 18px rgba(255, 200, 40, 0.45);
    pointer-events: none;
    animation: tutorialRingPulse 1.35s ease-in-out infinite;
}

.tutorial-ring.is-round {
    border-radius: 50%;
}

.tutorial-cutout.is-snapping .tutorial-shade,
.tutorial-cutout.is-snapping .tutorial-ring {
    transition: none !important;
}

.tutorial-shade,
.tutorial-ring {
    transition: top 0.18s ease, left 0.18s ease, right 0.18s ease, bottom 0.18s ease,
                width 0.18s ease, height 0.18s ease, border-radius 0.18s ease;
}

@media (max-width: 480px) {
    .tutorial-ring {
        border-width: 2px;
    }
}

.tutorial-finger {
    position: fixed;
    z-index: 12003;
    width: 44px;
    height: 44px;
    margin: 0;
    pointer-events: none !important;
    display: none;
    transition: left 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
}

.tutorial-finger.is-on {
    display: block;
    animation: tutorialFingerBob 0.7s ease-in-out infinite;
}

.tutorial-finger-icon {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50% 50% 50% 8px;
    background: linear-gradient(145deg, #fffaf0, #ffd27a);
    border: 2px solid #e0a86a;
    transform: rotate(-28deg);
    position: relative;
}

.tutorial-finger-icon::after {
    content: "";
    position: absolute;
    inset: 10px 12px 14px 12px;
    border-radius: 999px;
    background: rgba(92, 56, 36, 0.16);
}

.tutorial-card {
    position: fixed;
    left: 50%;
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    top: auto;
    transform: translateX(-50%);
    width: min(400px, calc(100vw - 1.25rem));
    max-height: min(42vh, 320px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #fffefb 0%, #fff3e0 100%);
    border: 2px solid rgba(230, 170, 90, 0.45);
    border-radius: 1.35rem 1.35rem 1.1rem 1.1rem;
    padding: 0.85rem 1rem 0.95rem;
    box-shadow:
        0 16px 40px rgba(80, 40, 10, 0.22),
        0 0 0 1px rgba(255, 255, 255, 0.75) inset;
    color: #5c3824;
    text-align: center;
    z-index: 12010;
    pointer-events: auto !important;
    animation: tutorialPopIn 0.4s cubic-bezier(0.2, 1.2, 0.4, 1);
    touch-action: manipulation;
}

.tutorial-card.is-top {
    bottom: auto;
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    border-radius: 1.1rem 1.1rem 1.35rem 1.35rem;
    animation: tutorialPopInTop 0.4s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.tutorial-card.is-compact {
    max-height: none;
    padding: 0.7rem 0.9rem 0.8rem;
}

.tutorial-card.is-compact h3 {
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.tutorial-card.is-compact #tutorialText {
    margin-bottom: 0.55rem;
    font-size: 0.88rem;
}

.tutorial-kicker {
    margin: 0 0 0.15rem !important;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #c09020 !important;
    text-transform: none;
}

.tutorial-card h3 {
    margin: 0 0 0.35rem;
    font-weight: 900;
    font-size: clamp(1.1rem, 4.6vw, 1.3rem);
    line-height: 1.35;
}

.tutorial-card #tutorialText {
    margin: 0 0 0.85rem;
    line-height: 1.65;
    color: #7b4a2e;
    font-size: clamp(0.88rem, 3.8vw, 0.98rem);
}

.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 0.28rem;
    margin-bottom: 0.45rem;
    padding: 0 0.25rem;
}

.tutorial-progress span {
    flex: 1 1 0;
    max-width: 26px;
    height: 4px;
    border-radius: 999px;
    background: rgba(123, 74, 46, 0.18);
    transition: background 0.25s ease, max-width 0.25s ease;
}

.tutorial-progress span.active {
    max-width: 36px;
    background: #ffd24a;
}

.tutorial-progress span.done {
    background: rgba(255, 210, 74, 0.55);
}

.tutorial-actions {
    display: flex;
    gap: 0.55rem;
    justify-content: stretch;
    align-items: stretch;
}

.tutorial-btn {
    flex: 1;
    min-height: 48px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.95rem;
    border: 2px solid transparent;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important;
    user-select: none;
}

.tutorial-btn-primary {
    background: linear-gradient(135deg, #ffc85a, #ff9f43);
    color: #5c3824;
    border-color: rgba(220, 160, 80, 0.4);
    box-shadow: 0 6px 14px rgba(200, 120, 40, 0.2);
}

.tutorial-btn-primary:active {
    transform: scale(0.97);
}

.tutorial-btn-ghost {
    background: #fffefb;
    color: #7b4a2e;
    border-color: rgba(220, 160, 80, 0.4);
}

.tutorial-btn[hidden] {
    display: none !important;
}

.tutorial-card.is-demo {
    max-height: none;
}

.tutorial-pulse-target {
    position: relative;
    z-index: 12002 !important;
    animation: tutorialTargetBounce 0.95s ease-in-out infinite;
}

body.tutorial-running .app-container,
body.tutorial-running .install-banner {
    pointer-events: none !important;
}

body.tutorial-running .tutorial-card,
body.tutorial-running .tutorial-card * {
    pointer-events: auto !important;
}

@media (max-width: 480px) {
    .tutorial-card {
        width: calc(100vw - 1rem);
        bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
        padding: 0.8rem 0.85rem 0.9rem;
    }

    .tutorial-actions {
        flex-direction: column-reverse;
    }

    .tutorial-btn {
        width: 100%;
        min-height: 50px;
    }
}

@keyframes tutorialPopIn {
    from { opacity: 0; transform: translateX(-50%) translateY(18px) scale(0.96); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes tutorialPopInTop {
    from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.96); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes tutorialRingPulse {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.35) inset,
            0 0 14px rgba(255, 200, 40, 0.35);
        border-color: #ffd24a;
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.5) inset,
            0 0 24px rgba(255, 210, 60, 0.65);
        border-color: #ffe066;
    }
}

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

@keyframes tutorialFingerBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ===== Level end overlay ===== */
.level-end-overlay {
    position: fixed;
    inset: 0;
    z-index: 13000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    background: rgba(40, 22, 10, 0.48);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.level-end-overlay[hidden] {
    display: none !important;
}

.level-end-card {
    position: relative;
    width: min(400px, 100%);
    text-align: center;
    padding: 1.4rem 1.15rem 1.2rem;
    border-radius: 1.5rem;
    background: linear-gradient(180deg, #fffefb 0%, #ffe9c4 100%);
    border: 2px solid rgba(230, 170, 90, 0.5);
    box-shadow: 0 22px 50px rgba(60, 30, 10, 0.28);
    color: #5c3824;
    overflow: hidden;
    animation: levelEndPop 0.45s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.mirza-level-complete-cinematic .level-end-card {
    animation: none;
    overflow: visible;
}

.level-end-burst {
    position: absolute;
    inset: -20% -10% auto;
    height: 55%;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 210, 60, 0.4), transparent 70%);
    pointer-events: none;
}

.level-end-kicker {
    margin: 0;
    font-weight: 800;
    color: #c09020;
    font-size: 0.8rem;
}

.level-end-card h2 {
    margin: 0.2rem 0 0.65rem;
    font-weight: 900;
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
}

.level-end-stars {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
    font-size: clamp(1.6rem, 7vw, 2.1rem);
    color: #d8c0a0;
}

.level-end-stars span {
    display: inline-block;
    transform: scale(0.4);
    opacity: 0;
}

.level-end-stars span.lit {
    color: #ffd24a;
    text-shadow: 0 0 12px rgba(255, 200, 40, 0.55);
    animation: levelStarPop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

.level-end-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin-bottom: 1.1rem;
}

.level-end-stat {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(230, 170, 90, 0.3);
    border-radius: 1rem;
    padding: 0.55rem 0.3rem;
}

.level-end-stat-label {
    display: block;
    font-size: 0.68rem;
    color: #8a5a38;
    margin-bottom: 0.15rem;
}

.level-end-stat-value {
    display: block;
    font-weight: 900;
    font-size: clamp(1rem, 4vw, 1.2rem);
    color: #5c3824;
}

.level-end-next {
    width: 100%;
    min-height: 52px;
}

@keyframes levelStarPop {
    to { opacity: 1; transform: scale(1); }
}

@keyframes levelEndPop {
    from { opacity: 0; transform: translateY(18px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 380px) {
    .level-end-stats {
        grid-template-columns: 1fr;
    }
}

/* ===== Full-bleed mobile game shell polish ===== */
@media (max-width: 576px) {
    body.mamosta-bright {
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    body.mamosta-bright .app-container {
        max-width: 100% !important;
        width: 100%;
        min-height: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    body.mamosta-bright .card-mamosta {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    body.mamosta-bright .header-persian {
        padding-top: max(0.55rem, env(safe-area-inset-top, 0px), var(--browser-ui-top, 0px)) !important;
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 0.65rem !important;
    }

    body.mamosta-bright .game-play-body {
        padding-bottom: 0.2rem !important;
    }

    body.mamosta-bright .letter-cell {
        min-width: 44px;
        min-height: 44px;
        touch-action: none;
    }

    body.mamosta-bright .btn-mamosta,
    body.mamosta-bright .btn-outline-mamosta,
    body.mamosta-bright .music-toggle {
        touch-action: manipulation;
        -webkit-user-select: none;
        user-select: none;
    }

    body.mamosta-bright .btn-mamosta:active,
    body.mamosta-bright .btn-outline-mamosta:active {
        transform: scale(0.96);
    }

    body.mamosta-bright .word-display {
        font-size: clamp(1.05rem, 5.5vw, 1.35rem) !important;
        min-height: 48px;
        padding: 0.55rem 0.85rem !important;
    }

    body.mamosta-bright .level-end-overlay,
    body.mamosta-bright .register-modal-backdrop {
        padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left)) !important;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    body.mamosta-bright {
        align-items: stretch !important;
    }

    body.mamosta-bright .app-container {
        min-height: 0;
        height: 100%;
    }

    body.mamosta-bright .header-persian {
        padding: 0.35rem 0.65rem !important;
        padding-top: max(0.35rem, env(safe-area-inset-top, 0px)) !important;
        padding-left: max(0.65rem, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(0.65rem, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 0.3rem !important;
    }

    body.mamosta-bright .kurdish-table-scene {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

@supports (padding: max(0px)) {
    body.mamosta-bright .game-header-top {
        padding-inline: 0;
    }
}

