/* CSS Custom Properties for Themes */
:root {
    /* Dark Theme (Default) */
    --bg-primary: radial-gradient(circle at top left, rgba(99, 102, 241, 0.18), transparent 18%),
                 radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.14), transparent 22%),
                 linear-gradient(180deg, #0b1220 0%, #111827 100%);
    --bg-overlay: linear-gradient(135deg, rgba(255,255,255,0.04), transparent 40%),
                  radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.18), transparent 5%),
                  radial-gradient(circle at 80% 15%, rgba(16, 185, 129, 0.14), transparent 8%);
    --container-bg: rgba(15, 23, 42, 0.96);
    --container-border: rgba(148, 163, 184, 0.12);
    --header-bg: rgba(30, 41, 59, 0.98);
    --header-border: rgba(148, 163, 184, 0.14);
    --panel-bg: rgba(15, 23, 42, 0.88);
    --panel-border: rgba(148, 163, 184, 0.14);
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --success-bg: rgba(34, 197, 94, 0.18);
    --success-text: #d9f99d;
    --error-bg: rgba(239, 68, 68, 0.18);
    --error-text: #fecaca;
    --button-bg: linear-gradient(135deg, #6366f1, #8b5cf6);
    --button-hover: rgba(99, 102, 241, 0.25);
    --grid-empty-bg: rgba(59, 130, 246, 0.12);
    --grid-empty-text: #bfdbfe;
    --grid-configured-bg: rgba(34, 197, 94, 0.12);
    --grid-configured-text: #d1fae5;
    --grid-page-bg: rgba(248, 113, 113, 0.14);
    --grid-page-text: #fecaca;
    --grid-selected-bg: rgba(124, 58, 237, 0.16);
    --selected-info-bg: rgba(71, 85, 105, 0.9);
    --selected-info-border: rgba(99, 102, 241, 0.8);
    --form-border: rgba(148, 163, 184, 0.18);
    --form-focus-border: rgba(99, 102, 241, 0.8);
    --form-focus-shadow: rgba(99, 102, 241, 0.12);
    --grid-default-bg: rgba(255, 255, 255, 0.04);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.05), transparent 40%);
    --container-bg: rgba(255, 255, 255, 0.98);
    --container-border: rgba(0, 0, 0, 0.15);
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-border: rgba(0, 0, 0, 0.1);
    --panel-bg: rgba(255, 255, 255, 0.95);
    --panel-border: rgba(0, 0, 0, 0.12);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent-primary: #2563eb;
    --accent-secondary: #1d4ed8;
    --success-bg: rgba(34, 197, 94, 0.15);
    --success-text: #15803d;
    --error-bg: rgba(239, 68, 68, 0.15);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #2563eb, #1d4ed8);
    --button-hover: rgba(37, 99, 235, 0.25);
    --grid-empty-bg: rgba(59, 130, 246, 0.15);
    --grid-empty-text: #1e40af;
    --grid-configured-bg: rgba(34, 197, 94, 0.15);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.15);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.2);
    --selected-info-bg: rgba(241, 245, 249, 0.95);
    --selected-info-border: rgba(37, 99, 235, 0.6);
    --form-border: rgba(0, 0, 0, 0.15);
    --form-focus-border: rgba(37, 99, 235, 0.8);
    --form-focus-shadow: rgba(37, 99, 235, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Yellow Theme */
[data-theme="yellow"] {
    --bg-primary: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(254, 252, 232, 0.98);
    --container-border: rgba(161, 98, 7, 0.25);
    --header-bg: rgba(254, 249, 195, 0.95);
    --header-border: rgba(161, 98, 7, 0.2);
    --panel-bg: rgba(254, 252, 232, 0.95);
    --panel-border: rgba(161, 98, 7, 0.22);
    --text-primary: #78350f;
    --text-secondary: #92400e;
    --text-muted: #a16207;
    --accent-primary: #ca8a04;
    --accent-secondary: #a16207;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(239, 68, 68, 0.2);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #ca8a04, #a16207);
    --button-hover: rgba(202, 138, 4, 0.3);
    --grid-empty-bg: rgba(245, 158, 11, 0.2);
    --grid-empty-text: #92400e;
    --grid-configured-bg: rgba(34, 197, 94, 0.2);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.25);
    --selected-info-bg: rgba(254, 249, 195, 0.95);
    --selected-info-border: rgba(202, 138, 4, 0.7);
    --form-border: rgba(161, 98, 7, 0.25);
    --form-focus-border: rgba(202, 138, 4, 0.8);
    --form-focus-shadow: rgba(202, 138, 4, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Green Theme */
[data-theme="green"] {
    --bg-primary: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(240, 253, 244, 0.98);
    --container-border: rgba(21, 128, 61, 0.25);
    --header-bg: rgba(220, 252, 231, 0.95);
    --header-border: rgba(21, 128, 61, 0.2);
    --panel-bg: rgba(240, 253, 244, 0.95);
    --panel-border: rgba(21, 128, 61, 0.22);
    --text-primary: #14532d;
    --text-secondary: #166534;
    --text-muted: #22c55e;
    --accent-primary: #16a34a;
    --accent-secondary: #15803d;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(239, 68, 68, 0.2);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #16a34a, #15803d);
    --button-hover: rgba(22, 163, 74, 0.3);
    --grid-empty-bg: rgba(34, 197, 94, 0.2);
    --grid-empty-text: #166534;
    --grid-configured-bg: rgba(16, 185, 129, 0.2);
    --grid-configured-text: #0f5132;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.25);
    --selected-info-bg: rgba(220, 252, 231, 0.95);
    --selected-info-border: rgba(22, 163, 74, 0.7);
    --form-border: rgba(21, 128, 61, 0.25);
    --form-focus-border: rgba(22, 163, 74, 0.8);
    --form-focus-shadow: rgba(22, 163, 74, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Blue Theme */
[data-theme="blue"] {
    --bg-primary: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(239, 246, 255, 0.98);
    --container-border: rgba(30, 64, 175, 0.25);
    --header-bg: rgba(219, 234, 254, 0.95);
    --header-border: rgba(30, 64, 175, 0.2);
    --panel-bg: rgba(239, 246, 255, 0.95);
    --panel-border: rgba(30, 64, 175, 0.22);
    --text-primary: #1e3a8a;
    --text-secondary: #1e40af;
    --text-muted: #3b82f6;
    --accent-primary: #1d4ed8;
    --accent-secondary: #1e3a8a;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(239, 68, 68, 0.2);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #1d4ed8, #1e3a8a);
    --button-hover: rgba(29, 78, 216, 0.3);
    --grid-empty-bg: rgba(59, 130, 246, 0.2);
    --grid-empty-text: #1e3a8a;
    --grid-configured-bg: rgba(34, 197, 94, 0.2);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.25);
    --selected-info-bg: rgba(219, 234, 254, 0.95);
    --selected-info-border: rgba(29, 78, 216, 0.7);
    --form-border: rgba(30, 64, 175, 0.25);
    --form-focus-border: rgba(29, 78, 216, 0.8);
    --form-focus-shadow: rgba(29, 78, 216, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Purple Theme */
[data-theme="purple"] {
    --bg-primary: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(250, 245, 255, 0.98);
    --container-border: rgba(88, 28, 135, 0.25);
    --header-bg: rgba(243, 232, 255, 0.95);
    --header-border: rgba(88, 28, 135, 0.2);
    --panel-bg: rgba(250, 245, 255, 0.95);
    --panel-border: rgba(88, 28, 135, 0.22);
    --text-primary: #581c87;
    --text-secondary: #7c2d92;
    --text-muted: #a855f7;
    --accent-primary: #7c3aed;
    --accent-secondary: #581c87;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(239, 68, 68, 0.2);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #7c3aed, #581c87);
    --button-hover: rgba(124, 58, 237, 0.3);
    --grid-empty-bg: rgba(139, 92, 246, 0.2);
    --grid-empty-text: #581c87;
    --grid-configured-bg: rgba(34, 197, 94, 0.2);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(168, 85, 247, 0.25);
    --selected-info-bg: rgba(243, 232, 255, 0.95);
    --selected-info-border: rgba(124, 58, 237, 0.7);
    --form-border: rgba(88, 28, 135, 0.25);
    --form-focus-border: rgba(124, 58, 237, 0.8);
    --form-focus-shadow: rgba(124, 58, 237, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Red Theme */
[data-theme="red"] {
    --bg-primary: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(254, 242, 242, 0.98);
    --container-border: rgba(153, 27, 27, 0.25);
    --header-bg: rgba(254, 226, 226, 0.95);
    --header-border: rgba(153, 27, 27, 0.2);
    --panel-bg: rgba(254, 242, 242, 0.95);
    --panel-border: rgba(153, 27, 27, 0.22);
    --text-primary: #7f1d1d;
    --text-secondary: #991b1b;
    --text-muted: #dc2626;
    --accent-primary: #b91c1c;
    --accent-secondary: #7f1d1d;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(220, 38, 38, 0.2);
    --error-text: #b91c1c;
    --button-bg: linear-gradient(135deg, #b91c1c, #7f1d1d);
    --button-hover: rgba(185, 28, 28, 0.3);
    --grid-empty-bg: rgba(220, 38, 38, 0.2);
    --grid-empty-text: #7f1d1d;
    --grid-configured-bg: rgba(34, 197, 94, 0.2);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.25);
    --selected-info-bg: rgba(254, 226, 226, 0.95);
    --selected-info-border: rgba(185, 28, 28, 0.7);
    --form-border: rgba(153, 27, 27, 0.25);
    --form-focus-border: rgba(185, 28, 28, 0.8);
    --form-focus-shadow: rgba(185, 28, 28, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Orange Theme */
[data-theme="orange"] {
    --bg-primary: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(255, 247, 237, 0.98);
    --container-border: rgba(154, 52, 18, 0.25);
    --header-bg: rgba(254, 215, 170, 0.95);
    --header-border: rgba(154, 52, 18, 0.2);
    --panel-bg: rgba(255, 247, 237, 0.95);
    --panel-border: rgba(154, 52, 18, 0.22);
    --text-primary: #9a3412;
    --text-secondary: #c2410c;
    --text-muted: #ea580c;
    --accent-primary: #ea580c;
    --accent-secondary: #9a3412;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(239, 68, 68, 0.2);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #ea580c, #9a3412);
    --button-hover: rgba(234, 88, 12, 0.3);
    --grid-empty-bg: rgba(249, 115, 22, 0.2);
    --grid-empty-text: #9a3412;
    --grid-configured-bg: rgba(34, 197, 94, 0.2);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.25);
    --selected-info-bg: rgba(254, 215, 170, 0.95);
    --selected-info-border: rgba(234, 88, 12, 0.7);
    --form-border: rgba(154, 52, 18, 0.25);
    --form-focus-border: rgba(234, 88, 12, 0.8);
    --form-focus-shadow: rgba(234, 88, 12, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

/* Pink Theme */
[data-theme="pink"] {
    --bg-primary: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    --bg-overlay: linear-gradient(135deg, rgba(0,0,0,0.08), transparent 40%);
    --container-bg: rgba(253, 242, 248, 0.98);
    --container-border: rgba(190, 24, 93, 0.25);
    --header-bg: rgba(252, 231, 243, 0.95);
    --header-border: rgba(190, 24, 93, 0.2);
    --panel-bg: rgba(253, 242, 248, 0.95);
    --panel-border: rgba(190, 24, 93, 0.22);
    --text-primary: #be185d;
    --text-secondary: #db2777;
    --text-muted: #ec4899;
    --accent-primary: #db2777;
    --accent-secondary: #be185d;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #166534;
    --error-bg: rgba(239, 68, 68, 0.2);
    --error-text: #dc2626;
    --button-bg: linear-gradient(135deg, #db2777, #be185d);
    --button-hover: rgba(219, 39, 119, 0.3);
    --grid-empty-bg: rgba(236, 72, 153, 0.2);
    --grid-empty-text: #be185d;
    --grid-configured-bg: rgba(34, 197, 94, 0.2);
    --grid-configured-text: #166534;
    --grid-page-bg: rgba(239, 68, 68, 0.2);
    --grid-page-text: #dc2626;
    --grid-selected-bg: rgba(139, 92, 246, 0.25);
    --selected-info-bg: rgba(252, 231, 243, 0.95);
    --selected-info-border: rgba(219, 39, 119, 0.7);
    --form-border: rgba(190, 24, 93, 0.25);
    --form-focus-border: rgba(219, 39, 119, 0.8);
    --form-focus-shadow: rgba(219, 39, 119, 0.15);
    --grid-default-bg: rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    padding: 18px 0 20px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    pointer-events: none;
    z-index: -1;
    background-size: 180% 180%;
    animation: backgroundDrift 18s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    inset: -20%;
    background:
        radial-gradient(circle at 20% 25%, rgba(99, 102, 241, 0.12), transparent 22%),
        radial-gradient(circle at 80% 15%, rgba(16, 185, 129, 0.10), transparent 18%),
        radial-gradient(circle at 55% 85%, rgba(139, 92, 246, 0.08), transparent 20%);
    pointer-events: none;
    z-index: -2;
    filter: blur(18px);
    opacity: 0.9;
    animation: auraFloat 24s ease-in-out infinite alternate;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--container-bg);
    border: 1px solid var(--container-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.container:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.14);
}

/* Header */
.header {
    background: var(--header-bg);
    border: 1px solid var(--header-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.header:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 200px;
}

.theme-selector {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.theme-selector select {
    padding: 8px 28px 8px 12px;
    border: 1px solid var(--form-border);
    border-radius: 6px;
    background: var(--panel-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) calc(50% - 1px),
        calc(100% - 11px) calc(50% - 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: border-color 0.2s, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.theme-selector select:focus {
    outline: none;
    border-color: var(--form-focus-border);
    box-shadow: 0 0 0 2px var(--form-focus-shadow);
    transform: translateY(-1px);
}

/* Content */
.content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Page Navigation */
.page-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
}

.page-btn {
    padding: 8px 16px;
    background: var(--button-bg);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.page-btn:hover {
    background: var(--button-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
    filter: brightness(1.04);
}

.page-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.page-display .label {
    color: var(--text-muted);
}

.page-number {
    color: var(--accent-primary);
    font-size: 1.1rem;
}

/* Button Grid */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    min-height: 300px;
}

.grid-item {
    aspect-ratio: 1;
    background: var(--grid-default-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    padding: 10px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.grid-item:hover {
    background: var(--grid-empty-bg);
    color: var(--grid-empty-text);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.grid-item.selected {
    background: var(--grid-selected-bg);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--form-focus-shadow);
}

.grid-item.configured {
    background: var(--grid-configured-bg);
    color: var(--grid-configured-text);
}

/* Editor Panel */
.editor-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
}

.editor-panel h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.selected-info {
    margin-bottom: 20px;
    padding: 12px;
    background: var(--selected-info-bg);
    border: 1px solid var(--selected-info-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-info .label {
    color: var(--text-muted);
    font-weight: 500;
}

.selected-info .value {
    font-weight: 600;
    color: var(--accent-primary);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--form-border);
    border-radius: 6px;
    background: var(--panel-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--form-focus-border);
    box-shadow: 0 0 0 2px var(--form-focus-shadow);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
    flex: 1;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.btn-save {
    background: var(--button-bg);
    color: white;
}

.btn-save:hover {
    background: var(--button-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
    filter: brightness(1.04);
}

.btn-delete {
    background: var(--error-bg);
    color: var(--error-text);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .status-bar {
        justify-content: center;
    }
    
    .page-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .button-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .gallery {
        grid-template-columns: 1fr;
    }
    
    .systems {
        grid-template-columns: 1fr;
    }
}

/* Navigation */
.navigation {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, color 0.22s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--button-bg);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.nav-link.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* Inline images shown under news items */
.news-inline-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.news-inline-images img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}
.news-inline-images a {
    display: block;
    text-decoration: none;
}

/* Photo viewer: hide controls when requested */
.photo-viewer.hide-controls .photo-viewer-nav,
.photo-viewer.hide-controls .photo-viewer-zoom {
    display: none;
}

/* Overlay meta text style for news viewer */
.photo-viewer.overlay-meta .photo-viewer-panel {
    position: relative;
}
.photo-viewer.overlay-meta .photo-viewer-meta {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    background: rgba(2,6,23,0.95) !important;
    color: var(--text-primary);
    padding: 18px;
    border-radius: 10px;
    z-index: 31000 !important;
    font-size: 1.12rem;
}
.photo-viewer.overlay-meta .photo-viewer-title {
    font-size: 1.36rem;
    margin-bottom: 8px;
    font-weight: 700;
}

/* Reduce image size in overlay mode so meta text remains visible */
.photo-viewer.overlay-meta .photo-viewer-media {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 90px; /* reserve space for overlay meta */
}
.photo-viewer.overlay-meta .photo-viewer-image {
    max-height: 36vh !important;
    max-width: 66% !important;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45) !important;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

/* ensure overlay meta sits above everything */
.photo-viewer.overlay-meta .photo-viewer-meta {
    pointer-events: auto;
}
.gallery-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.gallery-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.gallery-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.gallery-section h3 {
    color: var(--accent-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.gallery-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.gallery-section ul {
    color: var(--text-secondary);
    padding-left: 20px;
    margin-bottom: 15px;
}

.gallery-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.gallery-section a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.gallery-section a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
    transform: translateX(2px);
}

.intro-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.intro-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.intro-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.intro-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.intro-section a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
    transition: color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.intro-section a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
    transform: translateX(2px);
}

.systems-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.systems-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.systems-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.systems-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.intro-section .features {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature-item {
    background: var(--grid-default-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--form-border);
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.10);
    border-color: var(--form-focus-border);
}

.feature-item h3 {
    color: var(--accent-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.feature-item p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.gallery-item {
    appearance: none;
    border: 0;
    padding: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: var(--grid-default-bg);
    border: 1px solid var(--form-border);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    transform: translateZ(0);
}

.gallery-item:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.14);
    border-color: var(--accent-primary);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    image-orientation: from-image;
    display: block;
}

.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 30000 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.photo-viewer.active {
    display: flex;
}

.photo-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.88) !important;
    backdrop-filter: blur(10px);
    z-index: 29990 !important;
}

.photo-viewer-panel {
    position: relative;
    z-index: 30001 !important;
    width: min(100%, 980px);
    max-height: 92vh;
    overflow: auto;
    display: grid;
    grid-template-rows: minmax(0, auto) auto;
    gap: 12px;
    overscroll-behavior: contain;
    background: var(--container-bg);
    border: 1px solid var(--container-border);
    border-radius: 16px;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
    padding: 18px;
}

.photo-viewer-media {
    max-height: 72vh;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.18);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-close {
    position: absolute;
    top: 26px;
    right: 28px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: white;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    z-index: 4;
    pointer-events: auto;
}

.photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 64px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    z-index: 2;
}

.photo-viewer-nav:hover {
    filter: brightness(1.08);
}

.photo-viewer-prev {
    left: 26px;
}

.photo-viewer-next {
    right: 26px;
}

.photo-viewer-zoom {
    position: absolute;
    right: 28px;
    bottom: 118px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: white;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    z-index: 2;
}

.photo-viewer-zoom:hover {
    filter: brightness(1.08);
}

.photo-viewer-zoom::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background: center / 58% 58% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}

.photo-viewer.zoomed .photo-viewer-media {
    align-items: center;
    justify-content: center;
}

.photo-viewer.zoomed .photo-viewer-panel {
    overflow: hidden;
}

.photo-viewer-image {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    min-width: 0;
    height: auto;
    object-fit: contain;
    object-position: center;
    image-orientation: from-image;
    display: block;
    transition: width 0.16s ease, height 0.16s ease;
}

.photo-viewer.zoomed .photo-viewer-image {
    max-width: none;
    max-height: none;
}

.photo-viewer-meta {
    padding: 16px 4px 4px;
}

.photo-viewer-meta h3 {
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 1.35rem;
}

.photo-viewer-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
    max-width: 56ch;
}

.page-shell {
    transition: filter 0.18s ease, transform 0.18s ease;
}

body.viewer-open .page-shell {
    filter: blur(12px) saturate(0.7);
    transform: scale(1.01);
    pointer-events: none;
    user-select: none;
}

body.viewer-open .page-footnote {
    pointer-events: none;
    user-select: none;
}

body.news-modal-open .container {
    filter: blur(12px) saturate(0.75);
    transform: scale(1.01);
    pointer-events: none;
    user-select: none;
}

body.news-modal-open .page-footnote {
    filter: blur(12px);
    pointer-events: none;
    user-select: none;
}


.video-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.video-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.video-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.video-section h3 {
    color: var(--accent-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.video-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.video-section ul {
    color: var(--text-secondary);
    padding-left: 20px;
    margin-bottom: 15px;
}

.video-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.video-section a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
    transition: color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.video-section a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
    transform: translateX(2px);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 15px 0;
    background: var(--grid-default-bg);
    border: 1px solid var(--form-border);
    border-radius: 8px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.video-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.14);
    border-color: var(--accent-primary);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.systems {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

.system-card {
    background: var(--grid-default-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--form-border);
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.system-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.10);
    border-color: var(--accent-primary);
}

.main-functions-section .main-functions-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 168px;
    padding: 14px 16px;
}

.main-functions-section .main-functions-card h3 {
    margin: 0 0 10px 0;
}

.main-functions-section .main-functions-card ul {
    margin: 0;
    padding-left: 18px;
}

.main-functions-section .main-functions-card li {
    margin-bottom: 5px;
}

.main-functions-section .systems {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.system-card h3 {
    color: var(--accent-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.system-card p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.system-card ul {
    color: var(--text-secondary);
    padding-left: 20px;
    margin-bottom: 10px;
}

.system-card li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* News styles */
.news-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.news-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.news-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

.news-header {
    margin-bottom: 20px;
    cursor: pointer;
}

.news-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.news-section ul {
    color: var(--text-secondary);
    padding-left: 20px;
    margin-bottom: 15px;
}

.news-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.news-item {
    background: var(--grid-default-bg);
    border: 1px solid var(--form-border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.news-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.10);
    border-color: var(--accent-primary);
}

.news-item h3 {
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.news-item p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.news-item ul {
    color: var(--text-secondary);
    padding-left: 20px;
}

.news-item li {
    margin-bottom: 5px;
}

.news-item a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
    transition: color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.news-item a:hover {
    color: var(--accent-secondary);
    transform: translateX(2px);
}

.news-header {
    margin-bottom: 20px;
}

.news-header p {
    margin-bottom: 0;
}

.featured-post {
    position: relative;
    margin-bottom: 22px;
    padding: 22px 22px 20px;
    border-radius: 14px;
    border: 1px solid var(--selected-info-border);
    background: linear-gradient(135deg, var(--selected-info-bg), var(--grid-default-bg));
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.featured-post:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.14);
    border-color: var(--accent-primary);
}

.featured-post.is-expanded {
    transform: scale(1.03);
    box-shadow: 0 24px 44px rgba(0, 0, 0, 0.18);
    border-color: var(--accent-primary);
    z-index: 3;
}

.featured-post.is-expanded h3,
.timeline-card.is-expanded h3 {
    font-size: 1.18rem;
}

.featured-post.is-expanded p,
.timeline-card.is-expanded p {
    font-size: 1.02rem;
    line-height: 1.72;
}

.featured-post-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--accent-primary);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.featured-post .news-date {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.featured-post h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.35rem;
}

.featured-post p {
    margin-bottom: 0;
}

.timeline {
    position: relative;
    display: grid;
    gap: 18px;
    padding-left: 18px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 7px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-primary), transparent);
    opacity: 0.55;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 16px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--grid-default-bg);
}

.timeline-date {
    padding-top: 11px;
    padding-left: 18px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.96rem;
}

.timeline-card {
    background: var(--grid-default-bg);
    border: 1px solid var(--form-border);
    border-radius: 12px;
    padding: 18px 18px 16px;
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.timeline-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.12);
    border-color: var(--accent-primary);
}

.timeline-card.is-expanded {
    transform: scale(1.03);
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.16);
    border-color: var(--accent-primary);
    z-index: 2;
}

.news-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.news-modal.active {
    display: flex;
}

.news-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(10px);
}

.news-modal-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 980px);
    max-height: 90vh;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid var(--container-border);
    background: var(--container-bg);
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
    padding: 22px;
}

.news-modal-close {
    position: absolute;
    top: 8px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: white;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    z-index: 2;
    appearance: none;
    -webkit-appearance: none;
}

.news-modal-content {
    padding-top: 28px;
}

.news-modal-post {
    margin: 0 !important;
    transform: none !important;
    box-shadow: none !important;
    border-color: var(--accent-primary);
    background: var(--panel-bg);
    cursor: default;
}

.news-modal-post h3 {
    font-size: 1.7rem;
}

.news-modal-post p,
.news-modal-post .news-date,
.news-modal-post .timeline-card p {
    font-size: 1.05rem;
    line-height: 1.75;
}

.news-modal-post .timeline-card {
    transform: none !important;
    box-shadow: none !important;
    border-color: var(--form-border);
    background: var(--grid-default-bg);
}

.news-modal-post .timeline-item {
    grid-template-columns: 1fr;
}

.news-modal-post .timeline-date {
    padding-left: 0;
    padding-top: 0;
    margin-bottom: 10px;
}

.news-modal-post .featured-post-badge {
    margin-bottom: 14px;
}

body.news-modal-open {
    overflow: hidden;
}
.page-footnote {
    display: block;
    margin: 14px 0 0 14px;
    color: var(--text-muted);
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    opacity: 0.7;
    pointer-events: none;
}

/* Links Section Styles */
.links-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 32px;
    margin: 20px 0 20px 0;
    text-align: center;
}

.links-section h2 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.links-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.links-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    align-items: center;
    width: 100%;
}


.link-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--panel-bg);
    border: 1px solid var(--form-border);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    width: 100%;
    max-width: none;
}

.link-inline:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0,0,0,0.10);
    border-color: var(--accent-primary);
}

.link-inline:active { transform: translateY(-1px); }

.link-icon svg { width: 20px; height: 20px; display: block; color: var(--accent-primary); }
.link-text { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }

@media (max-width: 720px) {
    .links-row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/* Documentation styles */
.doc-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.doc-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.doc-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.doc-section h3 {
    color: var(--accent-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.doc-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.doc-section ul {
    color: var(--text-secondary);
    padding-left: 20px;
    margin-bottom: 15px;
}

.doc-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.document-viewer-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.document-viewer-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.10);
}

.document-viewer-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.document-viewer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.document-viewer {
    width: 100%;
    height: 80vh;
    min-height: 700px;
    border: 1px solid var(--form-border);
    border-radius: 8px;
    background: var(--panel-bg);
}

.document-viewer iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .timeline-item {
        grid-template-columns: 1fr;
        padding-left: 12px;
    }

    .timeline-item::before {
        top: 12px;
    }

    .timeline-date {
        padding-top: 4px;
        padding-left: 18px;
    }

    .page-footnote {
        margin-left: 12px;
        max-width: calc(100vw - 24px);
    }

    .photo-viewer-nav {
        width: 40px;
        height: 56px;
        font-size: 1.7rem;
    }

    .photo-viewer-zoom {
        width: 40px;
        height: 40px;
    }
}

.pdf-viewer {
    display: grid;
    gap: 18px;
    margin-top: 10px;
}

.pdf-status {
    padding: 14px 16px;
    border: 1px solid var(--form-border);
    border-radius: 8px;
    background: var(--grid-default-bg);
    color: var(--text-secondary);
    font-weight: 500;
}

.pdf-page {
    padding: 14px;
    background: var(--grid-default-bg);
    border: 1px solid var(--form-border);
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.pdf-page-label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.pdf-page canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    background: white;
}

.pdf-page + .pdf-page {
    margin-top: 0;
}

@keyframes backgroundDrift {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

@keyframes auraFloat {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        transform: translate3d(1.5%, -1%, 0) scale(1.04);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .container:hover,
    .header:hover,
    .gallery-section:hover,
    .intro-section:hover,
    .systems-section:hover,
    .video-section:hover,
    .news-section:hover,
    .doc-section:hover,
    .document-viewer-section:hover,
    .feature-item:hover,
    .system-card:hover,
    .news-item:hover,
    .gallery img:hover,
    .video-container:hover,
    .grid-item:hover,
    .page-btn:hover,
    .btn-save:hover,
    .btn-delete:hover,
    .nav-link:hover,
    .gallery-section a:hover,
    .intro-section a:hover,
    .video-section a:hover,
    .news-item a:hover {
        transform: none;
        box-shadow: none;
    }
}