:root {
  --bg: #111214;
  --surface: #1b1c1f;
  --text: #e8e8ea;
  --muted: #9a9aa2;
  --accent: #ff4d6d;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.4;
}

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

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid #2a2b2f;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

/* Header: logo · Разделы / Видео / Пользователь · search · language (legacy spree navbar) */
.logo { display: flex; flex-direction: column; line-height: 1; }
.logo-word {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.5px;
  color: #e3262e;
}
.logo-tagline { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }

.header-menus { display: flex; gap: 6px; }
.menu { position: relative; }
.menu summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 600;
  user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; font-size: 11px; color: var(--muted); }
.menu[open] summary, .menu summary:hover { background: #26272b; }
.menu-items {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid #2a2b2f;
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.menu-items a, .menu-items .link-button { padding: 7px 10px; border-radius: 6px; text-align: left; }
.menu-items a:hover, .menu-items .link-button:hover { background: #26272b; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.menu-items a:has(> .icon), .menu-items .link-button:has(> .icon) { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.menu-items .inline-form:has(.icon) { display: block; }
.menu-items .link-button:has(> .icon) { width: 100%; color: var(--text); }
.menu-items a > .icon, .menu-items .link-button > .icon { color: var(--muted); transition: color .15s; }
.menu-items a:hover > .icon, .menu-items .link-button:hover > .icon { color: var(--accent); }
.menu-columns { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); min-width: 380px; }
.menu-columns .menu-all { grid-column: 1 / -1; color: var(--accent); }

.search-form { margin-left: auto; flex: 0 1 320px; display: flex; }
.search-form input[type=search] {
  width: 100%;
  background: var(--bg);
  border: 1px solid #333;
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
}
.lang-switch { font-weight: 700; font-size: 13px; color: var(--muted); border: 1px solid #333; border-radius: 6px; padding: 5px 8px; }
.lang-switch:hover { color: var(--text); border-color: var(--muted); }

@media (max-width: 760px) {
  .header-row { gap: 10px; }
  .logo-word { font-size: 28px; }
  .search-form { order: 5; flex: 1 1 100%; margin-left: 0; }
  .menu-columns { grid-template-columns: 1fr; min-width: 220px; }
  .header-menus .menu:last-child .menu-items { left: auto; right: 0; }
}

main.wrap { padding-top: 24px; padding-bottom: 60px; }

.section-title {
  font-size: 20px;
  margin: 32px 0 16px;
}

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

.video-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-card-link { display: block; }

.video-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.video-card:hover .video-card-actions,
.video-card:focus-within .video-card-actions { opacity: 1; }
@media (hover: none) { .video-card-actions { opacity: 1; } }

.video-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--accent);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hover preview clip (static/spree/js/previews.js) — shown once playable. */
.video-thumb .video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

.video-thumb.previewing .video-preview {
  opacity: 1;
}

.video-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #222, #2c2c30);
}

.video-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0,0,0,0.75);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.video-badge {
  position: absolute;
  left: 6px;
  top: 6px;
}

.video-meta { padding: 10px 12px; }

.video-title {
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-stats {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.video-page-title { font-size: 24px; margin: 12px 0; }

/* Legacy spree: a fixed 950x600 box (100% x 250px on phones), the video
   letterboxed inside it whatever its own aspect ratio. */
/* align-self pins it left regardless of .video-player-row's align-items —
   the max-width clamp leaves it narrower than the row on wide screens, so
   without this any align-items other than the default flex-start would
   shove the player itself sideways too, not just its siblings. */
.video-player { width: 100%; max-width: 950px; align-self: flex-start; }
.video-player > img, .video-player > .video-js {
  display: block;
  width: 100%;
  aspect-ratio: 950 / 600;
  border-radius: var(--radius);
  background: #000;
  overflow: hidden;
}
.video-player > img { object-fit: contain; }
.video-player > .video-js { height: auto; font-size: 12px; }
.video-player .vjs-tech { object-fit: contain; }
.video-player .vjs-poster { background-size: contain; }
@media (max-width: 600px) {
  .video-player > img, .video-player > .video-js { aspect-ratio: auto; height: 250px; }
}
/* VAST preroll overlay (js/vast-plugin.js; legacy .vast-btns): the whole
   ad above the control bar is the click-through. */
.vast-overlay { position: absolute; inset: 0 0 3em 0; z-index: 10; cursor: pointer; }
.vast-btns { position: absolute; color: #fff; background: rgba(0, 0, 0, .7); padding: 8px 10px; font-size: 13px; }
.vast-label { top: 0; left: 0; cursor: auto; font-size: 12px; }
.vast-countdown, .vast-skip { bottom: 6px; right: 6px; background: #a02203; border-radius: 4px; }
.vast-skip { cursor: pointer; font-weight: 600; }
/* the ad plays on the <video> directly, so video.js never clears its spinner */
.video-js.vjs-ad-playing .vjs-loading-spinner { display: none; }

.video-note { color: var(--muted); font-size: 13px; max-width: 900px; }

.video-info {
  display: flex;
  gap: 20px;
  color: var(--muted);
  margin: 12px 0;
  font-size: 14px;
}

.video-description { max-width: 900px; white-space: pre-line; }

.video-taxonomy > div { margin: 8px 0; }
.video-taxonomy a { color: var(--accent); }
.video-taxonomy a:not(:last-child)::after { content: ""; }

.category-description { color: var(--muted); max-width: 900px; }

.site-footer {
  border-top: 1px solid #2a2b2f;
  color: var(--muted);
  padding: 20px 0;
  font-size: 13px;
}

.video-grid-placeholder { color: var(--muted); font-size: 13px; }

.inline-form { display: inline; margin: 0; }
.link-button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.link-button:hover { color: var(--text); }

.auth-box {
  max-width: 440px;
  margin: 40px auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
}
.auth-box h1 { font-size: 22px; margin-top: 0; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  background: var(--bg);
  border: 1px solid #333;
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
}
.auth-form button {
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  padding: 11px;
}
.auth-hint, .auth-alt { color: var(--muted); font-size: 13px; margin-top: 16px; }
.auth-alt a { color: var(--accent); }
.auth-ok { color: #7ddc9a; }
.auth-error { color: var(--accent); }

.action-btn {
  background: var(--surface);
  border: 1px solid #333;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  padding: 7px 12px;
}
.action-btn:hover { border-color: #555; }
.action-btn.is-active { border-color: var(--accent); color: var(--accent); }
.action-btn-compact { background: rgba(0,0,0,.7); border: 0; padding: 4px 8px; font-size: 13px; }

/* Player, then one row below it with the action buttons and the vote box
   together (.video-controls) — max-width matches .video-player's, so
   that row never gets wider than the player itself. */
.video-player-row { display: flex; flex-direction: column; align-items: flex-start; max-width: 950px; gap: 10px; }
.video-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; width: 100%; }

.video-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vote-box { display: flex; align-items: center; gap: 8px; }
.vote-rate { font-weight: 600; min-width: 3ch; text-align: center; }
.vote-box .action-btn { filter: grayscale(1); opacity: .6; }
.vote-box .action-btn:hover { filter: none; opacity: 1; }
.vote-box .vote-up.is-voted { filter: none; opacity: 1; border-color: #3fb96a; background: rgba(63, 185, 106, .18); }
.vote-box .vote-down.is-voted { filter: none; opacity: 1; border-color: var(--accent); background: rgba(255, 77, 109, .18); }

.notice { color: #7ddc9a; }
.video-gone { max-width: 700px; margin: 40px 0; }
.video-gone a { color: var(--accent); }

.list-header { display: flex; align-items: baseline; justify-content: space-between; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin: 28px 0; }
.pager a, .pager-current { min-width: 36px; padding: 7px 10px; border-radius: 6px; text-align: center; background: var(--surface); }
.pager a:hover { background: #26272b; }
.pager-current { background: var(--accent); color: #fff; font-weight: 700; }
.pager-gap { color: var(--muted); padding: 0 2px; }
.pager-step { padding: 7px 14px; }
.auth-hint a { color: var(--accent); }
.empty { color: var(--muted); }


.comments { max-width: 900px; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #2a2b2f; }
.comment-avatar {
  flex: 0 0 36px; height: 36px; border-radius: 50%;
  background: #2c2c30; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.comment-date { color: var(--muted); }
.comment-delete { margin-left: auto; }
.comment-text { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.comment-votes { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; align-items: flex-start; }
.comment-form textarea {
  width: 100%; background: var(--bg); border: 1px solid #333; border-radius: var(--radius);
  color: var(--text); padding: 10px 12px; font: inherit; resize: vertical;
}

.muted { color: var(--muted); }
.playlist-create { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.playlist-create input {
  background: var(--bg); border: 1px solid #333; border-radius: var(--radius);
  color: var(--text); padding: 8px 12px; min-width: 220px;
}
.playlist-list { list-style: none; padding: 0; }
.playlist-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid #2a2b2f; }
.playlist-list a { color: var(--accent); }
.playlist-edit { margin: 8px 0 20px; max-width: 480px; }
.playlist-edit summary { cursor: pointer; color: var(--muted); }
.playlist-edit textarea {
  background: var(--bg); border: 1px solid #333; border-radius: var(--radius);
  color: var(--text); padding: 10px 12px; font: inherit;
}
.playlist-remove { margin-top: 6px; font-size: 13px; }
.playlist-save { position: relative; }
.playlist-save summary { list-style: none; display: inline-block; }
.playlist-save summary::-webkit-details-marker { display: none; }
.playlist-save-body:not(:empty) {
  position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; min-width: 280px;
  background: var(--surface); border: 1px solid #2a2b2f; border-radius: var(--radius); padding: 12px;
}
.playlist-widget { display: flex; flex-direction: column; gap: 6px; }
.playlist-toggle {
  background: none; border: 0; color: var(--text); cursor: pointer; font: inherit;
  text-align: left; padding: 4px 0;
}
.playlist-toggle.is-active { color: var(--accent); }

.profile-box { max-width: 520px; }
.auth-form textarea {
  background: var(--bg); border: 1px solid #333; border-radius: var(--radius);
  color: var(--text); padding: 10px 12px; font: inherit; resize: vertical;
}
.profile-links { padding-left: 18px; margin-top: 18px; }
.profile-links a, .playlist-list-link { color: var(--accent); }

.comment-avatar { position: relative; overflow: hidden; }
.comment-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-large { flex-basis: 72px; width: 72px; height: 72px; font-size: 28px; }
.profile-avatar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.avatar-form input[type=file] { color: var(--muted); max-width: 220px; }

.search-meta a, .quick-search a { color: var(--accent); }
.quick-search { color: var(--muted); margin-top: 32px; line-height: 1.8; }

/* Sort/period switch above video lists */
.tabs { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; }
.tabs a { color: var(--muted, #999); text-decoration: none; padding-bottom: 2px; }
.tabs a.active { color: inherit; border-bottom: 2px solid var(--accent); }

/* Category / special-tag tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 28px; }
.tile { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.tile img, .tile-blank { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #222; border-radius: 4px; display: block; }
.tile-name { font-weight: 600; }
.tile-count { font-size: 0.85em; }
.plain-list { list-style: none; padding: 0; line-height: 1.9; }
.tag-cloud { line-height: 1.6; }
.tag-cloud a { color: inherit; margin-right: 8px; }
.static-page { max-width: 720px; line-height: 1.6; }
.more-link { text-align: center; margin: 12px 0 0; }
.more-link a { color: var(--accent); }
.public-profile { display: flex; gap: 20px; align-items: flex-start; }
.public-profile .avatar { border-radius: 50%; }
.profile-about { white-space: pre-line; max-width: 640px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.footer-links a { color: var(--muted); }

/* Advanced search */
.adv-search { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; margin-bottom: 24px; }
.adv-search label { display: flex; flex-direction: column; gap: 4px; }
.adv-search label.check { flex-direction: row; align-items: center; gap: 6px; }
.adv-search .wide { grid-column: 1 / -1; }
.adv-search fieldset { border: 1px solid #333; border-radius: 4px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.save-search { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }

/* Staff job monitoring */
.staff-table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin-bottom: 24px; }
.staff-table th, .staff-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #2a2a30; vertical-align: top; }
.small { font-size: 0.85em; }
.status-ok { color: #4caf50; }
.status-failed { color: var(--accent); }
.status-skipped { color: var(--muted); }
.job-log { white-space: pre-wrap; background: #111; padding: 12px; border-radius: 4px; font-size: 0.85em; overflow-x: auto; }
.job-error { color: #ff8a80; }

.category-description { color: var(--muted); max-width: 900px; margin-bottom: 16px; }
.category-description p { margin: 0 0 8px; }
.category-description b, .category-description strong { color: var(--text); }

/* Admin section */
.staff-nav { display: grid; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid #2a2b2f; padding-bottom: 10px; }
.staff-nav-group { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.staff-nav-label { width: 90px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.staff-nav a { padding: 4px 9px; border-radius: 6px; color: var(--muted); }
.staff-nav a:hover { background: #26272b; color: var(--text); }
.staff-nav a.active { background: var(--accent); color: #fff; }
.staff-flash { background: #1e3a24; color: #9be7a5; padding: 8px 12px; border-radius: 6px; }
.staff-error { background: #3a1e22; color: #ff9aa2; padding: 8px 12px; border-radius: 6px; }
.staff-form { display: grid; gap: 14px; max-width: 980px; }
.staff-form fieldset { border: 1px solid #2a2b2f; border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; }
.staff-form legend { color: var(--muted); padding: 0 6px; }
.staff-form label { display: grid; gap: 4px; }
.staff-form label.check { display: flex; align-items: center; gap: 6px; }
.staff-form input[type=text], .staff-form input[type=number], .staff-form input[type=datetime-local],
.staff-form input[type=search], .staff-form input[type=url], .staff-form textarea, .staff-form select,
.staff-filter input, .staff-filter select {
  background: var(--bg); border: 1px solid #333; border-radius: 6px; color: var(--text); padding: 7px 10px; font: inherit;
}
.staff-form textarea { min-height: 90px; }
.staff-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.staff-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.staff-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.staff-actions form { margin: 0; }
.staff-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.staff-shots label { position: relative; display: block; }
.staff-shots img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; border: 3px solid transparent; }
.staff-shots input:checked + img { border-color: var(--accent); }
.staff-shots input { position: absolute; top: 6px; left: 6px; }
.staff-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 12px; }
.staff-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; display: block; }
.staff-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.staff-stat { background: var(--surface); border-radius: 8px; padding: 14px; display: grid; gap: 4px; }
.staff-stat b { font-size: 26px; }
.staff-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.staff-schedule input[type=text] {
  background: var(--bg); border: 1px solid #333; border-radius: 6px; color: var(--text); padding: 4px 7px; font: inherit; font-family: monospace;
}
label.check.small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.9em; }
.danger-btn { background: #5a1f27 !important; }
