/* ========================================
   ESTOURANDO BALÕES - GAME CSS
   Jogo de Coordenação Motora
   Layout 2026 Compatible
   ======================================== */

:root {
    --balloon-red: #FF6B6B;
    --balloon-blue: #4ECDC4;
    --balloon-yellow: #FFE66D;
    --balloon-green: #95E1D3;
    --balloon-purple: #A8E6CF;
    --balloon-orange: #FFB347;
    --balloon-pink: #FF85B3;
    
    --game-primary: #FF6B6B;
    --game-secondary: #4ECDC4;
    --game-accent: #FFE66D;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ========================================
   GAME CONTAINER
   ======================================== */

.game-container {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: var(--shadow-lg);
    min-height: 600px;
    overflow: hidden;
}

/* Permite scroll na tela de resultado (mobile) */
.game-container.showing-results {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: unset;
}

/* Fullscreen Button */
.fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    z-index: 1000;
}

.fullscreen-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

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

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

/* ========================================
   LEVEL SELECTION
   ======================================== */

.level-selection {
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.level-title {
    font-family: var(--font-primary);
    font-size: 36px;
    font-weight: 800;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.level-subtitle {
    font-family: var(--font-secondary);
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
}

.level-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.level-card {
    background: white;
    border-radius: 20px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--game-primary), var(--game-secondary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.level-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.level-card:hover::before {
    transform: scaleX(1);
}

.level-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: bounce 1s ease-in-out infinite;
}

.level-card:nth-child(2) .level-icon {
    animation-delay: 0.2s;
}

.level-card:nth-child(3) .level-icon {
    animation-delay: 0.4s;
}

.level-name {
    font-family: var(--font-primary);
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 15px 0 10px;
}

.level-description {
    font-family: var(--font-secondary);
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.level-age {
    font-size: 20px;
    margin: 10px 0;
}

.level-info {
    font-family: var(--font-secondary);
    font-size: 14px;
    color: #999;
    font-style: italic;
}

/* ========================================
   GAME PLAY
   ======================================== */

.game-play {
    position: relative;
    animation: fadeIn 0.5s ease;
}

.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-family: var(--font-secondary);
    font-size: 14px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-primary);
    font-size: 32px;
    font-weight: 800;
    color: #764ba2;
    line-height: 1;
}

.stat-value.warning {
    color: #FF6B6B;
    animation: pulse 0.5s ease;
}

/* Game Area - Where balloons appear */
.game-area {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    min-height: 500px;
    overflow: hidden;
    cursor: crosshair;
}

/* Balloon Styling */
.balloon {
    position: absolute;
    cursor: pointer;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.balloon:hover .balloon-body {
    filter: brightness(1.08);
    transform: scale(1.07);
}

.balloon-body {
    position: relative;
    /* Forma clássica de balão: mais largo no topo, pontinha embaixo */
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: inset -8px -8px 16px rgba(0, 0, 0, 0.18),
                inset 6px 6px 14px rgba(255, 255, 255, 0.55),
                0 6px 18px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, filter 0.12s ease;
    /* Leve balanço lateral - não conflita com JS (que move via bottom) */
    animation: sway 2.8s ease-in-out infinite;
}

/* Balloon Colors */
.balloon.red .balloon-body {
    background: radial-gradient(circle at 30% 30%, #FFB8B8, var(--balloon-red));
}

.balloon.blue .balloon-body {
    background: radial-gradient(circle at 30% 30%, #A8E6E2, var(--balloon-blue));
}

.balloon.yellow .balloon-body {
    background: radial-gradient(circle at 30% 30%, #FFF4B8, var(--balloon-yellow));
}

.balloon.green .balloon-body {
    background: radial-gradient(circle at 30% 30%, #D4F1E8, var(--balloon-green));
}

.balloon.purple .balloon-body {
    background: radial-gradient(circle at 30% 30%, #E0F5E5, var(--balloon-purple));
}

.balloon.orange .balloon-body {
    background: radial-gradient(circle at 30% 30%, #FFD8A8, var(--balloon-orange));
}

.balloon.pink .balloon-body {
    background: radial-gradient(circle at 30% 30%, #FFC7DC, var(--balloon-pink));
}

/* Balloon Label (nome da cor) */
.balloon-label {
    position: absolute;
    bottom: 28%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-primary);
    font-weight: 900;
    text-align: center;
    pointer-events: none;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    line-height: 1.1;
    width: 88%;
    white-space: nowrap;
    overflow: hidden;
}

/* Nó do balão (triângulo na base do corpo) */
.balloon-knot {
    width: 0;
    height: 0;
    margin: 0 auto;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    /* border-top-color é definido inline via JS */
    flex-shrink: 0;
    filter: brightness(0.75);
}

/* Barbante do balão */
.balloon-string {
    width: 2px;
    background: rgba(80, 80, 80, 0.5);
    border-radius: 1px;
    /* height definido via JS */
}

/* Balloon Shine Effect */
.balloon-shine {
    position: absolute;
    top: 20%;
    left: 25%;
    width: 30%;
    height: 35%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    transform: rotate(-30deg);
}

/* Pop Animation */
@keyframes popBalloon {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.balloon.popping {
    animation: popBalloon 0.3s ease-out forwards;
    pointer-events: none;
}

/* Particles on Pop */
.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 20;
}

@keyframes explodeParticle {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.particle {
    animation: explodeParticle 0.6s ease-out forwards;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn-action {
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 700;
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pause {
    background: #FFE66D;
    color: #333;
}

.btn-pause:hover {
    background: #FFD93D;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-quit {
    background: #FF6B6B;
    color: white;
}

.btn-quit:hover {
    background: #FF5252;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   RESULT SCREEN
   ======================================== */

.result-screen {
    text-align: center;
    padding: 40px 20px;
    animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

.result-title {
    font-family: var(--font-primary);
    font-size: 42px;
    font-weight: 800;
    color: white;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.result-message {
    font-family: var(--font-secondary);
    font-size: 20px;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 40px;
    line-height: 1.6;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.result-stat {
    background: white;
    border-radius: 15px;
    padding: 25px 15px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.result-stat:hover {
    transform: translateY(-5px);
}

.result-stat-label {
    font-family: var(--font-secondary);
    font-size: 14px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.result-stat-value {
    font-family: var(--font-primary);
    font-size: 36px;
    font-weight: 800;
    color: #764ba2;
    line-height: 1;
}

.result-medal {
    font-size: 80px;
    margin: 30px 0;
    animation: rotate 2s linear infinite;
}

.result-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
}

.btn-restart {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-restart:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-levels {
    background: white;
    color: #764ba2;
}

.btn-levels:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes sway {
    0%, 100% { transform: rotate(-3deg); }
    50%       { transform: rotate( 3deg); }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        min-height: 500px;
    }

    .level-title {
        font-size: 28px;
    }

    .level-subtitle {
        font-size: 16px;
    }

    .level-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .level-icon {
        font-size: 50px;
    }

    .game-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-value {
        font-size: 24px;
    }

    .game-area {
        min-height: 400px;
    }

    .result-title {
        font-size: 32px;
    }

    .result-message {
        font-size: 16px;
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .result-stat {
        padding: 20px 10px;
    }

    .result-stat-value {
        font-size: 28px;
    }

    .fullscreen-btn {
        width: 45px;
        height: 45px;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 15px;
        border-radius: 15px;
    }

    .level-title {
        font-size: 24px;
    }

    .level-card {
        padding: 25px 15px;
    }

    .level-icon {
        font-size: 40px;
    }

    .level-name {
        font-size: 20px;
    }

    .game-header {
        padding: 15px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 20px;
    }

    .game-area {
        min-height: 350px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
        justify-content: center;
    }

    .result-screen {
        padding: 20px 12px;
    }

    .result-icon {
        font-size: 52px;
        margin-bottom: 10px;
    }

    .result-title {
        font-size: 26px;
        margin-bottom: 8px;
    }

    .result-message {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin: 16px 0;
    }

    .result-stat {
        padding: 14px 8px;
        border-radius: 12px;
    }

    .result-stat-label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .result-stat-value {
        font-size: 26px;
    }

    .result-medal {
        font-size: 44px;
        margin: 14px 0;
    }

    .result-buttons {
        flex-direction: column;
        margin-top: 16px;
        gap: 10px;
    }

    .btn-action {
        padding: 15px 25px;
    }
}

/* ========================================
   GAME SPECIFIC SIZES
   ======================================== */

/* Tamanhos de balão controlados dinamicamente por JS (LEVEL_CONFIG.balloonSize) */

/* ========================================
   PAUSED STATE
   ======================================== */

.game-area.paused {
    filter: blur(5px);
    pointer-events: none;
}

.pause-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.pause-overlay h3 {
    font-family: var(--font-primary);
    font-size: 32px;
    font-weight: 800;
    color: #764ba2;
    margin-bottom: 20px;
}

.pause-overlay button {
    margin: 10px;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.balloon:focus {
    outline: 3px solid #FFE66D;
    outline-offset: 5px;
}

.btn-action:focus {
    outline: 3px solid white;
    outline-offset: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .balloon-body {
        border: 3px solid black;
    }
    
    .stat-value {
        font-weight: 900;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01s !important;
    }
}

/* ========================================
   TARGET COLOR INDICATOR
   ======================================== */

.target-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: 12px;
    padding: 14px 20px;
    margin-top: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    border: 3px solid rgba(255, 255, 255, 0.5);
    transition: background 0.5s ease, box-shadow 0.5s ease;
}

.target-indicator.flash {
    animation: flashTarget 0.4s ease;
}

@keyframes flashTarget {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.target-label {
    font-family: var(--font-secondary);
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.target-balloon-preview {
    width: 44px;
    height: 55px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.25);
    flex-shrink: 0;
    transition: background 0.5s ease;
    position: relative;
}

.target-balloon-preview::after {
    content: '';
    position: absolute;
    top: 18%;
    left: 22%;
    width: 32%;
    height: 36%;
    background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, transparent 70%);
    border-radius: 50%;
}

.target-color-name {
    font-family: var(--font-primary);
    font-size: 28px;
    font-weight: 800;
    color: white;
    text-shadow: 1px 1px 6px rgba(0,0,0,0.3);
    min-width: 110px;
    text-align: left;
    transition: color 0.5s ease;
}

.color-countdown-wrap {
    font-family: var(--font-secondary);
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.color-countdown-wrap span:first-child {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
}

#colorCountdown {
    font-size: 20px;
    font-weight: 800;
    color: #FFE66D;
}

/* ========================================
   WRONG POP FEEDBACK
   ======================================== */

.balloon.wrong-pop {
    animation: wrongPop 0.35s ease;
}

@keyframes wrongPop {
    0%   { transform: translateX(0)    scale(1); filter: none; }
    15%  { transform: translateX(-8px) scale(1.05); filter: brightness(1.8) saturate(0.2) sepia(1) hue-rotate(-20deg); }
    30%  { transform: translateX( 8px) scale(1.05); filter: brightness(1.8) saturate(0.2) sepia(1) hue-rotate(-20deg); }
    50%  { transform: translateX(-5px) scale(1); }
    70%  { transform: translateX( 5px) scale(1); }
    100% { transform: translateX(0)    scale(1); filter: none; }
}

/* ========================================
   QUIT MODAL
   ======================================== */

.quit-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
    border-radius: 20px;
}

.quit-modal-box {
    background: white;
    border-radius: 20px;
    padding: 36px 32px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.quit-modal-box h3 {
    font-family: var(--font-primary);
    font-size: 24px;
    color: #5e4fa2;
    margin-bottom: 10px;
}

.quit-modal-box p {
    font-family: var(--font-secondary);
    font-size: 15px;
    color: #666;
    margin-bottom: 28px;
    line-height: 1.6;
}

.quit-modal-btns {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.btn-cancel-quit {
    background: #eee;
    color: #444;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel-quit:hover { background: #ddd; }

.btn-confirm-quit {
    background: #FF6B6B;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-confirm-quit:hover { background: #ee5555; }

/* Mobile tweaks */
@media (max-width: 480px) {
    .target-color-name { font-size: 22px; min-width: 88px; }
    .target-balloon-preview { width: 36px; height: 46px; }
    .target-label { font-size: 11px; }
}
