:root {
  --premium-navy: #0b234c;
  --premium-navy-deep: #071a38;
  --premium-navy-soft: #183b68;
  --premium-gold: #c29439;
  --premium-gold-deep: #a97920;
  --premium-gold-soft: #fbf4e5;
  --premium-ink: #10223f;
  --premium-muted: #64738a;
  --premium-paper: #fffdf9;
  --premium-surface: #ffffff;
  --premium-surface-blue: #f6f9fd;
  --premium-line: #dce5ef;
  --premium-shadow-sm: 0 6px 18px rgba(8, 30, 63, .055);
  --premium-shadow-md: 0 14px 34px rgba(8, 30, 63, .085);
  --premium-shadow-gold: 0 12px 28px rgba(169, 121, 32, .22);
  --premium-radius-xl: 24px;
  --premium-radius-lg: 19px;
  --premium-radius-md: 14px;
}

html {
  background: var(--premium-paper);
}

body {
  background:
    radial-gradient(circle at 50% -120px, rgba(232, 241, 251, .82), transparent 360px),
    linear-gradient(180deg, #fbfdff 0%, var(--premium-paper) 34%, var(--premium-paper) 100%);
  color: var(--premium-ink);
  letter-spacing: -.006em;
}

.app-shell {
  width: min(100%, 720px);
  background: transparent;
}

/* Brand header */
.app-header {
  min-height: 92px;
  padding: calc(15px + env(safe-area-inset-top)) 20px 15px;
  gap: 16px;
  background: rgba(255, 253, 249, .93);
  border-bottom: 1px solid rgba(220, 229, 239, .78);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .82);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.brand-lockup {
  gap: 14px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
  border-radius: 17px;
  background: linear-gradient(145deg, #123d74 0%, var(--premium-navy) 58%, var(--premium-navy-deep) 100%);
  box-shadow: 0 10px 24px rgba(7, 26, 56, .2), inset 0 1px 0 rgba(255,255,255,.1);
}

.brand-play {
  margin-left: 4px;
  border-top-width: 11px;
  border-bottom-width: 11px;
  border-left-width: 18px;
  border-left-color: #d8a63f;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.12));
}

.brand-lockup h1 {
  font-size: clamp(21px, 5.6vw, 24px);
  line-height: 1.02;
  letter-spacing: -.035em;
  color: var(--premium-navy);
  font-weight: 850;
}

.brand-lockup p {
  max-width: 310px;
  margin-top: 5px;
  color: #65758e;
  font-size: clamp(12px, 3.45vw, 14px);
  line-height: 1.25;
  letter-spacing: -.01em;
}

.header-status.is-online {
  display: none;
}

.header-status.is-offline {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 999px;
  background: #fff1dd;
  color: #8c5f17;
  font-size: 11px;
  font-weight: 800;
}

.header-status.is-offline::before {
  content: "Offline";
}

/* Global spacing and typography */
.main-content {
  padding: 28px 20px calc(108px + env(safe-area-inset-bottom));
}

.page-heading {
  margin-bottom: 22px;
}

.page-heading .eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--premium-gold-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .22em;
}

.page-heading .eyebrow::after {
  content: "";
  width: 64px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--premium-gold), rgba(194,148,57,.22));
}

.page-heading h2 {
  max-width: 620px;
  font-size: clamp(32px, 9.1vw, 42px);
  line-height: .98;
  letter-spacing: -.048em;
  color: var(--premium-navy);
  font-weight: 860;
}

.page-heading > p:last-child {
  max-width: 610px;
  margin-top: 11px;
  color: var(--premium-muted);
  font-size: 16px;
  line-height: 1.42;
}

.compact-heading {
  margin: 24px 0 18px;
}

.compact-heading h2 {
  font-size: clamp(30px, 8vw, 38px);
}

/* Form controls */
.extract-form {
  gap: 12px;
}

.url-row,
.search-field {
  border-color: #d8e2ed;
  background: rgba(255,255,255,.96);
  box-shadow: var(--premium-shadow-sm), inset 0 1px 0 rgba(255,255,255,.9);
}

.url-row {
  min-height: 62px;
  padding: 7px 8px 7px 15px;
  border-radius: 19px;
}

.url-row input {
  font-size: 16px;
}

.youtube-mark {
  width: 25px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #ff2020;
  font-size: 10px;
  line-height: 1;
}

.button {
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, #d0a13b 0%, #bd8620 72%, #aa7414 100%);
  box-shadow: var(--premium-shadow-gold), inset 0 1px 0 rgba(255,255,255,.24);
}

.button-primary:hover {
  box-shadow: 0 15px 30px rgba(169, 121, 32, .27), inset 0 1px 0 rgba(255,255,255,.24);
}

.button-primary:active {
  transform: translateY(1px) scale(.997);
}

.button-ghost {
  color: var(--premium-navy);
  background: #edf4fb;
}

.button-block {
  min-height: 58px;
  border-radius: 18px;
  font-size: 18px;
}

.button-inline {
  min-height: 44px;
  padding-inline: 15px;
}

/* Cards */
.processing-card,
.video-compact,
.library-card,
.knowledge-card,
.quiet-card,
.stage-message,
.overview-summary,
.counter-card,
.intent-card {
  border-color: var(--premium-line);
}

.processing-card {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--premium-radius-xl);
  box-shadow: var(--premium-shadow-md);
}

.video-summary,
.video-compact {
  gap: 14px;
}

.video-thumb {
  border-radius: 15px;
  box-shadow: 0 5px 14px rgba(10, 34, 72, .1);
}

.video-summary .video-thumb {
  width: 118px;
}

.video-compact {
  padding: 14px;
  border-radius: var(--premium-radius-lg);
  box-shadow: var(--premium-shadow-sm);
}

.video-compact .video-thumb {
  width: 104px;
}

.video-title {
  color: var(--premium-navy);
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -.018em;
  font-weight: 850;
}

.video-meta,
.library-meta {
  color: var(--premium-muted);
}

.meta-chip {
  padding: 5px 9px;
  background: #eef5fc;
  color: #3f6387;
}

.quiet-card {
  margin-top: 24px;
  padding: 18px;
  border-radius: var(--premium-radius-lg);
  background: var(--premium-surface-blue);
}

.stage-message {
  padding: 16px;
  border-radius: var(--premium-radius-lg);
}

/* Processing */
.processing-steps {
  margin-top: 18px;
  padding-top: 14px;
}

.processing-step {
  grid-template-columns: 30px 1fr;
  gap: 12px;
  padding: 10px 0;
}

.processing-step:not(:last-child)::after {
  left: 14px;
  top: 40px;
  bottom: -10px;
}

.step-dot {
  width: 30px;
  height: 30px;
  border-width: 2px;
  font-size: 13px;
}

.step-copy strong {
  color: var(--premium-navy);
  font-size: 16px;
  letter-spacing: -.015em;
}

.step-copy small {
  display: block;
  margin-top: 3px;
  color: var(--premium-muted);
  font-size: 13px;
  line-height: 1.4;
}

.processing-step.is-done .step-dot {
  border-color: #3985c4;
  background: #3985c4;
}

.processing-step.is-active .step-dot {
  border-color: var(--premium-gold);
  color: var(--premium-gold-deep);
  box-shadow: 0 0 0 6px rgba(194,148,57,.12);
}

/* Explore */
.intent-tabs {
  gap: 8px;
  padding: 5px;
  border-radius: 16px;
  background: #f2f5f9;
}

.intent-tab {
  min-height: 48px;
  border-radius: 12px;
  color: #465a75;
  font-size: 14px;
}

.intent-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, #cfa13d, #b67d1c);
  box-shadow: 0 7px 16px rgba(169,121,32,.19);
}

.intent-grid {
  gap: 12px;
}

.intent-card {
  min-height: 82px;
  padding: 16px;
  border-radius: var(--premium-radius-lg);
  box-shadow: var(--premium-shadow-sm);
}

.intent-card > span:first-child {
  color: var(--premium-gold-deep);
}

.intent-card strong {
  color: var(--premium-navy);
  font-size: 14px;
}

.overview-summary {
  padding: 20px;
  border-radius: var(--premium-radius-lg);
  background: linear-gradient(135deg, #fff9ed 0%, #fffdf9 56%, #f5f9fd 100%);
  border-color: #eadbb9;
  box-shadow: var(--premium-shadow-sm);
}

.overview-summary strong {
  color: var(--premium-navy);
  font-size: 17px;
}

.overview-summary p {
  margin-top: 7px;
  color: var(--premium-muted);
  font-size: 14px;
}

.theme-chip {
  padding: 7px 10px;
  background: #edf5ff;
  color: #2568a4;
}

.counter-grid.adaptive {
  gap: 10px;
}

.counter-card {
  padding: 14px 8px;
  border-radius: 15px;
  box-shadow: var(--premium-shadow-sm);
}

.counter-card strong {
  color: var(--premium-navy);
  font-size: 22px;
}

.counter-card span {
  margin-top: 4px;
  color: var(--premium-muted);
  font-size: 11px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h3 {
  color: var(--premium-navy);
  font-size: 20px;
  letter-spacing: -.025em;
}

.section-copy {
  min-height: 38px;
  padding: 0 11px;
  border-radius: 11px;
}

.explore-list {
  gap: 11px;
}

.knowledge-card {
  padding: 16px;
  border-radius: var(--premium-radius-lg);
  box-shadow: var(--premium-shadow-sm);
}

.knowledge-copy {
  grid-template-columns: 34px 1fr;
  gap: 12px;
}

.knowledge-index {
  width: 34px;
  height: 34px;
  background: var(--premium-gold-soft);
  color: var(--premium-gold-deep);
  font-size: 13px;
}

.knowledge-copy strong {
  color: var(--premium-navy);
  font-size: 16px;
  line-height: 1.3;
}

.knowledge-copy p {
  margin-top: 6px;
  color: var(--premium-muted);
  font-size: 14px;
  line-height: 1.48;
}

.item-actions {
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf1f5;
}

.item-actions button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  color: #345878;
  background: #f1f5f9;
  font-size: 12px;
}

.item-actions .watch-action {
  color: #805b13;
  background: #fff3d8;
}

/* Library */
.library-search {
  min-height: 54px;
  margin-bottom: 18px;
  border-radius: 17px;
}

.library-list {
  gap: 12px;
}

.library-card {
  padding: 12px;
  border-radius: var(--premium-radius-lg);
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-sm);
}

.library-card .video-thumb {
  width: 112px;
}

.status-badge {
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 850;
}

/* Sheets */
.sheet-backdrop {
  background: rgba(5,18,40,.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sheet-panel {
  border-radius: 28px 28px 0 0;
  background: var(--premium-paper);
  box-shadow: 0 -24px 56px rgba(5,18,40,.24);
}

.sheet-header h2 {
  color: var(--premium-navy);
  font-size: 21px;
}

.sheet-close {
  background: #eef3f8;
}

.player-wrap {
  border-radius: 17px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  z-index: 45;
  left: 50%;
  bottom: 0;
  width: min(100%, 720px);
  transform: translateX(-50%);
  min-height: calc(76px + env(safe-area-inset-bottom));
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(216,226,237,.92);
  background: rgba(255,253,249,.95);
  box-shadow: 0 -10px 28px rgba(11,35,76,.055);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.nav-item {
  min-height: 58px;
  border-radius: 18px;
  gap: 4px;
  color: #607188;
  font-size: 12px;
  font-weight: 760;
}

.nav-item.is-active {
  color: var(--premium-gold-deep);
  background: linear-gradient(180deg, rgba(251,244,229,.92), rgba(250,242,223,.66));
}

.nav-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
}

.nav-svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.is-active .nav-svg {
  stroke-width: 2.1;
}

/* Accessibility and responsive density */
@media (max-width: 380px) {
  .main-content { padding-inline: 16px; }
  .app-header { padding-inline: 16px; }
  .brand-icon { width: 52px; height: 52px; flex-basis: 52px; }
  .brand-lockup { gap: 12px; }
  .brand-lockup h1 { font-size: 20px; }
  .brand-lockup p { font-size: 12px; }
  .page-heading h2 { font-size: 32px; }
  .video-summary .video-thumb { width: 106px; }
}

@media (min-width: 620px) {
  .main-content { padding-inline: 26px; }
  .app-header { padding-inline: 26px; }
  .bottom-nav { padding-inline: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
