:root {
  --bg: #0a0c11;
  --bg-soft: #10131a;
  --panel: #141821;
  --panel-2: #1a1f2b;
  --line: #232a38;
  --line-soft: #1b2130;
  --text: #e9eef8;
  --muted: #8c98ad;
  --accent: #4f8cff;
  --accent-2: #7aa8ff;
  --danger: #ff5a67;
  --ok: #3ecf8e;
  --radius: 14px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(79, 140, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(120, 90, 255, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

img {
  display: block;
  max-width: 100%;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.main {
  flex: 1;
  padding-top: 28px;
  padding-bottom: 72px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 12, 17, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #9b7bff);
  box-shadow: 0 6px 18px rgba(79, 140, 255, 0.35);
}

.brand-mark svg {
  width: 17px;
  height: 17px;
  fill: #fff;
  transform: translateX(1px);
}

.brand-name {
  font-size: 17px;
}

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

.nav-link {
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}

.danger-text:hover {
  color: var(--danger);
}

/* ---------- page head ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.01em;
}

.count {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- grid & cards ---------- */

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

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: var(--radius);
  transition: transform 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2130, #10141d);
  border: 1px solid var(--line);
}

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

.thumb .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.16s ease;
  background: rgba(6, 8, 12, 0.28);
}

.thumb .play svg {
  width: 48px;
  height: 48px;
  fill: rgba(255, 255, 255, 0.94);
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
}

.card:hover .thumb .play,
.thumb.placeholder .play {
  opacity: 1;
}

.thumb.placeholder .play svg {
  width: 40px;
  height: 40px;
  fill: rgba(255, 255, 255, 0.3);
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(6, 8, 12, 0.82);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.badge {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(79, 140, 255, 0.9);
  color: #fff;
  font-size: 11px;
}

.card-body h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- buttons & fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: #222938;
  border-color: #2f3849;
}

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

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #6f7bff);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(79, 140, 255, 0.28);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--accent-2), #8286ff);
}

.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--panel);
}

.btn.danger {
  color: var(--danger);
  border-color: rgba(255, 90, 103, 0.3);
  background: rgba(255, 90, 103, 0.08);
}

.btn.danger:hover {
  background: rgba(255, 90, 103, 0.16);
}

.btn.small {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1219;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 64px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.card-panel {
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), #11151d);
  box-shadow: var(--shadow);
}

/* ---------- player page ---------- */

.player-main {
  max-width: 960px;
}

.back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.back:hover {
  color: var(--text);
}

.player-shell {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-fallback {
  display: none;
}

.player-title {
  margin: 20px 0 6px;
  font-size: 22px;
  line-height: 1.4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 10px;
}

.copy-hint {
  margin: 0;
  color: var(--ok);
  font-size: 13px;
}

.share-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(20, 24, 33, 0.6);
}

.share-label {
  color: var(--muted);
  font-size: 12.5px;
}

.share-box code {
  font-size: 13px;
  color: var(--accent-2);
  word-break: break-all;
}

.description {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.description h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

.description p {
  margin: 0;
  color: #c6cfe0;
  white-space: pre-wrap;
}

/* ---------- auth ---------- */

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.auth-card .sub {
  margin-bottom: 20px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.form-notice,
.form-ok {
  margin: 0;
  color: var(--ok);
  font-size: 13px;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 20px 0 26px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- upload / admin ---------- */

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drop-zone {
  position: relative;
  padding: 26px 18px;
  border: 1.5px dashed #2c3547;
  border-radius: 14px;
  background: rgba(12, 15, 21, 0.6);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.08);
  outline: none;
}

.drop-icon {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
}

.drop-title {
  margin: 0 0 4px;
  font-size: 14.5px;
}

.link-like {
  color: var(--accent-2);
}

.drop-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.progress {
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0e1219;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8a7bff);
  transition: width 0.2s ease;
}

.upload-result {
  padding: 12px 14px;
  border: 1px solid rgba(62, 207, 142, 0.35);
  border-radius: 12px;
  background: rgba(62, 207, 142, 0.08);
  font-size: 13.5px;
  word-break: break-all;
}

.upload-result.error {
  border-color: rgba(255, 90, 103, 0.35);
  background: rgba(255, 90, 103, 0.08);
  color: #ffb3b9;
}

.upload-result code {
  color: var(--accent-2);
}

.section-title {
  margin: 30px 0 14px;
  font-size: 16px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.admin-thumb img,
.mini-placeholder {
  display: block;
  width: 150px;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  object-fit: cover;
  background: linear-gradient(135deg, #1a2130, #10141d);
}

.admin-info h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
}

.id-code {
  font-size: 12px;
  color: var(--muted);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-edit {
  grid-column: 1 / -1;
}

.admin-edit summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.admin-edit[open] summary {
  margin-bottom: 10px;
}

.edit-form {
  max-width: 560px;
}

.admin-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13.5px;
}

.empty {
  padding: 70px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(16, 19, 26, 0.5);
  text-align: center;
}

.empty h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.empty p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .admin-row {
    grid-template-columns: 1fr;
  }

  .admin-thumb img,
  .mini-placeholder {
    width: 100%;
    max-width: 240px;
  }

  .admin-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .main {
    padding-top: 20px;
  }

  .page-head h1 {
    font-size: 20px;
  }

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

  .player-title {
    font-size: 18px;
  }

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

  .card-panel {
    padding: 16px;
  }
}

