/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f4c27 0%, #1a6b3f 100%);
    z-index: 1000;
}

.welcome-screen.hidden {
    display: none;
}

.welcome-content {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-title {
    font-size: 4rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5),
                 0 4px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
    font-weight: bold;
}

.game-subtitle {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.welcome-info {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: #fff;
    font-size: 1.2rem;
}

.info-label {
    opacity: 0.8;
}

.info-value {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.4rem;
}

.start-button {
    padding: 1rem 3rem;
    font-size: 1.5rem;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    transition: all 0.3s ease;
    font-weight: bold;
}

.start-button:hover {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

.start-button:active {
    transform: translateY(0);
}

/* ===== GAME SCREEN ===== */
.game-screen {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: linear-gradient(135deg, #0f4c27 0%, #1a6b3f 100%);
}

.game-screen.active {
    display: flex;
}

/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.chips-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 215, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chips-icon {
    font-size: 1.5rem;
}

.chips-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-buttons {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.btn-icon {
    font-size: 1.3rem;
}

/* ===== TABLE CONTAINER ===== */
.table-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* ===== DEALER AREA ===== */
.dealer-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem;
    min-height: 180px;
}

.dealer-label {
    font-size: 1rem;
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

/* ===== MESSAGE AREA ===== */
.message-area {
    text-align: center;
    padding: 1rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-message {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5),
                 0 2px 4px rgba(0, 0, 0, 0.5);
    animation: messageGlow 2s ease-in-out infinite;
}

/* ===== PLAYER AREA ===== */
.player-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    min-height: 180px;
}

.player-label {
    font-size: 1rem;
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

.hands-container {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
}

.player-hand {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.player-hand.active {
    opacity: 1;
}

/* ===== CARDS ===== */
.hand-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.5rem;
    min-height: 1.8rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.cards-container {
    display: flex;
    gap: -30px;
    min-height: 140px;
    align-items: center;
    position: relative;
}

.card {
    width: 80px;
    height: 120px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.card:not(:first-child) {
    margin-left: -30px;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.card-top {
    position: absolute;
    top: 0.3rem;
    left: 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.card-rank {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
}

.card-suit {
    font-size: 1.2rem;
    line-height: 1;
}

.card-center {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-suit-large {
    font-size: 3rem;
}

.card-bottom {
    position: absolute;
    bottom: 0.3rem;
    right: 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transform: rotate(180deg);
}

.card.hearts .card-rank,
.card.hearts .card-suit,
.card.diamonds .card-rank,
.card.diamonds .card-suit {
    color: #e74c3c;
}

.card.clubs .card-rank,
.card.clubs .card-suit,
.card.spades .card-rank,
.card.spades .card-suit {
    color: #2c3e50;
}

.card.face-down {
    background: linear-gradient(45deg, #c0392b, #e74c3c);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back-pattern {
    width: 90%;
    height: 90%;
    border: 3px solid white;
    border-radius: 6px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
}

/* ===== BET DISPLAY ===== */
.bet-display {
    margin-top: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bet-label {
    color: #fff;
    font-size: 0.9rem;
    opacity: 0.8;
}

.bet-amount {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1rem;
}

/* ===== BETTING AREA ===== */
.betting-area {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.betting-area.hidden {
    display: none;
}

.bet-controls {
    max-width: 600px;
    margin: 0 auto;
}

.bet-amount-display {
    text-align: center;
    margin-bottom: 0.5rem;
}

.bet-label {
    color: #fff;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.current-bet {
    color: #ffd700;
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.chip-stack-display {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.chip-stack {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stacked-chip {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 5px solid rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5),
                inset 0 2px 4px rgba(255, 255, 255, 0.3),
                inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    animation: chipStack 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
}

.stacked-chip::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 -3px 0 rgba(0, 0, 0, 0.2),
                0 -6px 0 rgba(0, 0, 0, 0.15),
                0 -9px 0 rgba(0, 0, 0, 0.1);
    z-index: -1;
}

.stacked-chip[data-value="1"] {
    background: radial-gradient(circle, #ffffff, #e0e0e0);
    color: #000;
    border-color: #3498db;
}

.stacked-chip[data-value="5"] {
    background: radial-gradient(circle, #e74c3c, #c0392b);
    color: #fff;
}

.stacked-chip[data-value="25"] {
    background: radial-gradient(circle, #2ecc71, #27ae60);
    color: #fff;
}

.stacked-chip[data-value="100"] {
    background: radial-gradient(circle, #2c3e50, #1a252f);
    color: #fff;
}

.stacked-chip[data-value="500"] {
    background: radial-gradient(circle, #9b59b6, #8e44ad);
    color: #fff;
}

.chip-selector {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.chip-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

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

.chip-btn:active {
    transform: translateY(-2px);
}

.chip-btn[data-value="1"] {
    background: radial-gradient(circle, #ffffff, #e0e0e0);
    color: #000;
    border: 3px solid #3498db;
}

.chip-btn[data-value="5"] {
    background: radial-gradient(circle, #e74c3c, #c0392b);
    color: #fff;
}

.chip-btn[data-value="25"] {
    background: radial-gradient(circle, #2ecc71, #27ae60);
    color: #fff;
}

.chip-btn[data-value="100"] {
    background: radial-gradient(circle, #2c3e50, #1a252f);
    color: #fff;
}

.chip-btn[data-value="500"] {
    background: radial-gradient(circle, #9b59b6, #8e44ad);
    color: #fff;
}

.chip-value {
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.bet-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.bet-action-btn {
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.undo-btn {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
}

.undo-btn:hover {
    background: linear-gradient(45deg, #e67e22, #d35400);
}

.clear-btn {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
}

.clear-btn:hover {
    background: linear-gradient(45deg, #7f8c8d, #707b7c);
}

.deal-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.deal-btn:hover {
    background: linear-gradient(45deg, #27ae60, #229954);
}

.deal-btn:disabled,
.clear-btn:disabled,
.undo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== ACTION AREA ===== */
.action-area {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    display: none;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.action-area.active {
    display: flex;
}

.action-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 100px;
}

.hit-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.hit-btn:hover {
    background: linear-gradient(45deg, #2980b9, #21618c);
}

.stand-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

.stand-btn:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
}

.double-btn {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
}

.double-btn:hover {
    background: linear-gradient(45deg, #e67e22, #d35400);
}

.split-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
}

.split-btn:hover {
    background: linear-gradient(45deg, #8e44ad, #7d3c98);
}

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.action-btn:active:not(:disabled) {
    transform: translateY(2px);
}

/* ===== INSURANCE MODAL ===== */
.insurance-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

.insurance-modal.active {
    display: flex;
}

.insurance-content {
    background: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid #ffd700;
}

.insurance-text {
    font-size: 2rem;
    color: #ffd700;
    margin-bottom: 1rem;
    font-weight: bold;
}

.insurance-cost {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 1.5rem;
}

.insurance-buttons {
    display: flex;
    gap: 1rem;
}

.insurance-btn {
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.yes-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.yes-btn:hover {
    background: linear-gradient(45deg, #27ae60, #229954);
}

.no-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

.no-btn:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
}

/* ===== GAME OVER MODAL ===== */
.game-over-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 200;
}

.game-over-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    margin: auto;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 3px solid #ffd700;
    max-width: 400px;
}

.modal-title {
    font-size: 2.5rem;
    color: #ffd700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-message {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.primary-btn:hover {
    background: linear-gradient(45deg, #27ae60, #229954);
}

.secondary-btn {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
}

.secondary-btn:hover {
    background: linear-gradient(45deg, #7f8c8d, #707b7c);
}
