/* =============================================
   🎮 MINIGAMES HUB - ESTILOS
============================================= */

.games-section {
    background-color: var(--card-bg);
    border: 1px solid var(--brand-accent);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.8s ease 0.1s both;
    box-shadow: 0 0 20px rgba(0, 166, 81, 0.1);
}

.games-header { text-align: center; margin-bottom: 12px; }
.games-header h3 { font-size: 18px; color: var(--brand-accent); }
.games-header p { font-size: 12px; color: rgba(255,255,255,0.7); line-height: 1.4; }

/* Selector de Abas */
.game-selector-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.game-tab-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px; /* Caixinhas surpresa */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-border);
    border: 2px solid rgba(0, 166, 81, 0.2);
    color: var(--brand-light);
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}
.game-tab-btn.active, .game-tab-btn:hover {
    background-color: var(--brand-accent);
    color: var(--brand-dark);
    transform: scale(1.1);
    border-color: var(--brand-accent);
    box-shadow: 0 4px 10px rgba(0, 166, 81, 0.3);
}

.game-container {
    display: none;
    animation: fadeIn 0.4s ease;
}
.game-container.active {
    display: block;
}

/* Telas de Resultado Comuns */
.game-win-screen, .game-lose-screen {
    text-align: center; padding: 10px; background-color: rgba(0,0,0,0.6); border-radius: 8px;
    animation: fadeIn 0.4s ease;
    margin-top: 16px;
    display: none;
}
.game-win-screen h4 { font-size: 18px; color: var(--brand-accent); margin-bottom: 4px; }
.game-lose-screen h4 { font-size: 18px; color: #ff5252; margin-bottom: 4px; }
.game-win-screen p, .game-lose-screen p { font-size: 12px; margin-bottom: 12px; }

.game-coupon { 
    background-color: #ffeb3b; color: black; font-family: monospace; 
    font-size: 16px; font-weight: bold; padding: 8px; border-radius: 4px; 
    letter-spacing: 2px; display: inline-block; margin-bottom: 10px;
}
.game-restart-btn {
    background-color: #333; color: white; width: 100%; border: none; padding: 10px;
    font-family: var(--font-title); font-weight: bold; font-size: 12px;
    border-radius: 8px; cursor: pointer;
}

/* Mesas Comuns */
.game-table {
    background-color: #0d2b14; /* Cor de mesa de carteado/tabuleiro */
    border-radius: 12px;
    padding: 16px;
    border: 2px solid #081a0c;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    margin-bottom: 10px;
    position: relative;
    min-height: 200px;
}
.game-start-overlay {
    position: absolute; inset: 0; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(3px);
    display: flex; justify-content: center; align-items: center; z-index: 10;
    border-radius: 12px; transition: opacity 0.3s;
}
.game-start-overlay.hidden { display: none; }
.game-btn-primary { 
    background-color: var(--brand-accent); color: #000; padding: 12px 20px; font-size: 14px; 
    border: none; border-radius: 8px; font-family: var(--font-title); font-weight: 800; cursor: pointer;
}
.game-controls { display: flex; gap: 10px; justify-content: center; margin-top: 10px;}

/* -------------------------------------------
   JOGO 1: BLACKJACK
------------------------------------------- */
.bj-hand { margin-bottom: 16px; }
.bj-hand span { font-size: 12px; font-weight: bold; color: rgba(255,255,255,0.8); display: block; margin-bottom: 8px; font-family: var(--font-title); }
.cards-area { display: flex; gap: 8px; min-height: 70px; }
.bj-card {
    width: 48px; height: 68px;
    background-color: white; border-radius: 4px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: black; font-weight: bold; font-size: 16px; font-family: var(--font-inter);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3); position: relative; animation: bounceIn 0.3s ease;
}
.bj-card.red { color: #d32f2f; }
.bj-card.hidden { background-image: repeating-linear-gradient(45deg, #b71c1c 0, #b71c1c 5px, white 5px, white 10px); color: transparent; }
.bj-card::before { content: attr(data-suit); position: absolute; top: 4px; left: 4px; font-size: 10px; line-height: 1; }
.bj-card::after { content: attr(data-suit); position: absolute; bottom: 4px; right: 4px; font-size: 10px; line-height: 1; transform: rotate(180deg); }
.bj-card.hidden::before, .bj-card.hidden::after { display: none; }

.bj-btn { flex: 1; padding: 12px; border-radius: 8px; font-family: var(--font-title); font-weight: bold; font-size: 13px; cursor: pointer; transition: all 0.2s; border: none; }
.bj-btn.hit { background-color: var(--brand-accent); color: var(--brand-dark); }
.bj-btn.hit:hover { background-color: white; }
.bj-btn.stand { background-color: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }
.bj-btn.stand:hover { background-color: rgba(255,255,255,0.1); }

/* -------------------------------------------
   JOGO 2: JOGO DA VELHA
------------------------------------------- */
.ttt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 200px;
    margin: 0 auto;
}
.ttt-cell {
    aspect-ratio: 1;
    background-color: rgba(255,255,255,0.05);
    border: 2px solid rgba(0, 166, 81, 0.3);
    border-radius: 8px; display: flex; justify-content: center; align-items: center;
    font-size: 32px; cursor: pointer; font-family: var(--font-title);
    transition: background-color 0.2s;
}
.ttt-cell:hover { background-color: rgba(0, 166, 81, 0.1); }
.ttt-cell.x { color: var(--brand-accent); }
.ttt-cell.o { color: #f48fb1; }

/* -------------------------------------------
   JOGO 3: D20 — Design Premium
------------------------------------------- */
.d20-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0 8px;
}

.d20 {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
}

/* Forma principal do D20: 10 lados (decágono aproximado do icosahedro 2D) */
.d20-face {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #1e3a2f 0%, #0a1f14 50%, #071509 100%);
    clip-path: polygon(
        50% 0%, 80% 10%, 100% 35%, 100% 65%,
        80% 90%, 50% 100%, 20% 90%, 0% 65%,
        0% 35%, 20% 10%
    );
    border-radius: 4px;
    box-shadow:
        0 0 0 2px rgba(0, 166, 81, 0.6),
        0 0 20px rgba(0, 166, 81, 0.25),
        inset 0 2px 8px rgba(255, 255, 255, 0.05);
    transition: background 0.5s ease, box-shadow 0.5s ease;
}

/* Linhas internas do D20 (triângulos de face) via SVG embutido */
.d20-lines {
    position: absolute;
    inset: 0;
    clip-path: polygon(
        50% 0%, 80% 10%, 100% 35%, 100% 65%,
        80% 90%, 50% 100%, 20% 90%, 0% 65%,
        0% 35%, 20% 10%
    );
    opacity: 0.25;
}

.d20-lines::before,
.d20-lines::after {
    content: '';
    position: absolute;
    border-style: solid;
    border-color: rgba(0, 255, 100, 0.6);
}

/* Triângulo superior */
.d20-lines::before {
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 22px 38px 22px;
    border-color: transparent transparent rgba(0,200,80,0.5) transparent;
}

/* Triângulo inferior invertido */
.d20-lines::after {
    bottom: 14%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 38px 22px 0 22px;
    border-color: rgba(0,200,80,0.5) transparent transparent transparent;
}

/* Número no centro */
.d20-value {
    position: relative;
    z-index: 5;
    font-size: 34px;
    font-weight: 900;
    font-family: var(--font-title);
    color: white;
    text-shadow:
        0 0 10px rgba(0, 255, 100, 0.8),
        0 0 20px rgba(0, 200, 80, 0.5),
        0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: -1px;
    line-height: 1;
}

/* Borda decorativa giratória (efeito RPG) */
.d20::after {
    content: '';
    position: absolute;
    inset: -4px;
    clip-path: polygon(
        50% 0%, 80% 10%, 100% 35%, 100% 65%,
        80% 90%, 50% 100%, 20% 90%, 0% 65%,
        0% 35%, 20% 10%
    );
    background: conic-gradient(
        from 0deg,
        transparent 0%, rgba(0,166,81,0.8) 20%, transparent 35%,
        transparent 60%, rgba(0,220,100,0.6) 75%, transparent 90%
    );
    animation: d20border 4s linear infinite;
    z-index: -1;
}

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

/* Animação ao rolar: chacoalhar + girar */
.d20.rolling .d20-face {
    animation: d20shake 1.1s ease;
}

.d20.rolling .d20-value {
    animation: d20valueFlicker 1.1s ease;
}

@keyframes d20shake {
    0%  { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-15deg) scale(1.05); }
    20% { transform: rotate(20deg) scale(1.1); }
    35% { transform: rotate(-20deg) scale(1.15); }
    50% { transform: rotate(30deg) scale(1.1); }
    65% { transform: rotate(-15deg) scale(1.05); }
    80% { transform: rotate(10deg) scale(1.02); }
    100% { transform: rotate(0deg) scale(1); }
}

@keyframes d20valueFlicker {
    0%, 100% { opacity: 1; }
    25%, 75%  { opacity: 0.1; }
    50% { opacity: 0.5; }
}

/* Efeito crítico 20 — dourado */
.d20-face.critical {
    background: linear-gradient(145deg, #7a5000, #3d2800, #1a1000) !important;
    box-shadow:
        0 0 0 2px rgba(255, 200, 0, 0.9),
        0 0 30px rgba(255, 150, 0, 0.6),
        inset 0 2px 8px rgba(255, 200, 0, 0.1) !important;
}

/* Efeito vitória — verde */
.d20-face.win {
    background: linear-gradient(145deg, #0d3d1e, #062210, #020e06) !important;
    box-shadow:
        0 0 0 2px rgba(0, 220, 80, 0.9),
        0 0 30px rgba(0, 166, 81, 0.5) !important;
}

/* Efeito derrota — vermelho */
.d20-face.fail {
    background: linear-gradient(145deg, #3d0a0a, #200404, #0e0101) !important;
    box-shadow:
        0 0 0 2px rgba(220, 50, 50, 0.8),
        0 0 20px rgba(180, 30, 30, 0.4) !important;
}

/* -------------------------------------------
   JOGO 4: COPOS
------------------------------------------- */
.cups-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 16px;
    margin: 16px auto;
    width: 100%;
    max-width: 260px;
    position: relative;
}
.cup-wrapper {
    width: 70px;
    text-align: center;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    transition: transform 0.32s ease;
}
.cup {
    font-size: 40px; line-height: 1;
    display: block;
}
.cup-wrapper:hover .cup { transform: scale(1.08); }
.cup-ball {
    width: 16px; height: 16px;
    background: radial-gradient(circle at 35% 35%, #ffd700, #ff8f00);
    border-radius: 50%;
    margin: 6px auto 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 6px rgba(255,180,0,0.7);
}

/* Animações Globais */
@keyframes bounceIn { 0% { transform: scale(0.8); opacity: 0; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}
