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

:root {
  /* Surfaces */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-hover: #f3f4f6;

  /* Borders */
  --border: #e5e7eb;
  --border-light: #f0f1f3;

  /* Text */
  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  /* Brand */
  --brand: #b91c1c;
  --brand-light: #fef2f2;
  --brand-hover: #991b1b;

  /* Semantic */
  --green: #059669;
  --green-bg: #ecfdf5;
  --orange: #d97706;
  --orange-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --yellow: #ca8a04;
  --purple: #7c3aed;

  /* Motion */
  --ease: 150ms ease;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════
   Header
   ═══════════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-mark {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 2px;
}

.header-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.header-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════
   Layout
   ═══════════════════════════════════════ */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.tagline {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.tagline-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════
   Mode Tabs
   ═══════════════════════════════════════ */

.mode-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 9px 20px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  background: var(--bg);
  color: var(--text);
}

/* ═══════════════════════════════════════
   Input Card
   ═══════════════════════════════════════ */

.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.input-card:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.input-card textarea {
  width: 100%;
  min-height: 180px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  padding: 16px 16px 8px;
  resize: vertical;
  outline: none;
}

.input-card textarea::placeholder { color: var(--text-muted); }

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-light);
}

.char-count {
  font-size: 12px;
  color: var(--text-muted);
}

.input-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 8px;
}

.input-hint strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* URL Input */
.url-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.yt-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

#input-url {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

#input-url::placeholder { color: var(--text-muted); }

/* ═══════════════════════════════════════
   Buttons
   ═══════════════════════════════════════ */

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease);
}

.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn-full {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 20px;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════
   Loading
   ═══════════════════════════════════════ */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   Results
   ═══════════════════════════════════════ */

.results {
  margin-top: 28px;
}

/* ═══════════════════════════════════════
   Score Card
   ═══════════════════════════════════════ */

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 24px 14px;
  margin-bottom: 12px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.score-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}

.score-meta-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.score-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-rating {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Rating colors */
.rating-clear .score-value,
.rating-clear .score-rating { color: var(--green); }

.rating-solid .score-value,
.rating-solid .score-rating { color: #0d9488; }

.rating-hazy .score-value,
.rating-hazy .score-rating { color: var(--yellow); }

.rating-dense .score-value,
.rating-dense .score-rating { color: var(--orange); }

.rating-jargon .score-value,
.rating-jargon .score-rating { color: var(--red); }

.rating-nosignal .score-value,
.rating-nosignal .score-rating { color: var(--text-muted); }

/* Gauge */
.gauge {
  position: relative;
  height: 4px;
  margin: 20px 0 6px;
}

.gauge-track {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: linear-gradient(to right, #059669, #0d9488 20%, #ca8a04 45%, #d97706 70%, #dc2626);
  opacity: 0.35;
}

.gauge-marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--text);
  transform: translate(-50%, -50%);
  transition: left 0.4s ease, border-color 0.3s;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════
   Stats
   ═══════════════════════════════════════ */

.stats {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 0;
  margin-bottom: 12px;
}

.stat {
  flex: 1;
  text-align: center;
}

.stat-value {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat-substance { color: var(--green); }
.stat-jargon { color: #475569; }
.stat-filler { color: var(--text-muted); }

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.stat-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   Pad Score (video)
   ═══════════════════════════════════════ */

.pad-score {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.pad-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.pad-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.pad-low { background: var(--green); }
.pad-med { background: var(--yellow); }
.pad-high { background: var(--orange); }
.pad-extreme { background: var(--red); }

.pad-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Duration stat (video) */
.duration-stat {
  text-align: center;
  padding: 10px 14px;
  background: var(--orange-bg);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--orange);
}

/* ═══════════════════════════════════════
   Compression Hero
   ═══════════════════════════════════════ */

.compression-hero {
  display: none;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 24px 20px;
  margin-bottom: 12px;
}

.compression-hero.visible { display: block; }

.compression-number {
  font-family: "IBM Plex Mono", monospace;
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  color: var(--brand);
}

.compression-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.compression-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ═══════════════════════════════════════
   Collapsible Sections
   ═══════════════════════════════════════ */

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background var(--ease);
}

.section-header::-webkit-details-marker { display: none; }
.section-header:hover { background: var(--surface-hover); }

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
  flex: 1;
}

.section-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 8px;
  line-height: 1.4;
}

.section-badge-red {
  color: var(--red);
  background: var(--red-bg);
}

.chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

details[open] > .section-header .chevron {
  transform: rotate(180deg);
}

.section-body {
  padding: 0 16px 16px;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ═══════════════════════════════════════
   Plain English
   ═══════════════════════════════════════ */

.plain-english {
  background: var(--green-bg);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

/* ═══════════════════════════════════════
   List Items
   ═══════════════════════════════════════ */

.list-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.list-item:last-child { border-bottom: none; }

.list-item::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 6px;
}

.list-empty {
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ═══════════════════════════════════════
   Jargon Glossary
   ═══════════════════════════════════════ */

.glossary-row {
  display: grid;
  grid-template-columns: 1fr auto 1.2fr;
  gap: 8px;
  padding: 10px 0;
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border-light);
  align-items: baseline;
}

.glossary-row:last-child { border-bottom: none; }

.jargon-term {
  color: #475569;
  font-weight: 600;
}

.jargon-arrow {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.jargon-meaning {
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   Red Flags
   ═══════════════════════════════════════ */

.flag-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.flag-item:last-child { border-bottom: none; }

.flag-item::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  margin-top: 6px;
}

/* ═══════════════════════════════════════
   Filler
   ═══════════════════════════════════════ */

.filler-item {
  padding: 10px 0;
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.filler-item:last-child { border-bottom: none; }

/* ═══════════════════════════════════════
   Drop Zone (screenshot)
   ═══════════════════════════════════════ */

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  margin: 16px;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-light);
}

.drop-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.drop-zone.drag-over .drop-icon { color: var(--brand); }

.drop-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.drop-browse {
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.drop-browse:hover { color: var(--brand-hover); }

.drop-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.drop-preview {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drop-preview img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* ═══════════════════════════════════════
   Timestamp Map (video)
   ═══════════════════════════════════════ */

.timestamp-map {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ts-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
}

.ts-time {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  flex-shrink: 0;
}

.ts-link {
  color: var(--brand);
  text-decoration: none;
}

.ts-link:hover { text-decoration: underline; }

.ts-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ts-badge-substance { background: var(--green-bg); color: var(--green); }
.ts-badge-filler { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.ts-badge-sponsor { background: #f3e8ff; color: var(--purple); }
.ts-badge-intro { background: var(--orange-bg); color: var(--yellow); }
.ts-badge-recap { background: var(--orange-bg); color: var(--orange); }

.ts-label { color: var(--text-muted); }
.ts-substance .ts-label { color: var(--text); }

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */

@media (max-width: 600px) {
  .container { padding: 20px 16px 60px; }
  .compression-number { font-size: 42px; }
  .score-value { font-size: 28px; }
  .stat-value { font-size: 20px; }
  .stats { padding: 12px 0; }

  .glossary-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .jargon-arrow { display: none; }

  .ts-row { flex-wrap: wrap; gap: 6px; }
  .ts-label { width: 100%; }
}
