/* Modern Layout */
.app-container {
    display: grid !important;
    grid-template-columns: 1fr;
    min-height: 100vh;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-md);
    gap: var(--spacing-lg);
    overflow-x: clip;
    box-sizing: border-box;
}

body.analysis-active #site-footer,
body.analysis-running #site-footer {
    display: none !important;
}

@media (min-width: 1025px) {
    .app-container {
        grid-template-columns: minmax(auto, 800px) 400px !important;
        justify-content: center;
        align-items: start;
        padding: 16px var(--spacing-xl) var(--spacing-xl);
        gap: 16px;
    }

    .board-container {
        max-width: 750px;
    }

    #board-wrapper {
        max-width: 100%;
    }

    .sidebar {
        top: 0px !important;
    }


}

/* Tablet Layout (All Orientations) */
/* Targets tablets regardless of rotation (768px to 1366px) */
@media (min-width: 768px) and (max-width: 1366px) {
    .app-container {
        /* Side-by-side layout for tablet, adjusted columns */
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 300px !important;
        justify-content: center;
        align-items: start;
        padding: 16px;
        gap: 16px;
    }

    .board-container {
        width: 100%;
        max-width: 100%;
    }

    #board-wrapper {
        width: 100%;
    }

    /* Sidebar constrained to match approx board height */
    .sidebar {
        position: relative !important;
        top: auto !important;
        /* Remove sticky/height constraints from container */
        max-height: none !important;
        overflow: visible !important;
        width: 100%;
        display: block !important;
    }

    /* Fix toolbar to bottom on tablet */
    #review-panel-toolbar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3) !important;
        z-index: 20002 !important;
        background: var(--bg-secondary) !important;
        display: flex !important;
        justify-content: center !important;
        gap: 80px !important;
        /* Increased spacing for tablet */
        padding: 16px 0 !important;
    }

    /* Increase touch area for navigation buttons on Tablet */
    #review-panel-toolbar .btn-icon {
        padding: 20px !important;
        font-size: 1.5rem !important;
        width: 100px !important;
        height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #review-panel {
        /* Enable scrolling WITHIN the panel */
        display: block !important;
        max-height: 690px !important;
        /* Approx board height minus header/padding */
        overflow-y: auto !important;
        padding-bottom: 80px !important;

        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #review-panel::-webkit-scrollbar {
        display: none;
    }




}

/* Board Section */
.board-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
    max-width: 100%;
    align-items: center;
    overflow-x: clip;
    box-sizing: border-box;
}

/* Sticky Board Logic for Mobile Analysis */
@media (max-width: 767px) {

    /* Generic board sizing for mobile/tablet - Apply in all states */
    .board-section {
        width: 90% !important;
        margin: 0 auto !important;
    }

    body.analysis-active .app-container {
        display: block !important;
        /* Push content down to prevent overlap with fixed board 
           Calc: 60vw (board height) + 160px (approx controls/names height) */
        padding-top: calc(90vw + 160px) !important;
        overflow: visible !important;
    }

    body.analysis-active .site-header {
        display: none !important;
    }

    body.analysis-active .board-section {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 90% !important;
        z-index: 10000 !important;
        background: var(--bg-primary);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        margin: 0 auto !important;
        padding: 10px !important;
        /* Ensure it fits width */
        box-sizing: border-box !important;
        max-width: 90% !important;
        overflow: visible !important;
    }


}

.board-container {
    position: relative;
    display: grid !important;
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, auto) auto;
    gap: 10px;
    align-items: center;
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 100%;
}

#evaluation-bar {
    grid-column: 1;
    grid-row: 2;
    width: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-self: center;
    display: block;
}

/* Reduce text size on desktop */
#white-eval-text,
#black-eval-text {
    font-size: 12px !important;
}

/* Reduce eval bar width on mobile */
@media (max-width: 767px) {

    /* Remove padding from app container for edge-to-edge board */
    .app-container {
        padding: 0 !important;
        gap: 0 !important;
    }

    /* Remove gap from board section for edge-to-edge board */
    .board-section {
        gap: 0 !important;
        width: 90% !important;
        margin: 0 auto !important;
    }

    #evaluation-bar {
        width: 12px !important;
    }

    .board-container {
        grid-template-columns: 20px minmax(0, 1fr);
        /* Remove container styling on mobile for infinite feel */
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: var(--bg-primary) !important;
        gap: 0 !important;
        /* Remove spacing between eval bar and board */

        /* Make board sticky on mobile */
        /* Note: We handle sticky via board-section now */
        position: relative !important;
        z-index: 1 !important;
    }

    /* Adjust content padding to reduce gap below board 
       Calc: 90vw (board height) + 110px (approx controls/names height) */
    /* Adjust content padding to reduce gap below board 
       Calc: 60vw (board height) + 110px (approx controls/names height) */
    body.analysis-active .app-container {
        padding-top: calc(90vw - 20px) !important;
    }

    /* Ensure sticky override works correctly on mobile */
    body.analysis-active .board-section {
        margin: 0 auto !important;
        padding: 0 !important;
        width: 90% !important;
        max-width: 90% !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }

    #white-eval-text,
    #black-eval-text {
        font-size: 10px !important;
    }

    /* Add spacing above black player and below white player */
    #top-player-profile {
        padding-top: 15px !important;
    }

    #bottom-player-profile {
        padding-bottom: 15px !important;
    }

    /* Reduce player profile font size on mobile */
    .profile {
        font-size: 0.85rem !important;
        /* Reduced from 15px */
    }

    /* Reduce profile icon size */
    .profile img {
        width: 18px !important;
        height: 18px !important;
    }

    /* Reduce accuracy badge size */
    #top-player-accuracy,
    #bottom-player-accuracy {
        font-size: 0.75rem !important;
        padding: 2px 6px !important;
    }
}

@media (max-width: 480px) {

    /* Remove padding from app container for edge-to-edge board */
    .app-container {
        padding: 0 !important;
        gap: 0 !important;
    }

    /* Remove gap from board section for edge-to-edge board */
    .board-section {
        gap: 0 !important;
        width: 90% !important;
        max-width: 90% !important;
    }

    body.analysis-active .app-container {
        padding-top: calc(90vw - 20px) !important;
    }

    body.analysis-active .board-section {
        width: 90% !important;
        max-width: 90% !important;
    }

    #evaluation-bar {
        width: 18px !important;
    }

    .board-container {
        grid-template-columns: 18px minmax(0, 1fr);
        /* Remove container styling on mobile for infinite feel */
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: var(--bg-primary) !important;
        gap: 0 !important;
        /* Remove spacing between eval bar and board */

        position: relative !important;
        z-index: 1 !important;
    }

    #white-eval-text,
    #black-eval-text {
        font-size: 9px !important;
    }

    /* Add spacing above black player and below white player */
    #top-player-profile {
        padding-top: 15px !important;
    }

    #bottom-player-profile {
        padding-bottom: 15px !important;
    }

    /* Reduce player profile font size on mobile */
    .profile {
        font-size: 15px !important;
    }
}

/* Header Back Button */
#header-back-button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#header-back-button:hover {
    background: var(--bg-primary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#top-player-profile {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
}

#board-wrapper {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    position: relative;
    overflow: visible;
}

#board {
    width: 100%;
    height: auto;
    display: block;
}

#bottom-player-profile {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
}

.player-accuracy {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.9rem;
    margin-left: var(--spacing-sm);
}

/* Sidebar / Review Panel */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    height: 100%;
    max-height: calc(100vh - 2 * var(--spacing-xl));
    position: sticky;
    top: var(--spacing-xl);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Remove sticky positioning on mobile for natural scrolling */
/* Sidebar sticky behavior is now handled in respective Desktop/Tablet sections */
/* Mobile sidebar behavior covers natural scrolling via .sidebar display:block in mobile block */

.panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--spacing-lg);
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overflow-x: hidden;
    /* Hide scrollbar */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.panel::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo i {
    color: var(--accent-primary);
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

textarea,
select,
input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-family: inherit;
    resize: none;
    transition: var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
}

#pgn {
    cursor: pointer;
    transition: all 0.2s ease;
}

#pgn:hover:empty {
    border-color: #fba800;
    /* Changed to Orange */
    background: rgba(255, 255, 255, 0.05);
}

textarea:focus,
select:focus,
input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

#pgn {
    border-color: var(--border-color);
}

#pgn:hover {
    border-color: #fba800;
}

#pgn:focus {
    border-color: #fba800;
    box-shadow: 0 0 0 2px rgba(251, 168, 0, 0.3);
}

#depth-slider:focus {
    border-color: transparent;
    box-shadow: none;
}

select {
    padding-right: calc(var(--spacing-md) + 24px);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-family: inherit;
    /* Ensure button inherits Outfit font */
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
}

#review-button {
    font-size: 1.0rem;
    background: #fba800;
    color: #000000;
    box-shadow: 0 0 25px rgba(251, 168, 0, 0.4);
}

#review-button:hover {
    background: #e59a00;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary.analysing,
.btn-primary.analysing:hover {
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary) !important;
    color: #ffffff !important;
}

.btn-primary.analysing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, var(--accent-hover), var(--accent-primary));
    transition: width 0.3s ease;
    z-index: 1;
    border-radius: var(--radius-md);
}

.btn-primary.analysing i,
.btn-primary.analysing span {
    position: relative;
    z-index: 2;
}

#review-button.analysing,
#review-button.analysing:hover {
    background: var(--bg-tertiary) !important;
    color: #ffffff !important;
}

#review-button.analysing::before {
    background: linear-gradient(90deg, #e59a00, #fba800);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Analysis Tools */
.toolbar {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: var(--spacing-md) 0;
    background: var(--bg-tertiary);
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Desktop: Toolbar is sticky at bottom of the review panel */
#review-panel-toolbar {
    position: sticky;
    bottom: 0;
    z-index: 100;
    margin-top: 16px;
    margin-bottom: 0;
    margin-left: calc(-1 * var(--spacing-lg));
    margin-right: calc(-1 * var(--spacing-lg));
    background: var(--bg-secondary);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile: Fix toolbar to bottom of viewport */
/* Mobile: Fix toolbar to bottom of viewport */
@media (max-width: 767px) {
    #review-panel-toolbar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        margin: 0 !important;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3) !important;
        z-index: 20002 !important;
        /* Above Drawer (20000) */
        background: var(--bg-secondary) !important;
        /* Ensure background matches */
    }

    /* Add padding to bottom of panel so content doesn't hide under toolbar */
    #review-panel {
        padding-bottom: 80px !important;
    }
}

/* Classification Counts */
#classification-count-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: var(--spacing-md);
}

.classification-count-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.classification-count-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    text-transform: capitalize;
}

.classification-count-content img {
    width: 16px;
    height: 16px;
}

.classification-count-white,
.classification-count-black {
    font-weight: 700;
    font-size: 1rem;
    min-width: 24px;
    text-align: center;
}

/* Engine Suggestions */
#engine-suggestions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.engine-suggestion {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.engine-suggestion b {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 50px;
    text-align: center;
}

.engine-suggestion span {
    font-weight: 600;
    font-family: "JetBrains Mono", monospace;
}

/* Top Players Quick Access */
#top-players-container {
    display: none;
    /* Initially hidden, shown by JS */
    flex-direction: column;
    width: 100%;
}

#top-players-header:hover {
    opacity: 0.8;
}

#top-players-header:hover i {
    color: var(--accent-primary) !important;
}

.chevron-rotate {
    transform: rotate(180deg);
}

#top-players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.player-chip:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.player-chip i {
    color: var(--accent-primary);
}



/* Report Cards */
#report-cards {
    display: none;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 100%;
}

#evalgraph-container,
#evaluation-graph {
    max-width: 100%;
}

#ad-container-1 {
    max-width: 100%;
    overflow: hidden;
}

/* Input Tabs (Segmented Control) */
.input-tabs {
    display: flex;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.input-tab {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.input-tab:hover {
    color: var(--text-primary);
}

.input-tab.active {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    border: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Custom Spinner Animation */
.spinner {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    border: 3px solid rgba(255, 255, 255, 0.3) !important;
    border-top-color: #ffffff !important;
    border-radius: 50% !important;
    animation: custom-spin 1s linear infinite !important;
    margin-right: 8px !important;
    vertical-align: middle !important;
}

@keyframes custom-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Full-Width Modern Sections */
.full-width-section {
    width: 100%;
    padding: 80px 24px;
    box-sizing: border-box;
}

.full-width-section.alt-bg {
    background: var(--bg-secondary);
}

.full-width-section .section-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Modern Educational Content Styling */
.edu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.edu-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.full-width-section.alt-bg .edu-card {
    background: var(--bg-primary);
}

.edu-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.edu-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.edu-icon-wrapper {
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-primary);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.edu-card:hover .edu-icon-wrapper {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.edu-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.edu-card-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.edu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.edu-list-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.edu-list-item i {
    color: var(--accent-primary);
    font-size: 0.8rem;
    margin-top: 6px;
    flex-shrink: 0;
}

.edu-list-item strong {
    color: var(--text-primary);
}

.pro-tip-modern {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-left: 4px solid var(--accent-primary);
    padding: 24px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.pro-tip-modern i {
    font-size: 1.25rem;
    color: var(--warning);
    margin-top: 2px;
}

.pro-tip-modern p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pro-tip-modern strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    .full-width-section {
        padding: 48px 16px;
    }

    .edu-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .edu-card {
        padding: 24px;
    }
}


/* Mobile Analysis Panel Drawer */
/* Mobile Analysis Panel Drawer */
@media (max-width: 767px) {
    .sidebar {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        transform: none !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        padding-top: 20px;
    }


    /* Compact spacing for mobile report elements */
    #report-cards {
        gap: -4px !important;
    }

    #opening-name {
        margin-top: -4px !important;
        margin-bottom: -4px !important;
    }

    #classification-message-container {
        margin-top: -4px !important;
        margin-bottom: -8px !important;
    }

    #engine-suggestions-title {
        margin-top: -8px !important;
        margin-bottom: -4px !important;
    }

    #engine-suggestions {
        gap: -4px !important;
    }
}

/* Game Detailed Summary Logic is now handled in the Tablet Media Query above */

/* Force Landscape Mode on Tablets */
/* This overlay will ONLY appear on tablets when held in portrait mode */
#orientation-lock-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

@media (min-width: 768px) and (max-width: 1366px) and (orientation: portrait) {

    /* Hide the main app content */
    .app-container {
        display: none !important;
    }

    #orientation-lock-overlay {
        display: flex !important;
    }
}

/* Specific Mobile Overrides (Placed at end to ensure precedence) */
@media (max-width: 767px) {

    /* Player Profile Text */
    .profile {
        font-size: 0.70rem !important;
        /* Reduced size */
    }

    /* Player Profile Icon */
    .profile img {
        width: 8px !important;
        height: 8px !important;
    }

    #bottom-player-accuracy {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
        line-height: 1.5;
        /* Tighter line height for badge */
    }

    /* Force Slim Evaluation Bar */
    #evaluation-bar {
        width: 12px !important;
    }

    .board-container {
        grid-template-columns: 12px minmax(0, 1fr) !important;
    }

    /* Fix vertically stretched text inside the squashed SVG (12px width vs 24 unit box = 50% squash) */
    /* Scaling X by 2 restores original aspect ratio */
    #white-eval-text,
    #black-eval-text {
        transform-box: fill-box;
        transform-origin: center;
        transform: scaleX(1.5) !important;
    }
}