* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* ---------------------------------------- LOADING SCREEN ----------------------------------------- */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s;
}

.loading-box {
    text-align: center;
    animation: fadeIn 0.8s;
}

.loading-logo {
    width: 200px;
    height: 200px;
    object-fit: contain;
    animation: float 2s ease-in-out infinite;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
    margin-bottom: 20px;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.loading-box h1 {
    color: white;
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0 10px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin: 30px auto 15px;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 10px;
    animation: load 3s ease-out forwards;
}

@keyframes load {
    to {
        width: 100%;
    }
}

.loading-txt {
    color: white;
    font-size: 1.2em;
    font-weight: 600;
}

.dots::after {
    content: '';
    animation: dots 1.5s steps(4) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

/* Mobile Loading */
@media (max-width: 768px) {
    .loading-logo {
        width: 160px;
        height: 160px;
    }

    .loading-box h1 {
        font-size: 2.2em;
    }

    .progress-bar {
        width: 250px;
    }
}

@media (max-width: 480px) {
    .loading-logo {
        width: 140px;
        height: 140px;
    }

    .loading-box h1 {
        font-size: 1.8em;
    }

    .progress-bar {
        width: 200px;
    }
}

/* --------------------------------------- MAIN CONTAINER ---------------------------------------- */
.container {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 15px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 15px;
    position: relative;
}

h1 {
    color: #1e3c72;
    font-size: 2em;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.header-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.btn-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-header.leaderboard {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-header.privacy {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.chips-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.chips-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.chip-icon {
    font-size: 1.5em;
}

.chip-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #1e3c72;
}

.bet-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.bet-info .label {
    color: white;
    font-size: 0.95em;
    font-weight: 500;
}

.bet-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1em;
}

.score-item .label {
    color: #666;
    font-weight: 500;
}

.score-item .score {
    color: #1e3c72;
    font-weight: bold;
    font-size: 1.1em;
}

.game-area {
    margin: 15px 0;
}

.player-section {
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.dealer-section {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* margin-bottom: 12px; */
    flex-wrap: wrap;
    gap: 8px;
}

.player-info h2 {
    color: #333;
    font-size: 1.3em;
}

.hand-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #1e3c72;
    background: white;
    padding: 6px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cards-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 110px;
    align-items: center;
    justify-content: center;
}

.card {
    width: 70px;
    height: 100px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: dealCard 0.3s ease-out;
    position: relative;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-5px);
}

@keyframes dealCard {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.card.red {
    color: #d32f2f;
}

.card.black {
    color: #333;
}

.card.hidden {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: transparent;
}

.card.hidden::before {
    content: '🎴';
    position: absolute;
    font-size: 1.8em;
    color: white;
}

.card-rank {
    font-size: 1.5em;
}

.card-suit {
    font-size: 1em;
}

.game-status {
    text-align: center;
    margin: 18px 0;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.game-status.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.game-status.error {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.game-status.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#gameMessage {
    color: white;
    font-size: 1.15em;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.betting-controls {
    margin: 15px 0;
}

.betting-controls h3 {
    text-align: center;
    color: #1e3c72;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.btn {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.btn-special {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
}

.btn-special:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    max-width: 650px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    color: #1e3c72;
    font-size: 1.8em;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2.2em;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    color: #1e3c72;
    background: #f0f0f0;
    transform: rotate(90deg);
}

.modal-body {
    color: #333;
}

/* Stats Modal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card .stat-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95em;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    color: white;
    font-size: 2em;
    font-weight: bold;
}

/* Leaderboard Styles */
.leaderboard-container {
    margin-top: 20px;
}

.leaderboard-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.95em;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.leaderboard-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.leaderboard-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

.leaderboard-table tbody tr {
    transition: background 0.2s;
}

.leaderboard-table tbody tr:hover {
    background: #f5f7fa;
}

.leaderboard-table tbody tr.current-player {
    background: #fff3cd;
    font-weight: bold;
}

.rank-medal {
    font-size: 1.5em;
    margin-right: 5px;
}

.player-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.you-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.leaderboard-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

.btn-save-score {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.05em;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-save-score:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Privacy Policy Styles */
.privacy-content h3 {
    color: #1e3c72;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.privacy-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.privacy-content ul {
    margin: 10px 0 15px 25px;
    line-height: 1.8;
}

.privacy-content li {
    margin-bottom: 8px;
    color: #555;
}

.privacy-content strong {
    color: #1e3c72;
}

.privacy-summary {
    margin-top: 20px;
    padding: 15px;
    background: #f0f7ff;
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

/* Animations */
@keyframes celebrate {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.celebrate {
    animation: celebrate 0.5s ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.3s ease-in-out;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    h1 {
        font-size: 1.7em;
    }

    .header-buttons {
        gap: 6px;
    }

    .btn-header {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    .chips-display {
        gap: 12px;
    }

    .chips-info,
    .bet-info {
        padding: 6px 12px;
    }

    .chip-value {
        font-size: 1.2em;
    }

    .bet-value {
        font-size: 1.1em;
    }

    .score-board {
        gap: 15px;
    }

    .score-item {
        font-size: 0.9em;
    }

    .player-section {
        padding: 12px;
    }

    .player-info h2 {
        font-size: 1.2em;
    }

    .hand-value {
        font-size: 1.3em;
        padding: 5px 12px;
    }

    .card {
        width: 65px;
        height: 95px;
        font-size: 1.2em;
    }

    .modal-content {
        padding: 20px;
        max-height: 90vh;
    }

    .modal-header h2 {
        font-size: 1.5em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .leaderboard-table {
        font-size: 0.9em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }

    .header-buttons {
        gap: 5px;
    }

    .btn-header {
        padding: 5px 10px;
        font-size: 0.75em;
    }

    .chips-display {
        gap: 10px;
    }

    .chips-info {
        padding: 8px 10px;
    }

    .bet-info {
        padding: 10.5px 10px;
    }

    .chip-icon {
        font-size: 1.3em;
    }

    .chip-value {
        font-size: 1.1em;
    }

    .bet-value {
        font-size: 1em;
    }

    .score-board {
        gap: 10px;
    }

    .score-item {
        font-size: 0.8em;
    }

    .player-section {
        padding: 10px;
    }

    .player-info h2 {
        font-size: 1em;
    }

    .hand-value {
        font-size: 1.2em;
        padding: 4px 10px;
    }

    .card {
        width: 55px;
        height: 80px;
        font-size: 1em;
    }

    .card-rank {
        font-size: 1.3em;
    }

    .card-suit {
        font-size: 0.9em;
    }

    .cards-container {
        gap: 6px;
        min-height: 90px;
    }

    .game-status {
        padding: 12px;
        margin: 5px 0;
    }

    #gameMessage {
        font-size: 1em;
    }

    .modal-content {
        padding: 15px;
        width: 95%;
    }

    .modal-header h2 {
        font-size: 1.3em;
    }

    .close-btn {
        font-size: 1.8em;
        width: 35px;
        height: 35px;
    }

    .leaderboard-table {
        font-size: 0.8em;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 6px 4px;
    }

    .rank-medal {
        font-size: 1.2em;
    }

    .filter-btn {
        padding: 8px 15px;
        font-size: 0.85em;
    }

    .btn-save-score {
        padding: 10px 20px;
        font-size: 0.95em;
    }

    .privacy-content h3 {
        font-size: 1.1em;
    }

    .privacy-content p,
    .privacy-content li {
        font-size: 0.9em;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.85em;
    }

    .controls {
        gap: 8px;
    }
}