* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-green: #2E7D32;
    --dark-green: #1B5E20;
    --light-green: #4CAF50;
    --gold: #FFD700;
    --white: #FFFFFF;
    --light-gray: #F5F5F5;
    --dark-gray: #333333;
    --red: #D32F2F;
    --shadow: rgba(0, 0, 0, 0.3);
    --card-width: 35px;
    --card-height: 50px;
    --transition-speed: 0.3s;
}

@media (min-width: 480px) {
    :root {
        --card-width: 38px;
        --card-height: 54px;
    }
}

@media (min-width: 768px) {
    :root {
        --card-width: 42px;
        --card-height: 60px;
    }
}

@media (min-width: 1024px) {
    :root {
        --card-width: 45px;
        --card-height: 64px;
    }
}

@media (min-width: 1440px) {
    :root {
        --card-width: 48px;
        --card-height: 68px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.1) 0px,
            transparent 1px,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 3px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.1) 0px,
            transparent 1px,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 3px
        ),
        linear-gradient(135deg, #0a5f0a 0%, #1a7a1a 50%, #0a5f0a 100%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    height: 100vh;
    height: -webkit-fill-available; /* iOS Safari fix */
    padding: 3px;
    color: var(--white);
    overflow: hidden;
    touch-action: manipulation;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

@media (min-width: 768px) {
    body {
        padding: 5px;
    }
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: 
        radial-gradient(ellipse at center, rgba(0, 0, 0, 0.05) 0%, transparent 50%),
        linear-gradient(to bottom, rgba(139, 90, 43, 0.3) 0px, transparent 40px, transparent calc(100% - 40px), rgba(139, 90, 43, 0.3) 100%);
    border-radius: 8px;
    box-shadow: 
        inset 0 0 30px rgba(0, 0, 0, 0.3),
        0 10px 50px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth;
}

/* Mobile: Ensure scrolling works */
@media (max-width: 768px) {
    .app-container {
        border-radius: 4px;
        padding-bottom: 10px; /* Extra space at bottom */
    }
}

@media (min-width: 768px) {
    .app-container {
        max-width: 750px;
        border-radius: 12px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 900px;
    }
}

@media (min-width: 1440px) {
    .app-container {
        max-width: 1100px;
    }
}

header {
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px var(--shadow);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    header {
        padding: 8px;
        margin-bottom: 6px;
    }
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dealer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dealer-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold);
    box-shadow: 0 4px 12px var(--shadow);
}

@media (min-width: 768px) {
    .dealer-avatar {
        width: 55px;
        height: 55px;
    }
}

.dealer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dealer-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px var(--shadow);
}

@media (min-width: 769px) {
    .dealer-label {
        font-size: 0.75rem;
    }
}

.title-section {
    flex: 1;
    text-align: center;
}

header h1 {
    font-size: 1.1rem;
    margin-bottom: 3px;
    color: var(--gold);
    text-shadow: 2px 2px 4px var(--shadow);
}

@media (min-width: 768px) {
    header h1 {
        font-size: 1.3rem;
    }
}

@media (min-width: 769px) {
    header h1 {
        font-size: 1.5rem;
    }
}

@media (min-width: 1440px) {
    header h1 {
        font-size: 1.7rem;
    }
}

.balance-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    flex-wrap: wrap;
}

@media (min-width: 769px) {
    .balance-display {
        gap: 15px;
        font-size: 0.9rem;
    }
}

@media (min-width: 1440px) {
    .balance-display {
        gap: 20px;
        font-size: 0.95rem;
    }
}

.balance-display span {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition-speed) ease;
}

@media (min-width: 769px) {
    .balance-display span {
        padding: 5px 10px;
    }
}

.balance-display span:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.game-message {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px var(--shadow);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .game-message {
        font-size: 0.85rem;
        padding: 6px;
        margin-bottom: 5px;
        min-height: 28px;
    }
}

.game-message:empty {
    display: none;
}

.dealer-area, .player-area {
    background: 
        radial-gradient(ellipse at center, rgba(0, 100, 0, 0.4) 0%, rgba(0, 50, 0, 0.6) 100%);
    padding: 6px;
    margin-bottom: 5px;
    border-radius: 8px;
    border: 2px solid rgba(139, 90, 43, 0.7);
    box-shadow: 
        inset 0 2px 10px rgba(0, 0, 0, 0.4),
        0 4px 15px var(--shadow);
    position: relative;
    transition: all var(--transition-speed) ease;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .dealer-area, .player-area {
        padding: 8px;
        margin-bottom: 8px;
        border-radius: 10px;
    }
}

.dealer-area {
    border-top: 3px solid rgba(211, 47, 47, 0.6);
    background: 
        radial-gradient(ellipse at center, rgba(211, 47, 47, 0.15) 0%, rgba(0, 50, 0, 0.6) 100%);
}

.player-area {
    border-bottom: 4px solid rgba(76, 175, 80, 0.6);
    background: 
        radial-gradient(ellipse at center, rgba(76, 175, 80, 0.15) 0%, rgba(0, 50, 0, 0.6) 100%);
}

.dealer-area::before,
.player-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 7px;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        );
    pointer-events: none;
}

@media (min-width: 769px) {
    .dealer-area, .player-area {
        padding: 12px;
        margin-bottom: 10px;
    }
}

.dealer-area:hover, .player-area:hover {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 12px 40px var(--shadow);
}

.dealer-area h2, .player-area h2 {
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--gold);
    text-align: center;
    text-shadow: 0 2px 6px var(--shadow);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 6px;
}

@media (min-width: 769px) {
    .dealer-area h2, .player-area h2 {
        margin-bottom: 8px;
        font-size: 1rem;
    }
}

@media (min-width: 1440px) {
    .dealer-area h2, .player-area h2 {
        margin-bottom: 8px;
        font-size: 1.1rem;
    }
}

.hand-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hand-container-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hand-section-inline {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hand-label-inline {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

.card-row-inline {
    display: flex;
    gap: 3px;
    min-height: auto;
}

.hand-divider {
    font-size: 1.2rem;
    color: var(--gold);
    font-weight: 300;
    margin: 0 5px;
}

.dealer-status {
    text-align: center;
    font-size: 0.8rem;
    color: var(--gold);
    font-style: italic;
    margin-bottom: 8px;
    min-height: 22px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    font-weight: 500;
}

.hand-section {
    background: 
        radial-gradient(ellipse at center, rgba(255, 215, 0, 0.1) 0%, transparent 70%),
        rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 8px;
    border: 2px dashed rgba(255, 215, 0, 0.3);
    position: relative;
}

.hand-section::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    pointer-events: none;
}

.hand-section h3 {
    margin-bottom: 5px;
    font-size: 0.75rem;
    color: var(--light-green);
    text-align: center;
}

@media (min-width: 769px) {
    .hand-section h3 {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
}

@media (min-width: 1440px) {
    .hand-section h3 {
        font-size: 0.85rem;
    }
}

.card-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 60px;
    align-items: center;
    padding: 4px 0;
}

@media (min-width: 769px) {
    .card-row {
        gap: 5px;
        min-height: 70px;
    }
}

@media (min-width: 1440px) {
    .card-row {
        gap: 6px;
        min-height: 75px;
    }
}

.dealt-cards {
    min-height: 65px;
}

@media (min-width: 769px) {
    .dealt-cards {
        min-height: 75px;
    }
}

@media (min-width: 1440px) {
    .dealt-cards {
        min-height: 80px;
    }
}

.card {
    width: var(--card-width);
    height: var(--card-height);
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 8px var(--shadow);
    position: relative;
    user-select: none;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card:active {
    transform: scale(0.95);
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-10px) scale(1.05);
        box-shadow: 0 8px 16px var(--shadow);
    }
}

.card.selected {
    transform: translateY(-20px) scale(1.1);
    box-shadow: 0 12px 24px rgba(255, 215, 0, 0.5);
    border: 3px solid var(--gold);
    animation: bounce 0.6s ease;
}

@media (hover: hover) {
    .card.selected:hover {
        transform: translateY(-22px) scale(1.12);
    }
}

.card.red {
    color: var(--red);
}

.card.black {
    color: var(--dark-gray);
}

.card-rank {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 1px;
}

@media (min-width: 769px) {
    .card-rank {
        font-size: 1rem;
        margin-bottom: 2px;
    }
}

@media (min-width: 1440px) {
    .card-rank {
        font-size: 1.1rem;
    }
}

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

@media (min-width: 769px) {
    .card-suit {
        font-size: 1.2rem;
    }
}

@media (min-width: 1440px) {
    .card-suit {
        font-size: 1.3rem;
    }
}

.card-back {
    background: 
        repeating-linear-gradient(
            45deg,
            #1a237e,
            #1a237e 10px,
            #283593 10px,
            #283593 20px
        ),
        linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card-back::before {
    content: '🎴';
    font-size: 1.2rem;
    position: absolute;
    opacity: 0.6;
}

@media (min-width: 769px) {
    .card-back {
        font-size: 2rem;
    }
    
    .card-back::before {
        font-size: 1.5rem;
    }
}

.card.face-down {
    cursor: default;
}

.card.face-down .card-rank,
.card.face-down .card-suit {
    display: none;
}

.card.dealing {
    animation: dealCard 0.5s ease-out forwards;
}

.card.revealing {
    animation: flipCard 0.6s ease-in-out forwards;
}

.hand-rank {
    text-align: center;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--gold);
    font-weight: 600;
}

@media (min-width: 769px) {
    .hand-rank {
        font-size: 0.75rem;
        margin-top: 5px;
    }
}

@media (min-width: 1440px) {
    .hand-rank {
        font-size: 0.8rem;
    }
}

.controls {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.betting-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

@media (min-width: 769px) {
    .betting-controls {
        gap: 12px;
        margin-bottom: 10px;
    }
}

.betting-area {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
    background: 
        radial-gradient(ellipse at center, rgba(0, 100, 0, 0.3) 0%, rgba(0, 50, 0, 0.5) 100%);
    border-radius: 10px;
    border: 2px solid rgba(139, 90, 43, 0.5);
}

.betting-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.2), rgba(139, 90, 43, 0.4));
    border: 3px dashed var(--gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 
        inset 0 4px 10px rgba(0, 0, 0, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.3);
}

.tie-bet-circle {
    width: 110px;
    height: 110px;
    border-color: rgba(255, 193, 7, 0.8);
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 193, 7, 0.2), rgba(139, 90, 43, 0.4));
}

.tie-bet-circle .betting-label {
    font-size: 0.6rem;
    text-align: center;
    line-height: 1.2;
}

.betting-label {
    position: absolute;
    top: 15px;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
}

.chip-stack {
    min-height: 50px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    margin: 5px 0;
}

.chip-stack .chip {
    margin: -15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.chip-stack .chip:first-child {
    margin-bottom: 0;
}

.bet-total {
    position: absolute;
    bottom: 10px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 8px;
    border-radius: 10px;
}

.chip-tray {
    width: 100%;
    background: 
        linear-gradient(to bottom, rgba(139, 90, 43, 0.4), rgba(101, 67, 33, 0.6));
    border: 3px solid rgba(101, 67, 33, 0.8);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.4);
}

.tray-label {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.poker-chips {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

@media (min-width: 769px) {
    .poker-chips {
        gap: 8px;
    }
}

.chip {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    border: 3px dashed rgba(255, 255, 255, 0.5);
}

@media (min-width: 769px) {
    .chip {
        width: 50px;
        height: 50px;
    }
}

.chip:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

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

.tie-bet-chip {
    border: 3px dashed rgba(255, 193, 7, 0.8);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.tie-bet-chip:hover {
    box-shadow: 0 8px 16px rgba(255, 193, 7, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.tie-bet-chip .chip-inner {
    background: linear-gradient(135deg, 
        rgba(255, 193, 7, 0.3) 0%, 
        rgba(255, 193, 7, 0.1) 50%, 
        rgba(255, 193, 7, 0.3) 100%);
}

.chip.adding {
    animation: chipAdd 0.5s ease-out;
}

@keyframes chipAdd {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes chipDrop {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateY(5px) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chip-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chip-value {
    font-size: 0.7rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

@media (min-width: 769px) {
    .chip-value {
        font-size: 0.75rem;
    }
}

/* Chip Colors */
.chip-5 {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #c92a2a);
}

.chip-10 {
    background: radial-gradient(circle at 30% 30%, #4dabf7, #1971c2);
}

.chip-25 {
    background: radial-gradient(circle at 30% 30%, #51cf66, #2f9e44);
}

.chip-50 {
    background: radial-gradient(circle at 30% 30%, #ffd43b, #f59f00);
}

.chip-100 {
    background: radial-gradient(circle at 30% 30%, #000000, #2d2d2d);
}

.chip-500 {
    background: radial-gradient(circle at 30% 30%, #9775fa, #6741d9);
}

.chip-1000 {
    background: radial-gradient(circle at 30% 30%, #ff6b9d, #c2255c);
}

.bet-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 10; /* Ensure buttons are above other elements */
}

.bet-actions .btn {
    flex: 1;
    max-width: 150px;
}

@keyframes chipPulse {
    0%, 100% {
        box-shadow: 0 12px 24px rgba(255, 215, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 12px 24px rgba(255, 215, 0, 0.9), inset 0 2px 4px rgba(255, 255, 255, 0.7);
    }
}

.game-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 4px var(--shadow);
    min-width: 90px;
    position: relative;
    overflow: hidden;
}

@media (min-width: 769px) {
    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 110px;
    }
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

@media (hover: hover) {
    .btn:hover:not(:disabled) {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 6px 12px var(--shadow);
    }
}

.btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.btn-primary {
    background: var(--gold);
    color: var(--dark-gray);
}

.btn-primary:hover:not(:disabled) {
    background: #FFC107;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.instructions {
    text-align: center;
    margin-top: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.75rem;
}

@media (min-width: 769px) {
    .instructions {
        font-size: 0.8rem;
        padding: 8px;
        margin-top: 8px;
    }
}

@media (min-width: 1440px) {
    .instructions {
        font-size: 0.85rem;
    }
}

.hidden {
    display: none !important;
}

.player-hands {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.manual-split {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.split-instruction {
    text-align: center;
    font-size: 0.75rem;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 5px;
    font-weight: 600;
}

.split-hands {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.split-hand {
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.split-hand h3 {
    font-size: 0.75rem;
    color: var(--light-green);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-count {
    font-size: 0.7rem;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
}

.manual-hand {
    min-height: 70px;
    background: rgba(255, 215, 0, 0.05);
    border: 2px dashed rgba(255, 215, 0, 0.3);
    border-radius: 5px;
    padding: 5px;
}

.manual-hand .card {
    cursor: pointer;
}

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

footer {
    text-align: center;
    margin-top: 8px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--gold);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 5px;
}

.btn-link:hover {
    color: var(--white);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--primary-green);
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px var(--shadow);
}

.modal-content h2 {
    color: var(--gold);
    margin-bottom: 20px;
    font-size: 2rem;
}

.modal-content h3 {
    color: var(--light-green);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.modal-content p, .modal-content li {
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 1rem;
}

.modal-content ul, .modal-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--white);
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--red);
}

.rules-text {
    color: var(--white);
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glow {
    0%, 100% {
        text-shadow: 2px 2px 4px var(--shadow);
    }
    50% {
        text-shadow: 0 0 20px var(--gold), 2px 2px 4px var(--shadow);
    }
}

@keyframes dealCard {
    0% {
        opacity: 0;
        transform: translateX(-100vw) rotate(-45deg) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateX(10px) rotate(5deg) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0) scale(1);
    }
}

@keyframes flipCard {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-20px) scale(1.1);
    }
    50% {
        transform: translateY(-30px) scale(1.15);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 8px var(--shadow);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 12px var(--shadow), 0 0 20px rgba(255, 215, 0, 0.3);
    }
}

.btn-primary:not(:disabled) {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

/* Responsive Design - Mobile Portrait */
@media (max-width: 768px) {
    /* Compact header */
    header {
        padding: 4px;
        margin-bottom: 4px;
    }
    
    header h1 {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    .dealer-avatar {
        width: 35px;
        height: 35px;
    }
    
    .balance-display {
        font-size: 0.7rem;
        gap: 6px;
    }
    
    .balance-display span {
        padding: 3px 6px;
    }
    
    /* Compact game message */
    .game-message {
        font-size: 0.7rem;
        padding: 3px;
        min-height: 20px;
        margin-bottom: 3px;
    }
    
    /* Compact dealer/player areas */
    .dealer-area, .player-area {
        padding: 4px;
        margin-bottom: 4px;
    }
    
    .dealer-area h2, .player-area h2 {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }
    
    /* Make cards smaller */
    :root {
        --card-width: 32px;
        --card-height: 45px;
    }
    
    /* Compact betting controls */
    .betting-controls {
        margin-bottom: 6px;
        padding-bottom: 6px;
        gap: 6px;
    }
    
    /* Smaller chip trays */
    .chip-tray {
        padding: 4px;
        margin-bottom: 6px;
    }
    
    .tray-label {
        font-size: 0.6rem;
        margin-bottom: 3px;
    }
    
    .poker-chips {
        gap: 3px;
    }
    
    .chip {
        width: 35px;
        height: 35px;
        border-width: 2px;
    }
    
    .chip-value {
        font-size: 0.6rem;
    }
    
    /* COMPACT BET ACTIONS - Row layout on mobile */
    .bet-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 6px;
        padding: 6px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 6px;
        width: 100%;
    }
    
    .bet-actions .btn {
        flex: 1;
        min-width: calc(50% - 2px); /* 2 buttons per row */
        padding: 8px 4px;
        font-size: 0.75rem;
        min-height: 36px;
        white-space: nowrap;
    }
    
    /* Compact game controls */
    .game-controls {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px;
    }
    
    .game-controls .btn {
        flex: 1;
        min-width: calc(50% - 2px);
        padding: 8px 4px;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    /* Compact instructions */
    .instructions {
        font-size: 0.75rem;
        padding: 4px;
        margin-top: 4px;
    }
    
    /* Compact modal */
    .modal-content {
        padding: 15px;
        max-width: 90%;
    }
    
    .hand-section h3 {
        font-size: 0.85rem;
    }
    
    /* Ensure scrolling works */
    .player-area {
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    /* Smaller betting circles */
    .betting-circle {
        width: 90px;
        height: 90px;
    }
    
    .bet-label {
        font-size: 0.65rem;
    }
    
    .bet-amount {
        font-size: 0.85rem;
    }
}

/* Extra Small Mobile Devices (iPhone SE, etc) */
@media (max-width: 375px) {
    header h1 {
        font-size: 1rem;
    }
    
    .bet-actions .btn,
    .game-controls .btn {
        font-size: 0.7rem;
        padding: 6px 2px;
        min-height: 32px;
    }
    
    .chip {
        width: 32px;
        height: 32px;
    }
    
    .betting-circle {
        width: 80px;
        height: 80px;
    }
}

@media (min-width: 769px) {
    .player-hands {
        flex-direction: row;
        justify-content: space-around;
        gap: 20px;
    }

    .hand-section {
        flex: 1;
    }
}

@media (min-width: 1440px) {
    .dealer-area, .player-area {
        padding: 25px;
    }
}

@media (min-width: 1920px) {
    .app-container {
        max-width: 1300px;
    }
    
    .dealer-area, .player-area {
        padding: 30px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .card:hover {
        transform: none;
        box-shadow: 0 4px 8px var(--shadow);
    }
    
    .btn:hover:not(:disabled) {
        transform: none;
        box-shadow: 0 4px 8px var(--shadow);
    }
}

/* Mobile Landscape Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    /* Ultra compact for landscape */
    header {
        padding: 3px;
        margin-bottom: 3px;
    }
    
    header h1 {
        font-size: 1rem;
        margin-bottom: 2px;
    }
    
    .dealer-avatar {
        width: 30px;
        height: 30px;
    }
    
    .balance-display {
        font-size: 0.65rem;
    }
    
    .dealer-area, .player-area {
        padding: 3px;
        margin-bottom: 3px;
    }
    
    .dealer-area h2, .player-area h2 {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    
    .game-message {
        padding: 2px;
        margin-bottom: 2px;
        min-height: 18px;
        font-size: 0.65rem;
    }
    
    /* Extra compact cards in landscape */
    :root {
        --card-width: 28px;
        --card-height: 40px;
    }
    
    /* Extra compact chips */
    .chip {
        width: 30px;
        height: 30px;
    }
    
    .chip-value {
        font-size: 0.55rem;
    }
    
    /* Compact buttons - 3 per row in landscape */
    .bet-actions .btn,
    .game-controls .btn {
        min-width: calc(33.333% - 3px);
        padding: 6px 2px;
        font-size: 0.7rem;
        min-height: 32px;
    }
    
    .betting-controls {
        gap: 3px;
    }
    
    .chip-tray {
        padding: 3px;
        margin-bottom: 3px;
    }
    
    /* Smaller betting circles */
    .betting-circle {
        width: 70px;
        height: 70px;
    }
}

/* Win/Lose/Push animations */
.result-win {
    animation: winPulse 1s ease-in-out;
}

.result-lose {
    animation: losePulse 1s ease-in-out;
}

.result-push {
    animation: pushPulse 1s ease-in-out;
}

@keyframes winPulse {
    0%, 100% { background: rgba(0, 0, 0, 0.3); }
    50% { background: rgba(76, 175, 80, 0.5); }
}

@keyframes losePulse {
    0%, 100% { background: rgba(0, 0, 0, 0.3); }
    50% { background: rgba(211, 47, 47, 0.5); }
}

@keyframes pushPulse {
    0%, 100% { background: rgba(0, 0, 0, 0.3); }
    50% { background: rgba(255, 193, 7, 0.5); }
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid rgba(255, 215, 0, 0.3);
    border-top: 4px solid var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    animation: ripple-animation 0.6s ease-out;
}

@keyframes ripple-animation {
    to {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* Smooth transitions for all interactive elements */
button, .card, .hand-section {
    will-change: transform;
}

/* Performance optimization for animations */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
