/* ============================================================
   CESE Kids — Quem é Quem  |  style.css
   Mesma estética do Jogo da Memória
   ============================================================ */

html { overflow-x: hidden; max-width: 100vw; }

:root {
    --bg-color: #1a0a40;
    --text-primary: #f8fafc;
    --text-secondary: #c4b5fd;
    --card-bg: rgba(40, 18, 85, 0.78);
    --card-back: linear-gradient(135deg, #f97316 0%, #fbbf24 100%);
    --card-border: rgba(255, 255, 255, 0.14);
    --glass-bg: rgba(22, 8, 58, 0.82);
    --glass-border: rgba(255, 255, 255, 0.07);
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --success: #22c55e;
    --gold: #f59e0b;
    --danger: #ef4444;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(rgba(255,255,255,0.055) 1px, transparent 1px);
    background-size: 38px 38px;
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex; flex-direction: column;
    overflow-x: hidden; max-width: 100vw;
    position: relative;
}

/* Confetti */
#confetti-canvas {
    position: fixed; inset: 0; width: 100vw; height: 100vh;
    pointer-events: none; z-index: 500; display: none;
}

/* Toast */
.encourage-toast {
    position: fixed; top: 1.4rem; left: 50%;
    transform: translateX(-50%) translateY(-90px);
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff; padding: .65rem 1.75rem; border-radius: 50px;
    font-size: 1.05rem; font-weight: 700; z-index: 490;
    pointer-events: none; white-space: nowrap; opacity: 0;
    transition: transform .4s cubic-bezier(.175,.885,.32,1.275), opacity .35s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 2px rgba(34,197,94,.4);
}
.encourage-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.encourage-toast.error {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 2px rgba(239,68,68,.4);
}

/* Background blobs */
.background-shapes { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.shape {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35;
    animation: floatBlob 18s ease-in-out infinite;
}
.shape-1 { width: 380px; height: 380px; background: #f97316; top: -120px; left: -120px; }
.shape-2 { width: 420px; height: 420px; background: #818cf8; bottom: -140px; right: -140px; animation-delay: -6s; }
.shape-3 { width: 300px; height: 300px; background: #22c55e; top: 40%; left: 50%; animation-delay: -12s; }
@keyframes floatBlob {
    0%,100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(40px,-30px) scale(1.08); }
}

/* Container */
.container {
    width: 100%; max-width: 1100px; margin: 0 auto;
    padding: 1.2rem 1rem 2rem; display: flex; flex-direction: column; gap: 1.2rem;
}

.back-link {
    align-self: flex-start;
    color: var(--text-secondary); text-decoration: none;
    font-weight: 600; padding: .4rem .9rem; border-radius: 999px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
    transition: background .2s ease, color .2s ease;
}
.back-link:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Header */
header {
    display: flex; flex-direction: column; gap: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px; padding: 1.2rem 1.4rem;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 14px 40px rgba(0,0,0,.4);
}
.header-logo-title { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.header-logo-title h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 800;
    background: linear-gradient(135deg, #f97316, #fbbf24);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem;
}
.stat-box {
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px; padding: .7rem .5rem;
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    text-align: center;
}
.stat-icon { font-size: 1.4rem; }
.stat-box .label { font-size: .75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.stat-box .value { font-size: 1.1rem; font-weight: 800; }

.header-buttons {
    display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center;
}
.btn {
    border: none; cursor: pointer; font-family: inherit; font-weight: 700;
    padding: .65rem 1.1rem; border-radius: 14px;
    font-size: .95rem; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
    display: inline-flex; align-items: center; gap: .35rem;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.primary-btn {
    background: linear-gradient(135deg, #f97316, #fbbf24);
    color: #1a0a40; box-shadow: 0 8px 22px rgba(249,115,22,.35);
}
.primary-btn:disabled {
    opacity: .5; cursor: not-allowed; transform: none;
}
.secondary-btn {
    background: rgba(255,255,255,.08); color: #fff;
    border: 1px solid rgba(255,255,255,.12);
}
.restart-btn {
    background: rgba(239,68,68,.18); color: #fecaca;
    border: 1px solid rgba(239,68,68,.35);
}

/* Clue panel */
.glass-panel {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 24px; padding: 1.4rem;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 14px 40px rgba(0,0,0,.4);
}
.clue-panel { display: flex; flex-direction: column; gap: .7rem; min-height: 110px; }
.clue-title {
    font-size: 1.1rem; font-weight: 800; color: #fbbf24;
    display: flex; align-items: center; gap: .4rem;
}
.clue-title::before { content: "💡"; }
.clue-list { list-style: none; display: flex; flex-direction: column; gap: .55rem; }
.clue-list li {
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    border-left: 4px solid var(--accent);
    padding: .7rem 1rem; border-radius: 12px;
    font-size: 1rem; line-height: 1.4;
    animation: clueIn .4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes clueIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}
.clue-empty { color: var(--text-secondary); font-style: italic; }

/* Character board */
.char-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    max-width: 100%;
}
.char-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    box-shadow: 0 10px 26px rgba(0,0,0,.35);
    display: flex; flex-direction: column;
    aspect-ratio: 3 / 4;
    position: relative;
}
.char-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 18px 38px rgba(129,140,248,.45);
}
.char-card img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.char-card.correct {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(34,197,94,.5), 0 18px 38px rgba(34,197,94,.5);
    animation: pulseWin .6s ease;
}
.char-card.wrong {
    border-color: var(--danger);
    animation: shakeWrong .45s ease;
    opacity: .45;
    pointer-events: none;
}
.char-card.disabled { pointer-events: none; opacity: .55; }
@keyframes pulseWin { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shakeWrong {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Modal */
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(8, 4, 24, .75); backdrop-filter: blur(6px);
    padding: 1rem; animation: fadeIn .25s ease;
}
.modal.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    max-width: 480px; width: 100%; text-align: center;
    display: flex; flex-direction: column; gap: 1rem;
    animation: popIn .4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header h2 {
    font-size: 1.8rem; font-weight: 800;
    background: linear-gradient(135deg, #f97316, #fbbf24);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal-subtitle { color: var(--text-secondary); margin-top: .3rem; }
.how-to-play {
    display: flex; flex-direction: column; gap: .5rem; margin: .5rem 0;
}
.how-item {
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    padding: .65rem 1rem; border-radius: 12px;
    display: flex; align-items: center; gap: .6rem;
    font-weight: 600; text-align: left;
}
.how-item span { font-size: 1.3rem; }
.score-table {
    display: grid; grid-template-columns: 1fr 1fr; gap: .4rem;
    font-size: .9rem; color: var(--text-secondary);
    background: rgba(255,255,255,.04); padding: .8rem; border-radius: 12px;
}
.score-table strong { color: #fbbf24; }

/* Victory modal */
.victory-panel { padding: 2rem 1.5rem; }
.victory-h2 {
    font-size: 2rem; font-weight: 800;
    background: linear-gradient(135deg, #22c55e, #fbbf24);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-char-img {
    width: 140px; height: auto; margin: 0 auto;
    border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.victory-level-text { font-size: 1.3rem; font-weight: 800; color: #fbbf24; }
.stars-display { display: flex; justify-content: center; gap: .4rem; font-size: 2.2rem; }
.star-icon { filter: grayscale(1) opacity(.35); transition: filter .4s ease, transform .4s ease; }
.star-icon.earned { filter: none; transform: scale(1.15); animation: starPop .5s ease; }
@keyframes starPop { 0% { transform: scale(.5); } 60% { transform: scale(1.35); } 100% { transform: scale(1.15); } }
.victory-message { color: var(--text-secondary); font-weight: 600; }
.victory-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .5rem;
}
.v-stat {
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    padding: .7rem; border-radius: 12px;
    display: flex; flex-direction: column; gap: .15rem; align-items: center;
}
.v-stat-icon { font-size: 1.4rem; }
.v-stat-label { font-size: .75rem; color: var(--text-secondary); text-transform: uppercase; }
.v-stat-value { font-size: 1.2rem; font-weight: 800; }
.victory-buttons { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

.game-footer {
    margin-top: 1rem; padding: 1rem; text-align: center;
    color: var(--text-secondary); font-size: .85rem;
    display: flex; justify-content: center; gap: .6rem; align-items: center;
}

/* Mobile tweaks */
@media (max-width: 540px) {
    .stats { grid-template-columns: repeat(3, 1fr); }
    .stat-box .value { font-size: .95rem; }
    .char-board { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
    .header-buttons .btn { font-size: .85rem; padding: .55rem .8rem; }
}
