:root {
  color-scheme: dark;
  --bg: #081414;
  --panel: #102221;
  --panel-strong: #162c2a;
  --line: rgba(255, 255, 255, 0.11);
  --text: #eef9f5;
  --muted: #95aaa2;
  --accent: #42f0a2;
  --accent-2: #ffd566;
  --danger: #ff8d71;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(10, 42, 34, 0.78), rgba(8, 20, 20, 0.96) 330px),
    #081414;
}

body.is-locked .topbar,
body.is-locked main {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 28%, rgba(66, 240, 162, 0.14), transparent 34%),
    rgba(5, 11, 11, 0.92);
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1818;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 8px;
}

.login-panel label,
.admin-grid label {
  display: grid;
  gap: 8px;
  color: #d6e5df;
  font-size: 13px;
  font-weight: 800;
}

.login-panel input,
.admin-grid input,
.admin-grid select {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #071111;
}

.login-panel input:focus,
.admin-grid input:focus,
.admin-grid select:focus {
  border-color: rgba(66, 240, 162, 0.75);
  box-shadow: 0 0 0 3px rgba(66, 240, 162, 0.13);
}

.login-error,
.admin-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 20, 20, 0.86);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #061111;
  font-weight: 900;
  background: var(--accent);
}

.brand h1,
.brand p,
.search-copy h2,
.search-copy p,
.modal-head h3,
.modal-head p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.modal-actions,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

main {
  width: min(1660px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 460px) 1fr;
  align-items: end;
  gap: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 34, 33, 0.76);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.search-copy h2 {
  margin-top: 10px;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.search-box {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 24px;
}

.search-box input,
.form-grid input,
.form-grid select {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #0b1818;
}

.search-box input {
  padding: 0 18px 0 52px;
}

.search-box input:focus,
.form-grid input:focus,
.form-grid select:focus {
  border-color: rgba(66, 240, 162, 0.75);
  box-shadow: 0 0 0 3px rgba(66, 240, 162, 0.13);
}

.primary-button,
.ghost-button,
.danger-button,
.chip,
.tab,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  border-color: rgba(66, 240, 162, 0.55);
  color: #061111;
  font-weight: 900;
  background: var(--accent);
}

.ghost-button {
  min-height: 44px;
  padding: 0 16px;
}

.danger-button {
  min-height: 44px;
  padding: 0 16px;
  border-color: rgba(255, 141, 113, 0.56);
  color: #ffe5df;
  background: rgba(255, 141, 113, 0.1);
}

.filter-section {
  display: grid;
  gap: 16px;
  margin: 28px 0 20px;
}

.filter-group {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: start;
}

.filter-label {
  padding-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.chip {
  min-height: 38px;
  padding: 0 16px;
  color: #dcebe6;
  background: rgba(255, 255, 255, 0.08);
}

.chip.active {
  border-color: rgba(66, 240, 162, 0.6);
  color: #061111;
  font-weight: 900;
  background: var(--accent);
}

.tag-chips .chip {
  border-color: rgba(255, 213, 102, 0.22);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 16px;
}

.toolbar span {
  margin-left: 10px;
  color: var(--muted);
}

.sort-tabs {
  display: flex;
  gap: 8px;
}

.tab {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
}

.tab.active {
  color: var(--text);
  border-color: rgba(66, 240, 162, 0.45);
}

#soundToggleBtn.active {
  border-color: rgba(66, 240, 162, 0.58);
  color: #061111;
  font-weight: 900;
  background: var(--accent);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.thumb {
  position: relative;
  aspect-ratio: 9 / 12;
  overflow: hidden;
  background: #132220;
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.96) contrast(1.03);
  transition: transform 220ms ease;
}

.thumb video {
  background: #050909;
}

.video-card:hover .thumb img,
.video-card:hover .thumb video {
  transform: scale(1.035);
}

.duration,
.status-pill {
  position: absolute;
  top: 12px;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.56);
}

.duration {
  right: 12px;
}

.status-pill {
  left: 12px;
  color: #061111;
  background: var(--accent-2);
}

.card-body {
  padding: 14px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.card-body h3 {
  min-height: 46px;
  margin: 10px 0 8px;
  font-size: 17px;
  line-height: 1.35;
}

.card-body p {
  min-height: 42px;
  margin: 0 0 12px;
  color: #b5c7c0;
  font-size: 13px;
  line-height: 1.55;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 54px;
  margin-bottom: 14px;
}

.tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: #d9e8e2;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.editable-tag {
  padding-right: 20px;
}

.tag-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 141, 113, 0.7);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  background: #e4463f;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.72);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.editable-tag:hover .tag-remove,
.editable-tag:focus-within .tag-remove {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.tag-add {
  min-width: 34px;
  justify-content: center;
  border-style: dashed;
  border-color: rgba(66, 240, 162, 0.45);
  color: var(--accent);
  font-weight: 900;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.card-actions button {
  min-height: 38px;
}

dialog {
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card,
.detail-card {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1818;
  box-shadow: var(--shadow);
}

.modal-card {
  padding: 22px;
}

.admin-card {
  width: min(860px, calc(100vw - 28px));
}

.password-card {
  width: min(520px, calc(100vw - 28px));
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 150px auto;
  align-items: end;
  gap: 12px;
}

.password-grid {
  display: grid;
  gap: 14px;
}

.password-grid label {
  display: grid;
  gap: 8px;
  color: #d6e5df;
  font-size: 13px;
  font-weight: 800;
}

.password-grid input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #071111;
}

.password-grid input:focus {
  border-color: rgba(66, 240, 162, 0.75);
  box-shadow: 0 0 0 3px rgba(66, 240, 162, 0.13);
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 150px auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.user-identity,
.user-row div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-identity {
  min-width: 0;
}

.user-name-input,
.user-role-select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #071111;
}

.user-name-input {
  width: min(180px, 100%);
  padding: 0 10px;
}

.user-role-select {
  width: 100%;
  padding: 0 10px;
}

.user-name-input:focus,
.user-role-select:focus {
  border-color: rgba(66, 240, 162, 0.75);
  box-shadow: 0 0 0 3px rgba(66, 240, 162, 0.13);
}

.user-row .user-tools {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.user-tools .ghost-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.user-tools .danger-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.user-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.user-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.user-row span,
.user-row small {
  color: var(--muted);
  font-size: 12px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-head h3,
.detail-body h3 {
  margin-top: 6px;
  font-size: 26px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  font-size: 22px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed rgba(66, 240, 162, 0.48);
  border-radius: 8px;
  text-align: center;
  background: rgba(66, 240, 162, 0.06);
}

.dropzone input {
  display: none;
}

.drop-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 8px;
  color: #061111;
  font-size: 28px;
  font-weight: 900;
  background: var(--accent);
}

.dropzone small {
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.file-item {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d6e5df;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size,
.file-status {
  color: var(--muted);
  white-space: nowrap;
}

.progress-group {
  display: grid;
  gap: 7px;
}

.progress-line {
  display: grid;
  grid-template-columns: 68px 1fr 42px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.progress-bar.ai {
  background: var(--accent-2);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
  margin-top: 16px;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.type-selector legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: #d6e5df;
  font-size: 13px;
  font-weight: 800;
}

.type-card {
  position: relative;
  display: flex;
  gap: 10px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.type-card input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.type-card strong {
  display: block;
  margin-bottom: 5px;
}

.type-card small {
  color: var(--muted);
  line-height: 1.45;
}

.type-card:has(input:checked) {
  border-color: rgba(66, 240, 162, 0.72);
  background: rgba(66, 240, 162, 0.1);
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: #d6e5df;
  font-size: 13px;
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.form-grid input,
.form-grid select {
  padding: 0 12px;
}

.ai-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.ai-preview p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pulse {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 8px rgba(255, 213, 102, 0.12);
}

.detail-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  width: min(980px, calc(100vw - 28px));
  overflow: hidden;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.detail-media {
  min-height: 560px;
  background-size: cover;
  background-position: center;
}

.detail-media video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  object-fit: contain;
  background: #050909;
}

.detail-body {
  padding: 34px 28px;
}

.detail-body p {
  color: #bfd0ca;
  line-height: 1.7;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

@media (max-width: 1180px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    width: min(100% - 28px, 760px);
    padding-top: 18px;
  }

  .search-panel,
  .search-row,
  .form-grid,
  .type-selector,
  .admin-grid,
  .user-row,
  .detail-card {
    grid-template-columns: 1fr;
  }

  .filter-group {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-media {
    min-height: 360px;
  }

  .detail-media video {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .top-actions,
  .sort-tabs,
  .card-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .top-actions,
  .sort-tabs {
    display: grid;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .search-copy h2 {
    font-size: 34px;
  }
}
