/* ============================================
   GAME.CSS - TELA DO JOGO
   Responsivo e proporcional (max 6.9")
============================================ */

/* ============================================
   POSICIONAMENTO DO CANVAS
============================================ */
#game-ui-layer:not(.hidden)~#game-container,
body:has(#game-ui-layer:not(.hidden)) #game-container {
    background: #E0F2F1 !important;
}

/* ============================================
   UI DO JOGO - Layout Minimalista
============================================ */
#game-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: var(--max-app-width);
    max-height: var(--max-app-height);
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    padding: var(--space-xs);
    gap: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* ============================================
   1. HEADER - Score + Combo + Timer
============================================ */
/* ============================================
   1. HEADER - Score + Combo + Timer
============================================ */
.game-header {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 2px;
    padding: var(--space-sm);
    min-height: 55px;
    /* Reduzido de 70px */
}

.game-header .pause-btn,
.game-header .score-display,
.game-header .counter-item,
.game-header .level-badge,
.game-header .streak-indicator {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.game-header,
.game-header .score-label,
.game-header .score-value,
.game-header .counter-value,
.game-header .timer-value,
.game-header .level-label,
.game-header .level-value {
    color: white;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
    font-family: 'Luckiest Guy', cursive;
    /* FORCE LUCKY FONT */
}

/* Linha Superior: Pausa + Score + Timer */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.25);
    /* Consistent Glass */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: clamp(32px, 7vw, 38px);
    /* Reduzido de 38-46px para 32-38px */
    height: clamp(32px, 7vw, 38px);
    border-radius: 10px;
    /* Reduzido de 12px */
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    /* Reduzido */
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 3px;
    /* Visual center fix */
}

.pause-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.4);
}

.level-badge {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    /* Gold Gradient */
    color: #5d4037;
    padding: 3px 12px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    box-shadow: 0 3px 0 #b36b00, 0 5px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
}

.level-label {
    font-size: 0.6rem;
    font-weight: 400;
    color: #5d4037;
    text-shadow: none;
    letter-spacing: 0.5px;
}

.level-value {
    font-size: 1.2rem;
    font-weight: 400;
    color: #5d4037;
    text-shadow: none;
}

/* --- SECAO DE SCORE E COMBO --- */
.score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.score-display {
    background: rgba(0, 0, 0, 0.2);
    /* Darker contrast for score */
    padding: 4px 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-family: 'Poppins', sans-serif;
    /* Keep label simple */
    font-weight: 700;
}

.score-value {
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.5rem;
    color: #fff;
    /* White text */
    line-height: 1;
    text-shadow: 0 2px 0 #000;
    transition: transform 0.2s, color 0.2s;
}

.score-value.score-pop {
    transform: scale(1.3);
    color: #FFD700;
}

/* --- COMBO DISPLAY --- */
.combo-display {
    background: linear-gradient(135deg, #F59E0B, #EAB308);
    padding: 2px 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    animation: combo-bounce 0.4s ease;
    margin-top: 4px;
}

.combo-display.hidden {
    display: none;
}

.combo-value {
    font-family: 'Luckiest Guy', cursive;
    font-size: 1rem;
    color: white;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.combo-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    font-family: 'Poppins', sans-serif;
}

@keyframes combo-bounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

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

@keyframes combo-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.combo-display.active {
    animation: combo-pulse 0.6s ease infinite;
}


.counter-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 3px;
    /* Reduzido de 4px */
    border-radius: 50%;
    width: 36px;
    /* Reduzido de 44px */
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 #ccc, 0 4px 4px rgba(0, 0, 0, 0.2);
    /* Reduzido */
    /* 3D effect */
    flex-shrink: 0;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    margin: 0 3px;
    /* Reduzido de 4px */
}

.counter-item:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #ccc;
}

.counter-item:disabled {
    opacity: 0.6;
    filter: grayscale(1);
    cursor: not-allowed;
}



.counter-icon {
    font-size: 1rem;
    /* Reduzido de 1.2rem */
    margin-bottom: -2px;
}

.counter-value {
    font-family: 'Luckiest Guy', cursive;
    color: #5d4037;
    font-size: 0.7rem;
    /* Reduzido de 0.8rem */
    text-shadow: none;
}

/* --- STREAK INDICATOR --- */
.streak-indicator {
    background: linear-gradient(135deg, var(--danger), #F97316);
    padding: 3px var(--space-xs);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.streak-icon {
    font-size: clamp(0.75rem, 3vw, 0.9rem);
}

.streak-value {
    font-weight: 800;
    color: white;
    font-size: clamp(0.75rem, 3vw, 0.9rem);
}

/* --- TIMER CIRCULAR --- */
.game-timer {
    flex-shrink: 0;
}

.timer-circle {
    position: relative;
    width: clamp(32px, 8vw, 40px);
    /* Reduzido de 36-46px para 32-40px */
    height: clamp(32px, 8vw, 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timer-bonus-label {
    font-size: clamp(0.4rem, 1.8vw, 0.5rem);
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    line-height: 1;
}


.timer-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
}

.timer-ring-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1s linear, stroke 0.3s;
}

.timer-value {
    font-family: 'Luckiest Guy', cursive;
    font-weight: 400;
    color: #5d4037;
    font-size: clamp(0.7rem, 3vw, 0.9rem);
    position: relative;
    z-index: 1;
    text-shadow: none;
}

/* Timer States */
.game-timer.warning .timer-ring-progress {
    stroke: var(--warning);
}

.game-timer.warning .timer-value {
    color: var(--warning);
}

.game-timer.critical .timer-ring-progress {
    stroke: var(--danger);
}

.game-timer.critical .timer-value {
    color: var(--danger);
    animation: pulse-timer 0.5s infinite;
}

.game-timer.critical {
    animation: shake 0.5s infinite;
}

@keyframes pulse-timer {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes shake {

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

    25% {
        transform: translateX(-2px);
    }

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

@keyframes boost-animation {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

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

.game-timer.boost-animation .timer-ring-progress {
    stroke: var(--primary);
    animation: boost-animation 0.5s ease;
}

/* --- BONUS POPUP --- */
.bonus-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--primary), #00D2FF);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: 800;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 201, 167, 0.4);
    animation: bonus-popup-anim 1.5s ease forwards;
    z-index: 1000;
    pointer-events: none;
}

.bonus-popup .bonus-type {
    font-size: clamp(0.6rem, 2.5vw, 0.75rem);
    opacity: 0.9;
    margin-bottom: 3px;
}

.bonus-popup .bonus-value {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
}

@keyframes bonus-popup-anim {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    30% {
        transform: translate(-50%, -50%) scale(1);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -70%) scale(0.8);
    }
}

/* --- PONTOS FLUTUANTES --- */
.floating-points {
    position: absolute;
    pointer-events: none;
    font-weight: 800;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: float-up 1s ease forwards;
    z-index: 999;
}

.floating-points.combo {
    color: var(--warning);
    font-size: clamp(1rem, 4vw, 1.2rem);
}

.floating-points.bonus {
    color: var(--accent);
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
}

/* ============================================
   2. CENTRO - Area do Grid
============================================ */
.game-area-spacer {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ============================================
   3. PALAVRAS - Lista Compacta
============================================ */
/* ============================================
   3. PALAVRAS (Lista) - COMPACTA
============================================ */
/* ============================================
   3. PALAVRAS (Lista) - COMPACTA
============================================ */
.words-section {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px 8px;
    /* Reduzido padding vertical */
    border-radius: 12px;
    margin-bottom: 4px;
    /* Reduzido margem */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.4);
    pointer-events: auto;
    width: 95%;
    /* Garante que não encoste nas bordas */
    margin-left: auto;
    margin-right: auto;
}

.words-label {
    font-family: 'Poppins', sans-serif;
    font-size: 0.65rem;
    /* Levemente menor */
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
    /* Reduzido */
    text-align: left;
    /* Alinhado a esquerda para acompanhar o scroll se quiser, ou center */
    padding-left: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    display: block;
    /* Garante linha própria */
}

.words-grid {
    display: flex;
    flex-wrap: wrap;
    /* Permitir quebra de linha */
    gap: 6px;
    justify-content: center;
    /* Centralizar os itens */
    /* Remove scroll horizontal */
    overflow-x: hidden;
    padding-bottom: 0;
}

/* Removemos a regra de scrollbar antiga pois não é mais scroll */

.word-item {
    background: #fff;
    padding: 3px 8px;
    /* Mais compacto ainda */
    border-radius: 12px;
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.1rem;
    /* Aumentado de 0.75rem */
    color: #5d4037;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-bottom: 2px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
    white-space: nowrap;
    /* Não quebra linha DENTRO da palavra */
    flex-shrink: 0;
    line-height: 1;
    /* Altura de linha ajustada */
}

.word-item.found {
    background: #4ADE80;
    color: #065f46;
    border-bottom-color: #22c55e;
    transform: scale(1.05);
    /* Leve destaque */
    opacity: 1;
    text-decoration: none;
}

.word-item.pop-in {
    animation: wordPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.word-item.fade-out {
    animation: wordFadeOut 0.5s ease forwards;
}

@keyframes wordPopIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }

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

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

    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-10px);
    }
}

/* ============================================
   4. RODAPÉ (Banner) - MÍNIMO
============================================ */
.game-footer {
    width: 100%;
    flex-shrink: 0;
}

.ad-banner {
    background: #F3F4F6;
    border: 1px dashed #D1D5DB;
    border-radius: 10px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-label {
    color: #9CA3AF;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 2px;
}

/* ============================================
   5. RESPONSIVIDADE
============================================ */

@media (max-height: 700px) {

    .words-section {
        padding: 5px 8px;
        margin-bottom: 4px;
    }

    .words-label {
        font-size: 0.6rem;
        margin-bottom: 3px;
    }

    .word-item {
        padding: 2px 8px;
        font-size: 0.7rem;
    }

    .ad-banner {
        height: 35px;
    }
}

@media (max-height: 600px) {
    .words-label {
        display: none;
    }

    .ad-banner {
        height: 30px;
    }

    /* ============================================
       DEFINITION MODAL
    ============================================ */
    .definition-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .definition-overlay.visible {
        opacity: 1;
        pointer-events: all;
    }

    .definition-box {
        background: #fff;
        padding: 20px;
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        width: 90%;
        max-width: 380px;
        text-align: center;
        position: relative;
        transform: scale(0.9);
        transition: transform 0.3s ease;
    }

    .definition-overlay.visible .definition-box {
        transform: scale(1);
    }

    .definition-close-btn {
        position: absolute;
        top: 5px;
        right: 10px;
        background: none;
        border: none;
        font-size: 24px;
        color: #9CA3AF;
        cursor: pointer;
    }

    .definition-word {
        font-family: 'Poppins', sans-serif;
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--primary);
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .definition-text {
        font-size: 0.9rem;
        color: #4B5563;
        line-height: 1.5;
        margin-bottom: 10px;
    }

    /* ============================================
       CATEGORY MODE - DEFINITION BOX STYLES
    ============================================ */
    .definition-box-category {
        padding: 10px;
        text-align: center;
    }

    .definition-label {
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--text-light);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 5px;
    }

    .definition-text-category {
        font-size: clamp(0.8rem, 3vw, 1rem);
        font-weight: 700;
        /* Bolder */
        color: #111827;
        /* Darker (almost black) */
        line-height: 1.4;
    }

    .category-progress-bar {
        width: 100%;
        background-color: #e0e0e0;
        border-radius: 5px;
        height: 10px;
        margin-top: 8px;
    }

    .category-progress-fill {
        width: 0%;
        height: 100%;
        background-color: var(--primary);
        border-radius: 5px;
        transition: width 0.5s ease-in-out;
    }

    .hints-box {
        margin-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .hint-item {
        background: rgba(0, 0, 0, 0.05);
        padding: 5px 8px;
        border-radius: 6px;
        font-size: 0.7rem;
        color: #4B5563;
        font-style: italic;
    }
}

/* ============================================
   UI REFINEMENTS FOR CATEGORY MODE
============================================ */
#game-ui-layer.category-mode .game-header {
    background-image: none !important;
    background-color: transparent !important;
    padding-top: 5px;
    /* Reduced padding top */
    padding-bottom: 2px;
    min-height: auto;
    border: none;
    box-shadow: none;
}

#game-ui-layer.category-mode .header-top-row {
    justify-content: space-between;
    width: 100%;
    align-items: flex-start;
    /* Align closer to top */
}

/* Enlarge Buttons for better touch targets (REDUCED 40% FROM PREVIOUS LARGE SIZE) */
#game-ui-layer.category-mode .pause-btn {
    width: clamp(34px, 9vw, 42px);
    height: clamp(34px, 9vw, 42px);
    font-size: clamp(1rem, 3.5vw, 1.4rem);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

#game-ui-layer.category-mode .skip-btn {
    width: clamp(40px, 11vw, 50px);
    /* Still slightly emphasized */
    height: clamp(40px, 11vw, 50px);
    font-size: clamp(1.2rem, 4.5vw, 1.6rem);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    border: 2px solid #3B82F6;
    color: #3B82F6;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

#game-ui-layer.category-mode .skip-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 1);
}

#game-ui-layer.category-mode .skip-btn.hidden {
    display: none;
}

#game-ui-layer.category-mode .hint-counter {
    width: clamp(36px, 9.5vw, 44px);
    height: clamp(36px, 9.5vw, 44px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #FBBF24;
    box-shadow: 0 3px 8px rgba(251, 191, 36, 0.3);
}

#game-ui-layer.category-mode .hint-counter .counter-icon {
    font-size: clamp(1rem, 3.5vw, 1.3rem);
}

#game-ui-layer.category-mode .hint-counter .counter-value {
    font-size: clamp(0.6rem, 2.5vw, 0.8rem);
    font-weight: 800;
}

/* Push the definition box down but closer to header as requested */
#game-ui-layer.category-mode .words-section {
    margin-top: 5px;
    /* Minimal top margin to pull definition UP */
    margin-bottom: 40px;
    /* Keep strict bottom margin for grid */
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.06);
}

/* ============================================
   WORD NOTIFICATION POPUP
============================================ */
/* ============================================
   WORD NOTIFICATION POPUP
============================================ */
.word-notification {
    position: absolute;
    top: 50%;
    /* Centralizado verticalmente */
    left: 50%;
    transform: translate(-50%, -50%);
    /* Centralização exata */
    width: 90%;
    max-width: 400px;
    background: #FFFFFF;
    /* Fundo branco sólido */
    padding: 18px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    /* Sombra mais forte */
    text-align: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid var(--primary);
    /* Borda na cor primária para destaque */
}

.word-notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.word-notification h3 {
    margin: 0 0 8px 0;
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.word-notification p {
    margin: 0;
    color: #000000;
    /* Preto absoluto para contraste máximo */
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.word-notification.hidden {
    display: none;
}