/*
 * NOME DA IMAGEM V2 — game.css
 * Mobile-First | EducaJogos 2026
 */

/* ══════════════════════════════════════
   BOTÃO TELA CHEIA
══════════════════════════════════════ */
.fullscreen-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.25s ease;
    z-index: 1000;
}

.fullscreen-btn:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.fullscreen-btn svg {
    color: #5e4fa2;
    transition: transform 0.3s ease;
}

.fullscreen-btn:hover svg {
    transform: rotate(90deg);
}

/* ══════════════════════════════════════
   GAME CONTAINER (wrapper geral)
══════════════════════════════════════ */
.game-container {
    background: linear-gradient(135deg, #f3f0ff 0%, #e8f4fd 100%);
    border-radius: 20px;
    padding: 20px 16px;
    position: relative;
    overflow: hidden;
    min-height: 420px;
    box-shadow: 0 4px 20px rgba(94, 79, 162, 0.12);
    margin-bottom: 24px;
}

/* ══════════════════════════════════════
   TELA DE SELEÇÃO DE CATEGORIA
══════════════════════════════════════ */
.category-screen {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.category-title {
    font-size: 22px;
    font-weight: 800;
    color: #5e4fa2;
    margin-bottom: 6px;
    font-family: 'Nunito', sans-serif;
}

.category-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 480px;
    margin: 0 auto 14px;
}

.category-card {
    background: #fff;
    border: 2px solid #e0d6ff;
    border-radius: 16px;
    padding: 18px 12px 14px;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(94,79,162,0.08);
}

.category-card:hover,
.category-card:active {
    background: #5e4fa2;
    border-color: #5e4fa2;
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(94,79,162,0.3);
}

.category-card:hover .category-icon-emoji,
.category-card:hover .category-name,
.category-card:active .category-icon-emoji,
.category-card:active .category-name {
    color: #fff !important;
}

.category-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.category-icon-emoji {
    font-size: 40px;
    display: block;
    margin-bottom: 6px;
    line-height: 1;
}

.category-name {
    font-size: 15px;
    font-weight: 700;
    color: #5e4fa2;
    font-family: 'Nunito', sans-serif;
}

.category-todos {
    max-width: 480px;
    margin: 0 auto;
}

.category-todos .category-card {
    padding: 14px 12px;
    background: linear-gradient(90deg, #5e4fa2, #3b8fd4);
    border-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.category-todos .category-card:hover {
    background: linear-gradient(90deg, #4a3d8f, #2d7abf);
    transform: translateY(-2px);
}

.category-todos .category-name,
.category-todos .category-icon-emoji {
    color: #fff !important;
    font-size: 16px;
}

.category-todos .category-icon-emoji {
    font-size: 22px;
    margin-bottom: 0;
}

/* ══════════════════════════════════════
   TELA DO JOGO — progress + stats
══════════════════════════════════════ */
.game-screen {
    animation: fadeIn 0.3s ease;
}

.game-progress-wrap {
    margin-bottom: 14px;
}

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

.progress-label {
    font-size: 13px;
    font-weight: 700;
    color: #5e4fa2;
    font-family: 'Nunito', sans-serif;
}

.hints-info {
    font-size: 13px;
    color: #666;
    font-family: 'Nunito', sans-serif;
}

.hints-info strong {
    color: #e65100;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #e0d6ff;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5e4fa2, #3b8fd4);
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════
   ÁREA DA IMAGEM
══════════════════════════════════════ */
.word-image-area {
    text-align: center;
    margin-bottom: 18px;
    position: relative;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-image {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transition: opacity 0.3s ease, transform 0.3s ease;
    object-fit: contain;
    background: #fff;
    padding: 6px;
}

.word-image.new-image {
    animation: imagePop 0.4s ease;
}

.image-loading-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    animation: spin 1s linear infinite;
    display: none;
}

/* ══════════════════════════════════════
   CAIXAS DE LETRAS
══════════════════════════════════════ */
.letter-boxes-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.letter-boxes-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
    font-family: 'Nunito', sans-serif;
}

.letter-boxes {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 4px;
}

/* Tamanho das caixas por comprimento da palavra */
.letter-boxes.boxes-large  .letter-box { width: 62px; height: 72px; font-size: 28px; }
.letter-boxes.boxes-medium .letter-box { width: 50px; height: 60px; font-size: 24px; }
.letter-boxes.boxes-small  .letter-box { width: 42px; height: 52px; font-size: 19px; }
.letter-boxes.boxes-tiny   .letter-box { width: 34px; height: 44px; font-size: 16px; }

.letter-box {
    width: 50px;
    height: 60px;
    border: 2px solid #c4b5e8;
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: 'Nunito', 'Arial', sans-serif;
    color: #5e4fa2;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    box-shadow: 0 2px 6px rgba(94,79,162,0.08);
    user-select: none;
}

.letter-box .box-content {
    color: #bbb;
    font-size: 22px;
}

/* Estado active (próxima a ser preenchida) */
.letter-box.active {
    border-color: #5e4fa2;
    border-width: 2.5px;
    box-shadow: 0 0 0 3px rgba(94,79,162,0.18);
}

/* Preenchida corretamente */
.letter-box.filled .box-content {
    color: #5e4fa2;
}

/* Completa (palavra concluída) */
.letter-box.complete {
    background: #4caf50;
    border-color: #388e3c;
    animation: completeBounce 0.3s ease;
}
.letter-box.complete .box-content {
    color: #fff;
}

/* Erro (letra errada) */
.letter-box.wrong-flash {
    animation: wrongShake 0.35s ease;
    border-color: #f44336 !important;
    background: #fff0f0 !important;
}

/* Dica revelada */
.letter-box.hint-reveal {
    animation: hintPop 0.4s ease;
    border-color: #2196f3;
    background: #e3f2fd;
}
.letter-box.hint-reveal .box-content {
    color: #1565c0;
}

/* Bounce ao acertar letra */
.letter-box.bounce {
    animation: letterBounce 0.3s ease;
}

/* Input oculto que captura teclado */
.hidden-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    top: 0;
    left: 0;
    border: none;
    outline: none;
    pointer-events: none;
    font-size: 16px; /* evita zoom em iOS */
}

/* ══════════════════════════════════════
   BOTÕES DE AÇÃO NO JOGO
══════════════════════════════════════ */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-hint {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 3px 10px rgba(25,118,210,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-hint:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(25,118,210,0.4);
}

.btn-hint:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-quit-game {
    background: #fff;
    color: #999;
    border: 2px solid #ddd;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.18s;
}

.btn-quit-game:hover {
    border-color: #f44336;
    color: #f44336;
}

/* Flash verde de acerto de palavra sobre o jogo */
.word-success-overlay {
    position: absolute;
    inset: 0;
    background: rgba(76, 175, 80, 0.15);
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.word-success-overlay.show {
    opacity: 1;
}

/* ══════════════════════════════════════
   TELA DE RESULTADO
══════════════════════════════════════ */
.result-screen {
    text-align: center;
    padding: 10px 8px;
    animation: fadeIn 0.4s ease;
}

.result-screen.showing-results {
    overflow-y: auto;
    overflow-x: hidden;
}

.stars-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
}

.star-item {
    font-size: 48px;
    line-height: 1;
    transform: scale(0);
    opacity: 0;
    display: inline-block;
    transition: none;
}

.star-item.earned {
    animation: starPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.star-item.earned:nth-child(1) { animation-delay: 0.1s; }
.star-item.earned:nth-child(2) { animation-delay: 0.25s; }
.star-item.earned:nth-child(3) { animation-delay: 0.4s; }

.result-title {
    font-size: 24px;
    font-weight: 800;
    color: #5e4fa2;
    margin: 0 0 6px;
    font-family: 'Nunito', sans-serif;
}

.result-message {
    font-size: 16px;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
    font-family: 'Nunito', sans-serif;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 380px;
    margin: 0 auto 24px;
}

.result-stat {
    background: #fff;
    border-radius: 12px;
    padding: 12px 8px;
    box-shadow: 0 2px 8px rgba(94,79,162,0.1);
}

.result-stat-label {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.result-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #5e4fa2;
    font-family: 'Nunito', sans-serif;
    line-height: 1;
}

.result-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-replay {
    background: linear-gradient(135deg, #5e4fa2, #7b68c8);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 4px 14px rgba(94,79,162,0.35);
}
.btn-replay:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(94,79,162,0.45);
}

.btn-categories {
    background: #fff;
    color: #5e4fa2;
    border: 2px solid #c4b5e8;
    border-radius: 50px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.18s;
}
.btn-categories:hover {
    background: #f3f0ff;
    border-color: #5e4fa2;
}

/* ══════════════════════════════════════
   ANIMAÇÕES
══════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes imagePop {
    0%   { transform: scale(0.85); opacity: 0; }
    60%  { transform: scale(1.04); }
    100% { transform: scale(1);    opacity: 1; }
}

@keyframes wrongShake {
    0%   { transform: translateX(0);    background: #fff0f0; }
    20%  { transform: translateX(-7px); }
    40%  { transform: translateX( 7px); }
    60%  { transform: translateX(-5px); }
    80%  { transform: translateX( 5px); }
    100% { transform: translateX(0);    background: #fff; }
}

@keyframes letterBounce {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

@keyframes completeBounce {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes hintPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

@keyframes starPop {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.3) rotate(5deg); opacity: 1; }
    100% { transform: scale(1)  rotate(0deg); opacity: 1; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ══════════════════════════════════════
   RESPONSIVE — tablet 600px+
══════════════════════════════════════ */
@media (min-width: 600px) {
    .game-container { padding: 28px 28px; }

    .category-title { font-size: 26px; }

    .word-image { max-width: 220px; max-height: 220px; }
    .word-image-area  { min-height: 240px; }

    /* Caixas maiores em telas maiores */
    .letter-boxes.boxes-large  .letter-box { width: 72px; height: 82px; font-size: 34px; }
    .letter-boxes.boxes-medium .letter-box { width: 60px; height: 70px; font-size: 28px; }
    .letter-boxes.boxes-small  .letter-box { width: 50px; height: 62px; font-size: 24px; }
    .letter-boxes.boxes-tiny   .letter-box { width: 42px; height: 54px; font-size: 20px; }

    .result-stats { grid-template-columns: repeat(3, 1fr); }
    .result-stat-value { font-size: 30px; }
}

@media (min-width: 900px) {
    .word-image { max-width: 260px; max-height: 260px; }
    .word-image-area  { min-height: 280px; }
}
