:root {
  --bg: #0b0d14;
  --bg-elevated: #111521;
  --bg-card: #161b29;
  --bg-soft: #1b2234;
  --bg-pill: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #edf2ff;
  --muted: #99a3bf;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --accent-strong: rgba(99, 102, 241, 0.4);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.18);
  --success: #22c55e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --heading-tight: 0.96;
  --body-size: 15px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.18), transparent 28%),
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.1), transparent 22%),
    linear-gradient(180deg, #0b0d14, #0a0c12);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: var(--body-size);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 56px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.header-copy {
  display: grid;
  gap: 8px;
}

.site-header h1,
.panel-intro h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: var(--heading-tight);
  letter-spacing: -0.04em;
}

.header-summary,
.panel-copy,
.section-copy,
.library-count,
.loading-state,
.error-state {
  color: var(--muted);
  line-height: 1.55;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.search-field {
  position: relative;
  min-width: min(360px, 100%);
}

.search-field input {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 16px;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.search-field input::placeholder {
  color: #7c86a0;
}

.search-field input:focus {
  border-color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.header-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-pill {
  min-width: 130px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border-radius: 16px;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.meta-value {
  font-weight: 500;
}

.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 24px;
}

.tab {
  position: relative;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 11px 18px;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.tab::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0), rgba(99, 102, 241, 1), rgba(99, 102, 241, 0));
  opacity: 0;
  transform: scaleX(0.65);
  transition: opacity 180ms ease, transform 180ms ease;
}

.tab.active,
.tab:hover {
  color: var(--text);
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.tab.active {
  font-weight: 500;
}

.tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.main-content {
  position: relative;
}

.tab-panel {
  display: none;
}

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

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.overview-grid,
.stats-grid,
.new-grid,
.brief-grid,
.patterns-grid,
.library-grid,
.narrative-grid {
  display: grid;
  gap: 16px;
}

.overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 30px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.narrative-grid,
.brief-grid,
.patterns-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.new-grid,
.library-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-block {
  margin-bottom: 34px;
}

.card,
.stat-card,
.ad-card,
.pattern-card,
.brief-card,
.narrative-card,
.new-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card,
.narrative-card,
.brief-card,
.pattern-card,
.new-card {
  padding: 20px;
}

.stat-card {
  position: relative;
  min-height: 150px;
  overflow: hidden;
}

.stat-card::before {
  content: attr(data-icon);
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 1.25rem;
  opacity: 0.72;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -36px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28), transparent 66%);
  pointer-events: none;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.04em;
}

.stat-value-small {
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
}

/* Hook breakdown card */
.hook-breakdown-card {
  grid-column: 1 / -1;
}

.hook-breakdown {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hook-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  user-select: none;
}

.hook-row-header:hover .hook-type-name {
  color: var(--accent);
}

.hook-type-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.hook-type-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-left: auto;
}

.hook-expand-icon {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.hook-row.expanded .hook-expand-icon {
  transform: rotate(90deg);
}

.hook-row-detail {
  display: none;
  padding-top: 6px;
}

.hook-row.expanded .hook-row-detail {
  display: block;
}

.hook-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.hook-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 400ms ease;
}

.hook-type-def {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.hook-examples-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 8px 0 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hook-examples-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.hook-examples-list li {
  font-size: 0.82rem;
  color: var(--accent-light, #a5b4fc);
  line-height: 1.45;
  padding-left: 12px;
  position: relative;
}

.hook-examples-list li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.stat-detail,
.card-copy,
.pattern-card p,
.brief-card p,
.new-card p,
.narrative-card p {
  color: var(--muted);
  line-height: 1.6;
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin: 22px 0 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.card-thumb {
  position: relative;
  width: 100%;
  height: 280px;
  background: #080808;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: block;
  object-fit: cover;
}

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255,255,255,0.15);
  background: linear-gradient(135deg, #111, #1a1a2e);
}

.play-overlay-simple {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  pointer-events: none;
  opacity: 0.8;
}

.card-thumb:hover .play-overlay-simple {
  opacity: 1;
  background: rgba(99, 102, 241, 0.8);
}

.load-more-wrap {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px 0;
}

.load-more-btn {
  padding: 12px 32px;
  font-size: 0.9rem;
}

.toggle-filters-btn {
  display: none;
}

.toggle-filters-btn {
  display: block;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.filter-groups {
  display: none;
  width: 100%;
}

.filter-groups.open {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.filter-group {
  display: grid;
  gap: 10px;
  min-width: 220px;
  flex: 1 1 220px;
}

.filter-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.filter-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.filter-count {
  color: #c7cbff;
  font-size: 0.78rem;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  max-height: 140px;
  overflow-y: auto;
  gap: 8px;
}

.filter-pill {
  border: 1px solid var(--border);
  background: var(--bg-pill);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.filter-pill:hover {
  color: var(--text);
  border-color: var(--accent-strong);
}

.filter-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.field span {
  color: var(--muted);
  font-size: 0.8rem;
}

.field select {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 12px 14px;
}

.ghost-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

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

.library-count,
.loading-state,
.error-state {
  margin-bottom: 16px;
}

.library-grid.library-group-root {
  display: block;
}

.library-group-list {
  display: grid;
  gap: 16px;
}

.library-date-group {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.018));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.library-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 180ms ease;
}

.library-group-toggle:hover {
  background: rgba(255, 255, 255, 0.035);
}

.library-group-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.library-group-chevron {
  color: var(--muted);
  font-size: 1rem;
  flex: 0 0 auto;
}

.library-group-title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.library-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-pill);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.library-group-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 260ms ease;
}

.library-group-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 20px 20px;
}

.ad-card {
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.ad-card > .video-shell {
  aspect-ratio: unset;
  height: 360px;
}

.ad-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.46);
}

.ad-card.is-active {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2), var(--shadow);
}

@keyframes card-enter {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.video-shell {
  position: relative;
  background: #080808;
  aspect-ratio: 9 / 16;
  min-height: 200px;
  width: 100%;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
}

.video-shell video {
  z-index: 1;
}

.video-shell video,
.video-shell img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #080808;
}

.play-icon {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  pointer-events: none;
  backdrop-filter: blur(12px);
  transition: opacity 0.2s;
}

.play-overlay,
.duration-badge {
  position: absolute;
  right: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.48);
  color: var(--text);
  padding: 7px 11px;
  pointer-events: none;
  backdrop-filter: blur(12px);
  transition: opacity 0.2s;
}

.play-overlay {
  top: 14px;
}

/* Hide overlays when video has native controls visible */
.video-shell video:not([paused]) ~ .play-icon,
.video-shell video:not([paused]) ~ .play-overlay {
  opacity: 0;
}

.duration-badge {
  bottom: 14px;
}

.card-body {
  padding: 18px;
}

.card-topline,
.modal-topline,
.new-header,
.pattern-header,
.brief-header,
.brief-source {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.brand-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.brand-line h3,
.brand-line h4 {
  font-size: 1.08rem;
  line-height: 1.2;
}

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

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill,
.tag-pill,
.badge-new,
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid transparent;
}

.pill,
.tag-pill {
  background: var(--accent-soft);
  color: #c7cbff;
  border-color: rgba(99, 102, 241, 0.18);
}

.badge-new {
  background: var(--amber-soft);
  color: #ffd486;
  border-color: rgba(245, 158, 11, 0.24);
}

.pill-amber {
  background: var(--amber-soft);
  color: #ffd486;
  border-color: rgba(245, 158, 11, 0.24);
}

.category-pill {
  font-weight: 500;
}

.brand-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #ffd486;
  border-color: rgba(245, 158, 11, 0.2);
  min-width: 48px;
  justify-content: center;
  font-weight: 500;
}

.hook-text {
  font-size: 1.06rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.summary-text {
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.date-badge-inline {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  margin: -4px 0 12px;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.expand-button,
.link-button,
.nav-button,
.accordion-toggle {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.expand-button:hover,
.link-button:hover,
.nav-button:hover,
.accordion-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
}

.new-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)) padding-box,
    linear-gradient(140deg, rgba(245, 158, 11, 0.55), rgba(99, 102, 241, 0.18), rgba(255, 255, 255, 0.02)) border-box;
  border: 1px solid transparent;
}

.new-card .video-shell {
  border-radius: 18px;
  margin: 14px 0 6px;
}

.new-card h4,
.pattern-card h4,
.brief-card h4,
.narrative-card h4 {
  font-size: 1rem;
  line-height: 1.3;
}

.mini-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mini-list-item {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.55;
}

.quote-block {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid rgba(99, 102, 241, 0.55);
  background: rgba(255, 255, 255, 0.03);
  color: #d8def3;
  border-radius: 0 14px 14px 0;
}

.brand-adaptations {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.adaptation-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 10, 0.74);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 220ms ease;
}

.modal-overlay.visible {
  opacity: 1;
}

.modal-card {
  width: min(1240px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  border-radius: 26px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  transform: translateY(14px) scale(0.985);
  transition: transform 220ms ease;
}

.modal-overlay.visible .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 24px;
  padding: 24px;
}

.modal-video {
  position: sticky;
  top: 24px;
  align-self: start;
  border-radius: 22px;
  overflow: hidden;
  background: #080808;
}

.modal-video .video-shell {
  min-height: min(78vh, 760px);
  aspect-ratio: auto;
  height: min(78vh, 760px);
}

.modal-video .video-shell video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #080808;
}

.modal-details {
  max-height: calc(92vh - 48px);
  overflow: auto;
  display: grid;
  gap: 18px;
  padding-right: 6px;
}

.detail-block {
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 18px;
}

.detail-block h5 {
  font-size: 0.84rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.detail-block p,
.detail-block li {
  color: var(--text);
  line-height: 1.6;
}

.detail-block ul {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.detail-accordion {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 18px;
}

.detail-accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.detail-accordion-toggle::-webkit-details-marker {
  display: none;
}

.detail-accordion-toggle h5 {
  font-size: 0.84rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0;
}

.accordion-chevron {
  width: 18px;
  height: 18px;
  position: relative;
  flex-shrink: 0;
  transition: transform 200ms ease;
}

.accordion-chevron::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translate(-50%, -65%) rotate(45deg);
  transition: transform 200ms ease;
}

.detail-accordion[open] .accordion-chevron::before {
  transform: translate(-50%, -35%) rotate(-135deg);
}

.detail-accordion-body {
  padding: 0 18px 16px;
}

.detail-accordion-body p,
.detail-accordion-body li {
  color: var(--text);
  line-height: 1.6;
}

.detail-accordion-body ul {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.transcript-panel[open] .accordion-toggle {
  margin-bottom: 12px;
}

.transcript-panel summary {
  list-style: none;
}

.transcript-panel summary::-webkit-details-marker {
  display: none;
}

.transcript {
  white-space: pre-wrap;
  color: #d7ddf2;
}

.transcript-section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.transcript-section + .transcript-section {
  margin-top: 12px;
}

.transcript-section-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.transcript-section-label {
  font-weight: 700;
  color: #c7cbff;
}

.transcript-timestamp {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.ad-copy-text {
  white-space: pre-wrap;
  color: #d7ddf2;
  line-height: 1.65;
}

.modal-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.modal-links .link-button {
  font-size: 0.82rem;
  padding: 6px 12px;
}

.nav-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.empty-state {
  padding: 34px 28px;
  border: 1px dashed var(--border-strong);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
}

.editor-guide-hero,
.editor-reference-block,
.editor-checklist-block {
  padding: 24px;
}

.editor-guide-hero {
  margin-bottom: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
}

.editor-guide-hero-copy {
  max-width: 880px;
  display: grid;
  gap: 14px;
}

.editor-guide-eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: rgba(99, 102, 241, 0.12);
  color: #cfd4ff;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-guide-hero h3 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.editor-guide-hero p,
.guide-card p,
.study-block p,
.qa-item span,
.guide-callout {
  color: var(--muted);
  line-height: 1.65;
}

.editor-guide-sections {
  display: grid;
  gap: 18px;
}

.guide-section {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.guide-section summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  cursor: pointer;
  user-select: none;
}

.guide-section summary::-webkit-details-marker {
  display: none;
}

.guide-section summary::after {
  content: "+";
  margin-left: auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
}

.guide-section[open] summary::after {
  content: "−";
}

.guide-section-icon {
  font-size: 1.2rem;
}

.guide-section-title {
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.3;
}

.guide-section-content {
  padding: 0 24px 24px;
  display: grid;
  gap: 16px;
}

.guide-lead {
  color: #dce2f7;
  font-weight: 500;
}

.guide-grid-two,
.guide-grid-three,
.reference-grid,
.qa-grid {
  display: grid;
  gap: 16px;
}

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

.guide-grid-three,
.reference-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-card,
.qa-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  padding: 18px;
}

.guide-card h4,
.study-block h4,
.reference-category-header h4,
.qa-card legend {
  font-size: 1rem;
  line-height: 1.3;
}

.guide-card h5 {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.guide-card h4,
.study-block h4 {
  margin-bottom: 12px;
}

.guide-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.6;
}

.guide-list-numbered {
  padding-left: 20px;
}

.guide-callout {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  background: rgba(99, 102, 241, 0.08);
}

.editor-guide-heading {
  margin-bottom: 20px;
}

.editor-reference-block,
.editor-checklist-block {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  box-shadow: var(--shadow);
}

.reference-category + .reference-category {
  margin-top: 26px;
}

.reference-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.reference-card {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.reference-card .video-shell {
  border-radius: 16px 16px 0 0;
}

/* Copy URL button on reference video cards */
.copy-url-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  pointer-events: auto;
  white-space: nowrap;
}

.reference-card .video-shell:hover .copy-url-btn {
  opacity: 1;
}

.copy-url-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

.copy-url-btn.copied {
  background: rgba(22, 163, 74, 0.75);
  border-color: rgba(74, 222, 128, 0.4);
}

.reference-card .card-body {
  display: grid;
  gap: 12px;
}

.study-block {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.study-block p {
  display: block;
}

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

.qa-card {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.qa-card legend {
  padding: 0 8px;
  color: var(--text);
  font-weight: 600;
}

.qa-card-full {
  grid-column: 1 / -1;
}

.qa-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.qa-item input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.qa-item span {
  color: #d6ddf4;
}

@media (max-width: 1100px) {
  .overview-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .narrative-grid,
  .brief-grid,
  .new-grid,
  .patterns-grid,
  .library-grid,
  .library-group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-layout {
    grid-template-columns: 1fr;
  }

  .modal-video {
    position: static;
  }

  .modal-video .video-shell {
    min-height: 0;
    max-height: 72vh;
  }

  .modal-details {
    max-height: none;
    overflow: visible;
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 16px;
  }

  .site-header,
  .panel-intro,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions,
  .header-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .search-field {
    min-width: 100%;
  }

  .overview-grid,
  .stats-grid,
  .narrative-grid,
  .brief-grid,
  .new-grid,
  .patterns-grid,
  .guide-grid-two,
  .guide-grid-three,
  .reference-grid,
  .qa-grid {
    grid-template-columns: 1fr;
  }

  .library-grid,
  .library-group-grid {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
  }

  .library-grid .ad-card,
  .library-group-grid .ad-card {
    width: 100%;
  }

  .library-group-toggle {
    padding: 16px;
  }

  .library-group-grid {
    padding: 0 16px 16px;
  }

  .load-more-wrap {
    width: 100%;
    text-align: center;
  }

  .library-toolbar {
    padding: 14px;
  }

  .filter-group,
  .field {
    min-width: 100%;
  }

  .card-actions,
  .modal-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-card {
    max-height: 94vh;
  }

  .modal-layout {
    padding: 18px;
    gap: 16px;
  }

  .stat-card,
  .narrative-card,
  .brief-card,
  .pattern-card,
  .new-card,
  .card-body,
  .detail-block,
  .editor-guide-hero,
  .editor-reference-block,
  .editor-checklist-block,
  .guide-card,
  .qa-card {
    padding: 16px;
  }

  .guide-section summary,
  .guide-section-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .guide-section-content {
    padding-bottom: 16px;
  }

  .reference-category-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
