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

/* ── SITE FOOTER ── */
.site-footer {
  border-top: 0.5px solid var(--gray-light);
  padding: 2.5rem 2rem 2rem;
  margin-top: 4rem;
  background: var(--gray-bg);
}
.site-footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 2rem;
}
.site-footer-brand { grid-column: 1 / 2; }
.site-footer-brand .wordmark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.03em;
  color: #240608;
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}
.site-footer-brand p {
  font-size: 12px;
  color: var(--gray-mid);
  line-height: 1.6;
}
.site-footer-col h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 0.75rem;
}
.site-footer-col a {
  display: block;
  font-size: 13px;
  color: var(--gray-dark);
  text-decoration: none;
  margin-bottom: 0.4rem;
  transition: color 0.15s;
}
.site-footer-col a:hover { color: var(--accent); }
.site-footer-bottom {
  max-width: 900px;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 0.5px solid var(--gray-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.site-footer-bottom span, .site-footer-bottom a {
  font-size: 11px;
  color: var(--gray-mid);
  text-decoration: none;
}
.site-footer-bottom a:hover { color: var(--accent); }
@media (max-width: 640px) {
  .site-footer-inner { grid-template-columns: 1fr 1fr; }
  .site-footer-brand { grid-column: 1 / -1; }
}

/* ── FEEDBACK BUTTON ── */
.feedback-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--accent-grad);
  color: white;
  padding: 0.625rem 1.125rem;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(195,34,56,0.3);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s, bottom 0.2s;
  border: none;
  font-family: 'DM Sans', sans-serif;
}

:root {
  --black: #0f0f0f;
  --white: #ffffff;
  --gray-dark: #444;
  --gray-mid: #888;
  --gray-light: #e8e8e8;
  --gray-bg: #f7f7f5;
  /* Neutral surface tokens — for section backgrounds. See docs/BRAND_COLOURS.md.
     Paper #F5EFE6 = warm cream, picked for visible contrast against #FFFFFF
     while staying on-brand. The icon's lighter #faf8f4 was tested first but
     was indistinguishable from pure white at screen scale. */
  --at-paper: #F5EFE6;
  --accent: #C32238;
  --accent-dark: #4A0E18;
  --accent-end: #F6904A;
  --accent-light: #FBEAE2;
  --accent-grad: linear-gradient(135deg, #4A0E18 0%, #C32238 50%, #F6904A 100%);
  --accent-grad-text: linear-gradient(90deg, #C32238, #F6904A);
  --radius: 8px;
  --radius-lg: 12px;
}

.grad-text {
  background: var(--accent-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-accent {
  background: var(--accent-grad) !important;
  color: var(--white) !important;
  border: none;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  background: var(--white);
  color: var(--black);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* NAV */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 52px;
  border-bottom: 0.5px solid var(--gray-light);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-size: 14px;
  font-weight: 500;
  color: var(--black);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav-links { display: flex; gap: 1.5rem; align-items: center; }

nav a.nav-link {
  font-size: 13px;
  color: var(--gray-mid);
  text-decoration: none;
  transition: color 0.15s;
}

nav a.nav-link:hover { color: var(--black); }
nav a.nav-link.nav-active { color: var(--black); font-weight: 500; }

/* MAIN */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 6rem;
}

/* HERO */
.hero { margin-bottom: 2.5rem; }

.hero-eyebrow {
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 300;
  color: var(--black);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero h1 strong { font-weight: 600; }

.subtitle {
  font-size: 0.875rem;
  color: var(--gray-mid);
  font-weight: 300;
}

/* HOW IT WORKS */
.how-it-works {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 2rem;
}

.how-step {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 0.7rem 1.1rem;
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.how-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.how-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
}

/* OPTIONS ROW */
/* Collapsible "Options" menu wrapping the per-video controls */
.options-details {
  margin-bottom: 0.625rem;
}
.options-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--gray-mid);
  padding: 6px 12px;
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius);
  background: var(--gray-bg);
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.options-summary::-webkit-details-marker { display: none; }
.options-summary:hover { border-color: var(--accent); color: var(--accent); }
.options-caret { font-size: 10px; transition: transform 0.2s; }
.options-details[open] .options-caret { transform: rotate(180deg); }
.options-details[open] .options-summary { border-color: var(--accent); color: var(--accent); }
.options-more {
  font-size: 11px;
  color: var(--gray-mid);
  margin: 0;
}
.options-more a { color: var(--accent); }
.options-output-desc { font-size: 12px; color: var(--gray-mid); line-height: 1.5; margin: 0 0 0.875rem; padding-bottom: 0.75rem; border-bottom: 0.5px solid var(--gray-light); }

/* Learn / Understand mode selector (landing). Self-contained classes. */
/* Full-width within the form column (same width as the URL bar above), so the
   two-half toggle lines up edge-to-edge with the URL input — each half = half
   the URL bar's width. */
.atmode { display: flex; flex-direction: column; gap: 8px; margin: 0 0 1.25rem; width: 100%; box-sizing: border-box; }
.atmode-pills { display: flex; gap: 10px; flex-wrap: wrap; }
/* Pill styled like the Feedback button: rounded, white by default, filled
   with the brand gradient + white text when selected. */
.atmode-pill {
  flex: 1 1 160px; text-align: center;
  /* appearance:none kills the browser's native button chrome — on Chrome/Windows
     it can leave a faint dark edge/outline on one side over the gradient. */
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  padding: 0.625rem 1.125rem; border: 0.5px solid var(--gray-light); border-radius: 20px;
  background: var(--white); color: var(--gray-mid); cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: rgba(195,34,56,0.2); touch-action: manipulation;
}
.atmode-pill:focus { outline: none; }
.atmode-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .atmode-pill:hover { border-color: var(--accent); color: var(--accent); } }
.atmode-pill.atmode-on {
  border-color: transparent; background: var(--accent-grad); color: var(--white);
  box-shadow: 0 4px 12px rgba(67,97,238,0.3);
}
@media (max-width: 600px) {
  .atmode-pills { flex-direction: column; }
  .atmode-pill { flex: none; width: 100%; }
}

/* Horizontal two-part mode selector (landing). The two halves reuse
   .atmode-pill / .atmode-on so the existing isolated mode script + active-state
   styling keep working; the description lives BELOW the toggle, not inside the
   buttons, and updates on selection (#atModeSub). */
.atmode-cards-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 2px;
}
/* Two halves side by side — stays horizontal on mobile too (it's just 2 words). */
.atmode-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.atmode-seg-btn {
  /* override the pill width default; keep the rounded pill shape + transition */
  flex: none; width: 100%;
}
/* Active half: the "Install app" button look — brand gradient fade + white text. */
.atmode-seg-btn.atmode-on {
  border-color: transparent; background: var(--accent-grad); color: var(--white);
  box-shadow: 0 4px 12px rgba(67,97,238,0.3);
}
/* Description line under the toggle. */
.atmode-sub {
  font-family: 'DM Sans', sans-serif; font-size: 12.5px; font-weight: 400;
  color: var(--gray-mid); line-height: 1.45; margin: 2px 0 0; text-align: center;
}
@media (max-width: 560px) {
  /* keep the two halves side by side even on narrow screens */
  .atmode-seg { gap: 8px; }
  .atmode-seg-btn { width: 100%; }
}

.mode-row { display: flex; flex-direction: column; gap: 6px; margin: 0.75rem 0; }
.mode-row-label { font-size: 11px; color: var(--gray-mid); text-transform: uppercase; letter-spacing: 0.04em; }
.mode-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-pill {
  flex: 1 1 160px;            /* equal width, each its own clear tap target */
  text-align: center;
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  padding: 12px 14px;        /* taller hit area for touch */
  border: 1.5px solid var(--gray-light); border-radius: var(--radius);
  background: var(--white); color: var(--gray-mid); cursor: pointer; transition: all 0.15s;
  position: relative;
  -webkit-tap-highlight-color: rgba(195,34,56,0.2);
  touch-action: manipulation;
}
/* On narrow screens stack the two pills full-width so neither can overlap
   the other's tap area (was the reason "Understand" felt unclickable). */
@media (max-width: 600px) {
  .mode-pills { flex-direction: column; }
  .mode-pill { flex: none; width: 100%; }
}
/* hover only where a real pointer exists, so the highlight doesn't stick after a tap on touch */
@media (hover: hover) {
  .mode-pill:hover { border-color: var(--accent); color: var(--accent); }
}
/* selected state: strong, unmistakable — filled brand gradient + white text + checkmark */
.mode-pill.mode-selected {
  border-color: var(--accent);
  background: var(--accent-grad);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(195,34,56,0.25);
}
.mode-pill.mode-selected::before { content: "✓ "; font-weight: 700; }
.options-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-mid);
}

.count-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 4px 10px;
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius);
  background: var(--gray-bg);
  color: var(--black);
  cursor: pointer;
  outline: none;
}

.count-select:focus { border-color: var(--accent); }

/* INPUT TABS */
.input-tabs {
  display: flex;
  margin-bottom: 0.625rem;
}

.input-tab {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  padding: 5px 14px;
  border: 0.5px solid var(--gray-light);
  background: var(--gray-bg);
  color: var(--gray-mid);
  cursor: pointer;
  transition: all 0.15s;
}

.input-tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.input-tab.active { background: var(--accent-grad); color: var(--white); border-color: var(--accent); }

/* INPUT CARD */
.input-card {
  display: flex;
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}

.input-card:focus-within { border-color: var(--accent); }

/* Animated gradient border for the YouTube URL input — draws the eye to the primary action.
   Border wrap restored 2026-05-23; placeholder text inside stays neutral grey. */
.url-border-wrap {
  position: relative;
  padding: 2px;
  border-radius: calc(var(--radius-lg) + 2px);
  background: var(--accent-grad);
  background-size: 300% 300%;
  animation: urlBorderShift 4s ease-in-out infinite;
  margin-bottom: 1.5rem;
}
.url-border-wrap > .input-card {
  margin-bottom: 0;
  border: none;
  border-radius: var(--radius-lg);
}
/* URL placeholder — neutral grey to match other input fields */
#urlInput::placeholder { color: var(--gray-mid); opacity: 0.85; }
#urlInput::-webkit-input-placeholder { color: var(--gray-mid); opacity: 0.85; }
#urlInput::-moz-placeholder { color: var(--gray-mid); opacity: 0.85; }

/* Mobile: stack the Go! button below the URL input (same as the Paste Text
   tab) so the full placeholder fits without being squeezed by the button. */
@media (max-width: 600px) {
  .url-border-wrap > .input-card { flex-direction: column; }
  .url-border-wrap > .input-card #urlInput { width: 100%; padding: 0.875rem 1.125rem; font-size: 14px; }
  .url-border-wrap > .input-card #processBtn { width: 100%; padding: 0.875rem 1.5rem; font-size: 13px; border-radius: 0; }
}
@keyframes urlBorderShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .url-border-wrap { animation: none; }
}

/* Shimmer Sweep — diagonal light pass for CTAs; assumes the host element has a gradient/coloured bg */
.btn-shimmer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-shimmer::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  animation: shimmer-sweep 3s ease infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes shimmer-sweep {
  0%   { left: -100%; }
  60%, 100% { left: 160%; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-shimmer::after { animation: none; opacity: 0; }
}

/* Feedback FAB inherits the shimmer effect automatically on every page */
#feedbackBtn {
  position: fixed !important;
  overflow: hidden !important;
  isolation: isolate;
  transition: bottom 0.2s ease;
}
/* When body has .footer-visible the FAB sits above the footer instead of overlapping it.
   The bottom offset is set inline by JS to match the footer's intrusion into the viewport. */
body.footer-visible #feedbackBtn {
  /* placeholder; the actual bottom is set inline via JS */
}
#feedbackBtn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  animation: shimmer-sweep 3s ease infinite;
  pointer-events: none;
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  #feedbackBtn::after { animation: none; opacity: 0; }
}

.input-card input {
  flex: 1;
  padding: 0.875rem 1.125rem;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 300;
  background: var(--white);
  color: var(--black);
  outline: none;
  min-width: 0;
}

.input-card input::placeholder { color: #bbb; }

.input-card button {
  padding: 0.875rem 1.5rem;
  background: var(--accent-grad);
  color: var(--white);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-card button:hover { opacity: 0.85; }
.input-card button:disabled { opacity: 0.4; cursor: not-allowed; }

/* TEXT INPUT */
.input-card-text {
  flex-direction: column;
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}

.input-card-text:focus-within { border-color: var(--accent); }

.input-card-text textarea {
  width: 100%;
  padding: 0.875rem 1.125rem;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 300;
  background: var(--white);
  color: var(--black);
  outline: none;
  resize: vertical;
  line-height: 1.6;
  min-height: 120px;
}

.input-card-text textarea::placeholder { color: #bbb; }

.input-card-text button {
  padding: 0.875rem 1.5rem;
  background: var(--accent-grad);
  color: var(--white);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.input-card-text button:hover { opacity: 0.85; }
.input-card-text button:disabled { opacity: 0.4; cursor: not-allowed; }

/* STATUS */
.status-box {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.125rem;
  background: var(--gray-bg);
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-dark);
  margin-bottom: 1.5rem;
}

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--gray-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ERRORS & WARNINGS */
.error-box {
  padding: 0.875rem 1.125rem;
  background: #fff5f5;
  border: 0.5px solid #fecaca;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: #dc2626;
  margin-bottom: 1.5rem;
}

.warning-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.warning-blocking { background: #fff5f5; border: 0.5px solid #fecaca; color: #dc2626; }
.warning-caution { background: #fffbeb; border: 0.5px solid #fde68a; color: #92400e; }

.warning-icon {
  font-size: 0.75rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.warning-blocking .warning-icon { background: #dc2626; color: white; }
.warning-caution .warning-icon { background: #d97706; color: white; }

/* RESULT CARD */
.result-card {
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 2rem;
}

.result-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.875rem;
  padding: 1.125rem 1.5rem;
  border-bottom: 0.5px solid var(--gray-light);
  background: var(--white);
}

.result-header h2 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--black);
  margin: 0;
  word-wrap: break-word;
}

.download-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.download-btns::-webkit-scrollbar { height: 6px; }
.download-btns::-webkit-scrollbar-thumb { background: var(--gray-light); border-radius: 3px; }

.btn-download {
  padding: 0.4rem 0.875rem;
  background: var(--accent-grad);
  color: var(--white);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.btn-download:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--white);
  color: var(--black);
  border: 0.5px solid var(--gray-light);
}

.btn-secondary:hover { background: var(--gray-bg); opacity: 1; }

/* TABS */
.tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 0.5px solid var(--gray-light);
  padding: 0 1.5rem;
  background: var(--white);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-mid);
  cursor: pointer;
  margin-bottom: -0.5px;
  transition: color 0.15s;
}

.tab:hover { color: var(--black); }
.tab.active {
  background: var(--accent-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.tab-content {
  padding: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--gray-dark);
  background: var(--white);
}

.tab-content p { margin-bottom: 0.875rem; }
.tab-content p:last-child { margin-bottom: 0; }

/* VOCAB TABLE */
.vocab-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

.vocab-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-mid);
  padding: 0 0.75rem 0.75rem 0;
  border-bottom: 0.5px solid var(--gray-light);
}

.vocab-table td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 0.5px solid var(--gray-light);
  vertical-align: top;
  font-size: 0.8125rem;
}

.vocab-table tr:last-child td { border-bottom: none; }
.vocab-table td:first-child { font-weight: 500; color: var(--black); width: 22%; }
.vocab-table td:last-child { color: var(--gray-mid); font-style: italic; }

/* COMMENTARY */
.commentary-seg {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--gray-light);
}

.commentary-seg:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.commentary-label {
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  font-family: 'DM Mono', monospace;
}

.commentary-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--black);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.beta-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  margin-left: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, #C32238, #F6904A);
  color: #fff;
  vertical-align: middle;
  line-height: 1;
}

.beta-notice {
  background: #FEF3C7;
  border: 0.5px solid #FCD34D;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 13px;
  line-height: 1.5;
  color: #78350F;
  margin-bottom: 1.25rem;
}

.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light, #FBEAE2);
  border: 0.5px solid #e8cfc6;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--gray-dark);
  font-family: 'DM Sans', sans-serif;
}
.lang-pill strong { color: var(--black); font-weight: 600; }

/* Compact landing form-help — collapsible details */
.form-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
  font-size: 11px;
  color: var(--gray-mid);
  margin: 0.5rem 0 1rem;
  line-height: 1.5;
}
.form-help details {
  display: inline-block;
}
.form-help summary {
  cursor: pointer;
  list-style: none;
  color: var(--gray-mid);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.form-help summary::-webkit-details-marker { display: none; }
.form-help summary:hover { color: var(--accent); }
.form-help-caret {
  display: inline-block;
  transition: transform 0.15s;
  font-size: 13px;
  line-height: 1;
}
.form-help details[open] .form-help-caret { transform: rotate(90deg); }
.form-help-body {
  background: var(--gray-bg);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 6px;
  line-height: 1.7;
  font-size: 11px;
  color: var(--gray-dark);
  max-width: 460px;
}
.form-help-cta a { color: var(--accent); text-decoration: none; }
.form-help-cta a:hover { text-decoration: underline; }

/* COPY BUTTON */
.copy-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius);
  border: 0.5px solid var(--gray-light);
  background: transparent;
  color: var(--gray-mid);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.copy-btn:hover { background: var(--gray-bg); }

/* HISTORY */
.history-list { display: flex; flex-direction: column; }

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 0.5px solid var(--gray-light);
  gap: 1rem;
  flex-wrap: wrap;
}

.history-info { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 0; }

.history-title {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--black);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-title:hover { color: var(--accent); }
.history-date { font-size: 0.75rem; color: var(--gray-mid); }

.history-actions { display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0; }

.btn-watch {
  font-size: 12px;
  color: var(--gray-mid);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.btn-watch:hover { color: var(--black); }

.btn-delete {
  font-size: 12px;
  color: #dc2626;
  background: none;
  border: 0.5px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.3rem 0.625rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s;
}

.btn-delete:hover { background: #fff5f5; }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 4rem 0;
  color: var(--gray-mid);
}

.empty-state p { margin-bottom: 1.5rem; font-size: 0.875rem; }

/* DISCOVER */
.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.875rem;
  margin-top: 1rem;
}

.discover-card {
  border: 0.5px solid var(--gray-light);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  transition: border-color 0.15s;
  text-decoration: none;
  display: block;
}

.discover-card:hover { border-color: var(--accent); }

.discover-card-tag {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 6px;
}

.discover-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  margin-bottom: 4px;
  line-height: 1.3;
}

.discover-card-desc {
  font-size: 11px;
  color: var(--gray-mid);
  line-height: 1.5;
}

.discover-featured {
  border-color: var(--accent);
  background: var(--accent-light);
}


.discover-featured .discover-card-tag {
  background: var(--accent-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.discover-featured .discover-card-name { color: var(--black); }

.discover-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 0.5px solid var(--gray-light);
}

.discover-coming-soon {
  padding: 2.5rem 1.5rem;
  border: 0.5px dashed var(--gray-light);
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 2.5rem;
}

.discover-coming-soon h3 {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  color: var(--black);
}

.discover-coming-soon p {
  font-size: 0.875rem;
  color: var(--gray-mid);
  max-width: 420px;
  margin: 0 auto 0.5rem;
  line-height: 1.6;
}

/* HAMBURGER NAV */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--black);
  border-radius: 2px;
  transition: all 0.25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-dropdown {
  display: none;
  /* Fixed so the dropdown opens right under the nav at the current scroll
     position. Was `absolute` keyed to top:52px of the document, which only
     looked correct when the user was at the very top of the page; once
     scrolled down the dropdown floated off-screen up at page-coord (0, 52)
     and tapping the hamburger appeared to do nothing. */
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 0.5px solid var(--gray-light);
  z-index: 200;
  padding: 0.5rem 0;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a, .nav-dropdown span {
  display: block;
  padding: 0.75rem 1.5rem;
  font-size: 14px;
  color: var(--gray-mid);
  text-decoration: none;
  border-bottom: 0.5px solid var(--gray-light);
}
.nav-dropdown a:last-child { border-bottom: none; }
.nav-dropdown a.nav-active { color: var(--black); font-weight: 500; }
.nav-dropdown .nav-user {
  font-size: 12px;
  color: var(--gray-mid);
  padding: 0.625rem 1.5rem;
  border-bottom: 0.5px solid var(--gray-light);
  background: var(--gray-bg);
}

/* MOBILE */
@media (max-width: 600px) {
  /* Keep the sticky behaviour from the base rule on mobile too — the nav
     stays pinned to the top while scrolling so the logo + hamburger button
     are always one tap away. */
  nav { padding: 0 1rem; }
  .nav-hamburger { display: flex; }
  .nav-links { display: none; }
  main { padding: 2rem 1rem 4rem; }
  .how-it-works { gap: 6px; }
  .btn-download { flex-shrink: 0; }
  .vocab-table th:last-child, .vocab-table td:last-child { display: none; }

  /* History page mobile */
  .history-item { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1rem 0.25rem; }
  .history-info { width: 100%; }
  .history-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 6px;
    width: 100%;
  }
  .history-actions .btn-dl-hist,
  .history-actions .btn-print,
  .history-actions .btn-delete,
  .history-actions .btn-watch {
    text-align: center;
    padding: 0.45rem 0.5rem;
    font-size: 11px;
  }
  .history-title { white-space: normal; word-break: break-word; line-height: 1.35; }
  .history-date { font-size: 0.7rem; }

  /* Tabs strip — tighter padding so 4 tabs fit on narrow screens */
  .tabs { padding: 0 0.75rem; gap: 0; }
  .tab { padding: 0.75rem 0.6rem; font-size: 11px; }
  .tab-content { padding: 1.25rem 1rem; }

  /* Idioms cards — wrap phrase/badge row, smaller padding */
  #idiomsContent > div { padding: 12px !important; }
  #idiomsContent > div > div:first-child { flex-wrap: wrap !important; gap: 6px !important; }
}

/* ---- Site footer (sitemap, 4 columns) ---- */
.site-footer {
  border-top: 0.5px solid var(--gray-light);
  padding: 2.5rem 2rem 1.25rem;
  background: transparent;
  margin-top: 3rem;
}
.site-footer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2rem;
}
.site-footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--black);
  margin: 0 0 0.75rem;
}
.site-footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.site-footer-col a {
  font-size: 13px;
  color: var(--gray-mid);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-footer-col a:hover { color: var(--accent); }
.site-footer-bottom {
  max-width: 1100px;
  margin: 1.75rem auto 0;
  padding-top: 1.25rem;
  border-top: 0.5px solid var(--gray-light);
  font-size: 12px;
  color: var(--gray-mid);
  text-align: center;
}
@media (max-width: 720px) {
  .site-footer { padding: 1.75rem 1.25rem 1rem; margin-top: 2rem; }
  .site-footer-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .site-footer-col h4 { font-size: 11px; margin-bottom: 0.5rem; }
  .site-footer-col a { font-size: 12.5px; }
  .site-footer-bottom { margin-top: 1.25rem; padding-top: 1rem; }
}
