/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: url('../images/08d8b3d9-1239-4326-979a-700899d32587.webp') center center / cover no-repeat fixed;
    color: #333;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Fallback for mobile devices that don't support fixed backgrounds */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Loading Screen */
#loading-screen {
    background: rgba(0, 0, 0, 0.8);
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    color: white;
    font-size: 18px;
    font-weight: 500;
}

/* Main Menu */
#main-menu {
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
}

.menu-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.game-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: -1px;
}

.language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
}

.language-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-btn:hover {
    background: white;
    color: #667eea;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 40px;
}

/* Avatar grid in profile */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    justify-items: center;
}

.avatar-option {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    background: #fff;
}

.avatar-option.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Profile top bar with Save/Back */
.profile-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.profile-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.profile-name-edit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
}

.menu-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-btn.primary {
    background: white;
    color: #667eea;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.menu-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

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

.menu-btn.secondary:hover {
    background: white;
    color: #000;
}

/* Make the Register toggle button clearly visible */
#auth-mode-register.menu-btn.secondary {
    background: #000;
    color: #fff;
    border-color: #000;
}

#auth-mode-register.menu-btn.secondary:hover {
    background: #222;
    color: #fff;
}

/* Make the 'Show Results' quick button clearly visible in black */
#show-results-now-btn.menu-btn.secondary {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

#show-results-now-btn.menu-btn.secondary:hover {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}

.menu-btn.tertiary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.menu-btn.tertiary:hover {
    border-color: white;
    background: rgba(255, 255, 255, 0.1);
    color: #000;
}

/* Input Screens */
#name-input, #room-code-input {
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
}

.input-container {
    width: 100%;
    max-width: 350px;
    text-align: center;
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.input-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.input-container input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 500;
}

/* Auth specific small inputs spacing fix */
#auth-screen .input-container input { margin-bottom: 12px; }

.input-container input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Waiting Screen */
#waiting-screen {
    background: rgba(0, 0, 0, 0.7);
    text-align: center;
    padding: 20px;
}

.waiting-container {
    color: white;
    max-width: 350px;
}

.waiting-container h2 {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 600;
}

#room-code-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 20px 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Game Screen */
#game-screen {
    background: rgba(248, 249, 250, 0.7);
    display: none;
    flex-direction: column;
    position: relative;
    padding: 5px;
    height: 100vh;
    overflow: hidden;
}

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

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.game-info #current-round {
    font-size: 18px;
    font-weight: bold;
    color: #ecf0f1;
}

.game-info #turn-text {
    font-size: 14px;
    color: #bdc3c7;
}

/* Timer container adjustments */
.timer-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.timer-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745, #20c997);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.timer-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg, transparent 0%, #dc3545 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timer-circle.warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    animation: pulse-warning 1s infinite;
}

.timer-circle.danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    animation: pulse-danger 0.5s infinite;
}

.timer-circle.danger::before {
    opacity: 0.3;
}

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

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

#timer-text {
    position: relative;
    z-index: 2;
}

/* Game Notifications */
.game-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
    text-align: center;
}

.game-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.game-notification.info {
    background: rgba(23, 162, 184, 0.95);
}

.game-notification.warning {
    background: rgba(255, 193, 7, 0.95);
    color: #212529;
}

.game-notification.danger {
    background: rgba(220, 53, 69, 0.95);
}

/* Player Areas */
.board-container {
    display: grid;
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr;
    gap: 8px;
    height: calc(100vh - 90px);
    overflow: hidden;
}

.opponent-area, .player-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.opponent-area { flex-direction: row-reverse; }
.opponent-area .columns-container { transform: rotate(180deg); }

.player-info {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
    min-width: 100px;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* Avatar placed outside the name box */
.player-info-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.avatar-outside {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.throw-menu {
    position: fixed;
    transform: translateY(-100%);
    display: flex;
    gap: 6px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 3000;
}

.columns-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
    max-width: 560px;
}

.column {
    min-height: 200px;
    width: 90px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.column.clickable {
    cursor: pointer;
}

.column.clickable:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.column.valid-placement {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.3);
}

.column.invalid-placement {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    opacity: 0.6;
    cursor: not-allowed;
}

.column.winning-column {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: winning-glow 2s infinite;
}

@keyframes winning-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
        border-color: #ffd700;
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
        border-color: #ffed4e;
    }
}

.column-crown {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    z-index: 10;
    animation: crown-bounce 1.5s infinite;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes crown-bounce {
    0%, 100% { 
        transform: translateX(-50%) translateY(0px);
    }
    50% { 
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Column Tooltip */
.column-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 16px;
    z-index: 5000; /* ensure above everything */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 220px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    pointer-events: none;
}

.column.winning-column:hover .column-tooltip,
.column.winning-column.tooltip-active .column-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1.05);
    pointer-events: auto;
}

/* Rotate opponent tooltips so player can read them normally */
.opponent-columns .column-tooltip {
    transform: translate(-50%, -50%) rotate(180deg);
}

.opponent-columns .column.winning-column:hover .column-tooltip,
.opponent-columns .column.winning-column.tooltip-active .column-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) rotate(180deg) scale(1.05);
    pointer-events: auto;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: white;
}

.winning-hand, .losing-hand {
    text-align: center;
    width: 100%;
}

.hand-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.hand-value {
    font-size: 14px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hand-value.winner {
    color: #28a745;
    background: rgba(40, 167, 69, 0.2);
    border-color: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.3);
}

.hand-value.loser {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
}

.vs-divider {
    font-size: 16px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    padding: 4px 0;
}

/* Responsive tooltip for mobile */
@media (max-width: 480px) {
    .column-tooltip {
        min-width: 180px;
        padding: 12px;
    }
    
    .hand-value {
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .vs-divider {
        font-size: 14px;
    }
}

/* Current Card Area */
.current-card-area {
    position: fixed;
    display: flex;
    flex-direction: column;
    z-index: 2000;
    pointer-events: none; /* avoid estorbar clics en tablero */
}
#current-card-container { pointer-events: auto; }
/* Center the current card area during swap phase for better UX */
.current-card-area.centered {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -40%);
}

#current-card-container { text-align: center; }

.card-instruction {
    margin-top: 15px;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* Cards */
.card {
    width: 72px;
    height: 100px;
    background: white;
    border: 2px solid #333;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.card.large {
    width: 90px;
    height: 130px;
    font-size: 22px;
    padding: 8px;
}

.card.red {
    color: #dc3545;
}

.card.black {
    color: #333;
}

/* Card elements - make text even bigger */
.card .card-rank {
    font-size: 18px;
    font-weight: 800;
}

.card .card-suit {
    font-size: 22px;
    font-weight: 700;
}

.card.large .card-rank {
    font-size: 22px;
    font-weight: 800;
}

.card.large .card-suit {
    font-size: 26px;
    font-weight: 700;
}

.card.face-down {
    background: linear-gradient(135deg, #4a6cf7 0%, #667eea 100%);
    color: white;
    border-color: #4a6cf7;
}

.card.face-down::before {
    content: '?';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Cards revealed during swap phase */
.card.swap-revealed {
    background: white;
    border: 2px solid #28a745;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.5);
    animation: swap-reveal 0.5s ease-out;
}

@keyframes swap-reveal {
    0% {
        transform: rotateY(180deg);
        opacity: 0.5;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

.card-rank {
    font-size: inherit;
    line-height: 1;
}

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

/* Swap Phase - Use same area as current card */
.swap-phase-content {
    text-align: center;
}

/* Ensure swap content is clickable despite parent pointer-events none */
#swap-phase-content {
    pointer-events: auto;
}

.swap-instruction {
    margin: 10px 0;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

#pass-swap-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #6c757d;
    border-radius: 10px;
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 10px auto 5px auto; /* center horizontally */
    position: relative;
    z-index: 100;
}

#pass-swap-btn:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Results Screen */
#results-screen {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
}

.results-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

#game-result-title {
    color: white;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
}

.results-summary {
    background: white;
    border-radius: 20px;
    padding: 30px 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* History list rows */
#history-list .history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}
#history-list .history-row:last-child { border-bottom: none; }
#history-list .result-win { color: #28a745; font-weight: 700; }
#history-list .result-loss { color: #dc3545; font-weight: 700; }
#history-list .result-draw { color: #ffc107; font-weight: 700; }

.winner-display {
    font-size: 24px;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 25px;
}

.results-header {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 20px;
}

.column-result {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.column-result:last-child {
    border-bottom: none;
}

.hands-container {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    text-align: center;
}

.hands-container .winner {
    font-weight: 700;
    color: #28a745;
}

.hands-container .loser {
    color: #6c757d; /* keep neutral color */
    opacity: 1; /* ensure not faded */
}

/* Keep tooltip hand values crisp on hover/tap */
.column-tooltip .hand-value.loser,
.column-tooltip .hand-value.winner {
    opacity: 1;
}

/* Prevent opacity reduction on winning column hover tooltips */
.column.winning-column:hover .column-tooltip .hand-value,
.column.winning-column.tooltip-active .column-tooltip .hand-value {
    opacity: 1;
}

.hands-container .tie {
    color: #ffc107;
    font-weight: 600;
}

.vs-text {
    margin: 0 10px;
    color: #495057;
    font-weight: 600;
}

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

/* Tomato animation */
.tomato-anim {
    position: fixed;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 30% 30%, #ff4d4d, #cc0000);
    border-radius: 50%;
    z-index: 5000;
    transition: transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.tomato-anim.splat {
    width: 42px;
    height: 42px;
    border-radius: 30% 50% 40% 60% / 40% 30% 60% 50%;
    background: radial-gradient(circle at 40% 40%, #ff6666, #cc0000);
    transition: all 0.35s ease;
}

.bomb-anim {
    position: fixed;
    width: 36px;
    height: 36px;
    background: radial-gradient(circle at 30% 30%, #444, #000);
    border-radius: 50%;
    z-index: 5000;
    transition: transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.bomb-anim.boom {
    width: 60px;
    height: 60px;
    border-radius: 0;
    background: radial-gradient(circle, #ffa500, #ff4500, #000);
    box-shadow: 0 0 25px rgba(255,69,0,0.8);
    transition: all 0.35s ease;
}

/* Card Deal Animation */
.dealing-card {
    position: absolute;
    width: 60px;
    height: 85px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    pointer-events: none;
    transform-origin: center center;
    transition: none;
}

@keyframes deal-to-column {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(var(--mid-x, 0px), var(--mid-y, 0px)) rotate(15deg) scale(1.1);
        opacity: 0.9;
    }
    100% {
        transform: translate(var(--target-x), var(--target-y)) rotate(0deg) scale(1);
        opacity: 1;
    }
}

.dealing-card.animate {
    animation: deal-to-column 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Dealing card content styles */
.dealing-card .card-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 5px;
    font-size: 16px;
    font-weight: bold;
}

/* Color classes for dealing cards */
.dealing-card.red {
    color: #dc3545;
}

.dealing-card.black {
    color: #333;
}

.dealing-card .card-rank {
    text-align: left;
}

.dealing-card .card-suit {
    text-align: center;
    font-size: 20px;
}

.dealing-card .card-back {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 32px;
    color: white;
}

/* Instructions Screen */
#instructions-screen {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    height: 100vh;
    box-sizing: border-box;
}

.instructions-container {
    width: 100%;
    max-width: 450px;
    background: white;
    border-radius: 20px;
    padding: 30px 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin: 20px auto;
    max-height: none;
    overflow: visible;
}

.instructions-container h2 {
    color: #333;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
}

.instruction-section {
    margin-bottom: 25px;
}

.instruction-section h3 {
    color: #495057;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.instruction-section p {
    color: #6c757d;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.instruction-section ul {
    margin-left: 20px;
    color: #6c757d;
    font-size: 16px;
    line-height: 1.6;
}

.instruction-section li {
    margin-bottom: 8px;
}

#instructions-back-btn {
    width: 100%;
    margin-top: 20px;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px 25px;
    border-radius: 15px;
    max-width: 350px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: #dc3545;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 15px;
}

.modal-content p {
    color: #495057;
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Player card hover effects - only for player's own cards */
.player-columns .card.face-down:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.player-columns .card.face-down.own-card {
    position: relative;
}

.player-columns .card.face-down.own-card:hover::after {
    content: attr(data-card-info);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    opacity: 1;
    pointer-events: none;
    margin-bottom: 5px;
}

.player-columns .card.face-down.own-card::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    margin-bottom: -1px;
}

.player-columns .card.face-down.own-card:hover::before {
    opacity: 1;
}

/* Rotate opponent cards 180 degrees */
.opponent-columns .card {
    transform: rotate(180deg);
}

/* Opponent cards should not show details on hover */
.opponent-columns .card.face-down:hover {
    background: linear-gradient(135deg, #4a6cf7 0%, #667eea 100%);
    cursor: not-allowed;
    transform: rotate(180deg); /* Maintain rotation on hover */
}

.valid-placement {
    animation: pulse 1.5s infinite;
}

/* Responsive Design */
@media (max-width: 480px) {
    .game-title {
        font-size: 2.8rem;
    }
    
    .columns-container {
        gap: 6px;
        max-width: 320px;
    }
    
    .column {
        width: 55px;
        min-height: 130px;
    }
    
    .card {
        width: 45px;
        height: 65px;
        font-size: 11px;
    }
    
    .card.large {
        width: 70px;
        height: 98px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .columns-container {
        gap: 4px;
        max-width: 300px;
    }
    
    .column {
        width: 50px;
        min-height: 120px;
    }
    
    .card {
        width: 42px;
        height: 60px;
        font-size: 10px;
    }
}

/* Landscape Mode (Optional) */
@media (orientation: landscape) and (max-height: 600px) {
    .game-header {
        padding: 10px 20px;
        margin-bottom: 10px;
    }
    
    .opponent-area, .player-area {
        margin: 5px 0;
    }
    
    .current-card-area {
        margin: 10px 0;
    }
    
    .column {
        min-height: 100px;
    }
} 