/* CSS da BISCA */

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

:root {
    --verde-mesa-1: #1e6b3c;
    --verde-mesa-2: #0f4023;
    --dourado: #f3c969;
    --vermelho-naipe: #d1373f;
    --preto-naipe: #1a1a1a;
    --card-radius: 10px;
    --card-w: clamp(56px, 12vw, 92px);
    --card-h: calc(var(--card-w) * 1.48);
}

html, body {
    height: 100%;
}

body {
    background: radial-gradient(ellipse at center, var(--verde-mesa-1) 0%, var(--verde-mesa-2) 100%);
    font-family: "Segoe UI", Verdana, Arial, sans-serif;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Tela de jogo (tabuleiro) */
.game-board {
    position: relative;
    width: 100vw;
    height: 100dvh;
}

/* ---------- Overlays (início / fim) ---------- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    animation: fade-in 0.25s ease;
}

.overlay-content {
    text-align: center;
    padding: 32px 40px;
    border-radius: 16px;
    background: linear-gradient(160deg, #163d24, #0b2013);
    border: 1px solid rgba(243, 201, 105, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
}

.logo {
    font-size: clamp(2.2rem, 8vw, 3.4rem);
    color: var(--dourado);
    letter-spacing: 6px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    margin-bottom: 12px;
}

.subtitulo {
    color: #e8e8e8;
    margin-bottom: 24px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
}

.fim-titulo {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    margin-bottom: 12px;
}

.fim-titulo.vitoria { color: #6fdc8c; }
.fim-titulo.derrota { color: #e3646c; }
.fim-titulo.empate  { color: var(--dourado); }

.fim-placar {
    color: #fff;
    font-size: clamp(1rem, 3vw, 1.3rem);
    margin-bottom: 24px;
}

.btn {
    padding: 12px 28px;
    font-size: 1.05rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(160deg, #f7d685, var(--dourado));
    color: #1a1a1a;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f2f2f2;
    border: 1px solid rgba(243, 201, 105, 0.4);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.overlay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* ---------- Mesa (tabuleiro do jogo) ---------- */
#mesa {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* ---------- HUD ---------- */
#hud {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px clamp(10px, 3vw, 28px);
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 2px solid rgba(243, 201, 105, 0.35);
}

.hud-logo {
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    font-weight: 800;
    color: var(--dourado);
    letter-spacing: 3px;
    text-decoration: none;
    cursor: pointer;
}

.hud-logo:hover {
    text-decoration: underline;
}

.placar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 3vw, 24px);
}

.placar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.placar-label {
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: #dfe8df;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.placar-valor {
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 800;
    color: #fff;
    min-width: 1.4em;
    text-align: center;
}

.placar-user .placar-valor { color: #6fdc8c; }
.placar-cpu .placar-valor { color: #e3646c; }

.vez {
    font-size: clamp(0.8rem, 2.4vw, 1rem);
    color: var(--dourado);
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(243, 201, 105, 0.12);
    border: 1px solid rgba(243, 201, 105, 0.3);
    white-space: nowrap;
    animation: pulse 1.6s ease-in-out infinite;
}

/* ---------- Áreas de mãos ---------- */
.area-mao {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(6px, 2vh, 16px) 8px;
}

.mao {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: clamp(6px, 2vw, 16px);
    min-height: var(--card-h);
}

/* ---------- Área central: monte + cartas jogadas ---------- */
#area-central {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 5vw, 60px);
    padding: 10px;
    min-height: 0;
}

#deck {
    position: relative;
    width: var(--card-w);
    height: var(--card-h);
    flex-shrink: 0;
}

#jogadas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 3vw, 24px);
}

.jogada-slot {
    width: var(--card-w);
    height: var(--card-h);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--card-radius);
}

.jogada-slot .card {
    animation: entra-carta 0.25s ease;
}

/* ---------- Cartas ---------- */
.card {
    width: var(--card-w);
    height: var(--card-h);
    background-color: #fdfdfd;
    color: var(--preto-naipe);
    border: 1px solid #cfcfcf;
    border-radius: var(--card-radius);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(4px, 1.2vw, 8px);
    position: relative;
    font-size: clamp(0.7rem, 2.4vw, 1rem);
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.card.back {
    background: repeating-linear-gradient(45deg, #2c3e50, #2c3e50 10px, #34495e 10px, #34495e 20px);
    position: absolute;
    top: 0;
    left: calc(-1 * var(--card-w) * 0.85);
    z-index: 1;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #16202b;
}

.card.front {
    position: relative;
    z-index: 2;
}

#trunfo-card-front {
    font-size: clamp(1rem, 3vw, 1.4rem);
}

/* Naipes */
.suit-Copas, .suit-Ouros {
    color: var(--vermelho-naipe);
}
.suit-Espadas, .suit-Paus {
    color: var(--preto-naipe);
}

.card-value {
    text-align: left;
    font-size: 0.85em;
    line-height: 1.1;
}
.card-suit {
    text-align: right;
    font-size: 1.3em;
    align-self: flex-end;
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.6rem, 6vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
    opacity: 0.9;
    pointer-events: none;
}

.card-center svg {
    width: clamp(1.5rem, 5.6vw, 2.4rem);
    height: clamp(1.5rem, 5.6vw, 2.4rem);
    display: block;
}

.card.card-costas {
    background: repeating-linear-gradient(45deg, #2c3e50, #2c3e50 10px, #34495e 10px, #34495e 20px);
    border: 1px solid #16202b;
}

#maoUSER .card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#maoUSER .card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.4);
}

#maoUSER .card.disabled {
    cursor: default;
    opacity: 0.65;
}

#maoUSER .card.disabled:hover {
    transform: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* ---------- Animações ---------- */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes entra-carta {
    from { opacity: 0; transform: scale(0.6) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 640px) {
    #area-central {
        flex-direction: column;
        gap: 10px;
    }

    .card.back {
        top: calc(-1 * var(--card-h) * 0.18);
        left: 0;
    }
}

@media (max-height: 480px) {
    :root {
        --card-w: clamp(48px, 10vh, 70px);
    }

    .area-mao {
        padding: 4px;
    }
}

.home-subtitulo {
    max-width: 44ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ---------- Tela de regras ---------- */
body.regras-body {
    overflow-y: auto;
    height: auto;
}

.regras-page {
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 32px);
    color: #f2f2f2;
}

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

.logo-sm {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    margin-bottom: 0;
}

.btn-voltar {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.regras-secao {
    background: linear-gradient(160deg, #163d24, #0b2013);
    border: 1px solid rgba(243, 201, 105, 0.25);
    border-radius: 14px;
    padding: clamp(14px, 3vw, 22px);
    margin-bottom: 18px;
}

.regras-secao h2 {
    color: var(--dourado);
    font-size: clamp(1.05rem, 3vw, 1.3rem);
    margin-bottom: 10px;
}

.regras-secao p {
    line-height: 1.5;
    font-size: clamp(0.85rem, 2.4vw, 0.95rem);
}

.regras-secao ol {
    padding-left: 1.2em;
    line-height: 1.6;
    font-size: clamp(0.85rem, 2.4vw, 0.95rem);
}

.regras-secao li {
    margin-bottom: 6px;
}

.regras-nota {
    margin-top: 12px;
    color: #cfd8cf;
    font-size: clamp(0.78rem, 2.2vw, 0.85rem);
    font-style: italic;
}

.tabela-valores {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.valor-linha {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 8px;
    padding: 8px 12px;
    font-size: clamp(0.8rem, 2.2vw, 0.9rem);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.valor-linha:last-child {
    border-bottom: none;
}

.valor-linha.valor-cabecalho {
    background: rgba(243, 201, 105, 0.15);
    font-weight: 700;
    color: var(--dourado);
}

.naipes-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(12px, 3vw, 24px);
}

.naipe-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    min-width: 84px;
}

.naipe-simbolo {
    font-size: clamp(2rem, 6vw, 2.6rem);
    line-height: 1;
}

.naipe-nome {
    font-size: clamp(0.78rem, 2.2vw, 0.85rem);
    color: #dfe8df;
}

.carta-exemplo-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(10px, 3vw, 18px);
}

.carta-exemplo {
    position: relative;
}
