:root {
    --bg: #0c0d10;
    --bg-elevated: #16181d;
    --bg-card: #1c1f26;
    --border: #2a2e37;
    --text: #f2f3f5;
    --text-muted: #9aa0ac;
    --accent: #ff6b6f;
    --accent-hover: #ff8589;
    --accent-contrast: #ffffff;
    --accent-soft-bg: rgba(229, 72, 77, 0.16);
    --accent-soft-bg-hover: rgba(229, 72, 77, 0.26);
    --accent-soft-border: rgba(255, 107, 111, 0.45);
    --danger: #f14668;
    --supporter: #b98cff;
    --radius: 14px;
    --max-width: 1100px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(12, 13, 16, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    gap: 16px;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.brand .accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.nav-link.active {
    background: var(--bg-elevated);
    color: var(--accent);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent);
    object-fit: cover;
    overflow: hidden;
    text-transform: uppercase;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 200px;
    padding: 6px;
    display: none;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.dropdown[open] .dropdown-menu,
.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown summary {
    list-style: none;
    cursor: pointer;
}

.dropdown summary::-webkit-details-marker {
    display: none;
}

.dropdown-menu a, .dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-menu a:hover, .dropdown-menu button:hover {
    background: var(--bg-elevated);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.btn:hover {
    border-color: var(--accent);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-soft-bg);
    border-color: var(--accent-soft-border);
    color: var(--accent);
    backdrop-filter: blur(6px);
}

.btn-primary:hover {
    background: var(--accent-soft-bg-hover);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
    background: transparent;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Layout helpers */
.page {
    flex: 1;
    width: 100%;
}

.page-narrow {
    max-width: 640px;
    margin: 0 auto;
    padding: 40px 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

h1, h2, h3 {
    letter-spacing: -0.3px;
}

.text-muted {
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.badge-supporter {
    color: var(--supporter);
    border-color: var(--supporter);
}

.badge-admin {
    color: var(--accent);
    border-color: var(--accent);
}

.badge-age {
    color: #ffd166;
    border-color: #ffd166;
}

/* Forms */
form .field {
    margin-bottom: 16px;
}

form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form textarea,
form select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form textarea,
form select {
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

form input:focus, form textarea:focus, form select:focus {
    outline: none;
    border-color: var(--accent-soft-border);
    background: var(--accent-soft-bg);
    box-shadow: 0 0 0 4px var(--accent-soft-bg);
}

form input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
}

form input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    filter: invert(1) brightness(1.2);
}

form input[type="date"]::-webkit-calendar-picker-indicator:hover {
    background: var(--accent-soft-bg);
}

form textarea {
    resize: vertical;
    min-height: 90px;
}

/* Dropzone (video upload) */
.dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft-bg);
}

.dropzone.has-file {
    cursor: default;
    padding: 16px;
    text-align: left;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.dropzone-icon {
    font-size: 38px;
    margin-bottom: 8px;
}

.dropzone-text {
    font-weight: 700;
}

.dropzone-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.dropzone-result video {
    width: 100%;
    max-height: 320px;
    border-radius: 10px;
    background: #000;
    display: block;
}

.dropzone-file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
}

.dropzone-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    flex-shrink: 0;
}

.form-errors {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

.upload-progress {
    margin: 4px 0 16px;
}

.upload-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.15s ease;
}

.upload-progress-label {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
}

.flash-success {
    background: rgba(76, 201, 122, 0.15);
    color: #4cc97a;
    border: 1px solid rgba(76, 201, 122, 0.3);
}

.flash-error, .flash-danger {
    background: rgba(241, 70, 104, 0.15);
    color: var(--danger);
    border: 1px solid rgba(241, 70, 104, 0.3);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.footer a {
    color: var(--text-muted);
    text-decoration: underline;
}

.footer a:hover {
    color: var(--text);
}

/* Feed (rolki) */
.feed-list {
    padding: 32px 20px;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.feed-card {
    padding: 0;
    overflow: hidden;
}

.feed-card video {
    width: 100%;
    max-height: 60vh;
    background: #000;
    display: block;
}

.feed-card-body {
    padding: 18px 20px;
}

.vote-pill {
    display: inline-flex;
    align-items: center;
    background: var(--bg-elevated);
    border-radius: 999px;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: none;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-muted);
    line-height: 1;
}

button.vote-btn {
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    border-radius: 999px;
}

button.vote-btn:hover {
    color: var(--text);
}

.vote-btn.voted-up {
    color: var(--accent);
}

.vote-btn.voted-down {
    color: var(--danger);
}

.vote-divider {
    width: 1px;
    height: 14px;
    background: var(--border);
}

.icon-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
}

button.icon-action,
a.icon-action {
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

button.icon-action:hover,
a.icon-action:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.icon-action.accent {
    color: var(--accent);
    font-weight: 700;
}

button.icon-action.accent:hover,
a.icon-action.accent:hover {
    background: var(--accent-soft-bg);
    color: var(--accent-hover);
}

.icon-action svg,
.vote-btn svg {
    flex-shrink: 0;
}

.feed-empty {
    height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

/* Comments drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    display: none;
}

.drawer-backdrop.open {
    display: block;
}

.drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(400px, 100%);
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 91;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.comment {
    margin-bottom: 16px;
}

.comment-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.comment-head time {
    font-weight: 400;
    color: var(--text-muted);
}

.comment p {
    margin: 0;
    font-size: 14px;
    color: #dcdee2;
}

.drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Grid lists (videos, ranking, users) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

[data-controller~="video-ready"] {
    opacity: 0;
    transition: opacity 0.2s ease;
}

[data-controller~="video-ready"].is-ready {
    opacity: 1;
}

.video-tile {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 9 / 16;
    background: #000;
    border: 1px solid var(--border);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.video-tile:hover {
    border-color: var(--accent-soft-border);
    box-shadow: 0 0 0 4px var(--accent-soft-bg);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-tile .tile-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    font-size: 12px;
    font-weight: 700;
}

.ranking-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.ranking-rank {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-muted);
    width: 30px;
    text-align: center;
}

.ranking-row:nth-child(1) .ranking-rank { color: #ffd166; }
.ranking-row:nth-child(2) .ranking-rank { color: #cfd8dc; }
.ranking-row:nth-child(3) .ranking-rank { color: #d7a06a; }

.hero {
    padding: 60px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 40px;
    margin-bottom: 12px;
}

.hero p {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 480px;
    margin: 0 auto 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

@media (max-width: 700px) {
    .nav-links { display: none; }
    .hero h1 { font-size: 28px; }
}
