:root {
  --paper: #f7f3ec;
  --paper-deep: #efe8dc;
  --card: #fffdf9;
  --ink: #211f1b;
  --muted: #6d675d;
  --line: #ded5c7;
  --accent: #d94f2b;
  --accent-dark: #b93d1d;
  --sage: #2f6159;
  --shadow: 0 24px 70px rgba(65, 48, 28, 0.12);
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, select { font: inherit; }

button { cursor: pointer; }

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

:focus-visible {
  outline: 3px solid rgba(217, 79, 43, 0.45);
  outline-offset: 2px;
}

.site-header {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--accent);
  flex: 0 0 auto;
}

.brand-accent { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 26px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--ink); }

.account-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.account-nav a {
  color: var(--muted);
  text-decoration: none;
}

.account-nav a:hover { color: var(--accent); }

.nav-signin {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink) !important;
}

.logout-form { margin: 0; }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.link-button:hover { color: var(--accent); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 64px;
  align-items: center;
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 66px 0 82px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 6.1vw, 84px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero h1 em {
  color: var(--accent);
  font-weight: 400;
}

.lede {
  max-width: 600px;
  margin: 26px 0 30px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.url-form {
  display: flex;
  gap: 10px;
  max-width: 610px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 8px 30px rgba(65, 48, 28, 0.07);
}

.url-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 12px 14px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.url-form input::placeholder { color: #9a9285; }

.url-form input:focus { outline: none; }

.url-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 79, 43, 0.12);
}

.button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover { border-color: var(--ink); }

.button:active { transform: translateY(1px); }

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button.small {
  padding: 8px 12px;
  font-size: 12px;
}

.button.ghost {
  background: transparent;
}

.form-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.hero-preview {
  overflow: hidden;
  border: 1px solid #38342d;
  border-radius: 18px;
  background: #24211c;
  color: #f4eee4;
  box-shadow: var(--shadow);
  transform: rotate(1.2deg);
}

.preview-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  border-bottom: 1px solid #3b362e;
  background: #2d2923;
}

.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5f584d;
}

.preview-dot:first-child { background: var(--accent); }

.preview-title {
  margin-left: auto;
  color: #a49b8e;
  font: 11px var(--mono);
}

.preview-body {
  padding: 26px 26px 22px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.65;
}

.preview-body p { margin: 0 0 16px; }

.preview-time {
  margin-right: 10px;
  color: #d98a70;
  font: 11px var(--mono);
  white-space: nowrap;
}

.preview-cursor {
  width: 2px;
  height: 18px;
  margin-top: -6px;
  background: var(--accent);
  animation: blink 1.2s steps(2, start) infinite;
}

.preview-foot {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid #3b362e;
  color: #a49b8e;
  font-size: 11px;
}

@keyframes blink { 50% { opacity: 0; } }

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-strip article {
  padding: 30px 34px 32px 0;
}

.feature-strip article + article {
  padding-left: 34px;
  border-left: 1px solid var(--line);
}

.feature-number {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
  font: 11px var(--mono);
}

.feature-strip h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.feature-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.how, .faq {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 60px;
  width: min(1000px, calc(100% - 48px));
  margin: 0 auto;
  padding: 90px 0;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 50px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.steps li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.steps li > span {
  color: var(--accent);
  font: 12px var(--mono);
}

.steps h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq details:first-of-type { border-top: 1px solid var(--line); }

.faq summary {
  padding: 19px 28px 19px 0;
  position: relative;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

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

.faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 13px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
}

.faq details[open] summary::after { content: "−"; }

.faq details p {
  margin: -4px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px 40px;
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 46px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.small-brand { font-size: 15px; margin-bottom: 10px; }
.small-brand .brand-mark { width: 28px; height: 28px; }
.site-footer p { margin: 0; max-width: 430px; }
.footer-brand { max-width: 380px; }
.footer-note { text-align: right; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px 18px;
  max-width: 330px;
  font-weight: 650;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover { color: var(--accent); }

/* Editorial and legal pages */
.content-page {
  width: min(860px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 90px;
}

.content-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 5.4vw, 64px);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 1.02;
}

.content-head .lede { max-width: 720px; }

.page-meta {
  margin: -12px 0 26px;
  color: var(--muted);
  font: 11px var(--mono);
}

.contact-cta { margin: 0 0 10px; }

.prose {
  max-width: 720px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.prose section { margin: 32px 0 0; }

.prose h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.prose p {
  margin: 0 0 14px;
  color: #4e483f;
  font-size: 15px;
  line-height: 1.75;
}

.prose a { color: var(--accent); }

/* Optional account and saved history */
.login-page {
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 110px;
}

.login-card {
  padding: clamp(24px, 5vw, 46px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 18px 54px rgba(65, 48, 28, 0.08);
}

.login-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.login-card .lede { margin: 20px 0 24px; font-size: 16px; }

.google-signin { display: inline-block; margin: 0 0 26px; }

.login-points {
  display: grid;
  gap: 10px;
  margin: 0 0 26px;
  padding: 20px 0 0 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.login-points li::marker { color: var(--accent); }

.login-note,
.setup-note {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.login-note a { color: var(--accent); }

.setup-note {
  margin: 0 0 24px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(217, 79, 43, 0.06);
}

.form-error {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-left: 3px solid #a33120;
  background: rgba(163, 49, 32, 0.07);
  color: #7e2a1c;
  font-size: 13px;
}

.history-page {
  width: min(900px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 100px;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}

.history-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 1.03;
}

.history-head .lede { max-width: 620px; margin: 16px 0 0; font-size: 15px; }

.history-list { border-top: 1px solid var(--line); }

.history-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 2px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.history-item:hover .history-item-title { color: var(--accent); }

.history-item-title {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.025em;
  line-height: 1.25;
  transition: color 120ms ease;
}

.history-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.history-empty {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.history-empty > p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.history-empty .form-note { margin-top: 10px; }

/* Transcript page */
.transcript-page {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 70px;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb a { color: var(--accent); text-decoration: none; }

.transcript-heading h1 {
  max-width: 980px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 4.2vw, 52px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 16px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.video-meta span + span::before {
  content: "·";
  margin-right: 18px;
  color: var(--line);
}

.video-meta a { color: var(--accent); text-decoration: none; }
.video-meta a:hover { text-decoration: underline; }

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.player-column {
  position: sticky;
  top: 18px;
}

.player-shell {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #2c2924;
  border-radius: 14px;
  background: #171512;
  box-shadow: 0 18px 44px rgba(49, 38, 24, 0.16);
}

.player-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.language-field {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-tools select {
  max-width: 210px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.reading-card {
  margin-top: 14px;
  padding: 16px;
  border-left: 3px solid var(--sage);
  background: rgba(47, 97, 89, 0.07);
  color: var(--muted);
  font-size: 12.5px;
}

.reading-card p { margin: 0; }
.reading-card .saved-note { margin-top: 10px; font-size: 11.5px; }
.saved-note a { color: var(--sage); font-weight: 700; }
.reading-label {
  margin-bottom: 6px !important;
  color: var(--sage);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.transcript-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 34px rgba(65, 48, 28, 0.06);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbf8f2;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.panel-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.transcript-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.transcript {
  max-height: min(68vh, 720px);
  overflow-y: auto;
  padding: 14px 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: #c9bfae transparent;
}

.transcript::-webkit-scrollbar { width: 8px; }
.transcript::-webkit-scrollbar-thumb { background: #c9bfae; border-radius: 6px; }

.segment {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid rgba(222, 213, 199, 0.55);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}

.segment:last-child { border-bottom: 0; }

.timestamp {
  align-self: start;
  justify-self: start;
  min-width: 42px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--accent);
  font: 10px var(--mono);
  text-align: center;
  transition: background 120ms ease, border-color 120ms ease;
}

.timestamp:hover {
  border-color: var(--accent);
  background: #fff;
}

.segment.is-flashing .segment-text { background: #ffe9df; }

.transcript:not(.timestamp-mode) .segment { grid-template-columns: 1fr; }
.transcript:not(.timestamp-mode) .timestamp { display: none; }

.copy-status {
  display: inline-block;
  margin-left: 8px;
  color: var(--sage);
  font-size: 12px;
  font-weight: 650;
}

.live-region {
  min-height: 22px;
  padding: 0 20px 12px;
  color: var(--sage);
  font-size: 12px;
}

/* Error page */
.error-page {
  width: min(760px, calc(100% - 48px));
  margin: 0 auto;
  padding: 80px 0 110px;
}

.error-page h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.error-page .lede { margin-bottom: 14px; }

.error-hint {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.error-code {
  margin-top: 24px;
  color: #9a9285;
  font: 11px var(--mono);
}

/* Responsive */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 42px; padding-top: 38px; }
  .hero-preview { max-width: 520px; transform: none; }
  .feature-strip { grid-template-columns: 1fr; }
  .feature-strip article, .feature-strip article + article {
    padding: 24px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }
  .feature-strip article:last-child { border-bottom: 0; }
  .how, .faq { grid-template-columns: 1fr; gap: 32px; padding: 62px 0; }
  .workspace { grid-template-columns: 1fr; }
  .player-column { position: static; }
  .player-shell { max-width: 620px; }
  .transcript { max-height: none; }
}

@media (max-width: 640px) {
  .site-header, .hero, .feature-strip, .how, .faq, .site-footer, .transcript-page, .content-page, .login-page, .history-page, .error-page {
    width: min(100% - 32px, 1200px);
  }
  .site-nav { display: none; }
  .site-header { gap: 14px; }
  .account-nav { gap: 10px; font-size: 11px; }
  .nav-signin { padding: 7px 11px; }
  .hero { padding: 30px 0 54px; }
  .url-form { flex-direction: column; }
  .url-form .button { width: 100%; }
  .site-footer { flex-direction: column; gap: 18px; }
  .footer-note { text-align: left; }
  .footer-links { max-width: none; }
  .content-page { padding-top: 18px; }
  .login-page { padding-top: 24px; }
  .history-page { padding-top: 24px; }
  .history-head { flex-direction: column; gap: 16px; }
  .transcript-page { padding-top: 8px; }
  .transcript-heading h1 { font-size: 30px; }
  .video-meta span + span::before { display: none; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .transcript-actions { justify-content: flex-start; }
  .transcript { padding: 10px 14px 18px; }
  .segment { grid-template-columns: 42px 1fr; gap: 10px; font-size: 16px; }
  .player-tools { align-items: flex-start; flex-direction: column; }
  .player-tools select { max-width: 100%; width: 100%; }
}

@media print {
  .site-header, .site-footer, .player-column, .transcript-actions, .breadcrumb { display: none !important; }
  .transcript-page { width: 100%; padding: 0; }
  .transcript-panel { border: 0; box-shadow: none; }
  .transcript { max-height: none; overflow: visible; }
  .segment { break-inside: avoid; }
}
