:root {
  color-scheme: light;
  /* Claude-inspired warm palette: cream canvas, soft amber accents, readable warm greys. */
  --bg: #faf7f2;
  --bg-2: #f5efe6;
  --ink: #2d2a26;
  --ink-soft: #5e554a;
  --muted: #8a7e70;
  --faint: #efe7da;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-input: #ffffff;
  --line: rgba(94, 85, 74, 0.12);
  --line-strong: rgba(94, 85, 74, 0.2);
  --neon-cyan: #d97736;
  --neon-violet: #c2682f;
  --neon-magenta: #b85a28;
  --grad-neon: linear-gradient(120deg, #e88c4a, #d97736 54%, #b85a28);
  --grad-neon-soft: linear-gradient(120deg, rgba(217, 119, 54, 0.12), rgba(194, 104, 47, 0.12) 55%, rgba(184, 90, 40, 0.12));
  --blue: #d97736;
  --green: #4a9b6b;
  --red: #d9534f;
  --radius: 18px;
  --radius-sm: 12px;
  --glow-cyan: 0 0 0 1px rgba(217, 119, 54, 0.25), 0 18px 60px rgba(217, 119, 54, 0.12);
  --shadow: 0 24px 70px rgba(45, 42, 38, 0.1);
  --shadow-lg: 0 30px 90px rgba(45, 42, 38, 0.14);
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC";
  font-family: var(--font-cjk), ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  position: relative;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0.002em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 86% -4%, rgba(217, 119, 54, 0.08), transparent 38%),
    radial-gradient(circle at 4% 0%, rgba(194, 104, 47, 0.06), transparent 36%),
    radial-gradient(circle at 50% 120%, rgba(217, 119, 54, 0.05), transparent 45%),
    linear-gradient(180deg, #faf7f2 0%, #f7f2ea 50%, #f5efe6 100%);
  background-attachment: fixed;
}

/* Optional fallback warm ambience when canvas is disabled. */
body::before {
  content: "";
  position: fixed;
  inset: -25% -15% auto;
  z-index: -2;
  height: 72vh;
  background:
    radial-gradient(circle at 18% 38%, rgba(217, 119, 54, 0.04), transparent 26%),
    radial-gradient(circle at 74% 22%, rgba(194, 104, 47, 0.03), transparent 26%),
    radial-gradient(circle at 48% 70%, rgba(217, 119, 54, 0.04), transparent 30%);
  filter: blur(30px);
  animation: ambientDrift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Faint paper texture */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

body.admin-body {
  background:
    radial-gradient(circle at 86% -4%, rgba(217, 119, 54, 0.06), transparent 38%),
    radial-gradient(circle at 4% 0%, rgba(194, 104, 47, 0.05), transparent 36%),
    linear-gradient(180deg, #faf7f2, #f5efe6);
  background-attachment: fixed;
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body.viewer-open {
  overflow: hidden;
}

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 0;
  height: 3px;
  background: var(--grad-neon);
  box-shadow: 0 0 14px rgba(236, 193, 133, 0.6);
  transition: width 90ms linear;
}

.site-shell {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid transparent;
  background: rgba(250, 247, 242, 0.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  transition: background 240ms ease, border-color 240ms ease;
}

.topbar.is-scrolled {
  background: rgba(250, 247, 242, 0.88);
  border-bottom-color: var(--line);
}

/* Without backdrop blur (old Chrome) the translucent bar is unreadable over
   scrolling content — fall back to a near-solid background. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar {
    background: rgba(250, 247, 242, 0.96);
  }
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 18px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 10px rgba(236, 193, 133, 0.35));
}

.nav-link {
  position: relative;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 600;
  transition: color 180ms ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-neon);
  transition: width 220ms ease;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link:hover::after {
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  align-items: center;
  padding: 64px 0 48px;
  overflow: hidden;
}

/* Cinematic backdrop: drifting warm aurora, a slow light beam, rising embers. */
.hero-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-aurora {
  position: absolute;
  inset: -30% -12% auto;
  height: 150%;
  background:
    radial-gradient(38% 48% at 18% 28%, rgba(224, 164, 94, 0.26), transparent 70%),
    radial-gradient(34% 44% at 82% 18%, rgba(201, 116, 74, 0.2), transparent 70%),
    radial-gradient(46% 56% at 62% 78%, rgba(243, 210, 154, 0.16), transparent 72%);
  filter: blur(46px);
  animation: auroraDrift 17s ease-in-out infinite alternate;
}

.hero-beam {
  position: absolute;
  top: -45%;
  left: -30%;
  width: 46%;
  height: 190%;
  background: linear-gradient(90deg, transparent, rgba(243, 210, 154, 0.12), transparent);
  transform: translateX(-30%) rotate(18deg);
  filter: blur(22px);
  animation: beamSweep 11s ease-in-out infinite;
}

.hero-embers {
  position: absolute;
  inset: 0;
}

.ember {
  position: absolute;
  bottom: -12px;
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 210, 154, 0.95), rgba(224, 164, 94, 0.25) 65%, transparent 75%);
  box-shadow: 0 0 9px rgba(236, 193, 133, 0.6);
  opacity: 0;
  animation: emberRise var(--dur, 9s) linear var(--delay, 0s) infinite;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 48px;
  align-items: center;
}

.hero-copy-block {
  max-width: 760px;
  animation: heroRise 1000ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero h1,
.hero-title {
  position: relative;
  max-width: none;
  margin: 0;
  min-height: 1.22em;
  font-size: 40px;
  font-size: clamp(32px, 5.4vw, 56px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  font-weight: 800;
  text-wrap: balance;
  color: var(--ink);
}

.hero-title-typewriter {
  min-height: 1.22em;
  white-space: nowrap;
}

/* The rotating phrase gets the warm orange gradient. */
.type-rotate {
  background: var(--grad-neon);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.type-caret {
  display: inline-block;
  width: 3px;
  height: 0.96em;
  margin-left: 6px;
  vertical-align: -0.1em;
  border-radius: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(217, 119, 54, 0.45);
  animation: caretBlink 1.05s steps(1) infinite;
}

.hero-copy {
  max-width: 56ch;
  margin: 26px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  font-size: clamp(16.5px, 2vw, 19px);
  line-height: 1.78;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.about-copy {
  max-width: 64ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(16.5px, 2vw, 18px);
  line-height: 1.85;
  font-weight: 400;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--grad-neon-soft);
  color: var(--neon-cyan);
  font-size: 12px;
  font-weight: 680;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  animation: dotPulse 2.4s ease-in-out infinite;
}


.hero-actions,
.form-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.hero-actions {
  margin-top: 36px;
}

.button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 680;
  letter-spacing: 0.01em;
  transition: transform 180ms ease, box-shadow 200ms ease, background 200ms ease, color 180ms ease, border-color 180ms ease;
}

.button {
  position: relative;
  overflow: hidden;
  min-height: 50px;
  padding: 0 28px;
  color: #ffffff;
  font-weight: 720;
  background: var(--grad-neon);
  box-shadow: 0 14px 40px rgba(217, 119, 54, 0.24);
}

.button::after {
  content: "";
  position: absolute;
  inset: -80% auto -80% -45%;
  width: 42%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: buttonSweep 4.4s ease-in-out infinite;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 52px rgba(217, 119, 54, 0.32);
}

.button.secondary {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.button.secondary::after {
  display: none;
}

.button.secondary:hover {
  border-color: rgba(217, 119, 54, 0.45);
  box-shadow: var(--glow-cyan);
}

/* ---------- Library section ---------- */
.section {
  padding: 14px 0 104px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin: 0;
  font-size: 34px;
  font-size: clamp(30px, 5.4vw, 50px);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -0.01em;
}

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

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

/* ---------- Category tabs (horizontal pill row) ---------- */
.category-tabs {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 11px;
  margin: 0 0 34px;
  padding: 3px 2px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  background: var(--grad-neon);
  box-shadow: 0 12px 36px rgba(236, 193, 133, 0.3);
  opacity: 0;
  transition: transform 380ms cubic-bezier(0.16, 1, 0.3, 1), width 380ms cubic-bezier(0.16, 1, 0.3, 1), height 380ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
  pointer-events: none;
}

.category-tab {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  backdrop-filter: blur(16px);
  scroll-snap-align: start;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.category-tab:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: var(--ink);
}

.category-tab span {
  font-size: 15px;
  font-weight: 620;
}

.category-tab small {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 660;
}

.category-tab.active {
  color: #05060a;
  background: transparent;
  border-color: transparent;
}

.category-tab.active span {
  color: #05060a;
}

.category-tab.active small {
  background: rgba(5, 6, 10, 0.18);
  color: #05060a;
}

/* ---------- Video cards ---------- */
.video-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: 0 16px 44px rgba(45, 42, 38, 0.1);
  opacity: 1;
  transition: opacity 520ms ease var(--stagger, 0ms), transform 520ms cubic-bezier(0.16, 1, 0.3, 1) var(--stagger, 0ms), box-shadow 240ms ease;
  transform-style: preserve-3d;
}

/* Hide cards up front only when JS confirmed a working IntersectionObserver
   (html.js-reveal). Without it (very old browsers / scripts failed), cards
   stay visible rather than getting stuck at opacity:0. */
html.js-reveal .video-card {
  opacity: 0;
  transform: translateY(24px) scale(0.985);
}

/* subtle warm border */
.video-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, rgba(217, 119, 54, 0.12), rgba(94, 85, 74, 0.04) 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: background 260ms ease, opacity 260ms ease;
  pointer-events: none;
}

/* pointer-follow glow */
.video-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), rgba(217, 119, 54, 0.1), transparent 60%);
  transition: opacity 240ms ease;
  pointer-events: none;
}

html.js-reveal .video-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.video-card:hover {
  box-shadow: 0 26px 64px rgba(45, 42, 38, 0.14), 0 0 0 1px rgba(217, 119, 54, 0.12);
}

.video-card:hover::before,
.video-card.is-previewing::before {
  background: var(--grad-neon);
  opacity: 0.9;
}

.video-card:hover::after {
  opacity: 1;
}

.video-card.is-previewing {
  box-shadow: 0 26px 68px rgba(217, 119, 54, 0.14);
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(236, 193, 133, 0.12), transparent),
    #14100c;
}

/* Old browsers without aspect-ratio (Chrome < 88): hold the 2:3 poster shape
   with the classic padding-bottom ratio hack. Children fill via top/left/etc. */
@supports not (aspect-ratio: 1 / 1) {
  .thumb {
    height: 0;
    padding-bottom: 150%;
  }
}

.thumb-button {
  cursor: pointer;
  text-align: left;
}

.preview-video,
.preview-poster {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 260ms ease, transform 700ms ease;
}

.preview-video {
  opacity: 0;
  background: #000;
}

.preview-poster {
  opacity: 1;
}

.empty-preview {
  background:
    radial-gradient(circle at 30% 24%, rgba(236, 193, 133, 0.16), transparent 34%),
    linear-gradient(135deg, #14100c, #241c14);
}

.video-card.is-previewing .preview-video {
  opacity: 1;
}

.video-card.is-previewing .preview-poster {
  opacity: 0;
}

.video-card:hover .preview-poster,
.video-card:hover .preview-video {
  transform: scale(1.05);
}

.thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 54%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
  pointer-events: none;
}

.play-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #05060a;
  background: var(--grad-neon);
  box-shadow: 0 8px 26px rgba(236, 193, 133, 0.45);
  transition: transform 220ms ease;
}

.video-card:hover .play-badge {
  transform: scale(1.08);
}

.play-badge::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid currentColor;
}

.card-body {
  position: relative;
  z-index: 4;
  padding: 12px 13px 14px;
}

.card-title {
  display: -webkit-box;
  margin: 0;
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 680;
  letter-spacing: -0.005em;
  color: var(--ink);
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.card-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--neon-cyan);
  background: rgba(236, 193, 133, 0.1);
  border: 1px solid rgba(236, 193, 133, 0.22);
  font-size: 11px;
  font-weight: 640;
  letter-spacing: 0.04em;
}

/* Poster wall keeps cards uniform — description/tags live in the player view. */
.video-card .card-copy,
.video-card .tag-row {
  display: none;
}

.card-copy {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
  word-break: break-word;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.tag {
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}

.empty-state {
  padding: 52px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: var(--surface);
}

/* ---------- Viewer modal ---------- */
.viewer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.viewer[hidden] {
  display: none;
}

.viewer-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.8);
  opacity: 0;
  backdrop-filter: blur(10px);
  transition: opacity 220ms ease;
}

.viewer-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border-radius: 22px;
  background: #080605;
  box-shadow: 0 40px 130px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: scale(0.95) translateY(14px);
  transition: opacity 200ms ease, transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.viewer.active .viewer-backdrop {
  opacity: 1;
}

.viewer.active .viewer-shell {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.viewer-video {
  display: block;
  width: 100%;
  max-height: min(78vh, 780px);
  background: #000;
}

/* Vertical (9:16) clips: shrink the shell so the video isn't lost in side bars. */
.viewer.is-portrait .viewer-shell {
  width: min(440px, 100%);
}

.viewer.is-portrait .viewer-video {
  max-height: min(82vh, 900px);
  object-fit: contain;
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  color: #fff;
  background: rgba(13, 10, 8, 0.96);
  border-top: 1px solid var(--line);
}

.viewer-title {
  font-size: 18px;
  font-weight: 740;
}

.viewer-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.viewer-quality {
  margin: 0;
  justify-content: flex-end;
}

.viewer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  font-size: 24px;
  line-height: 1;
  transition: background 180ms ease, transform 220ms ease;
}

.viewer-close:hover {
  background: rgba(201, 116, 74, 0.4);
  transform: rotate(90deg);
}

/* ---------- Watch page ---------- */
.watch-page {
  padding: 36px 0 100px;
}

.player-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.player-frame::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-neon);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

.video-player {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  max-height: 78vh;
  background: #000;
}

/* Center vertical clips in a portrait-width frame instead of a wide letterbox. */
.watch-page.is-portrait .player-frame {
  max-width: 460px;
  margin-inline: auto;
}

.watch-page.is-portrait .video-player {
  max-height: 82vh;
}

.watch-meta {
  margin-top: 32px;
}

.watch-meta h1 {
  margin: 0;
  font-size: 38px;
  font-size: clamp(30px, 7vw, 58px);
  line-height: 1.12;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.watch-meta p {
  max-width: 72ch;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.74;
  word-break: break-word;
}

.quality-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- Admin ---------- */
.admin-layout {
  min-height: 100vh;
  padding: 20px 0 72px;
}

.admin-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 70px;
  margin: -20px -16px 24px;
  padding: 0 20px;
  background: rgba(250, 247, 242, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

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

.admin-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--faint);
  border-radius: 999px;
}

.admin-tab {
  padding: 9px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease;
}

.admin-tab:hover {
  color: var(--ink);
}

.admin-tab.active {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(45, 42, 38, 0.08);
}

.admin-title h1,
.login-card h1 {
  margin: 0;
  font-size: clamp(26px, 6vw, 38px);
  line-height: 1.1;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.admin-title p {
  margin: 10px 0 0;
  color: var(--muted);
}

.admin-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.admin-panel,
.library-panel,
.login-card,
.settings-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.admin-panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 720;
}

.admin-form {
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.input,
.textarea,
.file,
select.input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-input);
  color: var(--ink);
  outline: none;
  padding: 15px 16px;
  transition: border 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #9b9084;
}

select.input option {
  background: #ffffff;
  color: var(--ink);
}

.input:focus,
.textarea:focus,
.file:focus,
select.input:focus {
  border-color: rgba(217, 119, 54, 0.55);
  box-shadow: 0 0 0 4px rgba(217, 119, 54, 0.12);
  background: var(--surface-input);
}

.textarea {
  min-height: 120px;
  line-height: 1.6;
  resize: vertical;
}

.file {
  padding: 12px;
  color: var(--ink-soft);
}

.file::file-selector-button {
  margin-right: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.file-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* ---------- Settings panel ---------- */
.settings-form {
  padding-bottom: 40px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.settings-group {
  padding: 24px;
}

.settings-head {
  margin: 0 0 20px;
}

.settings-head .eyebrow {
  margin-bottom: 10px;
}

.settings-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 720;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 20px;
}

.icon-upload {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.icon-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg-2);
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.active {
  display: block;
}

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

@media (max-width: 640px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    flex-wrap: wrap;
  }

  .admin-tabs {
    order: 1;
    width: 100%;
  }
}

.progress-panel {
  display: none;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(236, 193, 133, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(236, 193, 133, 0.06);
}

.progress-panel.active {
  display: grid;
}

.progress-line {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--grad-neon);
  box-shadow: 0 0 16px rgba(236, 193, 133, 0.6);
  transition: width 120ms linear;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 14px;
}

.form-actions {
  margin-top: 22px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  color: var(--ink-soft);
  font-weight: 600;
}

.switch input {
  width: 19px;
  height: 19px;
  accent-color: var(--neon-cyan);
}

.library-panel {
  overflow: hidden;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.library-toolbar h2 {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 720;
}

.admin-list {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.admin-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.admin-item:hover {
  border-color: rgba(217, 119, 54, 0.35);
  box-shadow: 0 8px 24px rgba(45, 42, 38, 0.06);
  transform: translateY(-1px);
}

.admin-item img,
.admin-item .no-cover {
  width: 84px;
  height: 126px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--bg-2);
}

.admin-item h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}

.admin-item .muted {
  margin-top: 6px;
  font-size: 13.5px;
}

.admin-item-desc {
  display: -webkit-box;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.admin-actions {
  margin-top: 16px;
}

.mini-button {
  min-height: 38px;
  padding: 0 16px;
  color: var(--neon-cyan);
  background: rgba(217, 119, 54, 0.08);
  border: 1px solid rgba(217, 119, 54, 0.22);
}

.mini-button:hover {
  background: rgba(217, 119, 54, 0.14);
  box-shadow: var(--glow-cyan);
}

.mini-button.danger {
  color: var(--red);
  background: rgba(255, 107, 120, 0.1);
  border-color: rgba(255, 107, 120, 0.28);
}

.mini-button.danger:hover {
  background: rgba(255, 107, 120, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 107, 120, 0.4), 0 14px 40px rgba(255, 107, 120, 0.22);
}

.mini-button.active {
  color: #05060a;
  background: var(--grad-neon);
  border-color: transparent;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.status.success {
  color: var(--green);
}

.status.error {
  color: var(--red);
}

.login-card {
  width: min(440px, calc(100% - 32px));
  margin: 14vh auto;
  padding: 36px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 16px;
  text-align: center;
}

.login-brand img {
  width: 56px;
  height: 56px;
}

.login-brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 720;
}

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

.login-hint {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 14.5px;
  text-align: center;
  line-height: 1.6;
}

/* ---------- Admin enhancements ---------- */
.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(440px, calc(100% - 24px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 17px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(45, 42, 38, 0.16);
  backdrop-filter: blur(16px);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.toast.success::before {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.toast.error::before {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

.dropzone {
  position: relative;
  margin-bottom: 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 180ms ease, background 180ms ease;
  cursor: pointer;
}

.dropzone:hover {
  border-color: rgba(217, 119, 54, 0.45);
}

.dropzone.dragover {
  border-color: var(--neon-cyan);
  background: rgba(217, 119, 54, 0.06);
}

.dz-empty {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 36px 22px;
  text-align: center;
  color: var(--muted);
}

.dz-empty strong {
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 660;
}

.dz-empty span {
  font-size: 13px;
  line-height: 1.5;
  max-width: 38ch;
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-neon-soft);
  color: var(--neon-cyan);
  font-size: 21px;
  border: 1px solid var(--line);
}

.dz-preview {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.dz-video {
  width: 116px;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 11px;
  background: #000;
  flex: 0 0 auto;
}

.dz-file {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dz-file strong {
  font-size: 15px;
  word-break: break-all;
}

.dz-file span {
  color: var(--muted);
  font-size: 13px;
}

.dz-file .mini-button {
  justify-self: start;
  margin-top: 8px;
}

.cover-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  align-items: start;
}

.cover-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 11px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  background: linear-gradient(135deg, #f5efe6, #efe7da);
  border: 1px solid var(--line);
}

.cover-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.cover-fields {
  display: grid;
  gap: 12px;
  align-content: start;
}

.library-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 24px 18px;
}

.library-filters .input {
  padding: 12px 14px;
}

.admin-item {
  position: relative;
}

.admin-item.draggable-on {
  cursor: grab;
}

.admin-item.dragging {
  opacity: 0.5;
}

.admin-item.drop-target {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.admin-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-item-head h3 {
  margin: 0;
}

.vstatus {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.vstatus::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.vstatus.ready {
  color: var(--green);
  border-color: rgba(74, 155, 107, 0.3);
  background: rgba(74, 155, 107, 0.08);
}

.vstatus.ready::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.vstatus.processing {
  color: var(--neon-cyan);
  border-color: rgba(217, 119, 54, 0.3);
  background: rgba(217, 119, 54, 0.08);
}

.vstatus.processing::before {
  background: var(--neon-cyan);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.vstatus.failed {
  color: var(--red);
  border-color: rgba(217, 83, 79, 0.3);
  background: rgba(217, 83, 79, 0.08);
}

.vstatus.failed::before {
  background: var(--red);
}

.vmini-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--faint);
  overflow: hidden;
  margin-top: 12px;
}

.vmini-progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad-neon);
  box-shadow: 0 0 12px rgba(217, 119, 54, 0.35);
  transition: width 300ms ease;
}

.reorder-hint {
  padding: 0 24px 14px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Keyframes ---------- */
@keyframes ambientDrift {
  from {
    transform: translate3d(-2%, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 26px, 0) scale(1.06);
  }
}

@keyframes auroraDrift {
  0% {
    transform: translate3d(-3%, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(3%, 2%, 0) scale(1.1);
  }
}

@keyframes beamSweep {
  0%, 100% {
    transform: translateX(-30%) rotate(18deg);
    opacity: 0.4;
  }
  50% {
    transform: translateX(360%) rotate(18deg);
    opacity: 0.9;
  }
}

@keyframes emberRise {
  0% {
    transform: translate(0, 0) scale(0.7);
    opacity: 0;
  }
  12% {
    opacity: 0.9;
  }
  85% {
    opacity: 0.7;
  }
  100% {
    transform: translate(var(--drift, 0), -82vh) scale(1.15);
    opacity: 0;
  }
}

@keyframes caretBlink {
  0%, 50% {
    opacity: 1;
  }
  50.01%, 100% {
    opacity: 0;
  }
}

@keyframes hueShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.7;
  }
}

@keyframes heroRise {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes buttonSweep {
  0%, 55% {
    left: -45%;
  }
  100% {
    left: 120%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .video-card {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 560px) {
  .site-shell {
    width: min(1200px, calc(100% - 24px));
  }

  .hero {
    padding: 32px 0 28px;
  }

  .hero h1 {
    font-size: clamp(26px, 7.2vw, 36px);
    line-height: 1.22;
    max-width: 100%;
  }

  .hero-copy {
    font-size: 16px;
    line-height: 1.72;
    max-width: 100%;
  }

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

  .topnav {
    gap: 14px;
  }

  .admin-item {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
  }

  .admin-item img,
  .admin-item .no-cover {
    width: 72px;
    height: 108px;
  }

  .cover-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .viewer {
    padding: 0;
  }

  .viewer-shell {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .viewer-video {
    max-height: 82vh;
  }

  .viewer-bar {
    align-items: start;
    flex-direction: column;
  }
}

@media (min-width: 720px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .card-body {
    padding: 14px 15px 16px;
  }

  .card-title {
    font-size: 16.5px;
  }

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

  .field.full,
  .cover-card,
  .progress-panel {
    grid-column: 1 / -1;
  }

  /* Give the cover preview + fields a roomy single row on wider screens. */
  .cover-card {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}

@media (min-width: 1080px) {
  .hero {
    padding: 72px 0 48px;
  }

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

  .admin-dashboard {
    grid-template-columns: minmax(420px, 0.9fr) minmax(0, 1.1fr);
    align-items: start;
  }

  .admin-panel,
  .library-panel {
    position: sticky;
    top: 90px;
  }
}

@media (hover: none) {
  .video-card.is-visible {
    transform: none;
  }

  /* background-attachment: fixed forces costly full-screen repaints on every
     scroll on touch devices (and is flaky on old WebViews) — let it scroll. */
  body,
  body.admin-body {
    background-attachment: scroll;
  }
}


/* ---------- Tech doc (Feishu/Notion-like reader) ---------- */
.works-view[hidden] {
  display: none;
}

.tech-doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding: 8px 0 40px;
}

.tech-doc-toc-wrap {
  position: sticky;
  top: 96px;
}

.tech-doc-toc {
  border-left: 2px solid var(--line);
  padding-left: 16px;
}

.tech-doc-toc-title {
  font-size: 13px;
  font-weight: 660;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.tech-doc-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tech-doc-toc-item a {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 140ms ease;
}

.tech-doc-toc-item a:hover {
  color: var(--neon-cyan);
}

.tech-doc-toc-level-1 a {
  font-weight: 620;
  color: var(--ink);
}

.tech-doc-toc-level-2 a {
  padding-left: 12px;
}

.tech-doc-toc-level-3 a {
  padding-left: 24px;
  font-size: 13px;
}

.tech-doc-article {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 44px 48px 56px;
  box-shadow: var(--shadow);
}

.tech-doc-title {
  font-size: clamp(30px, 4.5vw, 42px);
  font-weight: 760;
  line-height: 1.15;
  margin: 0 0 34px;
  color: var(--ink);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.tech-doc-content > *:first-child {
  margin-top: 0;
}

.tech-doc-h1 {
  font-size: clamp(26px, 3.6vw, 32px);
  font-weight: 740;
  line-height: 1.2;
  margin: 46px 0 18px;
  color: var(--ink);
  scroll-margin-top: 100px;
}

.tech-doc-h2 {
  font-size: clamp(21px, 2.8vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  margin: 36px 0 14px;
  color: var(--ink);
  scroll-margin-top: 100px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tech-doc-h3 {
  font-size: 18px;
  font-weight: 680;
  line-height: 1.3;
  margin: 28px 0 12px;
  color: var(--neon-cyan);
  scroll-margin-top: 100px;
}

.tech-doc-paragraph {
  font-size: 16px;
  line-height: 1.82;
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.tech-doc-quote {
  margin: 24px 0;
  padding: 18px 22px;
  background: rgba(217, 119, 54, 0.08);
  border-left: 4px solid var(--neon-cyan);
  border-radius: 10px;
}

.tech-doc-quote p {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  font-style: italic;
}

.tech-doc-divider {
  border: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 32px 0;
}

.tech-doc-figure {
  margin: 26px 0;
}

.tech-doc-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(45, 42, 38, 0.1);
  cursor: zoom-in;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.tech-doc-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(45, 42, 38, 0.14);
}

.tech-doc-figure figcaption {
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.tech-doc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 10, 0.88);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.tech-doc-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.tech-doc-lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.tech-doc-lightbox-close {
  position: absolute;
  top: 18px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Tech doc editor (admin) ---------- */
.tech-editor {
  max-width: 900px;
  margin: 0 auto;
}

.tech-editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.tech-editor-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 720;
}

.tech-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-editor-actions.bottom {
  margin-top: 22px;
  align-items: center;
}

.tech-doc-title-field {
  margin-bottom: 18px;
}

.tech-block-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.tech-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tech-block-type {
  width: auto;
  min-width: 120px;
  font-size: 14px;
}

.tech-block-actions {
  display: flex;
  gap: 6px;
}

.tech-image-field .tech-image-row {
  display: flex;
  gap: 10px;
}

.tech-image-field .tech-image-row .input {
  flex: 1;
}

.tech-block-thumb {
  display: block;
  margin-top: 12px;
  max-width: 240px;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
}

/* ---------- Responsive tech doc ---------- */
@media (max-width: 900px) {
  .tech-doc-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .tech-doc-toc-wrap {
    position: static;
    order: -1;
  }

  .tech-doc-toc {
    border-left: 0;
    border-bottom: 1px solid var(--line);
    padding-left: 0;
    padding-bottom: 16px;
  }

  .tech-doc-toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 16px;
  }

  .tech-doc-toc-level-2 a,
  .tech-doc-toc-level-3 a {
    padding-left: 0;
  }

  .tech-doc-article {
    padding: 28px 24px 36px;
    border-radius: 14px;
  }
}

@media (max-width: 640px) {
  .tech-editor-head {
    flex-direction: column;
  }

  .tech-editor-actions {
    width: 100%;
  }

  .tech-image-field .tech-image-row {
    flex-direction: column;
  }
}


/* ---------- Rich-text editor (Word-like) ---------- */
.rich-editor-wrap {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.rich-editor-toolbar button {
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 620;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.rich-editor-toolbar button:hover {
  background: var(--surface-solid);
  color: var(--ink);
  border-color: var(--line-strong);
}

.rich-editor-toolbar button:active {
  background: var(--line);
}

.rich-toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
  margin: 0 4px;
}

.rich-editor {
  min-height: 420px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 28px 32px 44px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
  outline: none;
}

.rich-editor:empty::before {
  content: '在此输入内容，像编辑 Word 一样直接排版…';
  color: var(--muted);
  pointer-events: none;
}

.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4,
.rich-editor h5,
.rich-editor h6 {
  color: var(--ink);
  font-weight: 720;
  line-height: 1.25;
  margin: 26px 0 12px;
}

.rich-editor h1 {
  font-size: 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rich-editor h2 {
  font-size: 22px;
}

.rich-editor h3 {
  font-size: 18px;
  color: var(--neon-cyan);
}

.rich-editor p {
  margin: 0 0 14px;
}

.rich-editor ul,
.rich-editor ol {
  margin: 0 0 16px;
  padding-left: 26px;
}

.rich-editor li {
  margin-bottom: 6px;
}

.rich-editor blockquote {
  margin: 16px 0;
  padding: 14px 18px;
  background: rgba(217, 119, 54, 0.08);
  border-left: 4px solid var(--neon-cyan);
  border-radius: 10px;
  color: var(--ink);
}

.rich-editor img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(45, 42, 38, 0.1);
}

.rich-editor hr {
  border: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 22px 0;
}

.rich-editor pre {
  background: var(--bg-2);
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 14px;
}

.rich-editor code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-2);
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 0.92em;
}

@media (max-width: 640px) {
  .rich-editor {
    padding: 20px 18px 32px;
  }

  .rich-editor-toolbar {
    gap: 2px;
    padding: 8px;
  }

  .rich-editor-toolbar button {
    padding: 6px 8px;
    font-size: 13px;
  }

  .rich-toolbar-sep {
    display: none;
  }
}


/* ---------- Admin tech doc split view ---------- */
.tech-editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.tech-editor-pane {
  min-width: 0;
}

.tech-editor-pane-edit {
  position: sticky;
  top: 90px;
}

.tech-editor-pane-preview {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tech-preview-header {
  padding: 12px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 660;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tech-preview-content {
  min-height: 420px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 28px 32px 44px;
}

.tech-preview-content > *:first-child {
  margin-top: 0;
}

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

  .tech-editor-pane-edit {
    position: static;
  }

  .tech-editor-pane-preview {
    order: -1;
  }
}

@media (max-width: 640px) {
  .tech-preview-content {
    padding: 20px 18px 32px;
  }
}


/* ---------- Word-imported content rendering ---------- */
.tech-doc-content,
.tech-preview-content {
  overflow-x: auto;
}

.tech-doc-content table,
.tech-preview-content table,
.rich-editor table {
  max-width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.tech-doc-content td,
.tech-doc-content th,
.tech-preview-content td,
.tech-preview-content th,
.rich-editor td,
.rich-editor th {
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
}

.tech-doc-content img,
.tech-preview-content img,
.rich-editor img {
  max-width: 100%;
  height: auto;
}
