

* {
    user-select: none;
    box-sizing: border-box;
}

body {
    background: linear-gradient(145deg, #0a3a2a 0%, #064e3b 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', 'Poppins', 'Roboto', system-ui, sans-serif;
    margin: 0;
    padding: 20px;
}

.main-layout {
    display: flex;
    gap: 20px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.game-container {
    flex: 2;
    min-width: 0;
    background: rgba(0, 20, 10, 0.55);
    border-radius: 68px;
    padding: 20px 24px 30px;
    backdrop-filter: blur(2px);
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.info-panel {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    background: #1e2a2aee;
    padding: 12px 24px;
    border-radius: 60px;
    margin-bottom: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid #ffd966;
    color: #f9f3d9;
}

.bankroll {
    font-size: 1.7rem;
    font-weight: bold;
    background: #0f1f1a;
    padding: 5px 20px;
    border-radius: 40px;
    letter-spacing: 1px;
    box-shadow: inset 0 1px 3px #00000055, 0 2px 3px #ffdf8c33;
}

    .bankroll span {
        color: #f5cb5c;
        font-size: 2rem;
        margin-right: 8px;
    }

.bet-area {
    display: flex;
    gap: 18px;
    align-items: center;
    background: #00000066;
    padding: 5px 20px;
    border-radius: 40px;
}

.bet-label {
    font-weight: 600;
    font-size: 1.2rem;
}

.current-bet {
    background: #d9b650;
    color: #1e2a1c;
    font-weight: bold;
    font-size: 1.6rem;
    padding: 0 18px;
    border-radius: 30px;
    font-family: monospace;
}

.progress-container {
    background: linear-gradient(135deg, #1a1a1aaa, #0d0d0daa);
    border-radius: 30px;
    padding: 12px 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    border: 1px solid #ffd966;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #ffefb9;
    position: relative;
    z-index: 1;
}

    .progress-info span:first-child {
        color: #f5cb5c;
    }

#progressPercent {
    color: #ffaa44;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

.progress-bar-bg {
    background: linear-gradient(135deg, #1f1f1f, #2a2a2a);
    border-radius: 20px;
    height: 32px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 1px 2px rgba(255,255,255,0.1);
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f5b042 0%, #ffd700 25%, #ffaa33 50%, #ffd700 75%, #f5b042 100%);
    background-size: 200% 100%;
    animation: gentleShimmer 3s ease-in-out infinite;
}

@keyframes gentleShimmer {
    0%, 100% {
        background-position: 0% 50%;
        filter: brightness(1);
    }

    50% {
        background-position: 100% 50%;
        filter: brightness(1.08);
    }
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0) 100%);
    animation: shimmerSlide 2.5s infinite;
    transform: translateX(-100%);
    pointer-events: none;
}

@keyframes shimmerSlide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-star {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 0 2px gold);
    animation: starTwinkle 1.5s ease-in-out infinite;
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.progress-stats {
    text-align: center;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #ffefb9;
    position: relative;
    z-index: 1;
}

    .progress-stats span {
        color: #ffaa44;
        font-weight: bold;
        font-size: 1.1rem;
    }

@keyframes particleFloat {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-80px) rotate(360deg);
        opacity: 0;
    }
}

.threshold-particle {
    position: absolute;
    font-size: 16px;
    animation: particleFloat 1.2s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes milestoneCelebration {
    0%, 100% {
        transform: scale(1);
        border-color: #ffd966;
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
        border-color: #ffaa44;
    }
}

.pulse-glow {
    animation: milestoneCelebration 1.5s ease-out;
}

.milestone-icon {
    position: absolute;
    font-size: 1.2rem;
    animation: floatStarsExtended 1.8s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes floatStarsExtended {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-60px) rotate(360deg);
        opacity: 0;
    }
}

.progress-flash {
    animation: progressFlash 1.2s ease-out;
}

@keyframes progressFlash {
    0%, 100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.4);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
    }
}

/* Split Hand Styles */
.split-hand {
    background: #1a4a3aee !important;
    border: 2px solid #ffaa44 !important;
    margin-top: 20px;
    animation: splitHandAppear 0.3s ease-out;
}

@keyframes splitHandAppear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.split-hand-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

    .split-hand-buttons button {
        padding: 8px 20px;
        font-size: 0.95rem;
        border: none;
        border-radius: 40px;
        cursor: pointer;
        font-weight: bold;
        transition: all 0.2s ease;
    }

.split-hit-btn {
    background: #2b6a4a;
    color: white;
    box-shadow: 0 3px 0 #1a3a2a;
}

    .split-hit-btn:hover:not(:disabled) {
        background: #3a8a5a;
        transform: translateY(-1px);
    }

.split-stand-btn {
    background: #8b5a2a;
    color: white;
    box-shadow: 0 3px 0 #5a3a1a;
}

    .split-stand-btn:hover:not(:disabled) {
        background: #ab7a3a;
        transform: translateY(-1px);
    }

.split-double-btn {
    background: #c49a2b;
    color: #1a2f1a;
    box-shadow: 0 3px 0 #8a6a1a;
}

    .split-double-btn:hover:not(:disabled) {
        background: #e4ba4b;
        transform: translateY(-1px);
    }

.split-hand-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.split-hand-buttons button:active {
    transform: translateY(2px);
}

/* Insurance Panel */
.insurance-panel {
    background: linear-gradient(135deg, #1a2a2aee, #0d1f1fee);
    border-radius: 40px;
    padding: 15px 25px;
    margin: 15px 0;
    border: 2px solid #ffd966;
    backdrop-filter: blur(8px);
    animation: panelSlideIn 0.3s ease-out;
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.insurance-message {
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffefb9;
    margin-bottom: 12px;
}

.insurance-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.insurance-btn {
    padding: 10px 25px;
    font-size: 1rem;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-weight: bold;
}

.yes-btn {
    background: linear-gradient(135deg, #2e7d64, #1a5a48);
    color: #ffefb9;
    box-shadow: 0 3px 0 #0a3a2a;
}

    .yes-btn:hover {
        background: linear-gradient(135deg, #3a9a7a, #2a7a5a);
        transform: translateY(-1px);
    }

.no-btn {
    background: linear-gradient(135deg, #6b2a2a, #4a1a1a);
    color: #ffcccc;
    box-shadow: 0 3px 0 #2a0a0a;
}

    .no-btn:hover {
        background: linear-gradient(135deg, #8b3a3a, #6a2a2a);
        transform: translateY(-1px);
    }

.insurance-btn:active {
    transform: translateY(2px);
}

/* Chat Log */
.chat-log {
    flex: 1;
    min-width: 280px;
    max-width: 380px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid #ffd966;
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: 90vh;
    position: sticky;
    top: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e3a2f, #0a2a1f);
    border-radius: 24px 24px 0 0;
    border-bottom: 2px solid #ffd966;
    font-weight: bold;
    font-size: 1.2rem;
    color: #ffefb9;
}

.clear-chat-btn {
    background: #5a2a2a;
    border: none;
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    color: #ffcccc;
    transition: all 0.2s;
}

    .clear-chat-btn:hover {
        background: #7a3a3a;
        transform: translateY(-1px);
    }

.chat-messages {
    padding: 16px;
    overflow-y: auto;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-entry {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-entry.player {
    background: rgba(52, 152, 219, 0.2);
    border-left: 3px solid #3498db;
    color: #a8d8ff;
}

.chat-entry.dealer {
    background: rgba(231, 76, 60, 0.2);
    border-left: 3px solid #e74c3c;
    color: #ffb8a8;
}

.chat-entry.win {
    background: rgba(46, 204, 113, 0.2);
    border-left: 3px solid #2ecc71;
    color: #a8ffcc;
}

.chat-entry.loss {
    background: rgba(231, 76, 60, 0.2);
    border-left: 3px solid #e74c3c;
    color: #ffb8a8;
}

.chat-entry.push {
    background: rgba(241, 196, 15, 0.2);
    border-left: 3px solid #f1c40f;
    color: #ffeaa7;
}

.chat-entry.blackjack {
    background: rgba(155, 89, 182, 0.2);
    border-left: 3px solid #9b59b6;
    color: #dbb8ff;
}

.chat-entry.system {
    background: rgba(149, 165, 166, 0.2);
    border-left: 3px solid #95a5a6;
    color: #bdc3c7;
    font-style: italic;
}

.chat-entry.welcome {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
    border-left: 3px solid #ffd700;
    color: #ffecb3;
    font-weight: bold;
}

.chat-entry.insurance {
    background: rgba(155, 89, 182, 0.2);
    border-left: 3px solid #9b59b6;
    color: #dbb8ff;
}

.chat-entry.evenmoney {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
    border-left: 3px solid #ffd700;
    color: #ffecb3;
}

.chat-entry.split {
    background: rgba(52, 152, 219, 0.3);
    border-left: 3px solid #3498db;
    color: #a8d8ff;
}

.chat-timestamp {
    font-size: 0.7rem;
    color: #888;
    margin-right: 8px;
}

.hand-section {
    background: #0f3b2cee;
    border-radius: 48px;
    padding: 20px 20px 25px;
    margin-bottom: 28px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid #dbb45c;
}

.hand-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 0 12px;
    font-size: 1.6rem;
    font-weight: bold;
    color: #ffefb9;
    text-shadow: 2px 2px 0 #1f4d2e;
}

.score-badge {
    background: #1a1f1c;
    padding: 6px 18px;
    border-radius: 40px;
    font-family: monospace;
    font-size: 1.5rem;
    color: #f5cb5c;
}

.cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 140px;
    padding: 12px;
    background: #1c4d3a80;
    border-radius: 32px;
    margin-top: 6px;
}

.card {
    width: 100px;
    height: 130px;
    background: white;
    border-radius: 14px;
    box-shadow: -3px 3px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 2px #f9f3cf;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 2.5rem;
    font-family: monospace;
    transition: transform 0.2s ease;
}

    .card:hover {
        transform: translateY(-6px);
    }

.card-rank {
    font-size: 2.2rem;
    font-weight: 800;
}

.card-suit {
    font-size: 2.8rem;
    margin-top: -6px;
}

.suit-red {
    color: #c33;
}

.suit-black {
    color: #222;
}

.hidden-card {
    background: repeating-linear-gradient(45deg, #2c5a3e, #2c5a3e 12px, #1f4532 12px, #1f4532 24px);
    border: 2px solid #e9bc6d;
    display: flex;
    justify-content: center;
    align-items: center;
}

    .hidden-card::after {
        content: "?";
        font-size: 3rem;
        opacity: 0.9;
        color: #ffd966;
    }

    .hidden-card .card-rank,
    .hidden-card .card-suit {
        display: none;
    }

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin: 25px 0 20px;
}

button {
    background: #2b2b1f;
    border: none;
    font-size: 1.25rem;
    font-weight: bold;
    padding: 12px 28px;
    border-radius: 60px;
    cursor: pointer;
    color: #faf0ca;
    transition: 0.1s linear;
    box-shadow: 0 4px 0 #5f4c2b;
    font-family: inherit;
    letter-spacing: 1px;
}

    button:active {
        transform: translateY(2px);
        box-shadow: 0 1px 0 #5f4c2b;
    }

    button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-primary {
    background: #c49a2b;
    color: #1a2f1a;
    box-shadow: 0 4px 0 #735e1f;
}

.reset-btn {
    background: #1e5a6e;
}

.bet-control {
    background: #294e3c;
    padding: 8px 18px;
    font-size: 1.1rem;
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: #c0dfcf;
    margin-top: 20px;
}

@media (max-width: 1000px) {
    .main-layout {
        flex-direction: column;
    }

    .chat-log {
        max-width: 100%;
        position: static;
        margin-top: 20px;
    }

    .chat-messages {
        max-height: 300px;
    }
}

@media (max-width: 650px) {
    .card {
        width: 70px;
        height: 96px;
    }

    .card-rank {
        font-size: 1.5rem;
    }

    .card-suit {
        font-size: 2rem;
    }

    button {
        padding: 8px 18px;
        font-size: 0.9rem;
    }

    .bankroll {
        font-size: 1.2rem;
    }

    .insurance-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .split-hand-buttons {
        flex-direction: column;
        align-items: center;
    }
}
