/* Chess Elegante - Unified Game Page Styles (Play & Analyze) */

/* Main Content */
.main-content {
    margin-top: 56px;
    padding: 0;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   STATUS PANEL (Unified)
   ============================================ */
.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot.status-success {
    background: #10b981;
}

.status-dot.status-error {
    background: #dc2626;
}

.status-dot.status-warning {
    background: #f59e0b;
}

.status-dot.status-info {
    background: #3b82f6;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.game-action-buttons {
    display: flex;
    gap: 8px;
}

.game-ctrl-btn {
    padding: 8px;
    border-radius: 8px;
    background: #f5f5f4;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #57534e;
}

.game-ctrl-btn:hover {
    background: #e7e5e4;
}

.game-ctrl-btn-danger {
    background: #fef2f2;
    color: #dc2626;
}

.game-ctrl-btn-danger:hover {
    background: #fee2e2;
}

/* ============================================
   DESKTOP/MOBILE VISIBILITY
   ============================================ */
.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .desktop-only {
        display: block;
    }

    .main-content {
        margin-top: 16px;
        padding: 40px;
    }
}

/* ============================================
   SHARED PANEL STYLES
   ============================================ */
.panel-section {
    background: #fafafa;
    border: 1px solid #e8e8e8;
}

.panel-title {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Helvetica Neue', sans-serif;
    margin-bottom: 20px;
    font-weight: 300;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 15px;
}

/* ============================================
   MOBILE BOTTOM TABS
   ============================================ */
.mobile-bottom-tabs {
    display: none;
}

/* Mobile bottom tabs - hidden by default, shown in mobile media query below */

/* ============================================
   GAME SECTION LAYOUT
   ============================================ */
.game-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: calc(100vh - 56px); /* viewport minus navbar */
    height: calc(100dvh - 56px); /* dynamic viewport for mobile */
    padding: 0;
    margin-top: 56px;
    overflow: hidden;
}

.center-panel {
    order: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    overflow: hidden;
    min-height: 0; /* allow flex shrinking */
}

.left-panel {
    order: 1;
    display: none;
    flex-shrink: 0;
}

.right-panel {
    order: 3;
    display: none;
}

@media (min-width: 768px) {
    .game-section {
        display: grid;
        grid-template-columns: 300px 600px 1fr;
        gap: 40px;
        align-items: start;
        padding: 0;
        margin-top: 40px;
        height: auto;
    }

    .left-panel {
        display: flex;
        flex-direction: column;
        gap: 20px;
        order: 0;
    }

    .center-panel {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        height: auto;
        order: 0;
    }

    .right-panel {
        display: flex;
        flex-direction: column;
        gap: 30px;
        order: 0;
    }
}

/* Status Panel - Unified for mobile and desktop */
.status-panel {
    width: 100%;
    flex-shrink: 0;
    background: #fafafa;
    border: 1px solid #e8e8e8;
}

.status-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.status-text {
    font-size: 14px;
    color: #57534e;
    font-family: 'Helvetica Neue', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .status-text {
        font-size: 15px;
    }
}

.status-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================
   ICON BUTTONS
   ============================================ */
.icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: white;
    border: 1px solid #e8e8e8;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    position: relative;
}

.icon-btn:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: white;
}

.icon-btn-danger {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: white;
}

.icon-btn-danger:hover {
    background: #333;
    border-color: #333;
}

.icon-btn svg {
    pointer-events: none;
}

.icon-btn .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #1a1a1a;
    color: white;
    padding: 6px 12px;
    font-size: 11px;
    font-family: 'Helvetica Neue', sans-serif;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.icon-btn .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1a1a1a;
}

.icon-btn:hover .tooltip {
    opacity: 1;
}

/* ============================================
   STATUS MESSAGES
   ============================================ */
.status-message {
    text-align: center;
    padding: 20px;
    background: white;
    border: 1px solid #e8e8e8;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 0.5px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
}

.status-message.info {
    background: #f0f0f0;
    color: #1a1a1a;
    border-color: #d0d0d0;
}

.status-message.success {
    background: #fafafa;
    color: #1a1a1a;
    border-color: #1a1a1a;
}

.status-message.error {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

.status-message.warning {
    background: #f5f5f5;
    color: #1a1a1a;
    border-color: #d0d0d0;
}

/* ============================================
   CHESS BOARD
   ============================================ */
.board-container {
    display: flex;
    justify-content: center;
    padding: 8px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

#board {
    width: 100% !important;
    max-width: 400px;
}

@media (min-width: 768px) {
    .board-container {
        padding: 20px;
        background: #fafafa;
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #board {
        width: 100% !important;
        max-width: 600px;
        height: auto !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    }
}

/* Click-to-move styling (Play mode) */
#board img {
    pointer-events: auto !important;
    cursor: pointer;
}

.selected-square {
    box-shadow: inset 0 0 0 3px rgba(26, 26, 26, 0.5) !important;
    background-color: rgba(255, 255, 100, 0.4) !important;
}

.move-hint {
    position: absolute;
    width: 25%;
    height: 25%;
    background-color: rgba(26, 26, 26, 0.3);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.move-hint.capture-hint {
    width: 80%;
    height: 80%;
    background-color: transparent;
    border: 3px solid rgba(26, 26, 26, 0.4);
}

/* ============================================
   ANALYSIS PANEL
   ============================================ */
.analysis-panel {
    padding: 30px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
}

.analysis-panel h3 {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Helvetica Neue', sans-serif;
    margin-bottom: 20px;
    font-weight: 300;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 15px;
}

/* ============================================
   BEST MOVE PANEL (Desktop)
   ============================================ */
#bestMovePanel {
    padding: 20px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    margin-top: 20px;
}

#bestMovePanel .panel-title {
    margin-bottom: 16px;
}

.best-move-content {
    padding: 16px;
    background: white;
    border: 1px solid #e8e8e8;
}

.best-move-content .move-display,
.best-move-modal-content .move-display {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding: 12px;
    background: #1a1a1a;
    color: white;
    margin-bottom: 12px;
}

.best-move-content .eval-display,
.best-move-modal-content .eval-display {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: center;
    color: #666;
    margin-bottom: 12px;
}

.best-move-content .pv-line,
.best-move-modal-content .pv-line {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    margin-bottom: 12px;
}

.best-move-content .pv-label,
.best-move-modal-content .pv-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 4px;
}

.best-move-content .commentary,
.best-move-modal-content .commentary {
    font-family: 'Georgia', serif;
    font-size: 14px;
    line-height: 1.6;
    color: #2c2c2c;
    font-style: italic;
    padding: 12px;
    background: #fafafa;
    border-left: 3px solid #1a1a1a;
}

.analysis-display {
    margin-top: 20px;
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.8;
}

.analysis-item {
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e8e8e8;
}

.analysis-evaluation {
    font-size: 18px;
    font-weight: 300;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
}

.analysis-best-move {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    margin-top: 5px;
}

.analysis-pv {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    font-family: 'Courier New', monospace;
}

.analysis-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.evaluation-positive {
    color: #2d7a2d;
}

.evaluation-negative {
    color: #a63939;
}

.evaluation-neutral {
    color: #666;
}

/* ============================================
   MOVE EVALUATION DISPLAY
   ============================================ */
.evaluation-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0px;
    background: #fafaf9;
    font-size: 12px;
    margin-top: 0;
    border-radius: 0;
    border: none;
}

.evaluation-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.evaluation-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.evaluation-dot.excellent {
    background: #10b981;
}

.evaluation-dot.good {
    background: #84cc16;
}

.evaluation-dot.inaccuracy {
    background: #f59e0b;
}

.evaluation-dot.mistake {
    background: #ef4444;
}

.evaluation-dot.blunder {
    background: #dc2626;
}

.evaluation-dot.best {
    background: #059669;
}

.evaluation-classification {
    font-weight: 500;
    font-family: 'Helvetica Neue', sans-serif;
}

.evaluation-classification.excellent {
    color: #10b981;
}

.evaluation-classification.good {
    color: #84cc16;
}

.evaluation-classification.inaccuracy {
    color: #f59e0b;
}

.evaluation-classification.mistake {
    color: #ef4444;
}

.evaluation-classification.blunder {
    color: #dc2626;
}

.evaluation-classification.best {
    color: #059669;
}

.evaluation-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Courier New', monospace;
    color: #78716c;
    font-size: 12px;
}

.evaluation-separator {
    color: #d6d3d1;
}

.evaluation-best {
    color: #059669;
    font-weight: bold;
}

.evaluation-row {
    display: none;
}

.evaluation-label {
    display: none;
}

.evaluation-value {
    display: none;
}

/* ============================================
   COMMENTARY SECTION
   ============================================ */
.commentary-section {
    margin-top: 0px;
    padding-top: 0px;
}

.commentary-section h4 {
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: 'Helvetica Neue', sans-serif;
    margin-bottom: 15px;
    font-weight: 400;
    color: #57534e;
}

.commentary-text {
    font-family: 'Georgia', serif;
    font-size: 14px;
    line-height: 1.7;
    color: #2c2c2c;
    font-style: italic;
    background: #fafafa;
    border-top: 1px solid #e8e8e8;
    padding-top: 5px;
}

.eval-commentary {
    padding: 15px;
    background: #f8f9fa;
    border-left: 3px solid #1a1a1a;
    margin-bottom: 15px;
    font-family: 'Georgia', serif;
    line-height: 1.6;
}

.commentary-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: #666;
    font-family: 'Helvetica Neue', sans-serif;
}

/* ============================================
   NAVIGATION CONTROLS
   ============================================ */
.navigation-controls {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 10px;
    height: 44px;
}

.nav-btn {
    background: white;
    color: #1a1a1a;
    border: 1px solid #e8e8e8;
    padding: 0;
    width: 44px;
    min-width: 44px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 300;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
}

.nav-btn:hover {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

.nav-btn:active {
    transform: scale(0.98);
}

.move-counter {
    text-align: center;
    font-size: 14px;
    font-weight: 300;
    color: #1a1a1a;
    padding: 15px;
    background: white;
    border: 1px solid #e8e8e8;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

.keyboard-hint {
    text-align: center;
    font-size: 11px;
    color: #999;
    font-style: italic;
    font-family: 'Helvetica Neue', sans-serif;
    letter-spacing: 0.5px;
}

/* ============================================
   GAME METADATA (Analyze Mode)
   ============================================ */
.game-metadata-panel {
    padding: 30px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
}

.game-metadata {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.metadata-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
}

.metadata-row:last-child {
    border-bottom: none;
}

.metadata-label {
    font-weight: 300;
    color: #666;
    flex-shrink: 0;
    margin-right: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
}

.metadata-value {
    color: #1a1a1a;
    text-align: right;
    word-break: break-word;
    font-size: 13px;
}

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

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}

.modal-header h3 {
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Helvetica Neue', sans-serif;
    font-weight: 300;
    margin: 0;
}

.close-modal {
    font-size: 28px;
    font-weight: 300;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: #1a1a1a;
}

.modal-body {
    padding: 40px;
}

.setting-group {
    margin-bottom: 30px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 12px;
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 300;
    color: #666;
}

.setting-group select,
.setting-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e8e8e8;
    background: #fafafa;
    font-size: 14px;
    font-family: 'Helvetica Neue', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-group select:hover,
.setting-group input[type="text"]:hover {
    border-color: #1a1a1a;
    background: white;
}

.setting-group select:focus,
.setting-group input[type="text"]:focus {
    outline: none;
    border-color: #1a1a1a;
    background: white;
}

.modal-footer {
    padding: 30px 40px;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 20px;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: 'Helvetica Neue', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #1a1a1a;
    background: #1a1a1a;
    color: white;
    border-radius: 4px;
}

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

.btn-secondary {
    background: white;
    color: #1a1a1a;
    border-color: #e8e8e8;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 1200px) {
    .game-section {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .main-content {
        padding: 40px 30px;
    }

    #board {
        width: 100% !important;
        max-width: 560px;
    }

    .left-panel {
        order: 2;
    }

    .center-panel {
        order: 1;
    }

    .right-panel {
        order: 3;
    }
}

@media (max-width: 767px) {
    /* Hide footer on game page mobile */
    footer {
        display: none !important;
    }

    .main-content {
        margin-top: 0 !important;
        padding: 0 !important;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .game-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 0;
        padding: 0;
        padding-top: 56px; /* navbar height */
        margin-top: 0;
        margin-bottom: 0;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    /* Show left-panel with only status-panel visible */
    .left-panel {
        display: block !important;
        order: 1 !important;
        flex-shrink: 0;
        width: 100%;
    }

    .left-panel > *:not(.status-panel) {
        display: none !important;
    }

    .left-panel .status-panel {
        display: block !important;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    /* Show only players row in game metadata panel on mobile (analyze mode) */
    .left-panel .game-metadata-panel {
        display: block !important;
        padding: 16px 20px;
    }

    .left-panel .game-metadata-panel h3 {
        display: none;
    }

    .left-panel .game-metadata-panel .metadata-row {
        display: none;
        padding: 0;
        border-bottom: none;
    }

    /* Show only the first metadata-row (players) on mobile */
    .left-panel .game-metadata-panel .metadata-row:first-child {
        display: flex;
        font-size: 14px;
    }

    .left-panel .game-metadata-panel .metadata-row:first-child .metadata-label {
        display: none;
    }

    .left-panel .game-metadata-panel .metadata-row:first-child .metadata-value {
        width: 100%;
        text-align: center;
        font-weight: 500;
    }

    /* Hide best move panel on mobile - use modal instead */
    #bestMovePanel {
        display: none !important;
    }

    .center-panel {
        order: 2 !important;
        width: 100%;
        padding: 8px;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        min-height: 0;
        overflow: hidden;
    }

    .right-panel {
        display: none !important;
    }

    .board-container {
        padding: 8px;
        background: white;
        border: 1px solid #e8e8e8;
        border-radius: 12px;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
        aspect-ratio: 1;
        flex-shrink: 0;
    }

    #board {
        width: 100% !important;
        max-width: 100%;
        max-height: 100%;
    }

    /* Mobile bottom tabs */
    .mobile-bottom-tabs {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e8e8e8;
        z-index: 99;
        padding-bottom: env(safe-area-inset-bottom);
        max-height: 56px;
        transition: max-height 0.3s ease;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }


    .mobile-bottom-tabs.expanded {
        max-height: 50vh;
    }

    /* Analyze mode: always expanded, no tab buttons */
    .mobile-bottom-tabs[data-always-expanded="true"] {
        max-height: 30vh;
        overflow: visible;
    }

    .mobile-bottom-tabs[data-always-expanded="true"] .bottom-tab-content {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-tab-buttons {
        display: flex;
        gap: 4px;
        padding: 8px;
        background: white;
        position: sticky;
        top: 0;
        z-index: 10;
        border-bottom: 1px solid #e8e8e8;
        min-height: 56px;
    }

    .tab-btn {
        flex: 1;
        padding: 10px 12px;
        border-radius: 8px;
        background: #f5f5f4;
        border: none;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        font-family: 'Helvetica Neue', sans-serif;
        color: #57534e;
        transition: all 0.2s;
    }

    .tab-btn.active {
        background: #1a1a1a;
        color: white;
    }

    .bottom-tab-content {
        background: white;
        padding: 16px;
        max-height: calc(50vh - 48px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-panel {
        display: none;
    }

    .tab-panel.active {
        display: block;
    }

    .icon-btn .tooltip {
        display: none;
    }

    .modal-header,
    .modal-footer,
    .modal-body {
        padding: 20px;
    }

    .analysis-panel {
        padding: 0;
        border: none;
        background: transparent;
    }

    .panel-title {
        font-size: 11px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .upload-section-compact,
    .saved-pgns-section {
        padding: 0 15px;
    }

    .saved-pgns-list {
        grid-template-columns: 1fr;
    }

    .navigation-controls {
        gap: 8px;
        height: 44px;
    }

    .nav-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .move-counter {
        padding: 12px;
    }

    .evaluation-text { 
        background-color: white;
    }

    .commentary-text {
        background-color: white;
    }


    /* History tab compact styles */
    #historyTab .analysis-panel h3 {
        display: none;
    }

    #historyTab .navigation-controls {
        margin-bottom: 12px;
        height: 44px;
    }

    #historyTab .nav-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
        font-size: 16px;
    }

    #historyTab .keyboard-hint {
        display: none;
    }

    #historyTab .moves-list {
        height: 44px;
        overflow: hidden;
    }

    #historyTab .move-pair {
        margin-bottom: 0;
    }

    #historyTab .move-san {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* Best Move tab styles */
    #bestMoveTab .best-move-section {
        padding: 12px;
        border: none;
        background: transparent;
    }

    #bestMoveTab .btn-best-move {
        padding: 12px 16px;
        font-size: 12px;
    }

    #bestMoveTab .best-move-result {
        margin-top: 12px;
        padding: 12px;
    }

    #bestMoveTab .best-move-result .move-display {
        font-size: 20px;
        padding: 10px;
    }

    #bestMoveTab .best-move-content .commentary,
.best-move-modal-content .commentary {
        font-size: 13px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .board-container {
        padding: 5px;
    }

    .upload-section-compact,
    .saved-pgns-section {
        padding: 0 10px;
    }

    .navigation-controls {
        gap: 5px;
    }

    .nav-btn {
        padding: 10px;
        font-size: 14px;
    }

    .move-counter {
        padding: 10px;
        font-size: 12px;
    }
}
