/* CSS Variables for Light/Dark Mode */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-tertiary: #fafafa;
    --bg-hover: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-tertiary: #555;
    --text-quaternary: #666;
    --border-color: #e0e0e0;
    --border-hover: #c0c0c0;
    --accent-color: #6b46c1;
    --accent-hover: #553c9a;
    --highlight-bg: #f5f3ff;
    --highlight-bg-light: #ede9fe;
    --highlight-border: #6b46c1;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-accent: rgba(107, 70, 193, 0.25);
    --highlight-shift-bg: #fff4e6;
    --highlight-shift-bg-light: #ffe8cc;
    --highlight-shift-border: #f59e0b;
    --shadow-shift: rgba(245, 158, 11, 0.25);
    --highlight-red-bg: #fee2e2;
    --highlight-red-bg-light: #fecaca;
    --highlight-red-border: #ef4444;
    --shadow-red: rgba(239, 68, 68, 0.25);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #252525;
    --bg-hover: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-tertiary: #c0c0c0;
    --text-quaternary: #a0a0a0;
    --border-color: #404040;
    --border-hover: #606060;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --highlight-bg: #3d2a5f;
    --highlight-bg-light: #4a3570;
    --highlight-border: #8b5cf6;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-accent: rgba(139, 92, 246, 0.4);
    --highlight-shift-bg: #4a3a1f;
    --highlight-shift-bg-light: #5a4525;
    --highlight-shift-border: #f59e0b;
    --shadow-shift: rgba(245, 158, 11, 0.4);
    --highlight-red-bg: #4a1f1f;
    --highlight-red-bg-light: #5a2525;
    --highlight-red-border: #ef4444;
    --shadow-red: rgba(239, 68, 68, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 120px; /* Space for element description panel */
}

/* Header */
header {
    background-color: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

/* Header Buttons Container */
.header-buttons {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Game Mode Toggle Button */
.game-mode-toggle {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.game-mode-toggle:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.game-mode-toggle:active {
    transform: translateY(0);
}

/* Theme Toggle Button */
.theme-toggle {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    display: block;
    transition: transform 0.3s ease;
}

/* Theme icon updated via JavaScript */

/* Main Container */
.container {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
    position: relative;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 120px;
    left: 20px;
    z-index: 1000;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
}

.sidebar-toggle:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
}

.sidebar-toggle:active {
    transform: translateY(0);
}

.sidebar-toggle:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.toggle-icon {
    display: block;
    transition: transform 0.3s;
    user-select: none;
}

/* Sidebar */
.sidebar {
    flex: 0 0 350px;
    min-width: 250px;
    max-width: 800px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    transition: opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    opacity: 0;
}

.sidebar.resizing {
    transition: none;
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    right: -5px;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background-color 0.2s;
}

.resize-handle:hover {
    background-color: var(--highlight-bg);
}

.resize-handle.active {
    background-color: var(--highlight-bg-light);
}

.sidebar.collapsed .resize-handle {
    display: none;
}

.sidebar h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

/* Filters Section */
.filters-section {
    flex-shrink: 0;
}

.filters-section .expandable-section {
    margin-bottom: 0;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

.filter-checkboxes label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-tertiary);
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.3s ease;
}

.filter-checkboxes label:hover {
    background-color: var(--bg-hover);
}

.filter-checkboxes input[type="checkbox"] {
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.expandable-section {
    margin-bottom: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.expandable-header {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: var(--bg-secondary);
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: background-color 0.2s, color 0.3s ease;
}

.expandable-header:hover {
    background-color: var(--bg-hover);
}

.expandable-header.active {
    background-color: var(--bg-tertiary);
}

.expand-icon {
    font-size: 0.75rem;
    transition: transform 0.3s;
    color: var(--text-quaternary);
}

.expandable-header.active .expand-icon {
    transform: rotate(180deg);
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: var(--bg-primary);
}

.expandable-content.expanded {
    max-height: 500px;
}

.expandable-content p {
    padding: 1rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    line-height: 1.6;
    transition: color 0.3s ease;
}

/* Features Section */
.features-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding-top: 0.5rem;
}

.feature-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--bg-primary);
}

.feature-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 4px var(--shadow-accent);
    transform: translateY(-1px);
}

.feature-item.selected {
    border-color: var(--accent-color);
    background-color: var(--highlight-bg);
    box-shadow: 0 2px 8px var(--shadow-accent);
}

.feature-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.feature-item-description {
    font-size: 0.875rem;
    color: var(--text-quaternary);
    line-height: 1.5;
    transition: color 0.3s ease;
}

/* Feature Details */
.feature-details {
    flex-shrink: 0;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    margin-top: 1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.feature-details.hidden {
    display: none;
}

.feature-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.feature-details h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    transition: color 0.3s ease;
}

.feature-details-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-quaternary);
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.feature-details-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
}

.feature-details-close:active {
    background-color: var(--border-color);
}

.feature-details p {
    font-size: 0.95rem;
    color: var(--text-tertiary);
    line-height: 1.6;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.feature-areas-details {
    margin-top: 1rem;
}

.product-areas-heading {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.area-detail-item {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.area-detail-item h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.area-detail-item p {
    font-size: 0.9rem;
    color: var(--text-quaternary);
    margin-bottom: 0;
    transition: color 0.3s ease;
}

/* Periodic Table Section */
.periodic-table-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem;
    transition: all 0.3s ease;
    gap: 1.5rem;
}

/* Game Mode Panel (integrated into page flow) */
.game-mode-panel {
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.game-mode-panel.hidden {
    display: none;
}

/* Element Description */
.element-description {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 800px;
    width: calc(100% - 2rem);
    padding: 1.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    transition: all 0.3s ease;
    box-shadow: 0 -2px 10px var(--shadow);
    z-index: 100;
    margin: 0 auto;
}

.element-description.hidden {
    display: none !important;
}

.element-description-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.3s ease;
    z-index: 10;
}

.element-description-close:hover {
    color: var(--text-primary);
}

.element-description h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
    padding-right: 2rem; /* Space for close button */
}

.element-description p {
    font-size: 1rem;
    color: var(--text-tertiary);
    line-height: 1.6;
    margin: 0;
    transition: color 0.3s ease;
}

.periodic-table-container {
    width: 100%;
    max-width: 1000px;
    overflow-x: auto;
}

.periodic-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 8px;
    margin: 0 auto;
}

.periodic-table thead th {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.periodic-table thead th:first-child {
    width: 120px;
    max-width: 120px;
}

.column-header.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.column-header.clickable:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-hover);
}

.column-header.clickable.highlighted {
    background-color: #f5f3ff;
    border-color: #6b46c1;
    border-width: 2px;
    box-shadow: 0 2px 6px rgba(107, 70, 193, 0.2);
}

.group-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-quaternary);
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

.row-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-quaternary);
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

.periodic-table tbody th {
    padding: 0.75rem 0.75rem;
    text-align: right;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    vertical-align: middle;
    width: 120px;
    max-width: 120px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.row-header.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.row-header.clickable:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-hover);
}

.row-header.clickable.highlighted {
    background-color: var(--highlight-bg);
    border-color: var(--highlight-border);
    border-width: 2px;
    box-shadow: 0 2px 6px var(--shadow-accent);
}

.element-cell {
    width: 140px;
    height: 120px;
    padding: 1rem;
    text-align: center;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
    cursor: pointer;
    vertical-align: middle;
}

.element-cell:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 6px var(--shadow);
}

.element-cell.feature-highlighted {
    background-color: var(--highlight-bg);
    border-color: var(--highlight-border);
    border-width: 2px;
    box-shadow: 0 2px 8px var(--shadow-accent);
    opacity: 0.8;
}

.element-cell.highlighted {
    background-color: var(--highlight-bg-light);
    border-color: var(--highlight-border);
    border-width: 3px;
    box-shadow: 0 4px 12px var(--shadow-accent);
    transform: scale(1.05);
    opacity: 1;
}

.element-cell.highlighted-shift {
    background-color: var(--highlight-shift-bg-light);
    border-color: var(--highlight-shift-border);
    border-width: 3px;
    box-shadow: 0 4px 12px var(--shadow-shift);
    transform: scale(1.05);
}

.element-cell.highlighted-red {
    background-color: var(--highlight-red-bg-light);
    border-color: var(--highlight-red-border);
    border-width: 3px;
    box-shadow: 0 4px 12px var(--shadow-red);
    transform: scale(1.05);
}

.element-cell.row-highlighted {
    background-color: var(--highlight-bg);
    border-color: var(--highlight-border);
    border-width: 2px;
    box-shadow: 0 2px 8px var(--shadow-accent);
}

.element-cell.column-highlighted {
    background-color: var(--highlight-bg);
    border-color: var(--highlight-border);
    border-width: 2px;
    box-shadow: 0 2px 8px var(--shadow-accent);
}

.element-cell.row-highlighted.column-highlighted {
    background-color: var(--highlight-bg-light);
    border-width: 3px;
    box-shadow: 0 3px 10px var(--shadow-accent);
}

.element-cell.empty {
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    cursor: default;
}

.element-cell.empty:hover {
    border-color: var(--border-color);
    box-shadow: none;
    transform: none;
}

.element-abbr {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    line-height: 1.2;
    transition: color 0.3s ease;
}

.element-name {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.3;
    transition: color 0.3s ease;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }

    .resize-handle {
        display: none;
    }

    .sidebar {
        flex: 1;
        max-height: none;
        order: 2;
    }

    .sidebar.collapsed {
        flex: 0 0 0;
        width: 0;
        padding: 0;
        border: none;
        overflow: hidden;
        opacity: 0;
        max-height: 0;
    }

    .periodic-table-section {
        order: 1;
    }

    .sidebar-toggle {
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 1rem;
        align-self: flex-start;
        order: 1;
    }
}

@media (max-width: 480px) {
    .sidebar-toggle {
        top: 100px;
        left: 10px;
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
        min-width: 40px;
        min-height: 40px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar {
        padding: 1rem;
    }

    .periodic-table {
        border-spacing: 4px;
    }

    .element-cell {
        width: 100px;
        height: 100px;
        padding: 0.75rem;
    }

    .element-abbr {
        font-size: 1.5rem;
    }

    .element-name {
        font-size: 0.7rem;
    }

    .periodic-table thead th,
    .periodic-table tbody th {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* Game Mode Styles */

.game-mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.game-info {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.game-timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
}

.game-timer.warning {
    color: #ef4444;
    animation: pulse 1s infinite;
}

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

.game-score {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.game-question-counter {
    font-size: 1rem;
    color: var(--text-secondary);
}

.game-exit-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.3s ease;
}

.game-exit-button:hover {
    color: var(--text-primary);
}

.game-question {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

.game-submit-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.game-submit-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.game-submit-button:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.game-submit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-submit-button.hidden {
    display: none;
}

/* Game Element States */
.element-cell.game-selected {
    border: 3px solid var(--accent-color);
    box-shadow: 0 0 10px var(--shadow-accent);
}

.element-cell.game-correct {
    background-color: #10b981;
    border-color: #059669;
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.element-cell.game-incorrect {
    background-color: #ef4444;
    border-color: #dc2626;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

[data-theme="dark"] .element-cell.game-correct {
    background-color: #059669;
    border-color: #047857;
}

[data-theme="dark"] .element-cell.game-incorrect {
    background-color: #dc2626;
    border-color: #b91c1c;
}

/* Game Results Screen */
.game-results {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-results.hidden {
    display: none;
}

.game-results-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.game-results-content h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.final-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 2rem;
}

.game-results-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.game-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.game-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.game-button:active {
    transform: translateY(0);
}

/* Disable interactions during game mode */
body.game-mode-active .sidebar,
body.game-mode-active .sidebar-toggle,
body.game-mode-active .feature-item,
body.game-mode-active .row-header.clickable,
body.game-mode-active .column-header.clickable {
    pointer-events: none;
    opacity: 0.5;
}

/* Ensure periodic table is clickable during game mode */
body.game-mode-active .element-cell {
    cursor: pointer;
}


@media (max-width: 480px) {
    header {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .header-buttons {
        right: 1rem;
        gap: 0.5rem;
    }

    .game-mode-toggle {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .game-mode-panel {
        padding: 1rem;
        width: 95%;
    }

    .game-info {
        gap: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .game-timer {
        font-size: 1.2rem;
    }

    .game-score {
        font-size: 1rem;
    }

    .game-question {
        font-size: 1.2rem;
        padding: 0.75rem;
    }

    .game-results-content h2 {
        font-size: 2rem;
    }

    .final-score {
        font-size: 1.5rem;
    }

    .element-cell {
        width: 80px;
        height: 80px;
        padding: 0.5rem;
    }

    .element-abbr {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .element-name {
        font-size: 0.65rem;
    }

    .group-name {
        font-size: 0.65rem;
    }
    
    .row-name {
        font-size: 0.65rem;
    }
}

/* Scrollbar Styling - Hidden but scrollable */
.sidebar,
.features-list,
.periodic-table-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.sidebar::-webkit-scrollbar,
.features-list::-webkit-scrollbar,
.periodic-table-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
    width: 0;
    height: 0;
}
