:root {
  --td-bg: #07111d;
  --td-panel: #0d1d2f;
  --td-panel-2: #11263d;
  --td-line: rgba(133, 187, 229, .2);
  --td-text: #f5f9fd;
  --td-muted: #a9b8c8;
  --td-cyan: #58deee;
  --td-gold: #ffd36a;
  --td-danger: #ff8e7d;
  --td-shadow: 0 18px 48px rgba(0, 0, 0, .24);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--td-bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--td-text);
  background:
    linear-gradient(rgba(75, 143, 199, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 143, 199, .045) 1px, transparent 1px),
    radial-gradient(circle at 80% 0, rgba(45, 174, 211, .16), transparent 31%),
    var(--td-bg);
  background-size: 24px 24px, 24px 24px, auto, auto;
}
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, video { max-width: 100%; }

.td-video-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 14px 0 96px; }
.td-video-topbar {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.td-video-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.td-video-brand img { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; object-fit: cover; }
.td-video-brand strong, .td-video-brand small { display: block; }
.td-video-brand strong { font-size: 15px; }
.td-video-brand small { margin-top: 2px; color: var(--td-muted); font-size: 10px; }
.td-video-toplinks { display: flex; align-items: center; gap: 8px; }
.td-video-toplinks a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--td-line);
  border-radius: 10px;
  background: rgba(13, 31, 50, .82);
  padding: 0 12px;
  color: #d9e9f6;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.td-library-hero, .td-video-hero, .td-video-panel {
  border: 1px solid var(--td-line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(17, 43, 68, .96), rgba(8, 24, 40, .98));
  box-shadow: var(--td-shadow);
}
.td-library-hero { padding: clamp(24px, 5vw, 54px); }
.td-library-kicker, .td-video-kicker {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--td-cyan), var(--td-gold));
  padding: 0 11px;
  color: #071421;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
}
.td-library-hero h1 { max-width: 820px; margin: 15px 0 10px; font-size: clamp(34px, 7vw, 64px); line-height: 1.05; letter-spacing: -.045em; }
.td-library-hero p { max-width: 760px; margin: 0; color: #c8d5e1; font-size: clamp(14px, 2vw, 17px); line-height: 1.8; }
.td-library-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.td-library-stats span { border: 1px solid var(--td-line); border-radius: 10px; background: rgba(3, 17, 29, .42); padding: 10px 12px; color: var(--td-muted); font-size: 12px; }
.td-library-stats strong { margin-right: 4px; color: var(--td-gold); font-size: 17px; }

.td-library-controls { position: sticky; top: 8px; z-index: 8; margin: 14px 0; border: 1px solid var(--td-line); border-radius: 14px; background: rgba(7, 19, 32, .9); padding: 10px; backdrop-filter: blur(16px); }
.td-library-filters { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.td-library-filters::-webkit-scrollbar { display: none; }
.td-library-filter { flex: 0 0 auto; min-height: 36px; border: 1px solid var(--td-line); border-radius: 9px; background: #0e2136; padding: 0 12px; color: #c5d3e0; cursor: pointer; font-size: 12px; font-weight: 800; }
.td-library-filter.is-active { border-color: transparent; background: var(--td-cyan); color: #061521; }

.td-video-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.td-video-card { min-width: 0; overflow: hidden; border: 1px solid var(--td-line); border-radius: 15px; background: rgba(12, 29, 48, .96); box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.td-video-card[hidden] { display: none; }
.td-video-card__cover { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: #0d1825; }
.td-video-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.td-video-card:hover .td-video-card__cover img { transform: scale(1.025); }
.td-video-card__duration { position: absolute; right: 8px; bottom: 8px; border-radius: 6px; background: rgba(0,0,0,.76); padding: 4px 6px; font-size: 10px; font-weight: 800; }
.td-video-card__body { padding: 13px; }
.td-video-card__meta { display: flex; justify-content: space-between; gap: 8px; color: var(--td-muted); font-size: 10px; }
.td-video-card h2 { margin: 9px 0 7px; font-size: 16px; line-height: 1.42; }
.td-video-card h2 a { text-decoration: none; }
.td-video-card p { display: -webkit-box; margin: 0; overflow: hidden; color: #b5c4d1; font-size: 12px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.td-video-card__open { display: inline-flex; margin-top: 11px; color: var(--td-cyan); font-size: 12px; font-weight: 900; text-decoration: none; }

.td-video-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px); gap: clamp(22px, 5vw, 60px); padding: clamp(20px, 4vw, 42px); }
.td-video-hero__copy { align-self: center; min-width: 0; }
.td-video-hero h1 { margin: 15px 0 12px; font-size: clamp(32px, 5.8vw, 58px); line-height: 1.08; letter-spacing: -.04em; }
.td-video-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; color: var(--td-muted); font-size: 12px; }
.td-video-summary { margin: 18px 0 0; color: #d5e0ea; font-size: 15px; line-height: 1.85; }
.td-video-highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.td-video-highlight { min-width: 0; border: 1px solid var(--td-line); border-radius: 11px; background: rgba(3, 17, 30, .48); padding: 11px; color: #fff0aa; font-size: 13px; font-weight: 850; line-height: 1.4; text-align: center; }
.td-video-player-wrap { width: 100%; max-width: 390px; justify-self: center; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 15px; background: #02060a; box-shadow: 0 18px 45px rgba(0,0,0,.32); }
.td-video-player-wrap video { display: block; width: 100%; aspect-ratio: 9 / 16; background: #000; object-fit: contain; }

.td-video-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.td-video-action {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--td-line);
  border-radius: 11px;
  background: var(--td-panel-2);
  padding: 0 12px;
  color: #e4f1fa;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}
.td-video-action.is-primary { border-color: transparent; background: linear-gradient(90deg, var(--td-cyan), #85e7d0); color: #061520; }

.td-video-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; margin-top: 14px; align-items: start; }
.td-video-panel { padding: clamp(17px, 3vw, 28px); }
.td-video-panel + .td-video-panel { margin-top: 14px; }
.td-video-panel h2 { margin: 0; font-size: 21px; }
.td-video-panel__lead { margin: 7px 0 18px; color: var(--td-muted); font-size: 12px; line-height: 1.65; }
.td-article { color: #d6e0e8; font-size: 15px; line-height: 1.86; }
.td-article h1 { display: none; }
.td-article h2 { scroll-margin-top: 78px; margin: 30px 0 11px; color: #fff; font-size: 21px; }
.td-article h3 { margin: 23px 0 9px; color: #e7f4fb; font-size: 17px; }
.td-article p { margin: 0 0 14px; }
.td-article ul, .td-article ol { margin: 0 0 16px; padding-left: 22px; }
.td-article li { margin: 6px 0; }
.td-article blockquote { margin: 14px 0; border-left: 3px solid var(--td-cyan); background: rgba(47, 151, 184, .09); padding: 11px 13px; color: #c5d8e4; }
.td-article a { color: var(--td-cyan); text-underline-offset: 3px; }
.td-article strong { color: #fff2b4; }

.td-video-side { position: sticky; top: 14px; }
.td-side-links { display: grid; gap: 8px; margin-top: 13px; }
.td-side-links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--td-line); border-radius: 10px; padding: 11px 12px; color: #d6e5f1; font-size: 12px; font-weight: 800; text-decoration: none; }
.td-side-links a span { color: var(--td-muted); font-size: 10px; font-weight: 600; }
.td-correction { border-left: 3px solid var(--td-gold); padding-left: 12px; color: #cfdae3; font-size: 13px; line-height: 1.7; }
.td-correction-list { display: grid; gap: 12px; margin: 0; padding-left: 22px; color: #cfdae3; font-size: 13px; line-height: 1.7; }
.td-correction-list p { margin: 3px 0; }
.td-correction-list a { color: var(--td-cyan); }
.td-transcript { color: #ccd8e1; font-size: 14px; line-height: 1.8; white-space: pre-line; }
details.td-video-panel summary { cursor: pointer; color: #f3f8fb; font-size: 18px; font-weight: 850; }
details.td-video-panel[open] summary { margin-bottom: 15px; }

.td-related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.td-related a { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: center; border: 1px solid var(--td-line); border-radius: 11px; background: rgba(6,20,34,.46); padding: 8px; text-decoration: none; }
.td-related img { width: 72px; aspect-ratio: 3 / 4; border-radius: 7px; object-fit: cover; }
.td-related strong { font-size: 12px; line-height: 1.45; }
.td-related small { display: block; margin-top: 5px; color: var(--td-muted); font-size: 10px; }

.td-share-fab { position: fixed; z-index: 20; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); min-height: 48px; border: 0; border-radius: 999px; background: linear-gradient(90deg, var(--td-cyan), var(--td-gold)); padding: 0 18px; color: #06131e; box-shadow: 0 12px 34px rgba(0,0,0,.38); cursor: pointer; font-size: 13px; font-weight: 900; }
.td-share-sheet[hidden] { display: none; }
.td-share-sheet { position: fixed; z-index: 50; inset: 0; display: grid; align-items: end; }
.td-share-sheet__backdrop { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.68); }
.td-share-sheet__panel { position: relative; width: min(100%, 560px); max-height: 88vh; margin: 0 auto; overflow: auto; border: 1px solid var(--td-line); border-radius: 20px 20px 0 0; background: #0b1b2c; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -20px 60px rgba(0,0,0,.42); }
.td-share-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.td-share-sheet__head h2 { margin: 0; font-size: 20px; }
.td-share-close { width: 34px; height: 34px; border: 1px solid var(--td-line); border-radius: 50%; background: #10243a; color: #fff; cursor: pointer; }
.td-share-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.td-share-options button { min-height: 58px; border: 1px solid var(--td-line); border-radius: 11px; background: #10243a; color: #e9f4fb; cursor: pointer; font-size: 12px; font-weight: 800; }
.td-share-qr { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 14px; border: 1px solid var(--td-line); border-radius: 12px; background: #f8fbfd; padding: 12px; color: #142536; }
.td-share-qr canvas, .td-share-qr img { display: block; width: 132px !important; height: 132px !important; }
.td-share-qr strong, .td-share-qr span { display: block; }
.td-share-qr span { margin-top: 7px; color: #4e6070; font-size: 12px; line-height: 1.6; }
.td-toast { position: fixed; z-index: 80; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(12px); border: 1px solid var(--td-line); border-radius: 999px; background: #10253b; padding: 10px 15px; color: #fff; opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; }
.td-toast.is-visible { transform: translateX(-50%) translateY(0); opacity: 1; }

.td-empty { grid-column: 1 / -1; border: 1px dashed var(--td-line); border-radius: 14px; padding: 32px; color: var(--td-muted); text-align: center; }
.td-video-footer { margin-top: 20px; color: #7f91a3; font-size: 11px; line-height: 1.7; text-align: center; }

@media (max-width: 980px) {
  .td-video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .td-video-layout { grid-template-columns: 1fr; }
  .td-video-side { position: static; }
}
@media (max-width: 760px) {
  .td-video-shell { width: min(100% - 20px, 720px); padding-top: 8px; }
  .td-video-toplinks a:first-child { display: none; }
  .td-video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .td-video-card__body { padding: 11px; }
  .td-video-card h2 { font-size: 14px; }
  .td-video-hero { grid-template-columns: 1fr; }
  .td-video-hero__copy { order: -1; }
  .td-video-player-wrap { max-width: 340px; }
  .td-video-highlights { grid-template-columns: 1fr; }
  .td-video-actions { grid-template-columns: 1fr; }
  .td-related { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .td-library-hero { padding: 22px 18px; }
  .td-video-grid { grid-template-columns: 1fr 1fr; }
  .td-video-card p { display: none; }
  .td-video-card__meta { display: block; }
  .td-video-card__meta span:last-child { display: none; }
  .td-video-hero { padding: 18px 14px; }
  .td-video-hero h1 { font-size: 30px; }
  .td-video-panel { padding: 17px 14px; }
  .td-share-options { grid-template-columns: 1fr; }
  .td-share-qr { grid-template-columns: 110px minmax(0, 1fr); }
  .td-share-qr canvas, .td-share-qr img { width: 110px !important; height: 110px !important; }
}
