:root {
    --bg-color: #050505;
    --text-color: #00ff41;
    --glass-bg: rgba(10, 10, 10, 0.6);
    --glass-border: rgba(0, 255, 65, 0.2);
    --glass-blur: 20px;
    --ui-scale: 1;
    --font-size-base: 16px;
    --nav-height: 70px;
    --header-padding: 15px;
}

[data-theme="light"] {
    --bg-color: #f0f0f0;
    --text-color: #000000;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #050505;
    --text-color: #00ff41;
    --glass-bg: rgba(10, 10, 10, 0.6);
    --glass-border: rgba(0, 255, 65, 0.2);
}

body.force-desktop { min-width: 800px; }
body.force-mobile { max-width: 600px; margin: 0 auto; }

/* ===== БАЗОВЫЙ ШРИФТ (без засечек) ===== */
body {
    font-family: 'Courier New', monospace;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
}

/* ===== ЗАСЕЧКИ — только через класс .serif ===== */
body.serif,
body.serif * {
    font-family: 'Georgia', serif !important;
}

/* Исключение для SVG и иконок */
svg, svg * {
    font-family: inherit !important;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
}

/* Сканирующая линия */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.4;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.cursor-dot {
    width: 0.5rem; height: 0.5rem;
    background: var(--text-color);
    border-radius: 50%;
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    transition: transform 0.1s;
}
.cursor-ring {
    width: 1.875rem; height: 1.875rem;
    border: 2px solid var(--text-color);
    border-radius: 50%;
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    transition: transform 0.2s, width 0.2s, height 0.2s;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--text-color); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-color); opacity: 0.8; }

/* ============================================
   HEADER & НАВИГАЦИЯ
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(0.75rem * var(--ui-scale)) calc(1.25rem * var(--ui-scale));
    min-height: var(--nav-height);
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--text-color);
    flex-shrink: 0;
}
.logo::before {
    content: '';
    display: block;
    width: 2.625rem;
    height: 2.625rem;
    background: url('/assets/logo.webp') no-repeat center / contain;
    filter: var(--logo-filter, none);
    flex-shrink: 0;
    transition: filter 0.3s;
}
.logo-text {
    font-size: calc(1.25rem * var(--ui-scale));
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}
.logo-text::after {
    content: '_';
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.9375rem;
    transition: all 0.3s ease;
}
.nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: calc(0.875rem * var(--ui-scale));
    transition: opacity 0.3s;
    white-space: nowrap;
}
.nav a:hover {
    opacity: 0.7;
}

.burger-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text-color);
    width: 2.25rem;
    height: 2.25rem;
    padding: 6px;
    cursor: pointer;
    z-index: 101;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    transition: all 0.3s;
}
.burger-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
}
.burger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.burger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.burger-btn.active span:nth-child(2) {
    opacity: 0;
}
.burger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.controls {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    flex-shrink: 0;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}
.btn-icon:hover,
.btn-icon.active {
    background: var(--text-color);
    color: var(--bg-color);
}

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 2.8125rem;
    min-width: 160px;
    border-radius: 8px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 5px;
    z-index: 200;
}
.dropdown-menu.active {
    display: flex;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 8px 12px;
    text-align: left;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    transition: background 0.2s;
}
.dropdown-item:hover {
    background: rgba(255,255,255,0.1);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    padding: calc(0.9375rem * var(--ui-scale));
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.controls-panel {
    padding: calc(1.125rem * var(--ui-scale));
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.search-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--glass-border);
    color: var(--text-color);
    font-size: calc(1rem * var(--ui-scale));
    padding: 10px 5px;
    outline: none;
    width: 100%;
    transition: border-color 0.3s;
}
.search-input:focus {
    border-color: var(--text-color);
}
.search-input::placeholder {
    opacity: 0.5;
}
.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: none;
    transition: all 0.3s;
    font-size: calc(0.8125rem * var(--ui-scale));
}
.filter-btn.active,
.filter-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.card {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 255, 65, 0.1);
}
.card-img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    filter: grayscale(50%) contrast(120%);
    transition: filter 0.3s;
}
.card:hover .card-img {
    filter: grayscale(0%) contrast(100%);
}
.card-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.card-name {
    font-size: 1.125rem;
    font-weight: bold;
    margin-bottom: 2px;
}
.card-info {
    font-size: 0.8125rem;
    opacity: 0.8;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s;
}
.modal-content {
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 25px;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.75rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    z-index: 10;
    transition: transform 0.3s;
}
.modal-close:hover {
    transform: rotate(90deg);
}
.modal-content img {
    border-radius: 8px;
    margin-bottom: 15px;
}

.bvi-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 300px;
    padding: 30px 25px;
    z-index: 500;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}
.bvi-panel.active {
    transform: translateX(0);
}
.bvi-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.875rem;
    color: var(--text-color);
    background: none;
    border: none;
    cursor: pointer;
}
.bvi-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bvi-group label {
    font-size: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: none;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--text-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
    background: var(--bg-color);
}

.footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    font-size: 0.875rem;
    opacity: 0.7;
}
.footer p {
    margin: 0;
}

[data-theme="dark"] .logo::before {
    --logo-filter: invert(1) brightness(1.2);
}

/* ============================================
   АДАПТИВ
   ============================================ */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
    }
    .header {
        padding: 12px 16px;
    }
    .logo-text {
        font-size: calc(1.125rem * var(--ui-scale));
    }
    .logo::before {
        width: 2.25rem;
        height: 2.25rem;
    }
    .nav a {
        font-size: calc(0.8125rem * var(--ui-scale));
    }
    .controls {
        gap: 8px;
    }
    .btn-icon {
        width: 2.125rem;
        height: 2.125rem;
    }
}

@media (max-width: 768px) {
    .burger-btn {
        display: flex;
        order: 1;
    }
    .nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--bg-color);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 25px;
        padding: 80px 20px 40px;
        transform: translateX(100%);
        transition: transform 0.4s ease;
        z-index: 99;
        opacity: 0.98;
        border: none;
    }
    .nav.open {
        transform: translateX(0);
    }
    .nav a {
        font-size: calc(1.375rem * var(--ui-scale));
        font-weight: bold;
        letter-spacing: 1px;
        padding: 8px 20px;
        border-bottom: 2px solid transparent;
        transition: all 0.3s;
    }
    .nav a:hover {
        border-bottom-color: var(--text-color);
        opacity: 1;
    }
    .header {
        padding: 10px 14px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .controls {
        gap: 6px;
        order: 2;
    }
    .logo {
        order: 0;
        flex-shrink: 1;
        min-width: 0;
    }
    .logo-text {
        font-size: calc(1rem * var(--ui-scale));
        letter-spacing: 1px;
    }
    .logo::before {
        width: 2rem;
        height: 2rem;
    }
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .card-img {
        height: 220px;
    }
    .controls-panel {
        padding: 14px;
        gap: 10px;
    }
    .search-input {
        font-size: 0.9375rem;
        padding: 8px 4px;
    }
    .filters {
        gap: 6px;
    }
    .filter-btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    .modal-content {
        padding: 20px 16px;
        max-width: 100%;
        margin: 10px;
    }
    .modal-content img {
        max-height: 250px;
    }
    .bvi-panel {
        width: 100%;
        max-width: 320px;
        padding: 25px 20px;
    }
    .dropdown-menu {
        right: -10px;
        min-width: 140px;
    }
    .cursor-dot,
    .cursor-ring {
        display: none !important;
    }
    * {
        cursor: auto !important;
    }
    button, a, input {
        cursor: pointer !important;
    }
    body::before {
        background-size: 100% 2px;
        opacity: 0.2;
    }
    .main-content {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
        min-height: 56px;
    }
    .logo::before {
        width: 1.75rem;
        height: 1.75rem;
    }
    .logo-text {
        font-size: 0.875rem;
        letter-spacing: 0.5px;
    }
    .btn-icon {
        width: 1.875rem;
        height: 1.875rem;
        border-radius: 6px;
    }
    .btn-icon svg {
        width: 1rem;
        height: 1rem;
    }
    .controls {
        gap: 4px;
    }
    .burger-btn {
        width: 1.875rem;
        height: 1.875rem;
        padding: 5px;
    }
    .card-img {
        height: 180px;
    }
    .card-name {
        font-size: 1rem;
    }
    .card-info {
        font-size: 0.75rem;
    }
    .controls-panel {
        padding: 12px;
    }
    .search-input {
        font-size: 0.875rem;
        padding: 6px 4px;
    }
    .filter-btn {
        font-size: 0.6875rem;
        padding: 4px 10px;
    }
    .filters {
        gap: 4px;
    }
    .modal-content {
        padding: 16px 12px;
    }
    .bvi-panel {
        max-width: 280px;
        padding: 20px 16px;
    }
    .bvi-group label {
        font-size: 0.875rem;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .nav.open {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
        padding: 60px 20px 30px;
        align-items: center;
        align-content: center;
    }
    .nav a {
        font-size: 1.125rem;
        padding: 6px 14px;
    }
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1400px) {
    .main-content {
        padding: calc(1.5625rem * var(--ui-scale));
    }
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 25px;
    }
    .card-img {
        height: 320px;
    }
}

/* Запрет выделения для изображений */
img {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
    pointer-events: none;
}