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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0f0f1e 100%);
    color: #fff;
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,215,0,0.03) 35px, rgba(255,215,0,0.03) 70px);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: containerFadeIn 1s ease;
}

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

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 3em;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 2px 2px 4px rgba(0,0,0,0.8);
    color: #ffd700;
    font-family: 'Georgia', serif;
    letter-spacing: 3px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
        margin-bottom: 10px;
        letter-spacing: 1px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }
}

.game-area {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .game-area {
        grid-template-columns: 220px 1fr 280px;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .game-area {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.players-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 768px) {
    .players-section {
        display: none;
    }
    
    .players-section.mobile-visible {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 10px;
        padding: 10px 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .players-section.mobile-visible .player-card {
        min-width: 200px;
        flex-shrink: 0;
    }
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (max-width: 768px) {
    .right-column {
        order: 3;
    }
}

.player-card {
    background: linear-gradient(145deg, #2a2a40 0%, #1f1f35 100%);
    border: 2px solid #3d3d5c;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,215,0,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.player-card:hover::before {
    opacity: 1;
}

.player-card.active {
    border-color: #ffd700;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 4px 15px rgba(0,0,0,0.4);
    transform: scale(1.02);
}

.player-card.active::before {
    opacity: 0.3;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.player-avatar {
    font-size: 2.5em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.player-name {
    font-weight: bold;
    font-size: 1.2em;
    color: #ffd700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.player-stats {
    font-size: 0.95em;
    opacity: 0.9;
    margin-left: 10px;
    font-family: 'Segoe UI', sans-serif;
}

.player-money {
    color: #4ade80;
    font-weight: bold;
    margin-top: 8px;
    font-size: 1.1em;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
    display: flex;
    align-items: center;
    gap: 5px;
}

.player-money::before {
    content: '💰';
}

.player-action {
    margin-top: 12px;
    font-size: 0.85em;
    padding: 8px 10px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    animation: slideIn 0.5s ease;
    font-family: 'Segoe UI', sans-serif;
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateX(-10px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

.center-area {
    display: flex;
    flex-direction: column;
}

.felt-table {
    background: linear-gradient(135deg, #1a5c3a 0%, #0f3d25 100%);
    border: 8px solid #8b4513;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        inset 0 0 50px rgba(0,0,0,0.5),
        0 10px 40px rgba(0,0,0,0.6);
    position: relative;
}

@media (max-width: 768px) {
    .felt-table {
        border: 4px solid #8b4513;
        border-radius: 15px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .felt-table {
        padding: 12px;
        border-radius: 12px;
    }
}

.felt-table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
    border-radius: 12px;
    pointer-events: none;
}

.cards-display {
    margin: 15px 0;
    position: relative;
    z-index: 1;
}

.cards-display h3 {
    margin-bottom: 12px;
    font-size: 1.1em;
    color: #ffd700;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-weight: 600;
    letter-spacing: 1px;
}

.card-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    min-height: 120px;
    align-items: center;
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 2px solid rgba(255,215,0,0.2);
}

.card {
    width: 70px;
    height: 100px;
    background: linear-gradient(145deg, #ffffff 0%, #f5f5f5 100%);
    border: 3px solid #2c3e50;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.4em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.5);
    position: relative;
}

@media (max-width: 768px) {
    .card {
        width: 55px;
        height: 80px;
        font-size: 1.1em;
        border: 2px solid #2c3e50;
    }
}

@media (max-width: 480px) {
    .card {
        width: 50px;
        height: 72px;
        font-size: 1em;
    }
}

.card::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 50%);
    border-radius: 7px;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-12px) scale(1.08);
    box-shadow: 
        0 12px 25px rgba(0,0,0,0.4),
        0 0 20px rgba(255,215,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.5);
}

.card.selected {
    transform: translateY(-18px) scale(1.12) rotate(-2deg);
    box-shadow: 
        0 15px 35px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4),
        inset 0 1px 2px rgba(255,255,255,0.5);
    border-color: #ffd700;
    animation: cardPulse 1.5s infinite;
}

@keyframes cardPulse {
    0%, 100% { 
        box-shadow: 
            0 15px 35px rgba(255, 215, 0, 0.6),
            0 0 30px rgba(255, 215, 0, 0.4);
    }
    50% { 
        box-shadow: 
            0 15px 35px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.6);
    }
}

.card.red { color: #dc2626; }
.card.black { color: #1f2937; }
.card.joker {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border-color: #ffd700;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.3),
        0 0 20px rgba(139, 92, 246, 0.5);
}

.human-section {
    background: linear-gradient(145deg, #2a2a40 0%, #1f1f35 100%);
    border: 3px solid #8b4513;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
    .human-section {
        padding: 15px;
        margin-bottom: 15px;
        border: 2px solid #8b4513;
        position: sticky;
        top: 0;
        z-index: 100;
        background: linear-gradient(145deg, #2a2a40 0%, #1f1f35 100%);
    }
}

.human-section h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

@media (max-width: 768px) {
    .human-section h3 {
        font-size: 1em;
        margin-bottom: 10px;
        gap: 8px;
    }
}

.hand-value {
    color: #ffd700;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.hand-cards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 15px 0;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
}

@media (max-width: 768px) {
    .hand-cards {
        gap: 8px;
        padding: 10px;
        margin: 10px 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .controls {
        gap: 8px;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
    }
}

button {
    padding: 14px 32px;
    font-size: 1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 
        0 4px 15px rgba(0,0,0,0.4),
        inset 0 1px 2px rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
    font-family: 'Georgia', serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

@media (max-width: 768px) {
    button {
        padding: 12px 20px;
        font-size: 0.9em;
        letter-spacing: 1px;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    button {
        width: 100%;
        padding: 14px 20px;
    }
}

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

button:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.5),
        inset 0 1px 2px rgba(255,255,255,0.3);
}

button:active:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-primary { 
    background: linear-gradient(145deg, #3b82f6 0%, #2563eb 100%);
    color: white; 
}

.btn-throw { 
    background: linear-gradient(145deg, #10b981 0%, #059669 100%);
    color: white; 
}

.btn-pick { 
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
    color: white; 
}

.btn-draw { 
    background: linear-gradient(145deg, #8b5cf6 0%, #7c3aed 100%);
    color: white; 
}

.btn-jhyaap {
    background: linear-gradient(145deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    font-size: 1.3em;
    padding: 18px 40px;
    box-shadow: 
        0 6px 20px rgba(220, 38, 38, 0.5),
        inset 0 1px 2px rgba(255,255,255,0.2);
    animation: jhyaapPulse 2s infinite;
}

@keyframes jhyaapPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 
            0 6px 20px rgba(220, 38, 38, 0.5),
            inset 0 1px 2px rgba(255,255,255,0.2);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 
            0 8px 30px rgba(220, 38, 38, 0.7),
            0 0 20px rgba(220, 38, 38, 0.5),
            inset 0 1px 2px rgba(255,255,255,0.2);
    }
}

.game-log {
    background: linear-gradient(145deg, #1f1f35 0%, #1a1a2e 100%);
    border: 2px solid #3d3d5c;
    padding: 15px;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 
        inset 0 2px 10px rgba(0,0,0,0.3),
        0 4px 15px rgba(0,0,0,0.4);
    flex-grow: 1;
}

@media (max-width: 768px) {
    .game-log {
        max-height: 200px;
        padding: 12px;
    }
}

.game-log h3 {
    margin-bottom: 12px;
    color: #ffd700;
    font-size: 1.1em;
    text-align: center;
    border-bottom: 2px solid rgba(255,215,0,0.3);
    padding-bottom: 8px;
}

.log-entry {
    margin-bottom: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 0.9em;
    font-family: 'Segoe UI', sans-serif;
    animation: logSlide 0.3s ease;
}

@keyframes logSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry.highlight {
    border-left-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
    backdrop-filter: blur(5px);
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show { display: flex; }

.modal-content {
    background: linear-gradient(145deg, #1a5c3a 0%, #0f3d25 100%);
    border: 8px solid #8b4513;
    color: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 700px;
    text-align: center;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.8),
        inset 0 0 50px rgba(0,0,0,0.3);
    animation: modalSlide 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 25px;
        border: 4px solid #8b4513;
        max-width: 90vw;
        border-radius: 15px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        max-width: 95vw;
    }
}

@keyframes modalSlide {
    from { 
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 25px;
    font-size: 2.8em;
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        2px 2px 4px rgba(0,0,0,0.5);
    color: #ffd700;
    animation: titleShine 2s infinite;
}

@media (max-width: 768px) {
    .modal-content h2 {
        font-size: 2em;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .modal-content h2 {
        font-size: 1.5em;
    }
}

.player-select-option {
    background: linear-gradient(145deg, #2a2a40 0%, #1f1f35 100%);
    border: 3px solid #3d3d5c;
    padding: 20px;
    margin: 10px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-select-option:hover {
    border-color: #ffd700;
    background: linear-gradient(145deg, #3a3a50 0%, #2f2f45 100%);
    transform: scale(1.02);
}

.player-select-option .avatar {
    font-size: 3em;
}

.player-select-option .info {
    text-align: left;
}

.player-select-option .name {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

.player-select-option .gender {
    font-size: 0.9em;
    opacity: 0.8;
}

@keyframes titleShine {
    0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 2px 2px 4px rgba(0,0,0,0.5); }
    50% { text-shadow: 0 0 30px rgba(255, 215, 0, 1), 2px 2px 4px rgba(0,0,0,0.5); }
}

.result-card {
    margin: 15px 0;
    padding: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: left;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}

.result-card:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.15);
}

.result-card.winner {
    background: rgba(46, 204, 113, 0.2);
    border: 2px solid #2ecc71;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.3);
}

.result-card.loser {
    background: rgba(231, 76, 60, 0.2);
    border: 2px solid #e74c3c;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

.money-display {
    font-size: 1.4em;
    color: #4ade80;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
    margin-top: 5px;
}

.info-bar {
    background: linear-gradient(145deg, #2a2a40 0%, #1f1f35 100%);
    border: 2px solid #3d3d5c;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

@media (max-width: 768px) {
    .info-bar {
        padding: 10px;
        margin-bottom: 10px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .info-bar {
        font-size: 0.85em;
        padding: 8px;
    }
}

.phase-indicator {
    display: inline-block;
    padding: 6px 18px;
    background: linear-gradient(145deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 20px;
    margin-left: 15px;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
    font-weight: bold;
}

@media (max-width: 768px) {
    .phase-indicator {
        padding: 4px 12px;
        margin-left: 8px;
        font-size: 0.85em;
    }
}

/* Mobile players toggle */
.mobile-players-toggle {
    display: none;
    background: linear-gradient(145deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .mobile-players-toggle {
        display: block;
    }
}

/* Reduce animations on mobile for performance */
@media (max-width: 768px) {
    @media (prefers-reduced-motion: no-preference) {
        * {
            animation-duration: 0.5s !important;
            transition-duration: 0.2s !important;
        }
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
    }
    
    .card:active {
        transform: scale(0.95);
    }
    
    button:hover:not(:disabled)::before {
        display: none;
    }
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { 
    background: rgba(0,0,0,0.3); 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, #ffd700 0%, #daa520 100%);
    border-radius: 10px;
    border: 2px solid rgba(0,0,0,0.3);
}
::-webkit-scrollbar-thumb:hover { 
    background: linear-gradient(180deg, #ffed4e 0%, #ffd700 100%);
}
