* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.main-container {
    width: 100%;
    min-height: 100vh;
    padding: 5px;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.top-bar h1 {
    color: #ffd700;
    font-size: 1.3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.home-link {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Settings Panel */
.settings-panel {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    backdrop-filter: blur(10px);
    font-size: 0.85em;
}

.settings-group {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 50px;
    height: 25px;
    appearance: none;
    background: #ccc;
    border-radius: 25px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-label input[type="checkbox"]:checked {
    background: #4caf50;
}

.toggle-label input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked::before {
    transform: translateX(25px);
}

.toggle-label .toggle-off {
    display: none;
}

.toggle-label input[type="checkbox"]:not(:checked) ~ span:first-of-type {
    display: none;
}

.toggle-label input[type="checkbox"]:not(:checked) ~ .toggle-off {
    display: inline;
}

.deck-info {
    margin-left: auto;
    gap: 20px;
    font-size: 0.95em;
}

.deck-info strong {
    color: #ffd700;
}

#speedControl {
    width: 100px;
    margin: 0 10px;
}

#speedValue {
    color: #ffd700;
    font-weight: bold;
}

/* Stats Panel */
.stats-panel {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    backdrop-filter: blur(10px);
    font-size: 0.85em;
}

.stat-item {
    color: white;
    display: flex;
    gap: 8px;
    align-items: center;
}

.stat-label {
    opacity: 0.9;
}

.stat-value {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1em;
}

.small-btn {
    margin-left: auto;
    padding: 8px 16px;
    background: rgba(255, 107, 107, 0.8);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.small-btn:hover {
    background: rgba(255, 107, 107, 1);
    transform: translateY(-2px);
}

/* Hints Panel */
.hints-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.6);
}

.hints-panel h3 {
    color: #ffd700;
    font-size: 1em;
    margin-bottom: 8px;
    text-align: center;
}

.hint-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.hint-content p {
    margin: 0;
    color: #333;
    font-weight: bold;
    font-size: 0.95em;
    line-height: 1.4;
}

.hint-content .recommended {
    color: #28a745;
    font-size: 1.1em;
}

.hint-content .avoid {
    color: #dc3545;
}

.hint-explanation {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85em;
    line-height: 1.3;
    font-style: italic;
}

/* Game Container */
.game-container {
    background: linear-gradient(135deg, #0a5c0a 0%, #0d7a0d 100%);
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

/* Dealer Section */
.dealer-section {
    text-align: center;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.dealer-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

.dealer-info h2 {
    color: white;
    font-size: 1.1em;
}

.score {
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 1em;
    min-width: 40px;
    text-align: center;
}

.cards-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 80px;
    align-items: center;
}

/* Shuffle Message */
.shuffle-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 40px 60px;
    border-radius: 20px;
    z-index: 100;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

/* Player Spots */
.player-spots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 10px 0;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.player-spots.hide-ai .player-spot:not(#spot0) {
    display: none;
}

.player-spot {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    padding: 8px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.player-spot.inactive {
    border-color: rgba(255, 255, 255, 0.2);
    opacity: 0.6;
}

.player-spot.active {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.player-spot.current-turn {
    border-color: #00ff00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
    animation: glow 1.5s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(0, 255, 0, 0.8); }
}

.spot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 5px;
}

.spot-label {
    color: white;
    font-weight: bold;
    font-size: 1.1em;
}

.spot-score {
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
}

.add-player-btn, .remove-player-btn {
    padding: 5px 10px;
    font-size: 0.85em;
    background: rgba(76, 175, 80, 0.8);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.add-player-btn:hover, .remove-player-btn:hover {
    background: rgba(76, 175, 80, 1);
    transform: scale(1.05);
}

.remove-player-btn {
    background: rgba(244, 67, 54, 0.8);
}

.remove-player-btn:hover {
    background: rgba(244, 67, 54, 1);
}

.spot-cards {
    flex: 1;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    margin: 5px 0;
}

.spot-bet-area {
    margin: 10px 0;
    text-align: center;
}

.bet-input {
    width: 100%;
    padding: 8px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    text-align: center;
}

.bet-input:focus {
    outline: none;
    border-color: #ffd700;
}

.bet-display {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.3em;
    margin-top: 5px;
    display: none;
}

.player-spot.active .bet-display {
    display: block;
}

.player-spot.active .bet-input {
    display: none;
}

.spot-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 5px;
}

.action-btn {
    padding: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    transition: all 0.3s;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.action-btn[data-action="double"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.action-btn[data-action="split"] {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.spot-result {
    margin-top: 10px;
    padding: 8px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    min-height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spot-result.win {
    background: rgba(76, 175, 80, 0.8);
    color: white;
}

.spot-result.lose {
    background: rgba(244, 67, 54, 0.8);
    color: white;
}

.spot-result.push {
    background: rgba(255, 193, 7, 0.8);
    color: #000;
}

.spot-result.blackjack {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    animation: flash 1s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Cards */
.card {
    width: 50px;
    height: 70px;
    background: white;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: bold;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: transform 0.3s;
    animation: dealCard 0.3s;
}

@keyframes dealCard {
    from {
        transform: translateY(-100px) rotate(20deg);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }
}

.card:hover {
    transform: translateY(-5px);
}

.card.red {
    color: #dc143c;
}

.card.black {
    color: #000;
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 2em;
}

.card-value {
    font-size: 1em;
    line-height: 1;
}

.card-suit {
    font-size: 1.5em;
    line-height: 1;
}

/* Deal Area */
.deal-area {
    text-align: center;
    margin-top: 8px;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.deal-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.deal-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

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

.insurance-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    border: none;
    padding: 15px 35px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.insurance-btn:hover {
    transform: translateY(-3px);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .player-spots {
        grid-template-columns: repeat(3, 1fr);
    }

    .card {
        width: 55px;
        height: 77px;
        font-size: 1.1em;
    }

    .settings-panel, .stats-panel {
        padding: 12px 20px;
        gap: 20px;
        font-size: 0.95em;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 5px;
    }

    .top-bar {
        padding: 10px 15px;
        margin-bottom: 8px;
    }

    .top-bar h1 {
        font-size: 1.3em;
    }

    .settings-panel, .stats-panel {
        padding: 10px 15px;
        gap: 10px;
        font-size: 0.85em;
        margin-bottom: 8px;
    }

    .settings-group {
        font-size: 0.9em;
    }

    .deck-info {
        margin-left: 0;
        width: 100%;
        justify-content: space-around;
    }

    .stat-item {
        font-size: 0.9em;
    }

    .game-container {
        padding: 15px;
        min-height: auto;
    }

    .dealer-section {
        padding: 12px;
        margin-bottom: 20px;
    }

    .dealer-info h2 {
        font-size: 1.2em;
    }

    .score {
        padding: 6px 15px;
        font-size: 1em;
    }

    .player-spots {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 15px 0;
    }

    .player-spot {
        padding: 12px;
        min-height: 250px;
    }

    .card {
        width: 50px;
        height: 70px;
        font-size: 1em;
    }

    .cards-display {
        min-height: 80px;
    }

    .spot-cards {
        min-height: 80px;
    }

    .action-btn {
        padding: 8px;
        font-size: 0.9em;
    }

    .deal-btn {
        padding: 12px 30px;
        font-size: 1.1em;
    }

    .insurance-btn {
        padding: 10px 25px;
        font-size: 1em;
    }

    .toggle-label input[type="checkbox"] {
        width: 40px;
        height: 20px;
    }

    .toggle-label input[type="checkbox"]::before {
        width: 16px;
        height: 16px;
    }

    .toggle-label input[type="checkbox"]:checked::before {
        transform: translateX(20px);
    }

    #speedControl {
        width: 80px;
    }
}

@media (max-width: 480px) {
    .top-bar h1 {
        font-size: 1.1em;
    }

    .settings-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .small-btn {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }

    .game-container {
        padding: 10px;
    }

    .player-spot {
        padding: 10px;
        min-height: 220px;
    }

    .card {
        width: 45px;
        height: 63px;
        font-size: 0.9em;
    }

    .spot-header {
        font-size: 0.9em;
    }

    .deal-btn {
        padding: 10px 25px;
        font-size: 1em;
    }
}
