:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --border: #e4e7ec;
    --border-strong: #d5dae2;
    --text: #1d2530;
    --muted: #6f7683;
    --accent: #2f6fed;
    --accent-dark: #1e56c8;
    --accent-soft: #eaf1fe;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.site-title { font-size: 1.25rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.site-title a { color: inherit; }
.site-tagline { color: var(--muted); font-size: 0.9rem; }

.main-nav { display: flex; gap: 4px; }
.main-nav a {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 999px;
    transition: background .15s, color .15s;
}
.main-nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }

main { padding: 28px 0 8px; }

.hero {
    background: linear-gradient(135deg, var(--accent-soft), var(--card) 55%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 34px 32px;
    margin-bottom: 36px;
}

.hero h2 { margin: 0 0 10px; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.25; }
.hero p { margin: 0 0 8px; max-width: 640px; color: var(--text); }
.hero .hero-meta { color: var(--muted); font-size: 0.9rem; margin: 14px 0 0; }

.section { margin-bottom: 40px; scroll-margin-top: 84px; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.section-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.01em; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 999px;
    padding: 7px 15px;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box svg {
    position: absolute;
    left: 11px;
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
}
.search-box input {
    width: 300px;
    max-width: 100%;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 999px;
    padding: 8px 15px 8px 33px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

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

.card-file {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card-file:hover, .card-file:focus-visible {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    outline: none;
}

.row-top { display: flex; align-items: flex-start; gap: 12px; }

.icon-chip {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.icon-chip svg { width: 20px; height: 20px; }
.icon-video { background: var(--accent-soft); color: var(--accent); }
.icon-audio { background: #f1edff; color: #7c5cfc; }
.icon-doc { background: #e7f6f0; color: #149a6c; }

.titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-title { margin: 0; font-size: 0.97rem; font-weight: 600; line-height: 1.3; word-break: break-word; }
.type-label { font-size: 0.78rem; color: var(--muted); }

.card-meta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }

.badge {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.5;
}
.badge-de { color: var(--accent-dark); background: var(--accent-soft); border-color: #d3e0fb; }
.badge-nl { color: #0f766e; background: #e6faf6; border-color: #c7efe8; }

.fname {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.76rem;
    color: var(--muted);
    word-break: break-all;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.empty, .load-error { color: var(--muted); font-size: 0.95rem; padding: 8px 2px; }

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.media-card {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color .15s, box-shadow .15s;
}
.media-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }

.letter-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.badge-vk { background: #0077ff; }
.badge-rutube { background: #d92d20; }

.media-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.media-title { font-weight: 600; font-size: 0.93rem; color: var(--text); }
.media-sub { font-size: 0.78rem; color: var(--muted); }

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

.card h2 { margin: 0 0 14px; font-size: 1.1rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tr:last-child td { border-bottom: none; }
td.size, td.date { color: var(--muted); white-space: nowrap; }

.path-badge {
    display: inline-block;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    color: var(--accent-dark);
    white-space: nowrap;
}

.note { color: var(--muted); font-size: 0.9rem; }
.breadcrumb { color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--border-strong); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .58);
}
.modal[hidden] { display: none; }

.modal-card {
    background: var(--card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 800px;
    max-height: calc(100vh - 40px);
    overflow: auto;
    box-shadow: var(--shadow);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 0;
}
.modal-head h3 { margin: 0; font-size: 1.08rem; line-height: 1.35; }

.modal-close {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    flex: none;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.modal-close:hover { border-color: var(--border-strong); color: var(--text); }

.modal-body { padding: 14px 20px 20px; }

#media-box video {
    display: block;
    width: 100%;
    max-height: 66vh;
    background: #000;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}
#media-box audio { display: block; width: 100%; margin-bottom: 12px; }

.player-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.player-nav .nav-btn { padding: 7px 14px; font-size: 0.86rem; }
.player-nav .nav-btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }
.player-nav .nav-count { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.embed-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
}
.embed-box iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.modal-meta { margin: 0 0 6px; font-size: 0.86rem; color: var(--muted); word-break: break-word; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 44px;
    padding: 22px 0 34px;
    color: var(--muted);
    font-size: 0.9rem;
}

.error-card { text-align: center; padding: 48px 26px; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--accent); margin: 0; line-height: 1.1; }

@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .media-grid { grid-template-columns: 1fr; }
    .hero { padding: 26px 22px; }
    .hero h2 { font-size: 1.25rem; }
    .search-box input { width: 100%; }
    .toolbar { width: 100%; }
    .chips { width: 100%; }
}
