:root {
    --bg: #0f151e;
    --card: #1e2937;
    --cardborder: #2a2f3a;
    --card2: #0f172a;
    --card2border: #0f172a;
    --text: #e6e8ec;
    --muted: #8b929e;
    --accent: #3b82f6;
    --danger: #ef4444;
    --ok: #22c55e;
    --border: #2a2f3a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px !important;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 1rem;
}

nav a:hover {
    color: var(--accent);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem;
}

.form label {
    display: block;
    margin-bottom: 0.75rem;
}

.form input[type=text],
.form input[type=username],
.form input[type=password],
.form input[type=number],
.form input[type=file],
.form select {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0.25rem;
    background: #1f252e;
    color: #e6e8ec;
    border: 1px solid #3a424f;
    border-radius: 8px;
    font-size: 1rem;
}

.form input::placeholder {
    color: #8b929e;
}

.form button,
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}

.form button:hover,
.btn:hover {
    filter: brightness(1.1);
}

.btn.small,
button.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    height: 28px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

button.btn {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
}

button.danger,
.danger {
    background: var(--danger);
}

.alert {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert.error {
    background: #3f1a1a;
    color: #fca5a5;
}

.alert.success {
    background: #14301f;
    color: #86efac;
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.meta {
    color: var(--muted);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.mono {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    text-align: left;
    padding: 2rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 500;
}

.gallery-page .container {
    max-width: 1200px;
}

.user-page .container {
    max-width: 1200px;
}

.admin-page .container {
    max-width: 1600px;
}

.table-wrap {
    overflow-x: auto;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pager {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.pager a {
    color: var(--accent);
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tabs a {
    padding: 0.4rem 0.8rem;
    background: var(--bg);
    border-radius: 4px;
    color: var(--muted);
    text-decoration: none;
}

.tabs a.active {
    background: var(--accent);
    color: #fff;
}

.inline {
    display: inline;
}

.badge {
    background: #422006;
    color: #fdba74;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.preview {
    margin: 1rem 0;
    text-align: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.item a {
    color: var(--text);
    text-decoration: none;
    display: block;
}

.item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg);
}

.item .vid,
.item .fileicon {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 4px;
    color: var(--muted);
    font-weight: 600;
}

.item span {
    display: block;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.check {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
}

.check input {
    width: auto !important;
    margin: 0;
}

.user,
a.filename {
    color: #c0cfe2;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--cardborder);
    border-radius: 12px;
    padding: 2rem;
    max-width: 420px;
    margin: 10rem auto;
}

.reg-closed {
    background: #8b5cf6;
    color: #fff;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.album-not-found-card,
.file-not-found-card {
    background: var(--card);
    border: 1px solid var(--cardborder);
    border-radius: 12px;
    padding: 2rem;
    max-width: 420px;
    margin: 20rem auto;
}

.purple-btn {
    width: 100%;
    padding: 0.85rem;
    background: #8b5cf6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

.purple-btn:hover {
    background: #a78bfa;
}

.form input {
    padding-right: 50px;
}

/* Thumbnails */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.thumb-item {
    display: block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, border-color 0.15s;
}

.thumb-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.thumb-item img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
    background: #111;
}

.thumb-item .no-thumb {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    color: var(--muted);
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.thumb-name {
    display: block;
    padding: 0.4rem 0.5rem 0.1rem;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumb-meta {
    display: block;
    padding: 0 0.5rem 0.4rem;
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}

.list-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    background: #111;
    vertical-align: middle;
}

.thumb-cell {
    width: 72px;
    padding: 0.3rem !important;
}

.no-thumb-sm {
    display: inline-block;
    width: 64px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: #111;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
}

.drop-zone {
    border-color: var(--accent);
    background: #0d1526;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: #1f252e;
}

.upload-header {
    margin-bottom: 1rem;
}

.limits-box {
    background: #0d1526;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.purple-btn {
    width: 100%;
    padding: 0.85rem;
    background: #8b5cf6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.filename {
    color: #60a5fa;
}

.plyr--fullscreen .plyr__video-wrapper video,
.plyr:fullscreen video {
    object-fit: contain !important;
    max-height: none !important;
    width: 100% !important;
    height: 100% !important;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #1e2937;
    padding: 2rem;
    border-radius: 12px;
    width: min(90%, 420px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content p {
    color: var(--muted);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal.show {
    display: flex;
}