:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e1e8;
  --primary: #116a7b;
  --primary-dark: #0d4f5c;
  --secondary: #e8eef2;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --accent: #f4a261;
  --shadow: 0 18px 45px rgba(30, 46, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(17, 106, 123, 0.08), transparent 360px),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

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

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(217, 225, 232, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a:hover,
.link-button:hover {
  color: var(--primary);
}

.nav-links form {
  margin: 0;
}

.link-button {
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.section-heading,
.form-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h1,
.form-heading h1,
.video-side h1,
.empty-state h1,
.empty-state h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.section-heading h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.form-heading h1,
.video-side h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(17, 106, 123, 0.22);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  color: var(--text);
  background: var(--secondary);
  border-color: var(--line);
}

.button-danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: #ffd1cc;
}

.button-small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

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

.flash-success {
  border-color: #bfe6d0;
  background: #effaf3;
}

.flash-error {
  border-color: #ffd1cc;
  background: #fff4f2;
}

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

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

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

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

.play-chip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #101820;
  background: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
}

.video-card-body {
  padding: 16px;
}

.video-card h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.28;
}

.video-card p,
.description,
.empty-state p {
  color: var(--muted);
}

.video-card p {
  display: -webkit-box;
  margin: 0 0 14px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 26px;
  align-items: start;
}

.player-panel {
  overflow: hidden;
  background: #0b1117;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.video-side,
.form-shell,
.table-panel,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.video-side {
  padding: 24px;
}

.description {
  margin: 14px 0 22px;
  white-space: pre-wrap;
}

.stats-list {
  display: grid;
  gap: 12px;
  margin: 0 0 22px;
}

.stats-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.stats-list dt {
  color: var(--muted);
}

.stats-list dd {
  margin: 0;
  font-weight: 800;
}

.action-row,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.share-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--primary);
  font-weight: 700;
}

.share-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.share-panel[hidden] {
  display: none;
}

.share-panel-head h2 {
  margin: 0;
  font-size: 1rem;
}

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

.share-option {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.share-option.is-selected {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.share-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.share-copy-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

.admin-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  color: var(--primary);
  font-weight: 700;
}

.form-shell {
  width: min(720px, 100%);
  padding: 24px;
}

.form-shell.narrow {
  width: min(440px, 100%);
}

.stack-form {
  display: grid;
  gap: 18px;
}

.stack-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.stack-form input,
.stack-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
}

.stack-form input:focus,
.stack-form textarea:focus {
  outline: 3px solid rgba(17, 106, 123, 0.18);
  border-color: var(--primary);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  background: var(--surface-soft);
}

tr:last-child td {
  border-bottom: 0;
}

.strong-link {
  font-weight: 800;
}

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

.small {
  font-size: 0.86rem;
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: clamp(24px, 7vw, 56px);
}

.empty-state p {
  margin: 0;
}

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

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .nav-links {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .button {
    width: 100%;
  }

  .row-actions .button,
  .action-row .button {
    width: auto;
  }

  .share-options,
  .share-copy-row {
    grid-template-columns: 1fr;
  }

  .video-side,
  .form-shell {
    padding: 18px;
  }
}
