* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Georgia, 'Times New Roman', serif;
    background: #1a120b;
    color: #fff;
    overflow-x: hidden;
}

/* ---------- Blooket-achtig startscherm ---------- */
.blooket-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #2fc6d4;
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 34px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 34px);
    overflow: hidden;
    transition: opacity 0.4s, visibility 0.4s;
}

.blooket-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.blooket-bg-shapes {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(closest-side, rgba(255, 255, 255, 0.09) 98%, transparent 100%);
    background-size: 340px 340px;
    background-position: -60px -40px, 260px 520px, 620px 120px;
}

.blooket-bg-shapes::before,
.blooket-bg-shapes::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 38% 62% 55% 45% / 45% 40% 60% 55%;
}

.blooket-bg-shapes::before {
    top: -60px;
    left: -60px;
    transform: rotate(-12deg);
}

.blooket-bg-shapes::after {
    bottom: -80px;
    right: 8%;
    width: 320px;
    height: 320px;
    transform: rotate(20deg);
}

.blooket-topbar {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.6rem;
    background: #9c3fb5;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.blooket-logo {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.01em;
}

.blooket-topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: underline;
}

.blooket-login-link {
    color: #fff;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
}

.blooket-center {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0 1rem;
}

.blooket-title {
    color: #fff;
    font-size: 3.2rem;
    font-weight: 900;
    font-style: italic;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
    margin-bottom: 0.4rem;
}

.blooket-join-row {
    display: flex;
    gap: 0.5rem;
}

.blooket-code-input {
    width: 200px;
    padding: 0.8rem 1.1rem;
    font-size: 1.15rem;
    font-weight: bold;
    text-align: center;
    border: none;
    border-radius: 10px;
    outline: none;
    color: #555;
    background: #fff;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}

.blooket-code-input::placeholder {
    color: #999;
    font-weight: bold;
}

.blooket-join-btn {
    width: 52px;
    padding: 0.8rem 0;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #333;
    background: #fff;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
    transition: transform 0.1s;
}

.blooket-join-btn:hover {
    transform: translateY(-2px);
}

.blooket-join-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.blooket-error {
    min-height: 1.2rem;
    color: #fff176;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---------- Naam-modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: linear-gradient(145deg, #2e1f14, #1a120b);
    border: 2px solid #c9a227;
    border-radius: 16px;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: 0 0 60px rgba(201, 162, 39, 0.3);
    animation: pop-in 0.5s ease;
}

.modal-content h1 {
    color: #ffd700;
    margin-top: 0;
}

.modal-content input {
    display: block;
    margin: 1rem auto;
    padding: 0.7rem 1rem;
    font-size: 1.1rem;
    text-align: center;
    border: 2px solid #c9a227;
    border-radius: 8px;
    background: #0d0a06;
    color: #fff;
    outline: none;
    width: 240px;
}

.modal-content input:focus {
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.modal-content button {
    padding: 0.7rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(145deg, #ffd700, #c9a227);
    color: #222;
    transition: transform 0.15s;
}

.modal-content button:hover {
    transform: scale(1.05);
}

.modal-content button.secondary {
    background: transparent;
    border: 2px solid #c9a227;
    color: #ffd700;
}

.auth-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.auth-error {
    min-height: 1.2rem;
    margin: 0.3rem 0;
    color: #ff8a80;
    font-weight: bold;
}

.auth-hint {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #c9a227;
}

/* ---------- Lobby ---------- */
.join-row {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1.2rem;
}

.join-row input {
    margin: 0;
    width: 140px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: bold;
}

/* ---------- Multiplayer ---------- */
.table-code-chip {
    cursor: default;
}

.other-players {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0 1rem 1rem;
    margin-bottom: 0.5rem;
}

.other-player {
    background: rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(201, 162, 39, 0.5);
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    min-width: 110px;
    text-align: center;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.other-player.on-turn {
    border-color: #ffd700;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.6);
}

.other-name {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.9rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.other-cards {
    justify-content: center;
    min-height: 0;
    margin: 0.4rem 0;
}

.other-cards .card {
    width: 52px;
    height: 74px;
}

.other-cards .card .card-rank {
    font-size: 1.1rem;
}

.other-cards .card .card-suit {
    font-size: 1rem;
}

.other-info {
    font-size: 0.8rem;
    color: #ffe082;
    min-height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.seat-chip {
    width: 34px;
    height: 34px;
    font-size: 0.65rem;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* ---------- Topbar & chips ---------- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    padding: 0 0.5rem;
}

.chip {
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    background: linear-gradient(145deg, #2e1f14, #1a120b);
    border: 2px solid #c9a227;
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1rem;
}

.logout {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 999px;
    background: #8b0000;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s;
}

.logout:hover {
    transform: scale(1.05);
}

.bet-area {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.chip-tray {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #c9a227;
    border-radius: 16px;
    padding: 0.7rem 1.2rem;
}

.tray-label {
    display: block;
    font-size: 0.85rem;
    color: #c9a227;
    margin-bottom: 0.5rem;
}

.tray-chips {
    display: flex;
    gap: 0.6rem;
}

/* Inzet-cirkel op de tafel */
.bet-spot {
    position: relative;
    margin: 0.4rem auto;
    width: 220px;
    min-height: 110px;
    border: 3px dashed rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem;
}

.bet-spot-label {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.35);
}

.bet-spot-chips {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    min-height: 60px;
    flex-wrap: wrap;
    max-width: 200px;
}

.bet-spot-chips .chip-btn {
    margin-left: -14px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.bet-spot-chips .chip-btn:first-child {
    margin-left: 0;
}

.chip-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px dashed #fff;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    color: #fff;
    transition: transform 0.15s;
}

.chip-btn:hover {
    transform: translateY(-4px) scale(1.08);
}

.chip-btn.c10 { background: #1565c0; }
.chip-btn.c25 { background: #2e7d32; }
.chip-btn.c50 { background: #e65100; }
.chip-btn.c100 { background: #111; }

/* Vliegende chip-kopie (animatie via Web Animations API) */
.chip-ghost {
    position: fixed;
    z-index: 200;
    pointer-events: none;
}

/* ---------- Inzet-timer ---------- */
.bet-timer {
    position: relative;
    width: min(300px, 80%);
    margin: 0.3rem auto;
    height: 22px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #c9a227;
    border-radius: 999px;
    overflow: hidden;
}

.bet-timer-bar {
    position: absolute;
    inset: 0;
    width: 100%;
    background: linear-gradient(90deg, #2e7d32, #66bb6a);
    transition: width 0.25s linear;
}

.bet-timer-bar.low {
    background: linear-gradient(90deg, #b71c1c, #ef5350);
    animation: pulse 0.8s ease-in-out infinite;
}

.bet-timer span {
    position: relative;
    z-index: 1;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 18px;
    font-size: 0.85rem;
}

@keyframes pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.4); }
}

.chip-btn.on-table {
    animation: chip-land 0.25s ease;
}

@keyframes chip-land {
    0% { transform: scale(1.3); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.current-bet.bump {
    animation: bump 0.3s ease;
}

@keyframes bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* ---------- Tafel ---------- */
.table {
    width: min(900px, 95vw);
    text-align: center;
}

.felt {
    position: relative;
    background:
        radial-gradient(ellipse at 50% 40%, #2f9e63 0%, #1e7d4f 55%, #0d4d2c 100%);
    border: 14px solid #4a2f1d;
    border-radius: 200px / 120px;
    box-shadow:
        inset 0 0 60px rgba(0, 0, 0, 0.5),
        0 10px 40px rgba(0, 0, 0, 0.6);
    padding: 2rem 2.5rem;
    min-height: 520px;
}

.table-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    letter-spacing: 0.4em;
    color: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    white-space: nowrap;
}

/* ---------- Dealer & speler ---------- */
.dealer-area,
.player-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    min-height: 170px;
}

.dealer-avatar {
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

.dealer-avatar svg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #c9a227;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    background: #2c1810;
}

.dealer-name,
.player-name {
    margin-top: 0.4rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.player-badge {
    text-align: center;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #c9a227;
    background: #0d4d2c;
    font-size: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hand-area {
    position: relative;
    min-width: 320px;
}

.score-badge {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.15rem 0.9rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid #c9a227;
    font-weight: bold;
    color: #ffd700;
    min-height: 1.6rem;
}

.score-badge:empty {
    visibility: hidden;
}

/* ---------- Kaarten ---------- */
.cards {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    min-height: 110px;
}

.card {
    width: 76px;
    height: 106px;
    flex: 0 0 auto;
    background: linear-gradient(160deg, #ffffff, #e8e4da);
    color: #222;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    animation: card-deal 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards;
}

.card.red {
    color: #c62828;
}

.card .card-rank {
    font-size: 1.6rem;
}

.card .card-suit {
    font-size: 1.4rem;
}

/* Verborgen dealerkaart: rode rug */
.card.hidden-card {
    background:
        repeating-linear-gradient(45deg, #8b0000 0 6px, #6b0000 6px 12px);
    box-shadow: inset 0 0 0 4px #fff, 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* ---------- Bericht ---------- */
.message {
    min-height: 2rem;
    margin: 0.5rem 0;
    font-size: 1.4rem;
    font-weight: bold;
    color: #ffe082;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.message.show {
    animation: message-pop 0.4s ease;
}

/* ---------- Knoppen ---------- */
.buttons {
    margin-top: 1.2rem;
}

.buttons button {
    margin: 0.3rem;
    padding: 0.8rem 1.8rem;
    font-size: 1.05rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    background: linear-gradient(145deg, #ffd700, #c9a227);
    color: #222;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}

.buttons button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 7px 16px rgba(0, 0, 0, 0.5);
}

.buttons button:active:not(:disabled) {
    transform: translateY(0);
}

.buttons button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---------- Animaties ---------- */
@keyframes card-deal {
    from {
        opacity: 0;
        transform: translate(60px, -160px) rotate(15deg);
    }
    to {
        opacity: 1;
        transform: translate(0, 0) rotate(0);
    }
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes message-pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
