/* =====================
   GAME — LAYOUT
   ===================== */
.game-layout
{
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    padding: 0 1rem;
    overflow: hidden;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--fern) transparent;
}

.game-layout::-webkit-scrollbar
{
    width: 3px;
}

.game-layout::-webkit-scrollbar-track
{
    background: transparent;
}

.game-layout::-webkit-scrollbar-thumb
{
    background: var(--fern);
    border-radius: 99px;
}

.game-header
{
    flex-shrink: 0;
    padding: 16px 0 8px;
}

.game-word-card
{
    flex-shrink: 0;
}

.game-options-wrap
{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 10px 8px;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    background: rgba(61, 92, 46, 0.04);
    border-radius: 10px;
    border: 1px solid var(--border);
    margin: 4px 0 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--fern) transparent;
}

body.dark-mode .game-options-wrap
{
    background: rgba(141, 184, 122, 0.04);
}

.game-options-wrap::-webkit-scrollbar
{
    width: 4px;
}

.game-options-wrap::-webkit-scrollbar-track
{
    background: transparent;
}

.game-options-wrap::-webkit-scrollbar-thumb
{
    background: var(--fern);
    border-radius: 99px;
}

.game-footer
{
    flex-shrink: 0;
    padding: 8px 0 16px;
}

/* =====================
   GAME — HEADER BUTTONS
   ===================== */
.header-container
{
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
}

.header-left
{
    display: flex;
    justify-content: flex-start;
}

.header-center
{
    display: flex;
    justify-content: center;
    text-align: center;
}

.header-right
{
    display: flex;
    justify-content: flex-end;
}

.game-return-btn
{
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-body);
    padding: 6px 12px;
    transition: 0.2s;
}

.game-return-btn:hover
{
    border-color: var(--muted);
    color: var(--muted);
}

.game-hint-btn
{
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 5px 12px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: 0.2s;
    position: relative;
    /* ← add this */
    overflow: visible;
}

.game-hint-btn:hover
{
    border-color: var(--muted);
}

.game-hint-btn:disabled
{
    cursor: not-allowed;
}

/* Hint XP float */
.hint-xp-float
{
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--terracotta);
    pointer-events: none;
    white-space: nowrap;
    animation: hintFloatUp 1.8s ease-out forwards;
    z-index: 10;
}

@keyframes hintFloatUp
{
    0%
    {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    60%
    {
        opacity: 0.8;
        transform: translate(-12px, -20px) scale(1.15);
    }

    100%
    {
        opacity: 0;
        transform: translate(-24px, -40px) scale(0.8);
    }
}

/* =====================
   GAME — WORD CARD
   ===================== */
.word-card
{
    background: var(--moss);
    border-radius: 10px;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    padding: 1rem 1rem 0.8rem;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Tap cue */
.word-card:active
{
    opacity: 0.85;
}

.word-card:hover
{
    opacity: 0.92;
}

/* Ripple effect */
.word-card-ripple
{
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: wordRipple 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes wordRipple
{
    to
    {
        transform: scale(14);
        opacity: 0;
    }
}

.word-card::before
{
    content: '';
    position: absolute;
    right: -24px;
    top: -24px;
    width: 160px;
    height: 160px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='70' rx='8' ry='30' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2'/%3E%3Cellipse cx='50' cy='70' rx='8' ry='30' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2' transform='rotate(40 50 70)'/%3E%3Cellipse cx='50' cy='70' rx='8' ry='30' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2' transform='rotate(80 50 70)'/%3E%3Cellipse cx='50' cy='70' rx='8' ry='30' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2' transform='rotate(120 50 70)'/%3E%3C/svg%3E") center/contain no-repeat;
    pointer-events: none;
}

.word-card::after
{
    content: '';
    position: absolute;
    left: -16px;
    bottom: -16px;
    width: 100px;
    height: 100px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='30' rx='6' ry='24' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='2'/%3E%3Cellipse cx='50' cy='30' rx='6' ry='24' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='2' transform='rotate(60 50 30)'/%3E%3Cellipse cx='50' cy='30' rx='6' ry='24' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='2' transform='rotate(120 50 30)'/%3E%3C/svg%3E") center/contain no-repeat;
    pointer-events: none;
}

.word-card-word
{
    font-family: var(--font-title), var(--font-arabic);
    font-size: 2.4rem;
    font-weight: 700;
    color: #e8f0e0;
    line-height: 1.9;
    letter-spacing: -0.02em;
    text-align: center;
    padding: 0.5rem 0 0;
}

.word-card-word.arabic-text
{
    font-family: var(--font-arabic), var(--font-title);
    font-size: 2.4rem;
    line-height: 1.9;
    text-align: center;
}

/* Speaker indicator — bottom-right, clickable (SVG icon) */
.word-card-speaker
{
    position: absolute;
    bottom: 0.6rem;
    right: 0.8rem;
    width: 26px;
    height: 26px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    z-index: 1;
    background-color: color-mix(in srgb, var(--color-text-on-structure) 35%, #fff 65%);
    -webkit-mask: url('/res/images/speaker.svg') center / contain no-repeat;
    mask: url('/res/images/speaker.svg') center / contain no-repeat;
}

.word-card-speaker:hover
{
    background-color: #fff;
}

.word-card-speaker:active
{
    opacity: 0.7;
}

/* Score — top-right */
.word-card-score
{
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--color-text-on-structure);
    pointer-events: none;
}

.word-card-lives
{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: 1rem;
    opacity: 1;
    line-height: 1.1;
    pointer-events: none;
}





/* =====================
   GAME — OPTIONS
   ===================== */
.game-options
{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

.option-btn
{
    flex: 1 1 calc(50% - 5px);
    min-height: 68px;
}

.option-btn
{
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 10px;
    font-family: var(--font-body);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    transition: all 0.18s;
    position: relative;
    overflow: hidden;
}

.option-btn:hover
{
    transform: translateY(-2px);
    border-color: var(--fern);
}

.option-btn:active
{
    opacity: 0.85;
}

.option-btn.correct
{
    background: var(--moss);
    border-color: var(--moss);
    color: #e8f0e0;
    animation: bloomIn 0.3s ease;
}

.option-btn.wrong
{
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: #fff5ee;
    animation: shakeWrong 0.35s ease;
}

/* =====================
   GAME — FIELD PROGRESS
   ===================== */
.field-progress
{
    width: 100%;
}

.field-progress-top
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.field-progress-label
{
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-progress-pct
{
    font-size: 0.70rem;
    color: var(--muted);
    font-family: var(--font-mono);
}

.field-progress-bar-wrap
{
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-progress-bar
{
    flex: 1;
    height: 6px;
    background: rgba(61, 92, 46, 0.1);
    border-radius: 99px;
    overflow: visible;
    position: relative;
}

body.dark-mode .field-progress-bar
{
    background: rgba(141, 184, 122, 0.1);
}

.field-progress-fill
{
    height: 100%;
    background: linear-gradient(90deg, var(--fern), var(--sprout));
    border-radius: 99px;
    position: relative;
    transition: width 0.8s ease-out;
}

.field-progress-fill::after
{
    content: '🌾';
    position: absolute;
    right: -8px;
    top: -10px;
    font-size: 0.85rem;
    transform: translateX(50%);
}

/* =====================
   GAME — DEATH MODAL
   ===================== */
.death-overlay
{
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 8, 0.82);
    /* backdrop-filter removed — expensive on mid-range Android GPU */
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeOverlay 0.25s ease;
}

.death-card
{
    background: #0f1a12;
    border-radius: 10px;
    padding: 32px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 28rem;
    animation: slideUpCard 0.3s ease-out;
}

.death-icon
{
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.death-title
{
    font-family: var(--font-title);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.death-sub
{
    font-size: 0.75rem;
    color: var(--color-text-on-structure);
    font-style: italic;
    margin-bottom: 6px;
}

.death-answer-label
{
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-on-structure);
    margin-bottom: 4px;
    margin-top: 16px;
}

.death-answer
{
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--color-text-on-structure);
    margin-bottom: 20px;
}

.death-btn
{
    width: 100%;
    background: var(--card);
    color: var(--text);
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: 0.2s;
    position: relative;
    z-index: 1;
}

.death-btn:hover
{
    background: var(--card);
    transform: translateY(-1px);
}

/* =====================
   STREAK BADGE
   ===================== */
.streak-badge
{
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--muted);
    background: rgba(184, 92, 40, 0.1);
    border: 1px solid rgba(184, 92, 40, 0.2);
    border-radius: 99px;
    padding: 3px 10px;
    letter-spacing: 0.04em;
    animation: badgePop 0.3s ease-out;
    white-space: nowrap;
}

body.dark-mode .streak-badge
{
    background: rgba(212, 120, 74, 0.12);
    border-color: rgba(212, 120, 74, 0.25);
}

/* =====================
   EXIT CONFIRM OVERLAY
   ===================== */
.exit-confirm-overlay
{
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 8, 0.82);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeOverlay 0.25s ease;
}

.exit-confirm-card
{
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 24px;
    text-align: center;
    width: 100%;
    max-width: 24rem;
    animation: slideUpCard 0.3s ease-out;
}

.exit-confirm-title
{
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.exit-confirm-sub
{
    font-size: 0.8rem;
    color: var(--muted);
    font-style: italic;
    margin-bottom: 20px;
    line-height: 1.5;
}

.exit-confirm-actions
{
    display: flex;
    gap: 8px;
}

.exit-confirm-actions .btn-continue-primary,
.exit-confirm-actions .btn-continue-ghost
{
    flex: 1;
    background: var(--action);
    color: var(--action-text);
    border: none;
    border-radius: 10px;
    padding: 12px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: all 0.2s;
}

.exit-confirm-actions .btn-continue-ghost
{
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.exit-confirm-actions .btn-continue-primary:hover { filter: brightness(1.1); }
.exit-confirm-actions .btn-continue-ghost:hover { border-color: var(--muted); }

/* =====================
   GARDEN MOMENT POPUP
   ===================== */
.garden-moment-overlay
{
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeOverlay 0.3s ease;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

/* Overlay background per state */
.gm-overlay--bloom
{
    background: radial-gradient(circle at center, rgba(10, 45, 20, 0.85) 0%, rgba(2, 18, 5, 0.95) 100%);
}

.gm-overlay--wrong
{
    background: radial-gradient(circle at center, rgba(50, 10, 10, 0.85) 0%, rgba(20, 2, 2, 0.95) 100%);
}

.gm-overlay--gameover
{
    background: radial-gradient(circle at center, rgba(55, 15, 15, 0.88) 0%, rgba(25, 3, 3, 0.95) 100%);
}

/* Decorative floating leaves */
.gm-leaves
{
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.gm-leaf
{
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.3;
    animation: floatLeaf 8s ease-in-out infinite;
}

.gm-leaf--1
{
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.gm-leaf--2
{
    bottom: 15%;
    right: 8%;
    animation-delay: -4s;
    font-size: 2rem;
}

.gm-leaf--3
{
    top: 40%;
    left: 80%;
    animation-delay: -6s;
    font-size: 1.8rem;
}

@keyframes floatLeaf
{

    0%,
    100%
    {
        transform: translateY(0) rotate(0deg);
        opacity: 0.25;
    }

    50%
    {
        transform: translateY(-30px) rotate(15deg);
        opacity: 0.45;
    }
}

/* Glass card */
.garden-moment-card
{
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 28rem;
    border-radius: 10px;
    padding: 36px 28px 28px;
    text-align: center;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: cardRise 0.5s ease-out both;
    overflow: hidden;
}

/* Shine effect (moves on hover) */
.gm-shine
{
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.garden-moment-card:hover .gm-shine
{
    opacity: 1;
}

/* State tints */
.state--bloom
{
    background: rgba(20, 50, 30, 0.75);
    border-color: rgba(100, 200, 120, 0.3);
}

.state--budding
{
    background: rgba(60, 25, 30, 0.75);
    border-color: rgba(255, 120, 120, 0.3);
}

.state--wilt
{
    background: rgba(50, 20, 30, 0.8);
    border-color: rgba(200, 100, 120, 0.35);
    animation: cardRise 0.7s ease-out both;
    /* slower entrance */
}

@keyframes cardRise
{
    from
    {
        opacity: 0;
        transform: translateY(30px);
    }

    to
    {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icon */
.garden-moment-icon
{
    font-size: 3.5rem;
    margin-bottom: 12px;
    display: block;
}

.state--bloom .garden-moment-icon
{
    animation: bloomIcon 0.7s ease-out 0.15s both;
}

.state--bloom .garden-moment-btn:hover
{
    background: rgba(80, 160, 100, 0.25);
    border-color: rgba(100, 200, 120, 0.4);
}

.state--budding .garden-moment-icon
{
    animation: shakeIcon 0.5s ease-out 0.1s both;
}

.state--wilt .garden-moment-icon
{
    animation: fallIcon 0.8s ease-out 0.1s both;
}

@keyframes bloomIcon
{
    0%
    {
        transform: translateY(20px);
        opacity: 0;
    }

    100%
    {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shakeIcon
{
    0%
    {
        transform: translateX(-6px);
    }

    25%
    {
        transform: translateX(6px);
    }

    50%
    {
        transform: translateX(-4px);
    }

    75%
    {
        transform: translateX(4px);
    }

    100%
    {
        transform: translateX(0);
    }
}

@keyframes fallIcon
{
    0%
    {
        transform: translateY(-20px) rotate(-10deg);
        opacity: 0;
    }

    100%
    {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

/* Title & sub */
.garden-moment-title
{
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.garden-moment-sub
{
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    font-style: italic;
    margin-bottom: 14px;
    line-height: 1.4;
}

/* Arabic word */
.garden-moment-word
{
    font-family: var(--font-arabic);
    font-size: 2.6rem;
    color: #fff;
    margin-bottom: 24px;
    line-height: 1.9;
    animation: wordGlow 0.5s ease-out 0.4s both;
}

@keyframes wordGlow
{
    from
    {
        opacity: 0;
        filter: blur(4px);
    }

    to
    {
        opacity: 1;
        filter: blur(0);
    }
}

/* Streak badge inside garden-moment */
.garden-moment-streak
{
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--sun);
    margin-bottom: 16px;
    letter-spacing: 0.06em;
    animation: streakAppear 0.5s ease-out 0.5s both;
}

@keyframes streakAppear
{
    from
    {
        opacity: 0;
        transform: scale(0.8);
    }

    to
    {
        opacity: 1;
        transform: scale(1);
    }
}

/* Button */
.garden-moment-btn
{
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all 0.25s ease;
    position: relative;
    z-index: 1;
}

.garden-moment-btn:hover
{
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.garden-moment-btn:active
{
    transform: translateY(1px);
    background: rgba(255, 255, 255, 0.1);
}

.garden-moment-btn:focus-visible
{
    outline: 2px solid #8db87a;
    outline-offset: 3px;
}

.garden-moment-actions
{
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.garden-moment-btn--ghost
{
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
}

.garden-moment-btn--ghost:hover
{
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: none;
}

/* Listen icon */
.listen-icon
{
    width: 64px;
    height: 64px;
    margin: 0.5rem auto;
    display: block;
    transition: opacity 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    background-color: color-mix(in srgb, var(--color-text-on-structure) 35%, #fff 65%);
    -webkit-mask: url('/res/images/speaker.svg') center / contain no-repeat;
    mask: url('/res/images/speaker.svg') center / contain no-repeat;
}

.listen-icon--playing
{
    animation: listenPulse 0.8s ease-in-out infinite;
}

@keyframes listenPulse
{
    0%
    {
        opacity: 1;
        transform: scale(1);
    }

    50%
    {
        opacity: 0.6;
        transform: scale(0.85);
    }

    100%
    {
        opacity: 1;
        transform: scale(1);
    }
}