* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e5128 0%, #2d6a4f 50%, #1e5128 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    max-width: 900px;
    width: 100%;
    background: radial-gradient(ellipse at center, #0d4d2c 0%, #0a3d23 100%);
    border-radius: 200px;
    padding: 40px;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.5),
        inset 0 0 100px rgba(0, 0, 0, 0.3),
        0 0 0 15px #8b4513,
        0 0 0 20px #654321;
    border: 5px solid #3d2817;
}

h1 {
    text-align: center;
    color: #ffd700;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    font-weight: bold;
    letter-spacing: 2px;
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #ffd700;
    font-size: 1.2em;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

h2 {
    color: #ffffff;
    font-size: 1.3em;
    margin-bottom: 15px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.score {
    color: #ffd700;
    font-weight: bold;
}

.game-area {
    margin-bottom: 30px;
}

.dealer-section,
.player-section {
    margin-bottom: 30px;
}

.card-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 120px;
    align-items: center;
}

.card {
    width: 80px;
    height: 112px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    font-weight: bold;
    position: relative;
    animation: dealCard 0.3s ease-out;
    box-sizing: border-box;
}

@keyframes dealCard {
    from {
        transform: translateY(-50px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotateY(0);
        opacity: 1;
    }
}

.card.red {
    color: #dc143c;
}

.card.black {
    color: #000000;
}

.card-top-right {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.3em;
    line-height: 1;
}

.card-bottom-left {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 1.3em;
    line-height: 1;
    transform: rotate(180deg);
}

.card-middle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5em;
}

.card-back {
    background: linear-gradient(135deg, #9ca3b7 0%, #ffffff 50%, #9ca3b7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-back::before {
    content: "";
    width: 70%;
    height: 70%;
    background-image: url('images/logo.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
}

/* Member Card Styles */
.card.member-card {
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #007AFF 0%, #0056D6 100%) !important;
}

.member-card-value {
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-weight: bold;
    z-index: 10;
    box-shadow: none !important;
    border: none !important;
    position: absolute;
    font-size: 1.3em;
    color: white;
    text-shadow: 
        1px 1px 3px rgba(0, 0, 0, 0.9),
        -1px -1px 3px rgba(0, 0, 0, 0.9),
        1px -1px 3px rgba(0, 0, 0, 0.9),
        -1px 1px 3px rgba(0, 0, 0, 0.9),
        0 0 5px rgba(0, 0, 0, 0.8);
}

.member-card-value.card-top-right {
    top: 5px;
    right: 5px;
}

.member-card-value.card-bottom-left {
    bottom: 5px;
    left: 5px;
}

.card-value-red {
    color: #dc143c !important;
}

.card-value-black {
    color: #000000 !important;
}

/* Override colors for member card values to be white with shadow */
.member-card-value.card-value-red,
.member-card-value.card-value-black {
    color: white !important;
}

/* Joker icons on member cards should have white shadow */
.member-card-value.joker-icon {
    color: #ffd700;
    text-shadow: 
        1px 1px 3px rgba(0, 0, 0, 0.3),
        -1px -1px 3px rgba(0, 0, 0, 0.3),
        1px -1px 3px rgba(0, 0, 0, 0.3),
        -1px 1px 3px rgba(0, 0, 0, 0.3),
        0 0 5px rgba(0, 0, 0, 0.3);
}

/* Underline for 6 and 9 to distinguish orientation */
.underlined-value {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

/* Joker card styles */
.card.joker-card {
    background: linear-gradient(135deg, #4a0080 0%, #8b00ff 50%, #4a0080 100%);
    color: #ffd700;
}

.joker-icon {
    font-size: 1em;
    line-height: 1;
}

/* Position joker icons to match member card values */
.card-top-right.joker-icon {
    top: 5px;
    right: 3px;
}

.card-bottom-left.joker-icon {
    bottom: 5px;
    left: 3px;
    transform: rotate(180deg);
}

/* Joker icon on member cards */
.member-card-value.joker-icon.card-top-right {
    top: 5px;
    right: 1px;
}

.member-card-value.joker-icon.card-bottom-left {
    bottom: 5px;
    left: 1px;
    transform: rotate(180deg);
}

.joker-middle {
    font-size: 3em;
}

.texture-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Border-radius removed - parent card's overflow:hidden handles rounding */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.member-card-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    object-fit: cover;
    border-radius: 4px;
    z-index: 2;
    opacity: 1;
    background: white;
}

.game-status {
    text-align: center;
    margin: 20px 0;
    min-height: 30px;
}

#game-message {
    color: #ffd700;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.game-btn {
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#hit-btn {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    color: white;
}

#hit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

#stand-btn {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
}

#stand-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

.new-game {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
}

.new-game:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.game-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Goal Setting */
.goal-container {
    text-align: center;
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.goal-label {
    color: #ffd700;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.goal-input {
    width: 80px;
    padding: 8px 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid #ffd700;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    transition: all 0.3s ease;
}

.goal-input:focus {
    outline: none;
    border-color: #ffed4e;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    background: white;
}

.goal-input::-webkit-outer-spin-button,
.goal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.goal-input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.goal-info {
    color: rgba(255, 215, 0, 0.8);
    font-size: 0.85rem;
    font-style: italic;
}

/* Alt-Values Checkbox */
.alt-values-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alt-values-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #ffd700;
}

.alt-values-label {
    color: #ffd700;
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: help;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
    position: relative;
}

.info-icon:hover {
    background: rgba(255, 215, 0, 0.5);
    transform: scale(1.1);
}

.info-icon::after {
    content: attr(title);
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffd700;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: normal;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border: 2px solid #ffd700;
    text-shadow: none;
    z-index: 1000;
}

.info-icon:hover::after {
    opacity: 1;
}

/* Active state for mobile click/tap */
.info-icon.active::after {
    opacity: 1;
}

/* Make tooltip more mobile-friendly */
@media (max-width: 600px) {
    .info-icon {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Return Button */
.return-container {
    text-align: center;
    margin-top: 30px;
}

.return-btn {
    display: inline-block;
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffd700;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.return-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
}

.return-btn:active {
    transform: translateY(0);
}

.return-btn i {
    margin-right: 8px;
}

/* Responsive Design */
@media (max-width: 600px) {
    .game-container {
        padding: 20px;
        border-radius: 100px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.1em;
    }

    .card-container {
        gap: 8px;
        justify-content: center;
    }

    .card {
        width: 58px;
        height: 81px;
    }

    .card-top-right {
        font-size: 1em;
        top: 3px;
        right: 3px;
    }

    .card-bottom-left {
        font-size: 1em;
        bottom: 3px;
        left: 3px;
    }

    .card-middle {
        font-size: 1.8em;
    }

    .member-card-value {
        font-size: 1em;
    }

    .member-card-value.card-top-right {
        top: 3px;
        right: 3px;
    }

    .member-card-value.card-bottom-left {
        bottom: 3px;
        left: 3px;
    }

    .member-card-image {
        width: 85%;
        height: 85%;
    }
    
    .joker-icon {
        font-size: 1em;
    }
    
    /* Adjust joker positioning on mobile to match card values */
    .card-top-right.joker-icon,
    .member-card-value.joker-icon.card-top-right {
        top: 3px;
        right: 3px;
    }
    
    .card-bottom-left.joker-icon,
    .member-card-value.joker-icon.card-bottom-left {
        bottom: 3px;
        left: 3px;
    }
    
    .joker-middle {
        font-size: 2em;
    }

    .game-btn {
        padding: 12px 30px;
        font-size: 1em;
    }

    .return-btn {
        padding: 10px 25px;
        font-size: 0.95rem;
    }

    .goal-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .goal-label {
        font-size: 1rem;
    }

    .goal-input {
        width: 70px;
        padding: 6px 10px;
        font-size: 1rem;
    }

    .goal-info {
        font-size: 0.75rem;
        width: 100%;
    }
    
    .alt-values-container {
        gap: 6px;
    }
    
    .alt-values-checkbox {
        width: 18px;
        height: 18px;
    }
    
    .alt-values-label {
        font-size: 0.9rem;
    }
    
    .info-icon {
        width: 18px;
        height: 18px;
        font-size: 0.75rem;
    }
    
    .info-icon::after {
        font-size: 0.7rem;
        padding: 8px 10px;
        white-space: normal;
        max-width: 50vw;
        width: max-content;
        text-align: center;
        bottom: 25px;
        left: 50%;
        transform: translateX(-50%);
        line-height: 1.3;
    }
    
    /* Ensure active state works on mobile */
    .info-icon.active::after {
        opacity: 1 !important;
    }
}

