/* Chess Puzzle Web App Styles */

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: #f0f0f0;
    font-weight: 400;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #f0f0f0;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

/* Leaderboard Styles */
.leaderboard-section {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.leaderboard-section h3 {
    text-align: center;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.leaderboard-tab {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.leaderboard-tab:hover {
    background: rgba(255,255,255,0.3);
}

.leaderboard-tab.active {
    background: #4CAF50;
    color: #fff;
}

.leaderboard-content {
    position: relative;
}

.leaderboard-list {
    display: none;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 15px;
}

.leaderboard-list.active {
    display: block;
}

.leaderboard-placeholder {
    text-align: center;
    color: #f0f0f0;
    font-style: italic;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
}

.leaderboard-entry:last-child {
    margin-bottom: 0;
}

.leaderboard-position {
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    margin: 0 15px;
    font-weight: 500;
}

.leaderboard-score {
    font-weight: bold;
    font-size: 1.1rem;
    color: #4CAF50;
}

.leaderboard-date {
    font-size: 0.8rem;
    color: #ccc;
    margin-left: 10px;
}

/* High Score Modal */
.high-score-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    color: #fff;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 20px;
    color: #f0f0f0;
}

.name-input-container {
    position: relative;
    margin-bottom: 20px;
}

.name-input {
    width: 100%;
    padding: 12px;
    padding-right: 40px; /* Space for the clear button */
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255,255,255,0.9);
}

.clear-name-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.clear-name-btn:hover {
    background: rgba(255,255,255,0.2);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-btn-primary {
    background: #4CAF50;
    color: #fff;
}

.modal-btn-primary:hover {
    background: #45a049;
}

.modal-btn-secondary {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

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

/* Solution Modal */
.solution-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.solution-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.solution-modal .modal-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid #e74c3c;
}

.solution-modal h3 {
    color: #ecf0f1;
    margin-bottom: 15px;
    font-size: 24px;
}

.solution-modal h4 {
    color: #f39c12;
    margin-bottom: 10px;
    font-size: 18px;
}

.solution-modal p {
    color: #bdc3c7;
    margin-bottom: 20px;
    font-size: 16px;
}

.solution-moves {
    margin-bottom: 25px;
}

#solution-moves-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.solution-move {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #c0392b;
    transition: all 0.3s ease;
}

.solution-move:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
}

/* Color-coded solution moves */
.solution-move-player {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #000000;
    border: 1px solid #dee2e6;
}

.solution-move-player:hover {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    transform: translateY(-1px);
}

.solution-move-opponent {
    background: linear-gradient(135deg, #000000, #212529);
    color: #ffffff;
    border: 1px solid #495057;
}

.solution-move-opponent:hover {
    background: linear-gradient(135deg, #212529, #343a40);
    transform: translateY(-1px);
}

/* Confirmation Modal */
.confirmation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.confirmation-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirmation-modal .modal-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid #e74c3c;
}

.confirmation-modal h3 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.confirmation-modal p {
    color: #ecf0f1;
    margin-bottom: 25px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.game-area {
    background: linear-gradient(135deg, rgba(64, 64, 64, 0.95) 0%, rgba(32, 32, 32, 0.95) 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.puzzle-info {
    text-align: center;
    margin-bottom: 30px;
}

.puzzle-info h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.puzzle-info p {
    color: #f0f0f0;
    font-size: 1.1rem;
}

.chess-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    overflow: visible;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    flex: 1;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

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

.btn-primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}

.btn-hint {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.btn-hint:hover {
    background: linear-gradient(135deg, #f57c00, #ff9800);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

.btn-hint:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Game layout */
.game-layout {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    justify-content: center;
    margin-bottom: 20px;
    width: 100%;
    position: relative;
}

/* Mode selector styling */
.mode-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
    min-width: 120px;
    margin-top: 20px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
}

.mode-label {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    font-size: 14px;
}

.btn-mode {
    padding: 8px 16px;
    border: 2px solid #444;
    background: #333;
    color: #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 100px;
}

.btn-mode:hover {
    background: #444;
    border-color: #555;
}

.btn-mode-active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-mode-active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-mode-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #222;
    color: #666;
    border-color: #333;
}

.btn-mode-disabled:hover {
    background: #222;
    border-color: #333;
}

.btn-share {
    padding: 8px 16px;
    border: 2px solid #4CAF50;
    background: #4CAF50;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 100px;
    margin-top: 15px;
}

.btn-share:hover:not(:disabled) {
    background: #45a049;
    border-color: #45a049;
    transform: translateY(-1px);
}

.btn-share:disabled {
    background: #666;
    border-color: #666;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

/* Hint highlighting */
.hint-highlight {
    background-color: #ffeb3b !important;
    box-shadow: 0 0 10px #ffeb3b, inset 0 0 10px #ffeb3b !important;
    animation: hint-pulse 1s ease-in-out infinite alternate;
}

@keyframes hint-pulse {
    0% {
        box-shadow: 0 0 10px #ffeb3b, inset 0 0 10px #ffeb3b;
    }
    100% {
        box-shadow: 0 0 20px #ffeb3b, inset 0 0 20px #ffeb3b;
    }
}

/* Selected piece highlighting */
.selected-piece {
    background-color: #4CAF50 !important;
    box-shadow: 0 0 15px #4CAF50, inset 0 0 15px #4CAF50 !important;
    animation: selected-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes selected-pulse {
    0% {
        box-shadow: 0 0 15px #4CAF50, inset 0 0 15px #4CAF50;
    }
    100% {
        box-shadow: 0 0 25px #4CAF50, inset 0 0 25px #4CAF50;
    }
}

/* Celebration animations */
.feedback-message.success {
    animation: celebration-bounce 0.6s ease-in-out;
}

@keyframes celebration-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Consecutive wins celebration */
.feedback-message.success.consecutive-win {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 400% 400%;
    animation: celebration-bounce 0.6s ease-in-out, gradient-shift 2s ease-in-out infinite;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.feedback {
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-message {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 15px 25px;
    border-radius: 10px;
    opacity: 0;
    transition: all 0.3s ease;
}

.feedback-message.show {
    opacity: 1;
}

.feedback-message.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    animation: bounce 0.6s ease;
}

.feedback-message.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    animation: shake 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.instructions {
    background: transparent;
    border-radius: 15px;
    padding: 25px;
    box-shadow: none;
}

.instructions h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 8px 0;
    color: #f0f0f0;
    position: relative;
    padding-left: 25px;
}

.instructions li:before {
    content: "♔";
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-size: 1.2rem;
}

/* Chess board specific styles for chessboard2 */
.chess-board img {
    max-width: 100%;
    height: auto;
}

/* Basic chess board styling for chessboard2 */
.chess-board {
    background: transparent;
    font-family: 'Inter', sans-serif;
    width: 500px;
    height: 500px;
    max-width: 500px;
    max-height: 500px;
}

/* Chess.com style board border */
.chess-board-container {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    min-height: 500px;
}

/* Coordinate labels */
.coordinate-labels {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px 20px 20px;
    min-height: 500px;
    width: 540px;
    margin: 0 auto;
}

.coordinate-labels .chess-board {
    position: relative;
    width: 500px !important;
    height: 500px !important;
    margin: 0 auto;
}

/* Left side coordinates (1-8) */
.coordinate-left {
    position: absolute;
    left: 0;
    top: 0; /* Adjust since we removed top padding */
    width: 20px;
    height: calc(100% - 20px); /* Adjust height since we removed top padding */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    z-index: 10;
}

.coordinate-left span {
    display: block;
}

/* Bottom coordinates (a-h) */
.coordinate-bottom {
    position: absolute;
    bottom: -20px; /* Move below the board */
    left: 20px;
    width: calc(100% - 40px);
    height: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    z-index: 10;
}

.coordinate-bottom span {
    display: inline-block;
}

/* Chess notation styling - Chess.com style */
.chess-board .notation {
    color: #666;
    font-weight: 500;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
}

/* Ensure chessboard has proper dimensions and centering */
#chessboard {
    width: 500px !important;
    height: 500px !important;
    min-width: 250px;
    min-height: 250px;
    margin: 0 auto !important;
    display: block !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
}

/* Force centering of chessboard2 wrapper elements */
.chess-board-container > * {
    margin: 0 auto !important;
}

/* Override any absolute positioning from chessboard2 */
.chess-board-container .board-b72b1,
.chess-board-container [class*="board-"],
.chess-board-container [class*="chessboard"] {
    margin: 0 auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    position: relative !important;
}

/* Global override for Chessboard2 notation spacing */
.notation-files-c3c0a {
    bottom: -12px !important; /* Reduce from -20px to -12px */
}

.notation-ranks-d3f97 {
    right: -10px !important; /* Reduce from -15px to -10px */
    top: 10px !important; /* Reduce from 15px to 10px */
}

/* More aggressive override with higher specificity */
#chessboard .notation-files-c3c0a {
    bottom: -12px !important; /* Ensure no overlap with higher specificity */
}

#chessboard .notation-ranks-d3f97 {
    right: -6px !important; /* Even more aggressive reduction */
    top: 6px !important; /* Even more aggressive reduction */
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    /* Mobile-specific container adjustments */
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    /* Game layout for mobile */
    .game-layout {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .mode-selector {
        margin-right: 0;
        margin-bottom: 10px;
        order: -1; /* Move to top */
    }
    
    /* Chess board mobile optimizations - Prevent over-stretching */
    .chess-board-container {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
        background: transparent !important;
        box-shadow: none !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    .chess-board {
        width: 100% !important;
        height: auto !important;
        max-width: 280px !important; /* Further reduce for mobile */
        max-height: 280px !important; /* Further reduce for mobile */
        aspect-ratio: 1 !important; /* Maintain square aspect ratio */
    }
    
    #chessboard {
        width: 280px !important;
        height: 280px !important;
        max-width: 280px !important;
        max-height: 280px !important;
    }
    
    /* Coordinate labels for mobile */
    .coordinate-labels {
        padding: 0 15px 18px 15px;
        min-height: auto !important;
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }
    
    .coordinate-left {
        width: 15px; /* Restore original size */
        font-size: 10px; /* Restore original size */
    }
    
    .coordinate-bottom {
        font-size: 10px; /* Restore original size */
        bottom: -18px; /* Increase gap for mobile to prevent overlap */
        left: 15px; /* Restore original size */
        width: calc(100% - 30px); /* Restore original size */
    }
    
    /* Override Chessboard2 library spacing */
    .notation-files-c3c0a {
        bottom: -10px !important; /* Increase spacing to prevent overlap */
    }
    
    .notation-ranks-d3f97 {
        right: -8px !important; /* Reduce from -15px to -8px */
        top: 8px !important; /* Reduce from 15px to 8px */
    }
    
    /* Game stats for mobile */
    .game-stats {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .stat {
        text-align: center;
    }
    
    /* Controls for mobile */
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-top: 20px;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    /* Puzzle info for mobile */
    .puzzle-info {
        margin-bottom: 20px;
    }
    
    .puzzle-info h2 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .puzzle-info p {
        font-size: 0.9rem;
    }
    
    /* Mobile-specific body overflow fix */
    body {
        overflow-x: hidden;
    }
    
    /* Leaderboard for mobile */
    .leaderboard-section {
        margin-top: 30px;
    }
    
    .leaderboard-section h3 {
        font-size: 1.3rem;
    }
    
    .leaderboard-tabs {
        gap: 5px;
    }
    
    .leaderboard-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Instructions for mobile */
    .instructions {
        margin-top: 30px;
        padding: 20px;
    }
    
    .instructions h3 {
        font-size: 1.2rem;
    }
    
    .instructions ul {
        padding-left: 20px;
    }
    
    .instructions li {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    /* Game area for mobile */
    .game-area {
        padding: 20px;
        margin-bottom: 20px;
        display: flex;
        flex-direction: column;
    }
    
    /* Reorder puzzle info to appear below mode selector on mobile */
    .puzzle-info {
        order: 2; /* Move puzzle info below mode selector */
    }
    
    .game-layout {
        order: 1; /* Keep mode selector at top */
    }
    
    .controls {
        order: 3; /* Keep controls at bottom */
    }
    
    .feedback {
        order: 4; /* Keep feedback at very bottom */
    }
    
    /* Feedback for mobile */
    .feedback {
        min-height: 50px;
    }
    
    .feedback-message {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .chess-board {
        max-width: 250px !important; /* Further reduce for very small screens */
        max-height: 250px !important; /* Further reduce for very small screens */
    }
    
    .chess-board-container {
        max-width: 250px !important; /* Further reduce for very small screens */
        height: auto !important; /* Override fixed height */
        min-height: auto !important; /* Override fixed min-height */
    }
    
    #chessboard {
        width: 250px !important;
        height: 250px !important;
        max-width: 250px !important;
        max-height: 250px !important;
    }
    
    /* Keep original coordinate sizes for very small screens too */
    .coordinate-labels {
        padding: 0 15px 18px 15px; /* Increase bottom padding for very small screens to prevent overlap */
        min-height: auto !important; /* Remove fixed min-height for very small screens */
    }
    
    .coordinate-left {
        width: 15px; /* Keep original size */
        font-size: 10px; /* Keep original size */
    }
    
    .coordinate-bottom {
        font-size: 10px; /* Keep original size */
        bottom: -18px; /* Increase gap for very small screens to prevent overlap */
        left: 15px; /* Keep original size */
        width: calc(100% - 30px); /* Keep original size */
    }
    
    /* Even more aggressive override for very small screens */
    .notation-files-c3c0a {
        bottom: -8px !important; /* Ensure no overlap on very small screens */
    }
    
    .notation-ranks-d3f97 {
        right: -6px !important; /* Further reduce for very small screens */
        top: 6px !important; /* Further reduce for very small screens */
    }
    
    .btn {
        max-width: 250px;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .game-area {
        padding: 15px;
    }
    
    .puzzle-info h2 {
        font-size: 1.1rem;
    }
}

/* Narrow browser window fix - when width is below 770px but not mobile */
@media (max-width: 770px) and (min-width: 481px) {
    .coordinate-bottom {
        bottom: -35px !important; /* Increase gap to prevent overlap */
    }
    
    .coordinate-labels {
        padding: 0 20px 35px 20px !important; /* Increase bottom padding */
    }
    
    /* Ensure chessboard2 notation doesn't overlap */
    .notation-files-c3c0a {
        bottom: -25px !important; /* Increase spacing for narrow windows */
    }
    
    .notation-ranks-d3f97 {
        right: -12px !important; /* Slightly reduce for narrow windows */
        top: 12px !important; /* Slightly reduce for narrow windows */
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Apple's recommended touch target size */
    }
    
    .leaderboard-tab {
        min-height: 44px;
    }
    
    .chess-board {
        touch-action: manipulation; /* Optimize for touch */
    }
    
    /* Ensure chess squares are properly sized for touch */
    .chess-board .square-55d63 {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Improve touch responsiveness */
    .chess-board img {
        pointer-events: auto;
        touch-action: manipulation;
    }
}

/* Footer styling */
.footer {
    margin-top: 40px;
    padding: 20px 0;
    background: transparent;
    color: white;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer a {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #fff;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .footer {
        margin-top: 20px;
        padding: 15px 0;
    }
} 