:root {
  --bg: #0D0E10;
  --bg-card: #16171D;
  --accent: #7c5cff;
  --text: #e8e8ee;
  --text-dim: #9a9aa8;
  --border: #2a2c35;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: #0E0E10;
  position: sticky; top: 0; z-index: 10;
  max-width: 1440px;
  margin: 14px auto 0 auto;
  border-radius: 12px;
}

.logo { font-weight: 700; font-size: 20px; color: var(--accent); }
.mainnav { display: flex; gap: 32px; flex: 1; }
.mainnav a { 
  color: var(--text-dim); 
  padding: 6px 2px; 
  border-radius: 0; 
  position: relative; 
  text-decoration: none;
  font-size: 18px;
}

.mainnav a:hover { 
  color: var(--text); 
  background: none; 
}

.mainnav a.active { 
  color: #7C5CFF; 
  background: none; 
}

.mainnav a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px; 
  background-color: #7C5CFF; 
  border-radius: 2px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.badge { background: var(--accent); border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 4px; }
.username { color: var(--text-dim); }

.btn-primary, .btn-outline, .btn-link {
  border: none; cursor: pointer; font-size: 14px; border-radius: 8px; padding: 8px 16px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-link { background: none; color: var(--text-dim); padding: 0; }

.container { max-width: 1440px; margin: 40px auto 0 auto; padding: 24px; }

.filters { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--text-dim); gap: 4px; }
.filters select { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: block; transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card-media { position: relative; aspect-ratio: 16/9; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card:not(.card-youtube) .card-media { cursor: pointer; }
.card-media img, .card-media video, .card-media .yt-preview-iframe { width: 100%; height: 100%; object-fit: cover; }
.card-youtube .yt-preview-iframe { border: 0; pointer-events: none; transition: transform 0.35s ease; transform-origin: center; }
.card-youtube:hover .yt-preview-iframe { transform: scale(1.22); }
.yt-preview-wrap { position: relative; width: 100%; height: 100%; }
.yt-preview-link { position: absolute; inset: 0; z-index: 2; display: block; }
.card-media-link { position: relative; display: block; width: 100%; height: 100%; }
.yt-card-open { position: absolute; left: 50%; bottom: 12px; z-index: 3; transform: translate(-50%, 6px); background: #000b; color: #fff; padding: 6px 10px; border-radius: 999px; font-size: 12px; opacity: 0; transition: opacity .15s ease, transform .15s ease; pointer-events: none; white-space: nowrap; }
.card-youtube:hover .yt-card-open, .card-youtube:focus-within .yt-card-open { opacity: 1; transform: translate(-50%, 0); }
.audio-thumb { font-size: 40px; }
.tag-nsfw { position: absolute; top: 6px; right: 6px; background: #d33; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; z-index: 3; }
.post-card-open { display: block; width: 100%; background: none; border: none; padding: 0; margin: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.card-body { padding: 10px; }
.card-title { margin: 0 0 6px; font-size: 16px; }
.card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-dim); margin: 0 0 4px; }
.card-author { font-size: 14px; color: var(--accent); margin: 0; }
.empty { color: var(--text-dim); grid-column: 1/-1; text-align: center; padding: 40px 0; }

.load-more { text-align: center; margin-top: 24px; }

/* ===== Просмотр поста: попап и отдельная страница ===== */

.post-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.post-overlay[hidden] { display: none; }
.post-overlay-content {
  width: 100%; max-width: 1100px; height: 100%; max-height: 100%;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden;
}

.post-standalone {
  height: calc(100vh - 140px);
  max-width: 1100px; margin: 0 auto;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden;
}

.post-modal-inner {
  position: relative;
  display: flex; flex-direction: row;
  height: 100%; width: 100%;
}

.post-close {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%;
  background: #00000080; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
}
.post-close:hover { background: var(--accent); }

.post-loading {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 15px;
}

.post-media-area {
  flex: 1 1 60%;
  min-width: 0;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.post-media-area img,
.post-media-area video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
}
.post-media-area .audio-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 30px;
}
.post-media-area .audio-icon { font-size: 60px; }
.post-media-area audio { width: 280px; max-width: 100%; }

.post-side {
  flex: 0 0 360px;
  max-width: 360px;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
}
.post-info h1 { margin: 0 0 4px; font-size: 18px; }
.post-author, .post-meta { color: var(--text-dim); font-size: 13px; margin: 2px 0; }
.btn-like { margin-top: 10px; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 20px; padding: 8px 18px; cursor: pointer; align-self: flex-start; }
.btn-like.liked { background: var(--accent); color: #fff; border-color: var(--accent); }

.post-owner-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn-danger { background: transparent; border: 1px solid #d33; color: #ff6b6b; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 14px; }
.btn-danger:hover { background: #d3333322; }

.delete-form { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

.existing-files { display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 14px; color: var(--text-dim); margin-bottom: 4px; }
.file-row { flex-direction: row !important; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.file-row img, .file-row video { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; }
.audio-thumb-small { font-size: 24px; width: 50px; text-align: center; }
.paste-hint { font-size: 13px; color: var(--text-dim); margin: 6px 0 0; }
.paste-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.paste-preview:empty { display: none; }
.paste-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.comments { margin-top: 20px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.comment-form textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px; min-height: 60px; }
.comment { border-top: 1px solid var(--border); padding: 12px 0; }
.comment.reply { margin-left: 24px; border-top: none; padding: 8px 0; }
.comment-author { color: var(--accent); font-size: 13px; margin: 0; }
.comment-text { margin: 4px 0; }

/* Мобильная адаптация: медиа сверху, инфо и комментарии снизу со своим скроллом */

@media (max-width: 760px) {
  .post-overlay { padding: 0; }
  .post-overlay-content, .post-standalone { border-radius: 0; max-width: 100%; height: 100vh; }
  .post-modal-inner { flex-direction: column; }
  .post-media-area { flex: 1 1 50%; max-height: 55vh; }
  .post-side { flex: 1 1 50%; max-width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .post-standalone { height: 100vh; }
}

.form-page { max-width: 500px; margin: 0 auto; }
.form-page.narrow { max-width: 380px; }
.form-page form { display: flex; flex-direction: column; gap: 14px; }
.form-page label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.form-page input[type=text], .form-page input[type=email], .form-page input[type=password], .form-page select, .form-page input[type=file] {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 14px;
}
.form-page .checkbox { flex-direction: row; align-items: center; gap: 8px; }
.error { color: #ff6b6b; }

.btn-twitch {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #7C5CFF; color: #fff; border-radius: 8px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-twitch:hover { background: #7c3ce8; }
.btn-twitch-small { padding: 16px 32px; font-size: 16px; }
.divider { display: flex; align-items: center; text-align: center; color: var(--text-dim); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.divider span { padding: 0 10px; }

.notif-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.notif-item.unread { background: #26283155; }

.footer { text-align: center; color: var(--text-dim); font-size: 13px; padding: 30px 0; }
.footer .made-by {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; color: var(--text-dim); text-decoration: none;
}
.footer .made-by:hover { color: var(--accent); }

/* ===== Стили для интерактивной загрузки файлов и превью ===== */

.file-input-box {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.file-input-box:hover {
  border-color: var(--accent);
}

.drop-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.drop-icon {
  font-size: 28px;
}

.drop-text {
  font-size: 14px;
}

.file-preview-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.file-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  gap: 12px;
  text-align: left;
}

.file-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-thumb-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border-radius: 6px;
  flex-shrink: 0;
}

.file-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 12px;
  color: var(--text-dim);
}

.file-remove-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.file-remove-btn:hover {
  background: #d3333322;
}
/* ===== Кнопка и модалка «Предложить видео» ===== */

.suggest-video-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.btn-suggest-video {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px 32px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.btn-suggest-video:hover { background: #6b4ce8; }

.suggest-video-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.suggest-video-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px;
}
.suggest-video-kicker { font-size: 11px; letter-spacing: 0.1em; color: var(--text-dim); margin: 0 0 4px; text-transform: uppercase; }
.suggest-video-head h2 { margin: 0; font-size: 20px; }
.suggest-video-head .post-close { position: static; }

.suggest-video-body { display: flex; gap: 24px; flex-wrap: wrap; }

.suggest-video-preview {
  flex: 0 0 220px;
  width: 220px; height: 160px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.suggest-video-preview img { width: 100%; height: 100%; object-fit: cover; }
.sv-preview-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 12px;
}

.suggest-video-fields { flex: 1 1 320px; display: flex; flex-direction: column; gap: 16px; }
.suggest-video-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.suggest-video-fields input[type=url],
.suggest-video-fields textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px; font-size: 14px;
}
.suggest-video-fields textarea { min-height: 70px; resize: vertical; }

.sv-field-block { display: flex; flex-direction: column; gap: 8px; }
.sv-category-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.sv-pill {
  background: var(--bg); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 20px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.sv-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.sv-comment-label { display: flex; justify-content: space-between; align-items: baseline; }
.sv-optional { font-size: 11px; }
.sv-counter { font-size: 11px; color: var(--text-dim); }

.sv-error { margin: 0; }
.sv-submit { align-self: flex-start; }
.sv-submit:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 640px) {
  .suggest-video-body { flex-direction: column; }
  .suggest-video-preview { width: 100%; }
}

/* ===== Мобильное нижнее меню ===== */

.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  align-items: flex-end; justify-content: space-between;
}
.mb-item, .mb-item-form {
  flex: 1 1 0;
  min-width: 0;
}
.mb-item, .mb-item-form button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-dim); font-size: 10px;
  background: none; border: none; padding: 4px 2px; cursor: pointer;
  position: relative;
  width: 100%;
}
.mb-item svg { flex-shrink: 0; }
.mb-item span, .mb-item-form span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mb-item.active { color: var(--accent); }
.mb-item-form { margin: 0; }
.mb-item-add { display: flex; justify-content: center; }
.mb-add-circle {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.5);
  margin-top: -22px;
}
.mb-badge {
  position: absolute; top: -2px; right: 8px;
  background: var(--accent); color: #fff; font-size: 10px;
  border-radius: 8px; padding: 1px 5px; line-height: 1.3;
}

@media (max-width: 760px) {
  .mainnav { display: none; }
  .topbar-right .notif-link,
  .topbar-right .username,
  .topbar-right form { display: none; }
  .mobile-bottom-nav { display: flex; }
  body { padding-bottom: 70px; }
}
/* По умолчанию на ПК контейнер скрыт */
.mobile-suggest-container {
  display: none;
}

/* На мобильных устройствах показываем кнопку внизу */
@media (max-width: 760px) {
  .mobile-suggest-container {
    display: block;
    margin: 30px 0 10px 0;
    padding: 0 16px;
  }

  .mobile-suggest-container .btn-suggest-video {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
}
@media (max-width: 760px) {
  .mobile-suggest-container {
    position: fixed;
    bottom: 65px; /* Высота над нижним баром меню */
    left: 0;
    right: 0;
    z-index: 80;
    background: linear-gradient(to top, var(--bg) 70%, transparent); /* Плавный фон, чтобы контент не резко обрезался под кнопкой */
    padding: 10px 16px;
    margin: 0;
  }
}
