:root {
  --bg: #0f0f12;
  --surface: #18181c;
  --surface-2: #212126;
  --surface-3: #2a2a31;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f5f5f7;
  --text-muted: #a9a9b2;
  --accent: #ff3b3b;
  --accent-press: #e22;
  --ok: #22c55e;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --header-h: 60px;
  --sidebar-w: 220px;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

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

.page-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(440px, 96vw);
}

.auth-logo {
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: 0.02em;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  background: rgba(15, 15, 18, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 220px minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 8px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(255, 59, 59, 0.7);
}

.header-search {
  width: 100%;
}

.header-search .input {
  margin: 0;
  height: 40px;
  border-radius: var(--radius-pill);
}

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

.avatar-menu {
  position: relative;
}

.avatar-menu > summary {
  list-style: none;
  cursor: pointer;
}

.avatar-menu > summary::-webkit-details-marker {
  display: none;
}

.avatar-menu__popup {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 2px;
}

.avatar-menu__popup form {
  margin: 0;
}

.avatar-menu__meta {
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.avatar-menu__popup .menu-item {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 500;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.avatar-menu__popup .menu-item:hover {
  background: var(--surface-2);
}

.menu-item--danger {
  color: #ffb6b6;
}

.app-body {
  display: block;
  min-height: calc(100vh - var(--header-h));
}

.app-sidebar {
  display: none;
}

.nav-link,
.nav-action {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: block;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 4px;
}

.nav-link:hover,
.nav-action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.app-content {
  padding: 22px 24px;
}

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

.section-title {
  margin: 0;
  font-size: 26px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: #363641;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--accent {
  background: var(--accent);
}

.btn--accent:hover {
  background: var(--accent-press);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
}

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

.btn--pill {
  border-radius: var(--radius-pill);
}

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

.time-ago {
  cursor: help;
  white-space: nowrap;
}

.ok {
  color: #9be7ac;
}

.err {
  color: #ffb6b6;
}

.input,
.textarea,
.select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px;
  margin-top: 6px;
  margin-bottom: 10px;
  font: inherit;
}

.textarea {
  resize: vertical;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #000;
}

.avatar--lg {
  width: 116px;
  height: 116px;
}

.video-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 18px;
}

.video-card {
  display: block;
  flex: 1 1 420px;
  min-width: 360px;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

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

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

.video-meta {
  padding: 10px;
}

.video-title {
  margin: 0 0 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(640px, 96vw);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 130px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 160px;
  padding: 24px 20px;
  border: 2px dashed rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: rgba(255, 100, 100, 0.55);
  background: rgba(255, 59, 59, 0.08);
  color: var(--text);
}

.file-drop.has-file {
  border-style: solid;
  border-color: rgba(255, 100, 100, 0.45);
  background: rgba(255, 59, 59, 0.06);
}

.file-drop.has-file .file-drop__icon,
.file-drop.has-file .file-drop__title,
.file-drop.has-file .file-drop__hint {
  display: none;
}

.file-drop__icon {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
  color: #ff8a8a;
}

.file-drop__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.file-drop__hint {
  font-size: 13px;
}

.file-drop__name {
  display: none;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-3);
  color: #fff;
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop.has-file .file-drop__name {
  display: block;
}

.file-drop__change {
  display: none;
  font-size: 12px;
  color: var(--text-muted);
}

.file-drop.has-file .file-drop__change {
  display: block;
}

.file-drop--compact {
  min-height: 120px;
  padding: 18px 16px;
}

.file-drop--compact .file-drop__icon {
  width: 28px;
  height: 28px;
}

.file-drop--compact .file-drop__title {
  font-size: 14px;
}

.file-drop--compact .file-drop__hint {
  font-size: 12px;
}

.file-drop.is-uploading {
  opacity: 0.7;
  pointer-events: none;
}

.thumb-preview {
  display: block;
  width: min(100%, 320px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.watch__main video {
  width: 100%;
  max-height: min(68vh, 780px);
}

.watch-title {
  margin: 12px 0 8px;
  line-height: 1.25;
}

.watch-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.watch-meta-row__author {
  flex: 1 1 220px;
  min-width: 0;
}

.watch-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.watch-toolbar__status {
  margin: 0 0 4px;
  font-size: 12px;
  text-align: right;
}

.watch-stats {
  margin: 8px 0 0;
}

.watch-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.watch-tool-btn:hover,
.watch-tool-btn.active {
  background: #3a3a42;
  border-color: rgba(255, 255, 255, 0.16);
}

.watch-tool-btn:focus {
  outline: none;
}

.watch-tool-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.watch-tool-btn__icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.share-menu-wrap {
  position: relative;
}

.share-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: var(--surface-3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.share-menu.open {
  display: block;
}

.share-menu__item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.share-menu__item:hover {
  background: var(--surface-2);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reaction {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-3);
  color: var(--text);
  border-radius: 999px;
  padding: 0 12px;
  height: 36px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.reaction:hover {
  background: #3a3a42;
  border-color: rgba(255, 255, 255, 0.16);
}

.reaction b {
  color: #fff;
  font-weight: 700;
}

.reaction.active {
  background: #4a2228;
  border-color: rgba(255, 100, 100, 0.55);
  box-shadow: none;
}

.watch-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-3);
  color: var(--text-muted);
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover,
.icon-btn.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  background: #3a3a42;
}

.icon-btn.active {
  border-color: rgba(255, 120, 120, 0.55);
  background: #4a2228;
}

.icon-btn:focus {
  outline: none;
}

.icon-btn__icon {
  width: 16px;
  height: 16px;
  display: block;
}

.icon-btn--inline {
  flex-shrink: 0;
  margin-top: 2px;
}

.video-description-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 0;
}

.video-description {
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

.video-editor {
  display: none;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.video-editor.open {
  display: block;
}

.video-editor__title {
  margin: 0 0 12px;
  font-size: 16px;
}

.video-editor__section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.video-editor__subtitle {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-muted);
}

.video-editor__danger {
  margin-top: 16px;
}

.field {
  display: block;
  margin-bottom: 10px;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.watch__side {
  display: grid;
  gap: 10px;
  align-content: start;
}

.suggest {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 10px;
}

.suggest__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
}

.comment {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.comment__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment__head .author-line {
  flex: 1;
  min-width: 0;
}

.comment-delete {
  margin: 0;
  flex-shrink: 0;
}

.comment-delete__btn {
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.comment-delete__icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.comment-delete__btn:hover {
  color: #ffd3d3;
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(255, 80, 80, 0.1);
}

.comment__text {
  margin: 8px 0;
}

.comment__actions {
  margin-top: 6px;
}

.reply-btn {
  border: 1px solid rgba(255, 59, 59, 0.55);
  background: rgba(255, 59, 59, 0.16);
  color: #ffd1d1;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.reply-btn:hover {
  background: rgba(255, 59, 59, 0.28);
}

.reply-form {
  display: none;
  margin-top: 8px;
}

.reply-form.open {
  display: block;
}

.comment-replies {
  margin-top: 10px;
  padding-left: 16px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.avatar-edit {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.avatar-edit .overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  font-size: 12px;
}

.avatar-edit:hover .overlay {
  opacity: 1;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

@media (max-width: 1100px) {
  .watch {
    grid-template-columns: 1fr;
  }

  .watch__side {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 1000px) {
  .app-header {
    grid-template-columns: auto 1fr auto;
  }

  .app-content {
    padding: 16px;
  }
}

@media (max-width: 700px) {
  .app-content {
    padding: 12px;
  }

  .watch-meta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .watch-toolbar {
    justify-content: flex-start;
  }

  .watch-toolbar__status {
    text-align: left;
  }

  .section-title {
    font-size: 22px;
  }

  .header-search {
    display: none;
  }

  .suggest {
    grid-template-columns: 120px 1fr;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .video-card {
    min-width: 100%;
    max-width: 100%;
  }
}
