:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #151821;
  --panel-strong: #1d2230;
  --text: #f4f2ec;
  --muted: #a7adba;
  --line: #2a3140;
  --accent: #e1b057;
  --accent-strong: #f1c86d;
  --danger: #e05b4f;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    linear-gradient(120deg, rgba(225, 176, 87, 0.08), transparent 32rem),
    radial-gradient(circle at 80% 0%, rgba(70, 111, 126, 0.22), transparent 28rem),
    var(--bg);
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 12, 15, 0.88);
  backdrop-filter: blur(18px);
}

.brand,
.nav,
.inline-form,
.form-actions,
.actions-cell,
.admin-strip {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.7rem;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid rgba(225, 176, 87, 0.56);
  background: rgba(225, 176, 87, 0.12);
  color: var(--accent-strong);
  font-weight: 900;
}

.nav {
  gap: 0.9rem;
  color: var(--muted);
}

.nav a:hover,
.video-title:hover,
.row-title:hover {
  color: var(--accent-strong);
}

.page {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 3rem) 0 4rem;
}

.toolbar,
.watch-meta,
.editor-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.4rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.6rem;
}

.search {
  display: flex;
  gap: 0.6rem;
  min-width: min(100%, 28rem);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 2.8rem;
  padding: 0 0.9rem;
}

textarea {
  padding: 0.8rem 0.9rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(225, 176, 87, 0.15);
}

.button {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  white-space: nowrap;
}

.button-primary {
  border-color: rgba(225, 176, 87, 0.7);
  background: var(--accent);
  color: #14110a;
  font-weight: 800;
}

.button-ghost:hover {
  border-color: var(--accent);
}

.button-danger {
  border-color: rgba(224, 91, 79, 0.6);
  color: #ffd8d4;
}

.full-width {
  width: 100%;
}

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

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 24, 33, 0.82);
  box-shadow: var(--shadow);
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #050608;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

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

.duration {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  padding: 0.2rem 0.42rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 0.78rem;
}

.video-meta {
  padding: 0.9rem;
}

.video-title,
.row-title {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 780;
}

.video-meta p,
.watch-meta p,
td span {
  color: var(--muted);
  line-height: 1.58;
}

.empty-state,
.auth-panel,
.table-shell,
.upload-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 24, 33, 0.84);
  box-shadow: var(--shadow);
}

.empty-state {
  padding: clamp(2rem, 7vw, 5rem);
  text-align: center;
}

.auth-panel {
  width: min(100%, 28rem);
  margin: 8vh auto 0;
  padding: 1.4rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-stack label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}

.upload-form {
  padding: 1.2rem;
}

.alert {
  padding: 0.8rem;
  border: 1px solid rgba(224, 91, 79, 0.45);
  border-radius: 6px;
  color: #ffd8d4;
  background: rgba(224, 91, 79, 0.12);
}

.player {
  width: 100%;
  max-height: 76vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
}

.watch-page {
  display: grid;
  gap: 1.2rem;
}

.facts {
  display: flex;
  gap: 1rem;
  margin: 0;
}

.facts div {
  min-width: 6rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.facts dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.facts dd {
  margin: 0.2rem 0 0;
  font-weight: 800;
}

.admin-strip {
  gap: 0.8rem;
}

.share-input {
  flex: 1;
}

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

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

th,
td {
  padding: 0.95rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.actions-cell {
  gap: 0.5rem;
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .watch-meta,
  .editor-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .nav {
    flex-wrap: wrap;
  }

  .toolbar,
  .watch-meta,
  .editor-shell {
    display: grid;
    align-items: start;
  }

  .search,
  .admin-strip,
  .facts {
    width: 100%;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  td,
  th {
    min-width: 9rem;
  }
}
