* {
    box-sizing: border-box;
}

body {
    color: #dcdcdc;
    font-family: Arial, sans-serif;
    font-size: 13px;
    margin: 0;
    padding: 20px;
}

.header-bar {
    background: linear-gradient(to bottom, #441111 0%, #110000 50%, #000000 51%, #220000 100%);
    border: 2px solid #8B4513;
    border-radius: 8px 8px 0 0;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    font-family: 'Times New Roman', serif;
    text-shadow: 0 0 10px #800000;
}

.logo span {
    color: #800000;
}

.nav-menu {
    background: #000;
    border: 2px solid #333;
    border-top: none;
    padding: 10px 30px;
    display: flex;
    gap: 20px;
    font-weight: bold;
}

.nav-menu a {
    color: #D4AF37;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 12px;
}

.nav-menu a:hover {
    color: #fff;
    text-shadow: 0 0 5px #ff0000;
}

.container {
    width: 1160px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid #333;
    border-top: none;
    box-shadow: 0 0 30px rgba(0,0,0,0.9);
}

.btn-glossy {
    display: inline-block;
    padding: 6px 12px;
    margin: 3px 0;
    background: linear-gradient(to bottom, #A52A2A 0%, #800000 50%, #5C1F1F 51%, #701D1D 100%);
    border: 1px solid #330000;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    font-size: 11px;
    text-decoration: none;
}

.btn-glossy:hover {
    background: linear-gradient(to bottom, #CC3333 0%, #A52A2A 50%, #701D1D 51%, #8B4513 100%);
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    background: #111;
    border: 1px solid #444;
    color: #fff;
    padding: 8px;
    margin-bottom: 8px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.media-box {
    background: #000;
    border: 1px solid #333;
    padding: 5px;
    text-align: center;
    position: relative;
}

.media-item {
    height: 240px;
    width: 100%;
    object-fit: cover;
    cursor: zoom-in;
    border: 1px solid #222;
    transition: transform 0.2s, filter 0.2s;
}

.media-item:hover {
    transform: scale(1.03);
    filter: brightness(1.2);
    box-shadow: 0 0 15px #800000;
    z-index: 10;
    position: relative;
}

.dl-link {
    display: block;
    color: #D4AF37;
    font-size: 10px;
    margin-top: 5px;
    text-decoration: none;
}

#lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lb-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 85%;
    position: relative;
}

.lb-media {
    max-width: 90vw;
    max-height: 90vh;
    border: 3px solid #800000;
    box-shadow: 0 0 30px #000;
}

.lb-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(128,0,0,0.7);
    color: white;
    border: 2px solid #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 15px 20px;
    font-weight: bold;
    border-radius: 5px;
}

.lb-btn:hover {
    background: #ff0000;
}

.lb-prev {
    left: 20px;
}

.lb-next {
    right: 20px;
}

#lb-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-weight: bold;
    z-index: 10001;
    width: 50px;
    height: 50px;
    background: rgba(128, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: background 0.2s, transform 0.2s;
}

#lb-close:hover {
    background: rgba(255, 0, 0, 0.8);
    color: #fff;
    transform: scale(1.1);
}

.footer {
    background: #080808;
    border-top: 2px solid #800000;
    padding: 15px;
    text-align: center;
    color: #777;
    font-size: 11px;
    font-family: monospace;
    letter-spacing: 1px;
    margin-top: 20px;
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.8);
}

.media-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 15px;
}

.media-grid-1 .media-item {
    height: auto;
    max-height: 600px;
    width: 100%;
    object-fit: contain;
    background: #050505;
}

.media-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.media-grid-2 .media-item {
    height: 350px;
    width: 100%;
    object-fit: cover;
}

.cat-btn {
    padding: 6px 15px;
    background: #111;
    color: #aaa;
    border: 1px solid #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 11px;
}

.cat-btn:hover {
    background: #333;
    color: #fff;
}

.cat-btn.active {
    background: #800000;
    color: #D4AF37;
    border-color: #A52A2A;
    box-shadow: 0 0 10px #800000;
}

/* Мобильный режим */
body.mobile-mode {
    padding: 0;
}

body.mobile-mode .container {
    width: 100% !important;
    border: none;
    box-shadow: none;
    padding: 5px;
    box-sizing: border-box;
}

body.mobile-mode .header-bar {
    flex-direction: column !important;
    gap: 10px;
    text-align: center;
    padding: 10px;
    border-radius: 0;
}

body.mobile-mode .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px;
    gap: 8px;
}

body.mobile-mode div[style*="display: flex"][style*="gap: 20px"] {
    flex-direction: column !important;
    gap: 15px !important;
}

body.mobile-mode div[style*="width: 320px"] {
    width: 100% !important;
}

body.mobile-mode .media-grid-1 {
    display: block !important;
}

body.mobile-mode .media-grid-1 .media-item {
    width: 100% !important;
    height: auto !important;
    max-height: 450px !important;
    object-fit: contain !important;
}

body.mobile-mode .media-grid-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
}

body.mobile-mode .media-grid-2 .media-item {
    width: 100% !important;
    height: 180px !important;
    object-fit: cover !important;
}

body.mobile-mode .media-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
}

body.mobile-mode .media-grid .media-item {
    width: 100% !important;
    height: 110px !important;
    object-fit: cover !important;
}

.audio-row {
    margin-top: 10px;
    background: #111;
    padding: 6px 10px;
    border: 1px solid #333;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.audio-title {
    color: #888;
    font-family: monospace;
    font-size: 11px;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.audio-player {
    height: 32px;
    flex-grow: 1;
    min-width: 0;
}

.audio-dl-btn {
    margin: 0 !important;
    padding: 4px 8px !important;
    font-size: 10px !important;
    background: #003366 !important;
    border-color: #004488 !important;
    text-decoration: none !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.reactions-bar {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #222;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center;
}

.reactions-bar .btn-glossy {
    display: inline-flex !important;
    width: auto !important;
    margin: 0 !important;
    padding: 5px 10px !important;
    font-size: 11px !important;
}

.edit-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    background: #111;
    padding: 3px 8px;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 10px;
    color: #aaa;
    cursor: pointer;
    vertical-align: middle;
}
.edit-toggle-checkbox { display: none; }
.edit-toggle-slider {
    width: 24px;
    height: 12px;
    background: #333;
    border-radius: 10px;
    position: relative;
    margin-left: 6px;
    transition: 0.2s;
}
.edit-toggle-slider::before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #888;
    border-radius: 50%;
    top: 1px;
    left: 1px;
    transition: 0.2s;
}
.edit-toggle-checkbox:checked + .edit-toggle-slider { background: #800000; }
.edit-toggle-checkbox:checked + .edit-toggle-slider::before {
    transform: translateX(12px);
    background: #ff4444;
}