/* ========================================
   RESET AND BASE STYLES
   ======================================== */

/* Universal reset for consistent styling across browsers */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Include padding and border in element width/height */
}

/* Main body styling with solitaire green theme */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #2d5a27 0%, #1a3d1a 100%); /* Green gradient background */
    color: white;
    overflow: hidden; /* Prevent scrolling for full-screen app experience */
    height: 100vh;   /* Full viewport height */
}

/* ========================================
   APP CONTAINER AND SCREEN MANAGEMENT
   ======================================== */

/* Main application container - holds all screens */
#app {
    width: 100vw;  /* Full viewport width */
    height: 100vh; /* Full viewport height */
    position: relative; /* Allows absolute positioning of child screens */
}

/* Base screen styling - all screens use this class */
.screen {
    position: absolute; /* Stack screens on top of each other */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Active screen is visible - only one screen active at a time */
.screen.active {
    display: flex;
}

/* ========================================
   MAIN MENU STYLES
   ======================================== */

/* Main menu screen container */
#main-menu {
    text-align: center;
    position: relative; /* Allow positioning of version display */
}

/* Game title with shadow effect */
#main-menu h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Depth effect */
}

/* Menu buttons container - vertical layout */
.menu-options {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Space between buttons */
}

/* Version display in bottom right corner */
.version-display {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-family: monospace;
    user-select: none;
    pointer-events: none;
}

/* Individual menu button styling */
.menu-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1); /* Semi-transparent white */
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease; /* Smooth hover/focus transitions */
    min-width: 200px; /* Consistent button width */
}

/* Button hover and focus states for TV remote navigation */
.menu-btn:hover,
.menu-btn.focused {
    background: rgba(255, 255, 255, 0.2); /* Brighter background */
   /* border-color: #ffdd44;  Yellow highlight border */
    transform: scale(1.05); /* Slight size increase for feedback */
}

/* ========================================
   GAME SCREEN LAYOUT
   ======================================== */

/* Main game screen container */
#game-screen {
    padding: 1rem;
    justify-content: flex-start; /* Align content to top */
}

/* Game header with info and controls */
.game-header {
    display: flex;
    justify-content: space-between; /* Info on left, controls on right */
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

/* Left side: Game status information */
.game-info {
    display: flex;
    gap: 2rem; /* Space between info items */
    font-size: 1.1rem;
}

/* Right side: Game control buttons */
.game-controls {
    display: flex;
    gap: 1rem; /* Space between control buttons */
}

/* Individual control button styling */
.control-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative; /* For positioning TV remote indicators */
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Space between text and remote indicator */
}

/* Remote button hint styling for control buttons */
.remote-button-hint {
    font-size: 1rem;
    opacity: 0.7;
    /*color: #ffdd44;*/
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    margin-left: auto; /* Push to right side of button */
}

.control-btn:hover .remote-button-hint,
.control-btn.focused .remote-button-hint {
    opacity: 1;
}

/* Control button hover and focus states */
.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Remove focus indicator for control buttons */
.control-btn.focused {
    /* No visual changes for focused state */
}

/* TV Remote Button Indicators - shown when using TV remote navigation */
.control-btn::after {
    content: "";
    display: none; /* Hidden by default */
    font-size: 1rem;
    opacity: 0.8;
}

/* Show TV remote indicators when in TV remote mode */
body.tv-remote-mode .control-btn::after {
    display: inline-block;
}

/* Specific button indicators for Fire TV remote using your provided icons */
body.tv-remote-mode #hint-btn::after {
    content: "⏩"; /* Play/pause icon for hint */
}

body.tv-remote-mode #undo-btn::after {
    content: "⏪"; /* Rewind/skip backward icon for undo */
}

body.tv-remote-mode #menu-btn::after {
    content: ""; /* menu icon */
}

/* Enhanced focus state for TV remote with SELECT instruction */
body.tv-remote-mode .control-btn.focused::before {
    /* content: "SELECT"; */
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    /* color: #ffdd44; */
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 100;
}

/* ========================================
   GAME BOARD LAYOUT
   ======================================== */

/* Main game board using CSS Grid for precise layout */
.game-board {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    grid-template-rows: auto 1fr;   /* Top row auto-sized, bottom row fills remaining space */
    gap: 2rem; /* Space between grid areas */
    width: 100%;
    height: calc(100vh - 120px); /* Full height minus header */
    max-width: 1200px; /* Maximum width for large screens */
    margin: 0 auto; /* Center the board */
}

/* ========================================
   FOUNDATION AREA (Top Right)
   ======================================== */

/* Container for the four foundation piles */
.foundation-area {
    display: flex;
    gap: 0.5rem; /* Small gap between foundation piles */
    justify-content: flex-end; /* Align to right side of grid cell */
    align-items: flex-start;
}

/* Individual foundation pile styling */
.foundation-pile {
    width: 80px;  /* Standard card width */
    height: 110px; /* Standard card height */
    border: 2px dashed rgba(255, 255, 255, 0.3); /* Dashed border indicates drop zone */
    border-radius: 8px;
    position: relative;
    background: rgba(0, 0, 0, 0.2); /* Dark semi-transparent background */
    transition: all 0.3s ease; /* Smooth focus transitions */
}

/* Foundation pile focus state for TV remote navigation */
.foundation-pile.focused {
    /*border-color: #ffdd44;  Yellow highlight */
    background: rgba(255, 221, 68, 0.1); /* Yellow tint */
}

/* Foundation pile suit indicators - show which suit belongs in each pile */
.foundation-pile[data-suit="hearts"]::before {
    content: "♥";
    color: #ff4444; /* Red for hearts */
}

.foundation-pile[data-suit="diamonds"]::before {
    content: "♦";
    color: #ff4444; /* Red for diamonds */
}

.foundation-pile[data-suit="clubs"]::before {
    content: "♣";
    color: #000000; /* Black for clubs */
}

.foundation-pile[data-suit="spades"]::before {
    content: "♠";
    color: #000000; /* Black for spades */
}

/* Common styling for all foundation pile suit indicators */
.foundation-pile::before {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the suit symbol */
    font-size: 2rem;
    opacity: 0.3; /* Subtle visibility when empty */
}

/* ========================================
   STOCK AREA (Top Left)
   ======================================== */

/* Container for stock and waste piles */
.stock-area {
    display: flex;
    gap: 1rem; /* Space between stock and waste piles */
    justify-content: flex-start; /* Align to left side of grid cell */
    align-items: flex-start;
    position: relative; /* Allow absolute positioning of hint */
}

/* Stock and waste piles container - no longer needed, removing wrapper */
.stock-waste-piles {
    display: flex;
    gap: 1rem; /* Space between stock and waste piles */
    align-items: flex-start;
}

/* Remote control hints positioning - align with score area */
.remote-hint {
    position: absolute;
    top: -3rem; /* Position above the game board, aligned with header */
    left: 15%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /*background: rgba(0, 0, 0, 0.7);*/
    color: #ffffff;
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    /*border: 1px solid rgba(255, 221, 68, 0.3);*/
    opacity: 0.9;
    transition: all 0.3s ease;
    z-index: 10;
}

/* Stock pile (face-down cards) and waste pile (face-up drawn cards) */
.stock-pile,
.waste-pile {
    width: 80px;  /* Standard card width */
    height: 110px; /* Standard card height */
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    position: relative;
    background: rgba(0, 0, 0, 0.3); /* Darker background than foundation */
    cursor: pointer; /* Indicates clickable */
    transition: all 0.3s ease;
}

/* Stock pile with custom card back image support */
.stock-pile {
    /* Apply same custom card back image system as face-down cards */
    background-image: var(--card-back-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Keep the gradient as fallback */
    background-color: rgba(0, 0, 0, 0.3);
}

/* Remote control hints hover and icon styling */
.remote-hint:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 221, 68, 0.5);
}

.remote-hint .hint-icon {
    font-size: 1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.remote-hint .hint-text {
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Focus states for TV remote navigation */
.stock-pile.focused,
.waste-pile.focused {
    /* border-color: #ffdd44;  Yellow highlight removed */
    background: rgba(255, 221, 68, 0.1); /* Yellow tint */
}

/* Stock pile indicator - shows card back symbol */
.stock-pile::before {
    content: "🂠"; /* Unicode card back symbol */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.3);
    
    /* Hide the Unicode symbol when custom image is used */
    display: var(--show-card-symbol, block);
}

/* Stock pile with custom image - hide Unicode symbol */
.stock-pile.custom-image::before {
    display: none;
}

/* ========================================
   TABLEAU AREA (Bottom, spans both columns)
   ======================================== */

/* Main playing area with seven columns */
.tableau-area {
    grid-column: 1 / -1; /* Span both grid columns */
    display: flex;
    gap: 0.5rem; /* Small gap between columns */
    justify-content: center; /* Center the seven columns */
    align-items: flex-start;
    height: 100%; /* Fill remaining grid space */
}

/* Individual tableau column */
.tableau-column {
    width: 80px;  /* Standard card width */
    min-height: 110px; /* Minimum height of one card */
    border: 2px dashed rgba(255, 255, 255, 0.2); /* Subtle dashed border */
    border-radius: 8px;
    position: relative;
    background: rgba(0, 0, 0, 0.1); /* Very subtle background */
    transition: all 0.3s ease;
}

/* Tableau column focus state */
.tableau-column.focused {
    /* border-color: #ffdd44;  Yellow highlight removed */
    background: rgba(255, 221, 68, 0.1); /* Yellow tint */
}

/* Empty column indicator - shows "K" to indicate only Kings can be placed */
.tableau-column.empty::before {
    content: "K"; /* King indicator */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    opacity: 0.3; /* Subtle visibility */
}

/* Card Styles */
.card {
    width: 80px;
    height: 110px;
    border-radius: 8px;
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.card.face-up {
    background: white;
    color: #333;
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
}

.card.face-down {
    background: linear-gradient(135deg, #1a4d72 0%, #2d5a87 100%);
    border: 1px solid #0f3a5f;
    
    /* Custom card back image support */
    background-image: var(--card-back-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.card.face-down::before {
    content: "🂠";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.3);
    
    /* Hide the Unicode symbol when custom image is used */
    display: var(--show-card-symbol, block);
}

/* Custom card back image variants */
.card.face-down.custom-image {
    --show-card-symbol: none; /* Hide Unicode symbol when using custom image */
}

/* Example custom card back images - you can modify these or add your own */
.card.face-down.royal-pattern {
    --card-back-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 110"><defs><pattern id="royal" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><rect width="20" height="20" fill="%23001f3f"/><circle cx="10" cy="10" r="3" fill="%23ffdc00"/></pattern></defs><rect width="80" height="110" fill="url(%23royal)"/><rect x="5" y="5" width="70" height="100" fill="none" stroke="%23ffdc00" stroke-width="2"/></svg>');
    --show-card-symbol: none;
}

.card.face-down.celtic-pattern {
    --card-back-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 110"><defs><pattern id="celtic" x="0" y="0" width="15" height="15" patternUnits="userSpaceOnUse"><rect width="15" height="15" fill="%23006400"/><path d="M0,7.5 Q7.5,0 15,7.5 Q7.5,15 0,7.5" fill="%2332cd32"/></pattern></defs><rect width="80" height="110" fill="url(%23celtic)"/><rect x="3" y="3" width="74" height="104" fill="none" stroke="%2332cd32" stroke-width="1"/></svg>');
    --show-card-symbol: none;
}

.card.face-down.vintage-pattern {
    --card-back-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 110"><rect width="80" height="110" fill="%23800000"/><rect x="10" y="10" width="60" height="90" fill="none" stroke="%23ffd700" stroke-width="2"/><rect x="15" y="15" width="50" height="80" fill="none" stroke="%23ffd700" stroke-width="1"/><circle cx="40" cy="55" r="15" fill="none" stroke="%23ffd700" stroke-width="2"/></svg>');
    --show-card-symbol: none;
}

.card.selected {
    transform: translateY(-10px);
    box-shadow: 0 4px 8px rgba(255, 221, 68, 0.5);
    border-color: #ffdd44;
}

.card.red {
    color: #d32f2f;
}

.card.black {
    color: #333;
}

.card-rank {
    font-size: 0.9rem;
    font-weight: bold;
}

.card-suit {
    font-size: 1.2rem;
    text-align: center;
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
}

/* Selected Cards Display */
.selected-cards {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 1000;
}

/* No Moves Left Indicator */
.no-moves-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    z-index: 4000;
    border: 2px solid #ffdd44;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    max-width: 400px;
    animation: slideInScale 0.3s ease-out;
}

.no-moves-indicator.hidden {
    display: none;
}

.no-moves-content h3 {
    margin: 0 0 1rem 0;
    color: #ffdd44;
    font-size: 1.5rem;
}

.no-moves-content p {
    margin: 0 0 1.5rem 0;
    color: #cccccc;
    font-size: 1rem;
}

.no-moves-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.no-moves-actions .control-btn {
    min-width: 120px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Focus styles for no moves indicator buttons */
.no-moves-actions .control-btn:focus,
.no-moves-actions .control-btn.focused {
    background-color: #4CAF50;
    transform: scale(1.05);
    outline: 2px solid #ffdd44;
}

/* Statistics Screen */
#stats-screen,
#settings-screen {
    padding: 2rem;
}

#stats-screen h2,
#settings-screen h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.stats-content,
.settings-content {
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    min-width: 400px;
}

.stat-item,
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:last-child,
.setting-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 1.1rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffdd44;
}

/* Settings */
.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #2d5a27 0%, #1a3d1a 100%);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    min-width: 400px;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: #ffdd44;
}

.game-over-stats {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.game-over-stats p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-btn {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover,
.modal-btn.focused {
    background: rgba(255, 255, 255, 0.2);
    /* border-color: #ffdd44;  Yellow border removed */
}

/* Focus Management */
.focusable.focused {
    /* outline: 2px solid #ffdd44;  Yellow outline removed */
    /* outline-offset: 2px; */
}

/* Animations */
@keyframes cardFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

.card.flipping {
    animation: cardFlip 0.6s ease-in-out;
}

@keyframes cardMove {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.card.moving {
    animation: cardMove 0.3s ease-in-out;
}

/* Responsive Design */

/* Large screens (1440p and above) - Extra large cards */
@media (min-width: 2560px) {
    .foundation-pile,
    .stock-pile,
    .waste-pile,
    .tableau-column,
    .card {
        width: 140px;
        height: 192px;
    }
    
    .game-board {
        gap: 3rem;
        max-width: 2000px;
    }
    
    .tableau-area {
        gap: 1rem;
    }
    
    .card-center {
        font-size: 2.5rem;
    }
    
    .card-rank {
        font-size: 1.8rem;
    }
    
    .card-suit {
        font-size: 2.4rem;
    }
    
    .foundation-pile::before,
    .stock-pile::before {
        font-size: 3.5rem;
    }
}

/* 1080p TV screens - Large cards for better visibility */
@media (min-width: 1920px) and (max-width: 2559px) {
    .foundation-pile,
    .stock-pile,
    .waste-pile,
    .tableau-column,
    .card {
        width: 120px;
        height: 165px;
    }
    
    .game-board {
        gap: 2.5rem;
        max-width: 1600px;
        height: calc(100vh - 140px);
    }
    
    .tableau-area {
        gap: 0.8rem;
    }
    
    .card-center {
        font-size: 2.2rem;
    }
    
    .card-rank {
        font-size: 1.5rem;
    }
    
    .card-suit {
        font-size: 2rem;
    }
    
    .foundation-pile::before,
    .stock-pile::before {
        font-size: 3rem;
    }
    
    /* Larger font sizes for game info on TV */
    .game-info {
        font-size: 1.4rem;
    }
    
    .control-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1.2rem;
    }
    
    #main-menu h1 {
        font-size: 4rem;
    }
    
    .menu-btn {
        font-size: 1.5rem;
        padding: 1.5rem 3rem;
    }
}

/* Standard 1080p and similar - Medium-large cards */
@media (min-width: 1366px) and (max-width: 1919px) {
    .foundation-pile,
    .stock-pile,
    .waste-pile,
    .tableau-column,
    .card {
        width: 100px;
        height: 138px;
    }
    
    .game-board {
        gap: 2rem;
        max-width: 1400px;
    }
    
    .tableau-area {
        gap: 0.7rem;
    }
    
    .card-center {
        font-size: 1.8rem;
    }
    
    .card-rank {
        font-size: 1.2rem;
    }
    
    .card-suit {
        font-size: 1.6rem;
    }
    
    .foundation-pile::before,
    .stock-pile::before {
        font-size: 2.5rem;
    }
    
    .game-info {
        font-size: 1.2rem;
    }
    
    .control-btn {
        padding: 0.7rem 1.3rem;
        font-size: 1.1rem;
    }
}

/* Tablet and small laptop screens */
@media (min-width: 1025px) and (max-width: 1365px) {
    .foundation-pile,
    .stock-pile,
    .waste-pile,
    .tableau-column,
    .card {
        width: 85px;
        height: 117px;
    }
    
    .game-board {
        gap: 1.5rem;
    }
    
    .tableau-area {
        gap: 0.6rem;
    }
    
    .card-center {
        font-size: 1.6rem;
    }
}

/* Standard tablet and small laptop */
@media (max-width: 1024px) {
    .game-board {
        gap: 1rem;
    }
    
    .foundation-pile,
    .stock-pile,
    .waste-pile,
    .tableau-column,
    .card {
        width: 70px;
        height: 96px;
    }
    
    .card-center {
        font-size: 1.2rem;
    }
}

/* Mobile and small tablet */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .game-info {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .foundation-pile,
    .stock-pile,
    .waste-pile,
    .tableau-column,
    .card {
        width: 60px;
        height: 82px;
    }
    
    .tableau-area {
        gap: 0.3rem;
    }
    
    .card-center {
        font-size: 1rem;
    }
}

/* TV-specific optimizations */
@media (min-width: 1920px) {
    /* Ensure better contrast for TV viewing */
    .card.face-up {
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
        border: 2px solid #ccc;
    }
    
    .card.selected {
        transform: translateY(-15px);
        box-shadow: 0 6px 12px rgba(255, 221, 68, 0.6);
        border-color: #ffdd44;
        border-width: 3px;
    }
    
    /* Better focus indicators for TV remote */
    .keyboard-focus {
        box-shadow: 0 0 0 4px #00bfff !important;
        outline: 3px solid #00bfff;
        outline-offset: 3px;
    }
    
    .keyboard-focus.card {
        transform: translateY(-5px);
    }
    
    /* Enhanced button visibility */
    .control-btn::after {
        font-size: 1.3rem;
    }
    
    /* Better modal sizing for TV */
    .modal-content {
        min-width: 500px;
        padding: 3rem;
    }
    
    .modal-content h2 {
        font-size: 2.5rem;
        margin-bottom: 1.5rem;
    }
    
    .modal-btn {
        padding: 1rem 2rem;
        font-size: 1.3rem;
    }
    
    .game-over-stats p {
        font-size: 1.4rem;
        margin: 1rem 0;
    }
}

/* Hint Highlighting */
.hint-highlight {
    box-shadow: 0 0 15px #ffdd44 !important;
    border-color: #ffdd44 !important;
}

/* Keyboard Focus Indicator */
.keyboard-focus {
    box-shadow: 0 0 0 3px #00bfff !important;
    outline: 2px solid #00bfff;
    outline-offset: 2px;
    z-index: 100;
}

.keyboard-focus.card {
    transform: translateY(-3px);
}

.keyboard-focus.foundation-pile,
.keyboard-focus.stock-pile,
.keyboard-focus.waste-pile,
.keyboard-focus.tableau-column {
    border-color: #00bfff !important;
    background: rgba(0, 191, 255, 0.1) !important;
}

/* Auto-complete Animation */
@keyframes autoComplete {
    0% { transform: translateY(0); }
    100% { transform: translateY(-200px); opacity: 0; }
}

.card.auto-completing {
    animation: autoComplete 0.8s ease-in forwards;
}

/* ========================================
   DEBUG PANEL FOR FIRE TV REMOTE TESTING
   ======================================== */

/* Debug panel container - positioned at bottom of screen */
.debug-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: rgba(0, 0, 0, 0.9);
    border-top: 2px solid #ffdd44;
    z-index: 5000;
    font-family: 'Courier New', monospace;
    display: none; /* Hidden by default */
    flex-direction: column;
}

/* Show debug panel when active */
.debug-panel.active {
    display: flex;
}

/* Debug panel header with controls */
.debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(255, 221, 68, 0.2);
    border-bottom: 1px solid rgba(255, 221, 68, 0.3);
}

.debug-header h3 {
    color: #ffdd44;
    font-size: 1rem;
    margin: 0;
}

/* Debug control buttons */
.debug-toggle-btn,
.debug-clear-btn {
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
}

.debug-toggle-btn:hover,
.debug-clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffdd44;
}

/* Debug content area */
.debug-content {
    flex: 1;
    padding: 0.5rem;
    overflow: hidden;
}

/* Debug log container */
.debug-log {
    height: 100%;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Debug log entries */
.debug-entry {
    margin-bottom: 0.3rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    border-left: 3px solid transparent;
}

/* Different colors for different event types */
.debug-entry.key-event {
    color: #00ff00;
    border-left-color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
}

.debug-entry.function-call {
    color: #ffdd44;
    border-left-color: #ffdd44;
    background: rgba(255, 221, 68, 0.1);
}

.debug-entry.error {
    color: #ff4444;
    border-left-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.debug-entry.info {
    color: #44ddff;
    border-left-color: #44ddff;
    background: rgba(68, 221, 255, 0.1);
}

/* Timestamp styling */
.debug-timestamp {
    opacity: 0.6;
    font-size: 0.7rem;
}

/* Key event details */
.debug-key-details {
    margin-left: 1rem;
    font-size: 0.7rem;
    opacity: 0.8;
}
