* {
    box-sizing: border-box;
    user-select: none;
}

body {
    background: #c8b896;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeBlend in='SourceGraphic' mode='multiply'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)' opacity='0.18'/%3E%3C/svg%3E"),
        linear-gradient(160deg, #d6c49e 0%, #b8a07a 40%, #c4aa82 70%, #a89060 100%);
    font-family: 'Segoe UI', 'Roboto', 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

/* ==================== MENU INICIAL ==================== */

.menu-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
    width: 100%;
}

.menu-card {
    background: rgba(0, 0, 0, 0.45);
    border-radius: 48px;
    padding: 56px 64px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    border: 2px solid rgba(233, 200, 145, 0.25);
    max-width: 480px;
    width: 100%;
}

.menu-logo {
    font-size: 5rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(255,215,0,0.4));
}

.menu-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #f9e0a0;
    margin: 0 0 6px;
    letter-spacing: 1px;
}

.menu-subtitle {
    font-size: 1rem;
    color: #a8c8a0;
    margin: 0 0 28px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.menu-name-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 32px;
}

.menu-name-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #c9a55b;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.menu-name-input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(233,200,145,0.35);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f9e0a0;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
    caret-color: #f9e0a0;
}

.menu-name-input::placeholder {
    color: rgba(249,224,160,0.35);
    font-weight: 400;
}

.menu-name-input:focus {
    border-color: #c9a55b;
    background: rgba(255,255,255,0.13);
}

.menu-color-picker {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 4px 0;
}

.menu-color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    outline: none;
    padding: 0;
}

.menu-color-btn:hover {
    transform: scale(1.15);
}

.menu-color-btn.selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.4), 0 2px 8px rgba(0,0,0,0.5);
    transform: scale(1.15);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.menu-buttons-group {
    display: flex;
    flex-direction: column !important;
    gap: 18px;
    width: 100%;
}

#menuModeButtons {
    flex-direction: column !important;
    gap: 18px;
    width: 100%;
}

.menu-btn {
    background: linear-gradient(135deg, #9c27b0, #6a1b9a);
    border: none;
    border-radius: 60px;
    padding: 18px 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 6px 20px rgba(156,39,176,0.4);
    width: 100%;
}

.menu-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 28px rgba(156,39,176,0.6);
    background: linear-gradient(135deg, #ab47bc, #7b1fa2);
}

.menu-btn-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.menu-btn-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

/* ==================== ECRÃ DE JOGO ==================== */

.game-screen {
    width: 100%;
    max-width: 1500px;
}

.game-wrapper {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

.game-main {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 48px;
    padding: 20px;
    box-shadow: 0 25px 40px rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

/* ==================== MESA DE JOGO ==================== */

.game-table {
    background:
        repeating-linear-gradient(
            92deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.04) 2px,
            rgba(0,0,0,0.04) 4px
        ),
        repeating-linear-gradient(
            180deg,
            rgba(255,255,255,0.03) 0px,
            rgba(255,255,255,0.03) 1px,
            transparent 1px,
            transparent 8px
        ),
        linear-gradient(160deg, #6b3d1e 0%, #4a2610 40%, #5c3318 70%, #3d1f0c 100%);
    border-radius: 64px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,200,120,0.15);
    border: 2px solid #2a1408;
}

.center-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* Última carta — sem caixa, igual ao baralho/descarte */
.current-card-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.card-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #a0b890;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.current-card {
    background: #fcf3da;
    border-radius: 12px;
    min-width: 90px;
    width: 90px;
    height: 126px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    font-size: 1.4rem;
    font-weight: 300;
    font-family: monospace;
    color: #8a7a5a;
}

.current-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    display: block;
}

.current-card.highlight {
    animation: cardFlash 0.5s ease-in-out 3;
    transform: scale(1.1);
}

@keyframes cardFlash {
    0%   { box-shadow: 0 0 0 0 #ffd966; }
    50%  { box-shadow: 0 0 0 15px #ffd966; background: #fff3cf; }
    100% { box-shadow: 0 0 0 0 #ffd966; }
}

.round-history {
    background: #3e2a1fe6;
    border-radius: 20px;
    padding: 12px 20px;
    color: #ffdd99;
    text-align: center;
    font-weight: bold;
    flex: 1;
    min-width: 300px;
}

.history-title {
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.history-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-top: 5px;
    min-height: 160px;
}

.history-card {
    background: transparent;
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    width: 108px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #d4af37;
    overflow: hidden;
    flex-shrink: 0;
}

.history-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.current-card.highlight-pirata {
    animation: cardFlashPirata 0.5s ease-in-out 3;
    transform: scale(1.1);
}

@keyframes cardFlashPirata {
    0%   { box-shadow: 0 0 0 0 #9c27b0; }
    50%  { box-shadow: 0 0 0 15px #9c27b0; }
    100% { box-shadow: 0 0 0 0 #9c27b0; }
}

.history-card.pirata-simulado {
    border: 2px solid #9c27b0;
    box-shadow: 0 0 10px rgba(156,39,176,0.6);
}

.discard-pile {
    background: #3e2a1f;
    border-radius: 20px;
    padding: 10px 18px;
    color: #ffdd99;
    text-align: center;
    font-weight: bold;
    min-width: 110px;
    font-size: 0.9rem;
}

/* ==================== JOGADORES ==================== */








.player-card {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.012 0.018' numOctaves='5' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.18'/%3E%3C/feComponentTransfer%3E%3CfeBlend in='SourceGraphic' mode='overlay'/%3E%3C/filter%3E%3Crect width='600' height='400' fill='%23e8d9be' filter='url(%23n)'/%3E%3C/svg%3E"),
        repeating-linear-gradient(
            128deg,
            rgba(255,255,255,0.18) 0px,
            rgba(255,255,255,0.0)  6px,
            rgba(210,185,140,0.22) 12px,
            rgba(255,255,255,0.12) 18px,
            rgba(220,195,155,0.10) 24px,
            rgba(255,255,255,0.0)  30px
        ),
        linear-gradient(160deg, #d4c5a0 0%, #c5b48a 50%, #cec09a 100%);
    border-radius: 24px;
    padding: 10px 12px 8px;
    width: 100%;
    backdrop-filter: blur(8px);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    border: 3px solid #c9a55b;
    box-shadow: 0 8px 12px black;
    box-sizing: border-box;
}

.player-card.active-turn {
    border-color: #ffd966;
    box-shadow: 0 0 0 3px #ffb347, 0 10px 20px black;
}

.player-card.bot-thinking {
    border-color: #ff6b6b;
    animation: pulse 1s ease-in-out infinite;
}

/* Bucaneiro: mesmo rebordo base que os outros, cor diferente só quando ativo */
.player-card.bucaneiro.active-turn {
    border-color: #ffd966;
    box-shadow: 0 0 0 3px #c45c00, 0 10px 20px black;
}

.player-card.bucaneiro.bot-thinking {
    border-color: #c45c00;
    animation: pulseBucaneiro 1s ease-in-out infinite;
}

@keyframes pulseBucaneiro {
    0%   { box-shadow: 0 0 0 0 rgba(196,92,0,0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(196,92,0,0); }
    100% { box-shadow: 0 0 0 0 rgba(196,92,0,0); }
}

/* ===== CORES DE JOGADOR ===== */
/* Amarelo (padrão humano) */
.cor-amarelo .player-card       { border-color: #c9a55b; }
.cor-amarelo .player-card.active-turn { border-color: #ffd966; box-shadow: 0 0 0 3px #ffb347, 0 10px 20px black; }
.cor-amarelo .treasure-card     { border-color: rgba(245,176,66,0.65); box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(245,176,66,0.1); }
.cor-amarelo .slot.filled       { border-color: #d49a2a; box-shadow: 0 3px 10px rgba(245,176,66,0.5); }

/* Vermelho (Marujo) */
.cor-vermelho .player-card      { border-color: #8b2020; }
.cor-vermelho .player-card.active-turn { border-color: #ff4444; box-shadow: 0 0 0 3px #cc2222, 0 10px 20px black; }
.cor-vermelho .player-card.bot-thinking { border-color: #ff4444; }
.cor-vermelho .treasure-card    { border-color: rgba(220,50,50,0.75); box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(220,50,50,0.15); }
.cor-vermelho .slot.filled      { border-color: #cc2222; box-shadow: 0 3px 10px rgba(220,50,50,0.5); }

/* Azul marinho claro (Bucaneiro) */
.cor-azul .player-card          { border-color: #1a4a7a; }
.cor-azul .player-card.active-turn { border-color: #4a9edd; box-shadow: 0 0 0 3px #1a6aaa, 0 10px 20px black; }
.cor-azul .player-card.bot-thinking { border-color: #4a9edd; }
.cor-azul .treasure-card        { border-color: rgba(74,158,221,0.75); box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(74,158,221,0.15); }
.cor-azul .slot.filled          { border-color: #2a7ecc; box-shadow: 0 3px 10px rgba(74,158,221,0.5); }

/* ===== FLASHES DE EVENTO NAS CAIXAS DO JOGADOR ===== */

/* Flash azul — ganhou a rodada (2s) */
.treasure-card.flash-gain {
    animation: boxFlashGain 0.5s ease-in-out 4;
}

@keyframes boxFlashGain {
    0%   { outline: 4px solid transparent; outline-offset: 2px; }
    50%  { outline: 4px solid #3399ff;     outline-offset: 4px; box-shadow: 0 0 20px 6px #3399ff; }
    100% { outline: 4px solid transparent; outline-offset: 2px; }
}

/* Flash roxo — está a roubar (1.5s) */
.treasure-card.flash-robbed {
    animation: boxFlashRobbed 0.5s ease-in-out 4;
}

@keyframes boxFlashRobbed {
    0%   { outline: 4px solid transparent; outline-offset: 2px; }
    50%  { outline: 4px solid #b039e0;     outline-offset: 4px; box-shadow: 0 0 20px 6px #b039e0; }
    100% { outline: 4px solid transparent; outline-offset: 2px; }
}

/* Flash vermelho — está a ser roubado (1.5s) */
.treasure-card.flash-stolen {
    animation: boxFlashStolen 0.5s ease-in-out 4;
}

@keyframes boxFlashStolen {
    0%   { outline: 4px solid transparent; outline-offset: 2px; }
    50%  { outline: 4px solid #e03030;     outline-offset: 4px; box-shadow: 0 0 20px 6px #e03030; }
    100% { outline: 4px solid transparent; outline-offset: 2px; }
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,107,107,0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(255,107,107,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,107,107,0); }
}

.player-name {
    font-size: 1.1rem;
    font-weight: bold;
    background: #000000aa;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 30px;
    margin-bottom: 8px;
    color: #f9e0a0;
}

.badge-bot {
    background: #ff6b6b;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
}

.hand-cards {
    display: grid;
    grid-template-columns: repeat(2, 100px);
    grid-template-rows: repeat(2, 138px);
    gap: 8px;
    justify-content: center;
    align-items: center;
    padding: 4px 2px;
    margin: 0 auto;
}

.card {
    background: transparent;
    width: 100px;
    height: 138px;
    border-radius: 12px;
    display: block;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    border: none;
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    pointer-events: none;
}

.card:hover:not(.disabled) {
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 12px 24px rgba(0,0,0,0.7);
}

.card.card-cover {
    cursor: default;
    pointer-events: none;
    opacity: 1;
}

.card.disabled {
    opacity: 0.4;
    filter: grayscale(0.6);
    cursor: not-allowed;
    pointer-events: none;
}

.card.jogavel {
    box-shadow: 0 0 0 3px #4caf50, 0 4px 8px rgba(0,0,0,0.5);
}

.card.jogavel:hover {
    transform: translateY(-8px);
    box-shadow: 0 0 0 3px #4caf50, 0 10px 20px rgba(0,0,0,0.6);
}

.treasure-slots {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    justify-items: center;
    align-items: center;
}

.slot {
    background: #2a1e14;
    padding: 0;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: bold;
    width: 100%;
    aspect-ratio: 2/3;
    text-align: center;
    color: #5a4a3a;
    border: 1px solid #4a3020;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.slot.filled {
    background: transparent;
    border: 2px solid #d49a2a;
    box-shadow: 0 3px 10px rgba(245,176,66,0.5);
    overflow: hidden;
}

.slot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

/* ==================== SEPARAÇÃO MÃO / TESOURO ==================== */

.hand-section {
    background:
        repeating-linear-gradient(
            92deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.05) 2px,
            rgba(0,0,0,0.05) 4px
        ),
        linear-gradient(160deg, #5a3318 0%, #3d1f0c 60%, #4a2610 100%);
    border-radius: 20px;
    padding: 8px 10px;
    margin-bottom: 0;
}

.treasure-section {
    background: rgba(20, 10, 5, 0.55);
    border: 2px solid rgba(245, 176, 66, 0.6);
    border-radius: 20px;
    padding: 14px 12px;
    margin-top: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 1px rgba(245,176,66,0.15);
}

.section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #c9a55b;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: center;
}

/* ==================== BARALHO + DESCARTE VISUAL ==================== */

.deck-discard-area {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.deck-visual, .discard-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mini-card-stack {
    width: 90px;
    height: 126px;
    background: #1a1210;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 0 #100b08, 6px 6px 0 #0a0705;
    overflow: hidden;
    position: relative;
}

.mini-card-face {
    width: 90px;
    height: 126px;
    background: #fcf3da;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 300;
    font-family: monospace;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    overflow: hidden;
    color: #8a7a5a;
}

.mini-card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.deck-label {
    font-size: 0.6rem;
    color: #a0b890;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.deck-count {
    font-size: 0.75rem;
    font-weight: 800;
    color: #ffdd99;
    background: rgba(0,0,0,0.3);
    padding: 1px 8px;
    border-radius: 10px;
}

button {
    background: #e0ac69;
    border: none;
    padding: 8px 12px;
    border-radius: 60px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    font-size: 0.75rem;
    transition: 0.1s;
}

button:hover {
    background: #d49a4a;
    transform: scale(1.02);
}

.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.player-header .pass-button,
.player-header .discard-button {
    margin-top: 0;
    padding: 3px 14px;
    font-size: 1.1rem;
    font-weight: bold;
    flex-shrink: 0;
    line-height: 1.4;
}

.log-panel-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(233,200,145,0.2);
    flex-shrink: 0;
}

.back-btn {
    background: #4a3a6a;
    color: #e8d8ff;
    padding: 8px 12px;
    font-size: 0.8rem;
    width: 100%;
    margin-top: 0;
}

.back-btn:hover {
    background: #5a4a7a;
}

.reset-btn {
    background: #3a2a1a;
    color: #f9e0a0;
    padding: 8px 12px;
    font-size: 0.8rem;
    width: 100%;
    margin-top: 0;
}

.reset-btn:hover {
    background: #4a3a2a;
}

/* log-area removido */

.pass-button {
    background: #c9772e;
    color: #1a0e00;
    padding: 6px 20px;
    font-size: 0.9rem;
}

.discard-button {
    background: #8b5a2b;
}

.hidden-hand-placeholder {
    background: #1a2a1a;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    color: #8aa88a;
    font-size: 0.85rem;
    border: 1px dashed #4a6a4a;
}

/* ==================== PAINEL DE HISTÓRICO (lateral direito) ==================== */

.game-log-panel {
    width: 220px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 32px;
    padding: 14px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(233,200,145,0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 680px;
    position: sticky;
    top: 20px;
}

.log-panel-title {
    color: #f9e0a0;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(233,200,145,0.25);
    text-transform: uppercase;
}

.log-panel-entries {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
}

.log-panel-entries::-webkit-scrollbar {
    width: 4px;
}

.log-panel-entries::-webkit-scrollbar-track {
    background: transparent;
}

.log-panel-entries::-webkit-scrollbar-thumb {
    background: rgba(233,200,145,0.3);
    border-radius: 4px;
}

.log-entry {
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.88rem;
    color: #d4c080;
    line-height: 1.4;
    border-left: 2px solid rgba(233,200,145,0.3);
    word-break: break-word;
}

.log-entry-vitoria {
    background: rgba(255, 215, 0, 0.18);
    border-left: 3px solid #ffd700;
    color: #ffe066;
    font-weight: 700;
}

.log-entry-tesouro {
    background: rgba(76, 175, 80, 0.15);
    border-left: 3px solid #4caf50;
    color: #a5d6a7;
}

.log-entry-roubo {
    background: rgba(156, 39, 176, 0.18);
    border-left: 3px solid #ce93d8;
    color: #ce93d8;
}

/* ==================== MODAL DE VITÓRIA ==================== */

.winner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.5s;
}

.winner-content {
    background: linear-gradient(145deg, #ffd700, #ff8c00);
    padding: 40px;
    border-radius: 60px;
    text-align: center;
    color: #1a472a;
    border: 5px solid gold;
    box-shadow: 0 0 50px rgba(255,215,0,0.5);
}

.winner-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.winner-content button {
    background: #1a472a;
    color: white;
    font-size: 1.2rem;
    padding: 12px 30px;
    margin-top: 20px;
}

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

/* ==================== SLOT VAZIO NA MÃO ==================== */

.card-empty-slot {
    width: 100px;
    height: 138px;
    border-radius: 12px;
    border: none;
    background: rgba(0,0,0,0.15);
    flex-shrink: 0;
}

/* ==================== MODAL DE INSTRUÇÕES ==================== */

.instrucoes-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.88);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 0;
    overflow-y: auto;
    z-index: 4000;
    animation: fadeIn 0.3s;
    box-sizing: border-box;
}

.instrucoes-content {
    background: linear-gradient(145deg, #1e3a2f, #0e2218);
    border: 2px solid rgba(233,200,145,0.35);
    border-radius: 36px;
    padding: 40px 44px;
    max-width: 520px;
    width: 90%;
    color: #f0e6a0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    margin: auto;
    flex-shrink: 0;
}

.instrucoes-content h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #f9e0a0;
    margin: 0 0 20px;
    text-align: center;
    letter-spacing: 1px;
}

.instrucoes-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instrucoes-content ul li {
    font-size: 0.92rem;
    line-height: 1.5;
    padding: 8px 14px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border-left: 3px solid rgba(233,200,145,0.4);
    color: #e0d09a;
}

.instrucoes-content ul li strong {
    color: #ffd966;
}

.instrucoes-content button {
    background: #9c27b0;
    color: white;
    font-size: 1rem;
    padding: 10px 28px;
    border-radius: 60px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(156,39,176,0.4);
}

.instrucoes-content button:hover {
    background: #ab47bc;
}

/* ==================== BOTÃO INSTRUÇÕES ==================== */

.menu-btn-instrucoes {
    background: linear-gradient(135deg, #2e5e3e, #1a3a2a) !important;
    box-shadow: 0 6px 20px rgba(46,94,62,0.4) !important;
}

.menu-btn-instrucoes:hover {
    background: linear-gradient(135deg, #3e7a50, #234d36) !important;
    box-shadow: 0 10px 28px rgba(46,94,62,0.6) !important;
}

.menu-btn-jogar {
    background: linear-gradient(135deg, #1565c0, #0d47a1) !important;
    box-shadow: 0 6px 20px rgba(21,101,192,0.5) !important;
    font-size: 1.2rem;
}

.menu-btn-jogar:hover {
    background: linear-gradient(135deg, #1976d2, #1565c0) !important;
    box-shadow: 0 10px 28px rgba(21,101,192,0.7) !important;
}

.menu-btn-back {
    background: linear-gradient(135deg, #4a3a2a, #2a1a0a) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

.menu-btn-back:hover {
    background: linear-gradient(135deg, #5a4a3a, #3a2a1a) !important;
}

/* Green player color */
.cor-verde .player-card { border-color: #2a7a38; }
.cor-verde .player-card.active-turn { border-color: #3cb84a; box-shadow: 0 0 0 3px #2a9438, 0 10px 20px black; }
.cor-verde .player-card.bot-thinking { border-color: #3cb84a; }
.cor-verde .treasure-card { border-color: rgba(60,184,74,0.75); box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(60,184,74,0.15); }
.cor-verde .slot.filled { border-color: #2a9438; box-shadow: 0 3px 10px rgba(60,184,74,0.5); }

/* ==================== RESPONSIVO ==================== */

@media (max-width: 900px) {
    .game-wrapper {
        flex-direction: column;
    }

    .game-log-panel {
        width: 100%;
        max-height: 200px;
        position: static;
        flex-direction: column;
    }

    .log-panel-entries {
        flex-direction: column;
        overflow-x: hidden;
    }

    .round-history {
        min-width: 220px;
        order: 2;
        width: 100%;
    }
    .current-card-area { order: 1; }
    .discard-pile { order: 3; }
    .center-panel {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .history-card {
        font-size: 1rem;
        padding: 5px 10px;
    }
}

@media (max-width: 780px) {
    .card { width: 82px; height: 114px; }
    .hand-cards {
        grid-template-columns: repeat(2, 82px);
        grid-template-rows: repeat(2, 114px);
    }
    .card-empty-slot { width: 82px; height: 114px; }
    .player-area-group { min-width: 200px; }
    .menu-card { padding: 40px 28px; }
    .menu-title { font-size: 1.8rem; }
}

/* ==================== TESOURO INDEPENDENTE ==================== */

.players-area {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.player-area-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    flex: 1;
    min-width: 260px;
    max-width: 420px;
}

.treasure-card {
    background: rgba(20, 10, 5, 0.7);
    border: 2px solid rgba(245, 176, 66, 0.65);
    border-radius: 24px;
    padding: 12px;
    width: 100%;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(245,176,66,0.1);
    backdrop-filter: blur(4px);
    box-sizing: border-box;
}

.treasure-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.treasure-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: #f9e0a0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.treasure-card-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #c9a55b;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.9;
}


/* ==================== ANIMAÇÕES DE CARTA VOADORA ==================== */

.anim-flying-card {
    border-radius: 12px;
    overflow: hidden;
    pointer-events: none;
    backface-visibility: hidden;
}

/* Animação de embaralhar no baralho */
@keyframes deckShuffleWiggle {
    0%   { transform: rotate(0deg) scale(1); }
    20%  { transform: rotate(-6deg) scale(1.04); }
    40%  { transform: rotate(5deg) scale(1.03); }
    60%  { transform: rotate(-4deg) scale(1.05); }
    80%  { transform: rotate(3deg) scale(1.02); }
    100% { transform: rotate(0deg) scale(1); }
}

.deck-shuffling .mini-card-stack {
    animation: deckShuffleWiggle 0.55s ease-in-out;
}
