/* ============================================================
   Jogo da Consoante V2 — game.css
   Estilo baseado em memoria-vogais-v2 (gradiente roxo/rosa)
   ============================================================ */

:root {
    --primary:      #7B1FA2;
    --primary-dark: #4A148C;
    --accent:       #E91E63;
    --accent-light: #FCE4EC;
    --correct:      #43A047;
    --correct-bg:   #E8F5E9;
    --wrong:        #E53935;
    --wrong-bg:     #FFEBEE;
    --text-dark:    #333;
    --radius:       18px;
    --shadow:       0 8px 30px rgba(0,0,0,.15);
    --font-primary: 'Nunito', 'Fredoka One', sans-serif;
}

/* ---- Container principal ---- */
.game-container {
    background: linear-gradient(135deg, #7B1FA2 0%, #E91E63 100%);
    border-radius: var(--radius);
    padding: 30px 24px 24px;
    position: relative;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    min-height: 300px;
}

/* ---- Botão tela cheia ---- */
.fullscreen-btn {
    position: absolute;
    top: 16px; right: 16px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,.18);
    border: 2px solid rgba(255,255,255,.35);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: white;
    transition: background .2s, transform .2s;
    z-index: 10;
}
.fullscreen-btn:hover { background: rgba(255,255,255,.3); transform: scale(1.08); }

/* ============================================================
   SELEÇÃO DE NÍVEL
   ============================================================ */
.level-selection { text-align: center; padding: 20px 0 10px; }

.level-title {
    font-family: var(--font-primary);
    font-size: clamp(22px, 5vw, 30px);
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,.2);
    margin-bottom: 8px;
}
.level-subtitle {
    color: rgba(255,255,255,.85);
    font-size: 16px;
    margin-bottom: 28px;
}

.level-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.level-card {
    background: white;
    border-radius: 16px;
    padding: 22px 20px;
    width: 140px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    transition: transform .25s, box-shadow .25s;
    position: relative;
    overflow: hidden;
}
.level-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform .3s;
    transform-origin: left;
}
.level-card:hover::before { transform: scaleX(1); }
.level-card:hover { transform: translateY(-10px); box-shadow: 0 12px 28px rgba(0,0,0,.2); }

.level-icon {
    font-size: 42px;
    margin-bottom: 10px;
    animation: bounce 1.5s infinite;
}
.level-card:nth-child(2) .level-icon { animation-delay: .2s; }
.level-card:nth-child(3) .level-icon { animation-delay: .4s; }

.level-name {
    font-family: var(--font-primary);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
}
.level-info {
    font-size: 12px;
    color: #888;
}

@keyframes bounce {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* ============================================================
   JOGO EM ANDAMENTO
   ============================================================ */
.game-play { padding-top: 10px; }

.game-header {
    background: white;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 18px;
    box-shadow: 0 3px 12px rgba(0,0,0,.1);
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
    margin-bottom: 10px;
}
.stat-item {}
.stat-value {
    font-family: var(--font-primary);
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}
.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 2px;
}

/* Barra de progresso */
.progress-bar-wrap {
    background: #EDE7F6;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 8px;
    transition: width .4s ease;
    width: 0%;
}

/* ---- Área de pergunta ---- */
.question-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.image-card {
    background: white;
    border-radius: 20px;
    padding: 20px 28px;
    box-shadow: 0 4px 18px rgba(0,0,0,.12);
    text-align: center;
    min-width: 180px;
    animation: cardIn .4s ease;
    transition: box-shadow .2s, transform .2s, border-color .2s;
    border: 3px dashed transparent;
}

/* ---- Drop zone states ---- */
.drop-zone.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 6px rgba(123,31,162,.20);
    transform: scale(1.04);
    background: #F3E5F5;
}
.drop-zone.correct-drop {
    border-color: var(--correct);
    background: var(--correct-bg);
    animation: correctPop .4s ease;
}
.drop-zone.wrong-drop {
    border-color: var(--wrong);
    background: var(--wrong-bg);
    animation: shake .4s ease;
}

/* ---- Dica de drop ---- */
.drop-hint {
    font-size: 13px;
    color: #aaa;
    margin-top: 6px;
    pointer-events: none;
}
@keyframes cardIn {
    from { opacity: 0; transform: scale(.85); }
    to   { opacity: 1; transform: scale(1); }
}

.image-emoji {
    font-size: clamp(64px, 15vw, 100px);
    line-height: 1.1;
    margin-bottom: 8px;
}
.image-word {
    font-family: var(--font-primary);
    font-size: clamp(22px, 5vw, 30px);
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.question-label {
    color: rgba(255,255,255,.9);
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

/* ---- Opções de letras ---- */
.options-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.drag-tile {
    width: 72px; height: 72px;
    background: white;
    border: 4px solid transparent;
    border-radius: 16px;
    font-family: var(--font-primary);
    font-size: 36px;
    font-weight: 900;
    color: var(--primary-dark);
    cursor: grab;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    transition: transform .15s, background .2s, border-color .2s, box-shadow .2s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.drag-tile:hover {
    transform: scale(1.1) translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 22px rgba(123,31,162,.3);
}
.drag-tile:active            { transform: scale(.96); cursor: grabbing; }
.drag-tile.dragging          { opacity: .35; transform: scale(.95); cursor: grabbing; }

/* Estados de resposta na tile */
.drag-tile.correct {
    background: var(--correct-bg);
    border-color: var(--correct);
    color: var(--correct);
    animation: correctPop .4s ease;
}
.drag-tile.wrong-choice {
    background: var(--wrong-bg);
    border-color: var(--wrong);
    color: var(--wrong);
    animation: shake .4s ease;
}
.drag-tile.reveal {
    background: var(--correct-bg);
    border-color: var(--correct);
    color: var(--correct);
}

/* Clone flutuante (touch) */
.touch-clone {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: .88;
    transform: scale(1.18) rotate(3deg);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0,0,0,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-size: 36px;
    font-weight: 900;
    background: white;
    border: 4px solid var(--primary);
    color: var(--primary-dark);
}

@keyframes correctPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.25); }
    100% { transform: scale(1.1); }
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-8px); }
    40%     { transform: translateX(8px); }
    60%     { transform: translateX(-6px); }
    80%     { transform: translateX(6px); }
}

/* ---- Feedback ---- */
.feedback-msg {
    font-family: var(--font-primary);
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 6px rgba(0,0,0,.25);
    min-height: 30px;
    text-align: center;
    animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ---- Botões de ação ---- */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn-action {
    padding: 10px 22px;
    border: none;
    border-radius: 50px;
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.btn-action:hover  { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.btn-action:active { transform: scale(.97); }

.btn-restart { background: white; color: var(--primary); }
.btn-quit    { background: rgba(255,255,255,.18); color: white; border: 2px solid rgba(255,255,255,.4); }

/* ============================================================
   TELA DE RESULTADO
   ============================================================ */
.result-screen {
    text-align: center;
    padding: 10px;
    animation: zoomIn .45s ease;
    position: relative;
}
@keyframes zoomIn {
    from { opacity:0; transform:scale(.8); }
    to   { opacity:1; transform:scale(1); }
}

.result-title {
    font-family: var(--font-primary);
    font-size: clamp(28px, 7vw, 42px);
    font-weight: 900;
    color: white;
    text-shadow: 0 3px 10px rgba(0,0,0,.25);
    margin-bottom: 10px;
}
.result-stars {
    font-size: clamp(36px, 8vw, 52px);
    letter-spacing: 6px;
    margin-bottom: 8px;
    animation: starPop .6s ease .2s both;
}
@keyframes starPop {
    0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
    60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); }
}
.result-message {
    color: rgba(255,255,255,.9);
    font-size: 17px;
    margin-bottom: 20px;
}
.result-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.result-stat-card {
    background: white;
    border-radius: 14px;
    padding: 14px 20px;
    min-width: 90px;
    box-shadow: 0 3px 12px rgba(0,0,0,.1);
}
.result-stat-value {
    font-family: var(--font-primary);
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
}
.result-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---- Confete ---- */
#confettiContainer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: var(--radius);
}
.confetti-piece {
    position: absolute;
    animation: confettiFall 1.2s ease-in forwards;
}
@keyframes confettiFall {
    0%   { opacity:1; transform: translateY(0) rotate(0deg); }
    100% { opacity:0; transform: translateY(200px) rotate(360deg); }
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 480px) {
    .game-container    { padding: 20px 14px 18px; }
    .level-cards       { gap: 10px; }
    .level-card        { width: 110px; padding: 16px 12px; }
    .level-icon        { font-size: 32px; }
    .level-name        { font-size: 15px; }
    .game-stats        { grid-template-columns: repeat(4,1fr); }
    .stat-value        { font-size: 20px; }
    .drag-tile         { width: 60px; height: 60px; font-size: 28px; }
    .image-card        { padding: 16px; }
}

@media (max-width: 360px) {
    .drag-tile         { width: 52px; height: 52px; font-size: 24px; }
}

/* Tela cheia */
:fullscreen .game-container,
:-webkit-full-screen .game-container {
    border-radius: 0;
    min-height: 100vh;
    padding: 30px 20px;
}

/* Acessibilidade */
.drag-tile:focus { outline: 3px solid white; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    .level-card, .drag-tile, .image-card,
    .level-icon, .result-stars { animation: none; transition: none; }
}
