/* ===== GUARDIÃO DA ÁGUA - ESTILOS CARTOON ===== */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Lilita One', cursive;
    /* A Lilita One só tem peso 400: qualquer bold/600+ nela vira um negrito falso, inventado pelo navegador,
       que borra a letra. Desligado no documento todo (fontes com negrito de verdade não são afetadas). */
    font-synthesis: none;
    background: linear-gradient(135deg, #00d4ff 0%, #0099ff 50%, #0066ff 100%);
    color: #ffffff;
    overflow: hidden;
    user-select: none;
}

/* ===== SISTEMA DE TELAS ===== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 10;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== TELA DE LOADING ===== */
#loading-screen {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 50%, #ffd93d 100%);
    flex-direction: column;
}

.loading-container {
    text-align: center;
    max-width: 500px;
    padding: 2rem;
}

.logo h1 {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: 5px 5px 0px #ff1744, 8px 8px 0px #000000;
    animation: float 3s ease-in-out infinite;
    font-weight: 900;
    -webkit-text-stroke: 1px #000000;
}

.logo p {
    font-size: 1.6rem;
    margin-bottom: 3rem;
    color: #fff;
    text-shadow: 3px 3px 0px #000000, 4px 4px 0px #ff1744;
    font-weight: bold;
    -webkit-text-stroke: 0.5px #000000;
}

.loading-bar {
    width: 100%;
    height: 12px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 4px solid #000000;
    box-shadow: 0 6px 0 #000000;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00ffff, #00ff88);
    border-radius: 8px;
    width: 0%;
    transition: width 0.3s ease;
    animation: shimmer 1.5s infinite;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.2);
}

.loading-tips {
    margin-top: 2rem;
    font-style: italic;
    font-size: 1.1rem;
    color: #fff;
    text-shadow: 2px 2px 0px #000000;
    font-weight: 700;
}

/* ===== MENU PRINCIPAL ===== */
#main-menu {
    background: linear-gradient(135deg, #ff6b9d 0%, #c471ed 50%, #12c2e9 100%);
}

.menu-container {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.menu-header h1 {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: 5px 5px 0px #ff1744, 8px 8px 0px #000000;
    animation: float 3s ease-in-out infinite;
    font-weight: 900;
    -webkit-text-stroke: 1px #000000;
}

/* Logo em SVG (assets/logo): o próprio desenho traz contorno, extrusão e sombra, então zera o visual de
   texto do h1 (.logo h1 / .menu-header h1). Largura limitada também pela altura, para caber em celular deitado. */
h1.game-logo {
    /* Pode passar da largura do .menu-container (centralizado pelo translate) */
    width: min(660px, 94vw, 70vh);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 0 0.75rem;
    line-height: 0;
    text-shadow: none;
    -webkit-text-stroke: 0;
    animation: none;
}

.game-logo > svg,
.game-logo__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1000 / 612;
}

.subtitle {
    font-size: 1.6rem;
    margin-bottom: 3rem;
    color: #fff;
    text-shadow: 3px 3px 0px #000000, 4px 4px 0px #ff1744;
    font-weight: bold;
    -webkit-text-stroke: 0.5px #000000;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.2rem 2.5rem;
    font-size: 1.4rem;
    border: 5px solid #000000;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 8px 0 #000000;
    position: relative;
    top: 0;
}

.menu-btn.primary {
    background: linear-gradient(135deg, #ff3838, #ff6b6b, #ff3838);
    color: #fff;
    text-shadow: 3px 3px 0px #000000;
}

.menu-btn.secondary {
    background: linear-gradient(135deg, #00ffff, #00d4ff, #00ffff);
    color: #000;
    text-shadow: 2px 2px 0px rgba(255,255,255,0.5);
}

.menu-btn:hover:not(:disabled) {
    top: 4px;
    box-shadow: 0 4px 0 #000000;
    transform: scale(1.05);
}

.menu-btn:active:not(:disabled) {
    top: 8px;
    box-shadow: 0 0px 0 #000000;
}

.menu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-icon {
    font-size: 1.8rem;
    filter: drop-shadow(2px 2px 0px #000000);
}

/* ===== TELA DO JOGO ===== */
#game-screen {
    display: none;
    position: relative;
}

#game-screen.active {
    display: block;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
}

#game-canvas:active {
    cursor: grabbing;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: linear-gradient(135deg, #ffd93d, #ffaf40);
    padding: 3rem;
    border-radius: 30px;
    text-align: center;
    box-shadow: 
        0 0 0 6px #000000,
        0 12px 0 #000000;
    max-width: 500px;
    border: 6px solid #000000;
}

.overlay-content h2 {
    margin-bottom: 2rem;
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 
        4px 4px 0px #ff1744,
        6px 6px 0px #000000;
    font-weight: 900;
    -webkit-text-stroke: 1px #000000;
}

.overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.overlay-btn {
    padding: 1.2rem 2.5rem;
    font-size: 1.3rem;
    border: 5px solid #000000;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 900;
    box-shadow: 0 6px 0 #000000;
    position: relative;
    top: 0;
}

.overlay-btn.primary {
    background: linear-gradient(135deg, #00ff88, #00ffcc);
    color: #000;
    text-shadow: 2px 2px 0px rgba(255,255,255,0.5);
}

.overlay-btn.secondary {
    background: linear-gradient(135deg, #ff6b9d, #ff8e9d);
    color: #fff;
    text-shadow: 2px 2px 0px #000000;
}

.overlay-btn:hover {
    top: 3px;
    box-shadow: 0 3px 0 #000000;
    transform: scale(1.05);
}

.overlay-btn:active {
    top: 6px;
    box-shadow: 0 0px 0 #000000;
}

/* ===== DIÁLOGOS (SweetAlert2 com o visual do overlay de pausa) ===== */
/* O popup já recebe .overlay-content e os botões .overlay-btn (ver gameDialog em GameUtils.js);
   aqui só se neutraliza o visual padrão do SweetAlert2, que tem a mesma especificidade. */
/* Acima de qualquer painel do jogo (o maior é 10001): confirmação nunca fica por baixo */
.swal2-container {
    z-index: 20000;
}

.swal2-container.swal2-backdrop-show {
    background: rgba(0, 0, 0, 0.85);
}

.swal2-popup.game-swal {
    background: linear-gradient(135deg, #ffd93d, #ffaf40);
    border: 6px solid #000000;
    border-radius: 30px;
    box-shadow: 0 0 0 6px #000000, 0 12px 0 #000000;
    padding: 2rem 2rem 2.5rem;
    width: min(500px, calc(100vw - 32px));
    font-family: 'Lilita One', cursive;
}

.swal2-popup.game-swal .swal2-title {
    margin-bottom: 0;
    padding: 0.5rem 0 0;
    font-size: 2rem;
    line-height: 1.15;
}

.swal2-popup.game-swal .swal2-html-container {
    color: #000000;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5;
}

/* Botões empilhados e da mesma largura, como no overlay de pausa */
.swal2-popup.game-swal .swal2-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
    width: 100%;
    max-width: 320px;
    margin: 1.5rem auto 0;
}

.swal2-popup.game-swal .swal2-actions .overlay-btn {
    margin: 0;
}

/* Resumo do jogo salvo no "Continuar?" da tela de perfis */
.swal2-popup.game-swal .save-summary {
    margin: 0.6rem 0;
    font-size: 1rem;
}

.swal2-popup.game-swal .swal2-icon {
    border-width: 5px;
    box-shadow: 0 4px 0 #000000;
    background: #ffffff;
}

.swal2-popup.game-swal .overlay-btn:focus-visible {
    outline: 4px solid #ffffff;
    outline-offset: 3px;
}

/* ===== ANIMAÇÕES ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1) rotate(-2deg); }
    50% { transform: scale(1.1) rotate(2deg); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(-2deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ===== UTILITÁRIOS ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-shadow {
    text-shadow: 3px 3px 0px #000000;
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #ffff00;
    border-radius: 10px;
    border: 3px solid #000000;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b9d, #c471ed);
    border-radius: 10px;
    border: 3px solid #000000;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff3838, #ff6b6b);
}