* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --background: #090d16;
    --panel: #161d2b;
    --panel-border: #293348;
    --text: #f8fafc;
    --muted: #a7b0c0;
    --table-border: #30394a;
}

body {
    min-height: 100vh;
    padding: 32px 20px 60px;
    background:
        radial-gradient(circle at top, #172033 0%, #090d16 55%);
    color: var(--text);
    font-family: Arial, sans-serif;
}

button {
    font: inherit;
}

[hidden] {
    display: none !important;
}

.poker-trainer {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
}

/* Cabecera */

header {
    margin-bottom: 28px;
    text-align: center;
}

header h1 {
    margin-bottom: 8px;
    color: #fbbf24;
    font-size: 30px;
}

#hand-counter {
    color: var(--muted);
    font-size: 17px;
}

/* Mesa */

.poker-table {
    position: relative;
    min-height: 680px;
    padding: 52px 40px;
    overflow: hidden;
    border: 4px solid var(--table-border);
    border-radius: 210px;
    background:
        radial-gradient(
            circle at center,
            #164e46 0%,
            #0d3d38 55%,
            #092f2c 100%
        );
    box-shadow:
        0 22px 55px rgb(0 0 0 / 55%),
        inset 0 0 65px rgb(0 0 0 / 28%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.poker-table::before {
    content: "";
    position: absolute;
    inset: 18px;
    border: 1px solid rgb(255 255 255 / 8%);
    border-radius: inherit;
    pointer-events: none;
}

.opponent,
.board,
.hero {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.opponent h2,
.hero h2 {
    font-size: 21px;
    letter-spacing: 1px;
}

.board h2 {
    margin: 14px 0;
    color: #b9c3d4;
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Stacks y acciones */

.stack {
    margin-top: 9px;
    padding: 8px 18px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 20px;
    background-color: rgb(5 10 18 / 65%);
    color: #f8fafc;
    font-size: 16px;
    font-weight: bold;
}

#opponent-action {
    margin-top: 15px;
    padding: 10px 20px;
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 8px;
    background-color: rgb(5 10 18 / 75%);
    color: #dbeafe;
    font-size: 16px;
}

/* Bote */

.pot-display {
    padding: 9px 22px;
    border: 1px solid #fbbf24;
    border-radius: 30px;
    background-color: rgb(5 10 18 / 80%);
    box-shadow: 0 0 18px rgb(251 191 36 / 16%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.pot-display span {
    color: #fbbf24;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1.5px;
}

#pot-size {
    font-size: 20px;
}

/* Cartas */

.cards {
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.card {
    position: relative;
    width: 76px;
    height: 108px;
    overflow: hidden;
    border: 2px solid rgb(255 255 255 / 35%);
    border-radius: 9px;
    color: white;
    box-shadow:
        0 7px 14px rgb(0 0 0 / 38%),
        inset 0 1px 0 rgb(255 255 255 / 25%);
    user-select: none;
}

.card::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -35px;
    width: 75px;
    height: 95px;
    border-radius: 50%;
    background-color: rgb(255 255 255 / 8%);
    transform: rotate(25deg);
}

.card.suit-s {
    background: linear-gradient(145deg, #3d4149, #181a1f);
}

.card.suit-h {
    background: linear-gradient(145deg, #ed2d34, #a90f15);
}

.card.suit-d {
    background: linear-gradient(145deg, #2d76ed, #1442ac);
}

.card.suit-c {
    background: linear-gradient(145deg, #22ad61, #08753a);
}

.card-corner {
    position: absolute;
    top: 7px;
    left: 8px;
    z-index: 2;
    font-size: 15px;
    font-weight: bold;
    line-height: 14px;
    text-align: center;
}

.card-corner small {
    display: block;
    font-size: 13px;
}

.card-main {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    font-size: 42px;
    font-weight: bold;
    transform: translate(-50%, -50%);
}

.card-symbol {
    position: absolute;
    right: 7px;
    bottom: 5px;
    z-index: 2;
    font-size: 23px;
    font-weight: bold;
}

.card.rank-ten .card-main {
    font-size: 35px;
}

/* Paneles inferiores */

.hand-history,
.decision-area,
.result-area {
    margin-top: 22px;
    padding: 26px 30px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background:
        linear-gradient(145deg, #1b2434, var(--panel));
    box-shadow: 0 10px 25px rgb(0 0 0 / 18%);
}

.hand-history {
    border-left: 5px solid #38bdf8;
}

.hand-history h2,
.decision-area h2,
.result-area h2 {
    margin-bottom: 15px;
}

#action-text,
#result-explanation {
    color: #d9e1ec;
    font-size: 17px;
    line-height: 1.6;
}

/* Botones */

#action-buttons {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

#action-buttons button,
.result-area button {
    min-height: 62px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 13px rgb(0 0 0 / 24%);
    transition:
        filter 0.2s,
        transform 0.2s;
}

#action-buttons button:hover,
.result-area button:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
}

.action-check {
    background-color: #18b957;
}

.action-fold {
    background-color: #475569;
}

.action-call {
    background-color: #2563eb;
}

.action-bet {
    background-color: #f97316;
}

.action-raise {
    background-color: #9d1778;
}

.action-allin {
    background-color: #5b168d;
}

.action-default {
    background-color: #2563eb;
}

#restart-button {
    margin-right: 8px;
    background-color: #2563eb;
}

#next-hand-button {
    background-color: #7c3aed;
}

#result-title.correct {
    color: #4ade80;
}

#result-title.incorrect {
    color: #fb7185;
}

/* Móviles */

@media (max-width: 700px) {
    body {
        padding: 18px 10px 40px;
    }

    header h1 {
        font-size: 24px;
    }

    .poker-table {
        min-height: 600px;
        padding: 40px 12px;
        border-radius: 100px;
        gap: 38px;
    }

    .card {
        width: 57px;
        height: 84px;
    }

    .card-main {
        font-size: 31px;
    }

    .card.rank-ten .card-main {
        font-size: 27px;
    }

    .card-corner {
        top: 5px;
        left: 6px;
        font-size: 12px;
    }

    .card-corner small {
        font-size: 10px;
    }

    .card-symbol {
        right: 5px;
        bottom: 4px;
        font-size: 17px;
    }

    .cards {
        min-height: 86px;
        gap: 5px;
    }

    .hand-history,
    .decision-area,
    .result-area {
        padding: 20px 18px;
    }

    #action-buttons {
        grid-template-columns: 1fr;
        }



}

    #action-buttons {
        grid-template-columns: 1fr;
    }

/* Este código queda fuera de @media */

section.hand-history {
    display: none !important;
}

section#decision-area {
    margin-top: 20px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

section#decision-area > h2 {
    display: none !important;
}

/* ========================================
   JUGADORES CIRCULARES — HU Y 3H
   ======================================== */

.opponents-row {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 220px;
}

.poker-table.three-handed .opponents-row {
    justify-content: space-around;
    gap: 40px;
}

.table-player {
    position: relative;
    min-width: 210px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.showdown-cards {
    position: absolute;
    top: 0;
    left: calc(50% + 68px);
    z-index: 6;
    min-width: 118px;
    padding: 8px 9px 9px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 12px;
    background: rgb(5 10 18 / 92%);
    box-shadow: 0 10px 24px rgb(0 0 0 / 38%);
    animation: showdown-cards-in 220ms ease-out;
}

.third-player-showdown {
    right: calc(50% + 68px);
    left: auto;
}

.showdown-cards > span {
    display: block;
    margin-bottom: 5px;
    color: #fbbf24;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-align: center;
    text-transform: uppercase;
}

.showdown-cards .cards {
    min-height: 68px;
    gap: 5px;
}

.showdown-cards .card {
    width: 46px;
    height: 66px;
    border-radius: 7px;
}

.showdown-cards .card-corner {
    top: 4px;
    left: 5px;
    font-size: 10px;
    line-height: 10px;
}

.showdown-cards .card-corner small {
    font-size: 8px;
}

.showdown-cards .card-main {
    font-size: 24px;
}

.showdown-cards .card.rank-ten .card-main {
    font-size: 20px;
}

.showdown-cards .card-symbol {
    right: 4px;
    bottom: 3px;
    font-size: 13px;
}

@keyframes showdown-cards-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.opponents-row .opponent {
    width: auto;
}

.player-circle {
    width: 112px;
    height: 112px;
    border: 5px solid #475569;
    border-radius: 50%;
    background:
        radial-gradient(circle at top, #202938, #0d111a);
    box-shadow:
        0 10px 25px rgb(0 0 0 / 40%),
        inset 0 0 18px rgb(255 255 255 / 5%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.player-circle h2 {
    margin: 0;
    color: white;
    font-size: 23px;
    line-height: 1;
}

.player-circle .stack {
    margin: 8px 0 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #dbe4f0;
    font-size: 16px;
}

.opponent-circle {
    border-color: #ff4b1f;
}

.third-player-circle {
    border-color: #7c3aed;
}

.hero-circle {
    border-color: #22e85f;
    box-shadow:
        0 0 20px rgb(34 232 95 / 20%),
        0 10px 25px rgb(0 0 0 / 40%);
}

.hero-area {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

#opponent-action,
#third-player-action {
    margin-top: 12px;
    padding: 8px 14px;
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 8px;
    background-color: rgb(5 10 18 / 75%);
    color: #dbeafe;
    font-size: 14px;
}

.table-player.folded {
    opacity: 0.3;
    filter: grayscale(80%);
}

#third-player[hidden] {
    display: none !important;
}

@media (max-width: 700px) {
    .opponents-row {
        gap: 20px;
    }

    .table-player {
        min-width: 135px;
    }

    .showdown-cards {
        top: -2px;
        left: calc(50% + 46px);
        min-width: 88px;
        padding: 6px;
    }

    .third-player-showdown {
        right: calc(50% + 46px);
        left: auto;
    }

    .showdown-cards .cards {
        min-height: 54px;
        gap: 3px;
    }

    .showdown-cards .card {
        width: 36px;
        height: 52px;
    }

    .showdown-cards .card-main {
        font-size: 18px;
    }

    .showdown-cards .card.rank-ten .card-main {
        font-size: 15px;
    }

    .showdown-cards .card-symbol {
        font-size: 10px;
    }

    .player-circle {
        width: 88px;
        height: 88px;
    }

    .player-circle h2 {
        font-size: 19px;
    }

    .player-circle .stack {
        font-size: 13px;
    }

    .hero-area {
        flex-direction: column;
        gap: 8px;
    }

    #opponent-action,
    #third-player-action {
        max-width: 145px;
        font-size: 12px;
    }
}

#retry-button {
    background-color: #f59e0b;
}

/* ========================================
   NAVEGACIÓN Y PANTALLAS
   ======================================== */

.app-nav {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto 30px;
    padding: 12px 18px;
    border: 1px solid #293348;
    border-radius: 12px;
    background-color: rgb(15 23 42 / 90%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.creator {
    color: #94a3b8;
    font-size: 14px;
    font-weight: bold;
}

.nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-buttons button {
    padding: 10px 16px;
    border: none;
    border-radius: 7px;
    background-color: transparent;
    color: #dbe4f0;
    font-weight: bold;
    cursor: pointer;
}

.nav-buttons button:hover {
    background-color: #263248;
    color: white;
}

.nav-buttons .sound-toggle-button {
    border: 1px solid #34435b;
    background-color: #101827;
    color: #dbeafe;
}

.nav-buttons .sound-toggle-button:hover {
    background-color: #1c2940;
}

.nav-buttons .sound-toggle-button[aria-pressed="true"] {
    color: #94a3b8;
}

.home-screen {
    width: 100%;
    max-width: 1180px;
    min-height: 680px;
    margin: 0 auto;
    border: 1px solid #293348;
    border-radius: 24px;
    background:
        radial-gradient(
            circle at center,
            #164e46 0%,
            #0d292c 48%,
            #0b1220 100%
        );
    box-shadow: 0 22px 55px rgb(0 0 0 / 35%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.home-content {
    max-width: 680px;
    padding: 40px 24px;
}

.home-eyebrow {
    margin-bottom: 12px;
    color: #38bdf8;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 3px;
}

.home-content h1 {
    color: #fbbf24;
    font-size: clamp(70px, 12vw, 145px);
    line-height: 1;
    text-shadow: 0 8px 25px rgb(0 0 0 / 35%);
}

.home-description {
    max-width: 540px;
    margin: 24px auto 30px;
    color: #cbd5e1;
    font-size: 19px;
    line-height: 1.6;
}

.start-playing-button {
    padding: 17px 34px;
    border: none;
    border-radius: 10px;
    background:
        linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    font-size: 19px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 25px rgb(34 197 94 / 25%);
    transition:
        transform 0.2s,
        filter 0.2s;
}

.start-playing-button:hover {
    filter: brightness(1.12);
    transform: translateY(-3px);
}

.played-screen {
    width: 100%;
    max-width: 1180px;
    min-height: 600px;
    margin: 0 auto;
    padding: 42px;
    border: 1px solid #293348;
    border-radius: 20px;
    background-color: #111827;
}

.played-header {
    margin-bottom: 35px;
}

.played-header h1 {
    margin-bottom: 10px;
    color: #f8fafc;
    font-size: 38px;
}

.played-header > p:last-child {
    color: #94a3b8;
}

#played-hands-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px;
}

.empty-message {
    color: #94a3b8;
}

@media (max-width: 700px) {
    .app-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-buttons {
        width: 100%;
    }

    .nav-buttons button {
        flex: 1;
    }

    .home-screen {
        min-height: 560px;
    }

    .played-screen {
        padding: 28px 18px;
    }
}

/* ========================================
   TARJETAS DE MANOS JUGADAS
   ======================================== */

.played-hand-card {
    padding: 20px;
    border: 1px solid #334155;
    border-radius: 14px;
    background:
        linear-gradient(145deg, #1e293b, #111827);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 18px rgb(0 0 0 / 22%);
    transition:
        transform 0.2s,
        border-color 0.2s,
        filter 0.2s;
}

.played-hand-card:hover {
    border-color: #38bdf8;
    filter: brightness(1.08);
    transform: translateY(-4px);
}

.played-hand-cards {
    min-height: 78px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.played-hand-card .card {
    width: 52px;
    height: 74px;
    border-radius: 7px;
}

.played-hand-card .card-main {
    font-size: 27px;
}

.played-hand-card .card.rank-ten .card-main {
    font-size: 23px;
}

.played-hand-card .card-corner {
    top: 4px;
    left: 5px;
    font-size: 10px;
    line-height: 10px;
}

.played-hand-card .card-corner small {
    font-size: 9px;
}

.played-hand-card .card-symbol {
    right: 4px;
    bottom: 3px;
    font-size: 14px;
}

.played-hand-information {
    text-align: center;
}

.played-hand-information h2 {
    margin-bottom: 9px;
    font-size: 17px;
}

.played-hand-status {
    margin-bottom: 7px;
    font-weight: bold;
}

.played-hand-status.completed {
    color: #4ade80;
}

.played-hand-status.incorrect {
    color: #fb7185;
}

.played-hand-attempts {
    color: #94a3b8;
    font-size: 13px;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(
            circle at top,
            #172238 0%,
            #080d17 60%
        );
}

.auth-card {
    width: min(430px, 100%);
    padding: 42px;
    border: 1px solid #29364b;
    border-radius: 22px;
    background: #111a2a;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.auth-author {
    margin: 0 0 22px;
    color: #96a3b8;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.auth-card h1 {
    margin: 0;
    color: #ffbd17;
    font-size: 52px;
}

.auth-subtitle {
    margin: 10px 0 30px;
    color: #bac4d5;
}

#login-form,
#invite-password-form {
    display: grid;
    gap: 10px;
}

#login-form label,
#invite-password-form label {
    margin-top: 8px;
    color: #f4f7fb;
    font-weight: 700;
}

#login-form input,
#invite-password-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #34435b;
    border-radius: 10px;
    background: #080f1c;
    color: white;
    font: inherit;
    box-sizing: border-box;
}

#login-form input:focus,
#invite-password-form input:focus {
    outline: 2px solid #2d6cf0;
    border-color: transparent;
}

#login-form button,
#invite-password-form button {
    margin-top: 18px;
    padding: 15px;
    border: 0;
    border-radius: 10px;
    background: #2d6cf0;
    color: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

#login-form button:hover,
#invite-password-form button:hover {
    background: #3d7bff;
}

.login-error {
    margin: 10px 0 0;
    color: #ff6f87;
}

.access-message {
    margin: 25px 0 0;
    color: #8f9bad;
    font-size: 14px;
    text-align: center;
}

[hidden] {
    display: none !important;
}

#hand-counter {
    display: none !important;
}

/* ========================================
   FEEDBACK DE ACCIONES EN LA MESA
   ======================================== */

.hero-seat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#hero-action {
    position: absolute;
    right: 50%;
    bottom: calc(100% + 12px);
    z-index: 5;
    margin: 0;
    white-space: nowrap;
    transform: translateX(50%);
    animation: hero-action-in 180ms ease-out;
}

.poker-table .board {
    transform: translateY(-14px);
}

.poker-table.three-handed .board {
    transform: translateY(-28px);
}

.table-player {
    min-height: 158px;
}

.table-action,
#opponent-action,
#third-player-action {
    min-height: 34px;
    margin-top: 12px;
    padding: 7px 13px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 18px;
    background: rgb(5 10 18 / 88%);
    color: #f8fafc;
    font-size: 14px;
    font-weight: 800;
    line-height: 18px;
    box-shadow: 0 8px 18px rgb(0 0 0 / 28%);
    animation: table-action-in 180ms ease-out;
}

.table-action.with-chips,
#opponent-action.with-chips,
#third-player-action.with-chips {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.table-action.with-chips::before,
#opponent-action.with-chips::before,
#third-player-action.with-chips::before {
    content: "";
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    border: 2px dashed rgb(255 255 255 / 72%);
    border-radius: 50%;
    background: #e11d48;
    box-shadow:
        -4px -3px 0 -1px #2563eb,
        4px -3px 0 -1px #16a34a,
        0 2px 5px rgb(0 0 0 / 45%);
}

.table-action.thinking,
#opponent-action.thinking,
#third-player-action.thinking {
    min-width: 54px;
    color: #fbbf24;
    letter-spacing: 4px;
    animation: thinking-pulse 700ms ease-in-out infinite alternate;
}

.table-player.thinking .player-circle {
    box-shadow:
        0 0 0 5px rgb(251 191 36 / 10%),
        0 0 24px rgb(251 191 36 / 32%),
        0 10px 25px rgb(0 0 0 / 40%);
}

.table-player.folded #opponent-action,
.table-player.folded #third-player-action {
    visibility: hidden !important;
}

.action-placeholder {
    visibility: hidden;
    pointer-events: none;
}

#action-buttons button:disabled {
    cursor: wait;
    filter: saturate(0.55) brightness(0.72);
    transform: none;
}

@keyframes table-action-in {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#hero-action.with-chips,
#hero-action.thinking {
    transform: translateX(50%);
}

@keyframes thinking-pulse {
    from {
        opacity: 0.48;
    }

    to {
        opacity: 1;
    }
}

@keyframes hero-action-in {
    from {
        opacity: 0;
        transform: translate(50%, 5px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(50%, 0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .table-action,
    #opponent-action,
    #third-player-action,
    .table-action.thinking,
    #opponent-action.thinking,
    #third-player-action.thinking {
        animation: none;
    }

    .showdown-cards {
        animation: none;
    }
}

@media (max-width: 700px) {
    #hero-action {
        bottom: calc(100% + 9px);
    }

    .poker-table .board {
        transform: translateY(-7px);
    }

    .poker-table.three-handed .board {
        transform: translateY(-14px);
    }

    .table-player {
        min-height: 131px;
    }
}
