:root {
    --bg: #0a0a0a;
    --fg: #00ff41;
    --fg-dim: #008f11;
    --border: #008f11;
    --alert: #ff003c;
}

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

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    height: 100vh;
    flex-direction: column;
}

button, input {
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    font-family: inherit;
    padding: 5px 10px;
    cursor: pointer;
    outline: none;
}

button:hover:not(:disabled) {
    background: var(--fg-dim);
    color: var(--bg);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--fg-dim);
}

.uploading {
    animation: blink 1s step-end infinite;
}

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

.hidden { display: none !important; }

.auth-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.auth-box {
    border: 1px dashed var(--border);
    padding: 30px;
    width: 350px;
    max-width: 90vw;
}

.auth-box .form-group { margin-bottom: 15px; }
.auth-box input { width: 100%; margin-top: 5px; }
.auth-box .actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--fg-dim);
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

h1, h2, h3 {
    font-weight: normal;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.catalog-card {
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 20px;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.photo-grid img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border: 1px solid var(--fg-dim);
    transition: filter 0.3s;
}

.photo-grid img:hover, .photo-grid img.clickable:hover { 
    border-color: var(--fg);
}

.rating-section {
    border-top: 1px dashed var(--fg-dim);
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.rating-buttons button {
    width: 35px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-form {
    border: 1px dashed var(--border);
    padding: 20px;
    margin-bottom: 30px;
}

.panel-form .form-group { margin-bottom: 15px; display: flex; flex-direction: column; }
.panel-form input { margin-top: 5px; }

.clickable {
    cursor: pointer;
}

.clickable:hover {
    text-decoration: underline;
    color: var(--fg);
}

.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.lightbox-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    background: var(--bg);
    padding: 20px;
    border: 1px dashed var(--border);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.1);
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#lightbox-img {
    max-width: 60vw;
    max-height: 70vh;
    border: 1px solid var(--border);
    object-fit: contain;
}

.lightbox-votes {
    width: 250px;
    height: 70vh;
    overflow-y: auto;
    border-left: 1px dashed var(--border);
    padding-left: 15px;
}

.lightbox-vote-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9em;
}

#lightbox-counter {
    margin-top: 10px;
    font-size: 1.2em;
}

.lightbox-nav, .lightbox-close {
    background: none;
    border: none;
    color: var(--fg);
    font-size: 2.5em;
    cursor: pointer;
    padding: 20px;
}

.lightbox-nav:hover, .lightbox-close:hover {
    color: var(--fg-dim);
    background: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
}

.mobile-only {
    display: none;
}

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

    #mobile-menu-btn {
        width: 100%;
        margin-bottom: 20px;
        padding: 10px;
        font-size: 1.1em;
        border: 1px dashed var(--border);
        text-align: center;
    }

    .app-layout {
        position: relative;
        flex-direction: row;
    }

    .sidebar {
        position: absolute;
        left: -100%;
        top: 0;
        height: 100%;
        width: 85vw;
        max-width: 320px;
        z-index: 1000;
        transition: left 0.3s ease;
        border-right: 1px dashed var(--border);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.8);
        background: var(--bg);
    }

    .sidebar.open {
        left: 0;
    }

    .close-sidebar-btn {
        background: none;
        border: none;
        color: var(--fg);
        font-size: 1.2em;
        padding: 5px;
    }

    .main-content {
        padding: 10px;
        width: 100%; 
    }

    .nav-bar {
        flex-direction: row; 
        justify-content: space-between;
        align-items: center;
        gap: 15px;
    }
    
    .nav-actions {
        display: flex;
        gap: 10px;
    }

    .catalog-header {
        flex-direction: column;
    }

    .lightbox-content {
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
        padding: 10px;
    }

    .lightbox-votes {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px dashed var(--border);
        padding-left: 0;
        padding-top: 15px;
        max-height: 30vh;
    }

    #lightbox-img {
        max-width: 85vw;
        max-height: 40vh;
    }

    .lightbox-nav {
        padding: 10px;
        font-size: 1.8em;
    }

    .lightbox-close {
        top: 5px;
        right: 5px;
        font-size: 1.5em;
        padding: 10px;
    }

    .lightbox {
        position: fixed;
    }

    .lightbox-content {
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
        padding: 10px;
        width: 100%;
        max-width: 100%;
        margin-top: 40px; 
    }

    #lightbox-img {
        max-width: 100vw;
        max-height: 50vh;
    }

    .lightbox-nav {
        position: absolute;
        top: 40%; 
        transform: translateY(-50%);
        padding: 15px 20px;
        font-size: 2em;
        background: rgba(10, 10, 10, 0.7);
        border: 1px solid var(--border);
        border-radius: 5px;
        z-index: 10001;
    }

    .lightbox-nav[onclick="prevImage()"] {
        left: 5px;
    }

    .lightbox-nav[onclick="nextImage()"] {
        right: 5px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 1.5em;
        padding: 5px 10px;
        background: rgba(10, 10, 10, 0.7);
        border: 1px solid var(--border);
        border-radius: 5px;
        z-index: 10002;
    }
}
