:root {
    --bg: #0f1115;
    --surface: #1a1d24;
    --surface-2: #232730;
    --border: #2a2f3a;
    --text: #e6e8eb;
    --muted: #8b93a1;
    --primary: #5865f2;
    --primary-hover: #4752c4;
    --danger: #ed4245;
    --success: #3ba55c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    transition: background .15s, transform .05s;
    user-select: none;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #c43539; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}
.user { display: flex; align-items: center; gap: 12px; }
.user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
}
.user span { font-weight: 500; }
.actions { display: flex; gap: 8px; align-items: center; }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    margin-bottom: 24px;
    transition: border-color .15s, background .15s;
}
.dropzone p { margin: 0; }
.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(88, 101, 242, 0.08);
    color: var(--text);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.thumb {
    aspect-ratio: 1;
    background: #000;
    cursor: zoom-in;
    overflow: hidden;
    position: relative;
}
.thumb img, .thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.thumb .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 8px;
}
.controls .btn { width: 100%; }
.controls .btn-wide { grid-column: 1 / -1; }

.empty, .status {
    text-align: center;
    color: var(--muted);
    padding: 48px;
}
.status { padding: 12px; color: var(--text); }

.hidden { display: none !important; }

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.lightbox-inner {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-inner img,
.lightbox-inner video {
    max-width: 95vw;
    max-height: 95vh;
    display: block;
    border-radius: 4px;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-close:hover { background: rgba(0,0,0,0.8); }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    text-align: center;
    background: var(--surface);
    padding: 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 420px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.login-box h1 { margin-top: 0; }
.login-box p { color: var(--muted); margin-bottom: 24px; }
.btn.discord {
    background: #5865f2;
    padding: 12px 20px;
    font-size: 15px;
}

@media (max-width: 600px) {
    header { padding: 12px 16px; }
    main { padding: 16px; }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .controls { grid-template-columns: 1fr; }
}
