:root {
  color-scheme: light;
  --page: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --secondary: #5f5f66;
  --separator: rgba(60, 60, 67, .18);
  --separator-strong: rgba(60, 60, 67, .32);
  --accent: #0066cc;
  --accent-hover: #004f9e;
  --radius-large: 22px;
  --radius-control: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 12px 34px rgba(0, 0, 0, .045);
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; }
body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, select, audio { font: inherit; }
button, select, a { touch-action: manipulation; }
a { color: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: max(10px, env(safe-area-inset-top)) max(24px, calc((100vw - 1060px) / 2), env(safe-area-inset-right)) 10px max(24px, calc((100vw - 1060px) / 2), env(safe-area-inset-left));
  border-bottom: 1px solid var(--separator);
  background: rgba(245, 245, 247, .96);
}
.app-title {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 650;
  text-decoration: none;
}
.meeting-picker { min-width: 0; }
.meeting-picker select {
  width: min(560px, 58vw);
  min-height: 44px;
  padding: 8px 36px 8px 14px;
  overflow: hidden;
  border: 1px solid var(--separator-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, .92);
  color: var(--text);
  font-size: 15px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 58px 24px max(76px, env(safe-area-inset-bottom));
}
.meeting-hero { max-width: 900px; }
.meeting-eyebrow, .section-label, .llm-label {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}
.meeting-hero h1 {
  margin: 10px 0 0;
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.04;
  text-wrap: balance;
}
.meeting-summary {
  max-width: 790px;
  margin: 18px 0 0;
  color: var(--secondary);
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.48;
  text-wrap: pretty;
}
.source-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 550;
  text-decoration: none;
}
.source-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

.analysis-section { margin-top: 50px; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; }
.panel-heading h2 {
  margin: 5px 0 0;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 650;
  line-height: 1.12;
}
.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.episode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
}
.episode-tab {
  display: grid;
  min-width: 0;
  min-height: 82px;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 3px 10px;
  align-content: center;
  padding: 10px 13px;
  border: 1px solid var(--separator);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.episode-tab:hover { border-color: var(--separator-strong); }
.episode-tab.is-selected {
  border-color: rgba(0, 102, 204, .6);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .09);
}
.episode-tab-marker {
  grid-row: 1 / 4;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.episode-tab-title { overflow: hidden; font-size: 14px; font-weight: 650; line-height: 1.22; text-overflow: ellipsis; white-space: nowrap; }
.episode-tab-meta { overflow: hidden; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.episode-tab-time { color: var(--secondary); font-size: 12px; font-variant-numeric: tabular-nums; }

.chart-frame { padding: 0 16px; }
.chart-summary {
  display: grid;
  grid-template-columns: 1.45fr .65fr 1.2fr .7fr;
  margin: 0 -16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--separator);
  background: #fafafa;
}
.chart-summary > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 0 18px;
}
.chart-summary > div:first-child { padding-left: 0; }
.chart-summary > div + div { border-left: 1px solid var(--separator); }
.chart-summary span { color: var(--secondary); font-size: 11px; font-weight: 600; }
.chart-summary strong { overflow: hidden; font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 650; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
#chart-speaker { overflow: visible; text-overflow: clip; white-space: normal; }
.chart-frame svg { display: block; width: 100%; height: auto; min-height: 280px; overflow: visible; }
.chart-grid-line { stroke: #e5e5ea; stroke-width: 1; }
.chart-grid-line.is-baseline { stroke: #7c7c83; stroke-width: 1.4; }
.chart-axis-label, .chart-axis-title, .chart-threshold-label, .chart-peak-label { fill: #6f6f76; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-axis-title { font-weight: 600; }
.chart-line { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3.5; pointer-events: none; }
.chart-line.is-context { opacity: .22; stroke-width: 2.5; }
.chart-line.is-focus { stroke-width: 4; }
.chart-line.is-negative { stroke-dasharray: 8 6; }
.chart-threshold { stroke: #8e5a3c; stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart-threshold-label { fill: #7b4529; font-size: 11px; font-weight: 650; }
.chart-peak-label { fill: var(--accent); font-size: 11px; font-weight: 650; }
.chart-value-marker circle { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.chart-value-marker path { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-width: 2; }
.episode-band { cursor: pointer; outline: none; }
.episode-band rect { fill: rgba(0, 102, 204, .08); stroke: rgba(0, 102, 204, .58); stroke-width: 1.5; stroke-dasharray: 5 4; }
.episode-band:hover rect, .episode-band.is-selected rect { fill: rgba(0, 102, 204, .11); stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: none; }
.episode-band:focus-visible rect { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; }
.chart-caption { margin: 0; padding: 0 12px 17px; color: var(--secondary); font-size: 13px; line-height: 1.45; }

.episode-detail { margin-top: 14px; padding: 24px 26px 26px; }
.insight-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; color: var(--accent); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.episode-detail h3 { max-width: 820px; margin: 8px 0 0; font-size: clamp(24px, 3vw, 32px); font-weight: 650; line-height: 1.2; text-wrap: balance; }
.episode-detail .llm-label { margin-top: 20px; }
.insight-comment { max-width: 850px; margin: 6px 0 0; color: #3e3e43; font-size: 16px; line-height: 1.55; }
.episode-detail audio { display: block; width: min(620px, 100%); min-width: 0; height: 44px; margin-top: 19px; accent-color: var(--accent); }
.clip-error { margin: 8px 0 0; color: #8a2f16; font-size: 13px; }

.transcript-block { margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--separator); }
.transcript-block h4 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.transcript-list { display: grid; gap: 3px; max-height: 290px; overflow-y: auto; overscroll-behavior: contain; }
.transcript-row {
  display: grid;
  min-height: 44px;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.transcript-row:hover { background: #f2f2f6; }
.transcript-row.is-active { background: #e9f3ff; }
.transcript-meta { display: grid; gap: 1px; }
.transcript-time { color: var(--secondary); font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.4; }
.transcript-speaker { color: var(--secondary); font-size: 11px; font-weight: 650; line-height: 1.3; }
.transcript-text { font-size: 14px; line-height: 1.5; }

.page-error { padding: 16px 18px; border: 1px solid #d69682; border-radius: 14px; background: #fff2ee; color: #6d2b18; font-size: 15px; }
.loading-state { display: grid; gap: 14px; padding-top: 22px; }
.loading-state span:not(.sr-only) { display: block; width: 100%; height: 88px; border-radius: var(--radius-large); background: #e5e5ea; }
.loading-state span:first-child { width: 72%; height: 170px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap; }
select:focus-visible, a:focus-visible, audio:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

@media (max-width: 760px) {
  .episode-tabs { grid-template-columns: 1fr; }
  .episode-tab { min-height: 76px; }
}

@media (max-width: 640px) {
  .app-header { align-items: stretch; flex-direction: column; gap: 7px; padding: max(9px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
  .app-title { min-height: 28px; align-content: center; }
  .meeting-picker select { width: 100%; }
  main { padding: 34px 16px 48px; }
  .meeting-hero h1 { font-size: clamp(35px, 10.5vw, 46px); }
  .meeting-summary { margin-top: 16px; font-size: 18px; }
  .analysis-section { margin-top: 38px; }
  .chart-frame { padding-inline: 3px; }
  .chart-summary { grid-template-columns: 1fr 1fr; margin-inline: -3px; padding: 0; }
  .chart-summary > div { min-height: 66px; justify-content: center; padding: 10px 14px; }
  .chart-summary > div:first-child { padding-left: 14px; }
  .chart-summary > div:nth-child(3) { border-left: 0; }
  .chart-summary > div:nth-child(n + 3) { border-top: 1px solid var(--separator); }
  .chart-summary strong { font-size: 14px; }
  .chart-frame svg { min-height: 250px; }
  .chart-caption { padding-inline: 14px; }
  .episode-detail { padding: 20px 18px 22px; }
  .episode-detail h3 { font-size: 25px; }
  .transcript-list { max-height: 340px; }
  .transcript-row { grid-template-columns: 88px minmax(0, 1fr); gap: 9px; padding-inline: 7px; }
}

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