/* ============================================
   Analyzing Islam
   Shared stylesheet — editorial dark theme
   ============================================ */

:root {
  --bg: #000000;
  --bg-elevated: #000000;
  --panel: #000000;
  --panel-2: #0a0a0a;
  --border: #1e1e1e;
  --border-hover: #3a3a3a;
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --muted: #9a9a9a;
  --text-dim: #5a5a5a;
  /* UI / interaction accent — Strong red. Used for hovers, active nav,
     counts, verse refs, quote stripes, buttons, focus, etc. */
  --accent: #c62828;
  --accent-hover: #ef5350;
  /* Inline content links inside entries/prose stay BLUE (cite-link, src-link,
     interlinear-link, .ref a, and the default <a>). */
  --link: #7aa2f7;
  --link-hover: #9ab5ff;
  --basic: #4caf50;
  --moderate: #ff9800;
  --strong: #e53935;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --radius: 0;
  --radius-lg: 2px;
  --serif: "Didot", "GFS Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* While a splitter is being dragged, suppress text selection and force the
   col-resize cursor across the whole page so the drag feels natural. */
body.splitter-dragging {
  cursor: col-resize !important;
  user-select: none;
}
body.splitter-dragging * {
  user-select: none;
}
/* Block iframe pointer events during drag so the cursor stays on the
   splitter when it passes over a compare/build iframe. */
body.splitter-dragging iframe {
  pointer-events: none;
}

/* Ghost line that tracks the cursor while dragging a splitter. The real
   layout is unchanged during drag — only on release does the column
   actually resize. Moving this element is compositor-only (transform),
   so it stays buttery-smooth even on pages with thousands of verses. */
.splitter-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 2px;
  height: 100vh;
  background: var(--accent);
  transform: translateX(-9999px);
  pointer-events: none;
  z-index: 9999;
  display: none;
  will-change: transform;
}
.splitter-ghost.is-visible { display: block; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--link-hover);
}

/* ===== Embed mode =====
   Applied when a reader page is loaded inside an iframe on the Compare
   page (via ?embed=1). Strips away the nav + footer so the pane shows
   only the actual reading content. */
html.embed-mode .site-nav,
body.embed-mode .site-nav,
html.embed-mode .site-footer,
body.embed-mode .site-footer {
  display: none !important;
}
html.embed-mode main,
body.embed-mode main,
html.embed-mode .reader-layout,
body.embed-mode .reader-layout {
  padding-top: 8px;
}

/* ===== Navigation ===== */
.site-nav {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: #000;
  /* Slide the whole bar out of view when the user scrolls down, back
     into view when they scroll up. Toggled by goat.js. */
  transition: transform 0.25s ease;
  will-change: transform;
}
.site-nav.is-hidden { transform: translateY(-100%); }

.site-nav-inner {
  max-width: none;
  margin: 0;
  padding: 10px clamp(20px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  column-gap: 18px;
  row-gap: 4px;
  flex-wrap: wrap;
}

/* The goat lives in the bottom-right corner of every page as a fixed floating
   button (see the .goat-scream rule further down + goat.js). It is no longer in
   the nav. Hide it inside Compare-page embeds. */
html.embed-mode .goat-scream,
body.embed-mode .goat-scream { display: none !important; }

.site-nav-inner .site-nav-links {
  margin-left: auto;
}

.site-brand {
  font-family: var(--serif);
  font-weight: 700;
  font-style: normal;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  flex-basis: auto;
  text-align: left;
  order: 0;
}

.site-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav-links {
  display: flex;
  /* Tightened so brand + all 11 links + auth button + goat share one desktop
     row. The brand now sits on this row too (was its own full-width row), so
     gap + letter-spacing are pulled in to keep headroom inside the 1200px bar
     even when signed in (the account pill is wider than "Sign in"). */
  gap: 12px;
  align-items: center;
}

.site-nav-links a {
  color: var(--text-muted);
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: color 0.2s;
}

.site-nav-links a:hover {
  color: var(--text);
  text-decoration: none;
  background: transparent;
}

.site-nav-links a.active {
  color: var(--accent);
  background: transparent;
}

/* ===== Layout containers ===== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 32px 120px;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 32px 120px;
}

/* ===== Typography ===== */
h1, h2, h3 {
  line-height: 1.15;
  margin-top: 0;
  color: var(--text);
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 48px;
  margin-bottom: 18px;
}

h2 {
  font-size: 32px;
  margin: 72px 0 24px;
}

h3 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  margin: 32px 0 12px;
  letter-spacing: -0.005em;
}

p {
  margin: 0 0 16px;
  color: var(--text);
}

ul, ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

li {
  margin-bottom: 8px;
}

code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: var(--radius-lg);
  font-size: 0.9em;
}

/* ===== Hero ===== */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(56px, 9vw, 120px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  margin-bottom: 28px;
  color: var(--text);
  /* No gradient — clean editorial solid text */
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  background-clip: initial;
  background: none;
}

.hero-tagline {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 44px;
  line-height: 1.65;
}

.hero-cta {
  display: inline-flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 14px 28px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s;
  border-radius: 0;
  font-family: inherit;
}

.btn:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  text-decoration: none;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-primary:hover {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== Stats grid — editorial rule-separated ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  margin: 72px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-card {
  padding: 40px 24px;
  text-align: center;
  border-right: 1px solid var(--border);
  background: transparent;
  border-radius: 0;
}

.stat-card:last-child {
  border-right: none;
}

.stat-card .number {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 10px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card .label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
}

/* ===== Section labels ===== */
.section-title {
  /* Group-header eyebrow used across the site (catalog, categories,
     landing pages). Bumped from 11→13px and 600→700 so the labels
     read as deliberate section dividers instead of blending with the
     body copy below them. */
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 24px;
  font-weight: 700;
}

/* Space between stacked sections so section-title floats centered in the gap */
main > section + section {
  margin-top: 56px;
}

/* ===== Card grids ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  background: transparent;
  border: none;
}

.card-grid > .card {
  border: 1px solid var(--border);
  outline: none;
  outline-offset: 0;
}

.card-solo {
  max-width: 380px;
  border: 1px solid var(--border);
}
.card-solo .card {
  display: block;
}

.card {
  background: #000000;
  padding: 32px 28px;
  transition: background 0.3s;
  display: block;
  color: inherit;
  border-radius: 0;
  border: none;
  position: relative;
}

.card:hover {
  background: #0d0d0d;
  text-decoration: none;
  transform: none;
  border-color: transparent;
}

.card h3 {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

.card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.card .count {
  display: inline-block;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-top: 0;
}

/* ===== Catalog controls ===== */
.catalog-header {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 24px 28px;
  margin-bottom: 32px;
  border-radius: 0;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.controls-row:last-child {
  margin-bottom: 0;
}

.controls-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-right: 6px;
  font-weight: 600;
}

#search,
#sv-search {
  flex: 1;
  min-width: 220px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  border-radius: 0;
}

/* ===== Native file inputs: match the dark theme site-wide =====
   The browser default "Choose File" button renders as a white bar on
   most OSes, which breaks the dark theme anywhere a raw
   <input type="file"> is visible (community icon/banner uploads, etc).
   Style the selector-button pseudo across engines to look like the
   search-bar inputs. */
input[type="file"] {
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
}

input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  margin-right: 12px;
  border-radius: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]::file-selector-button:hover {
  background: var(--panel);
  border-color: var(--border-hover);
  color: var(--accent);
}

input[type="file"]::-webkit-file-upload-button:focus,
input[type="file"]::file-selector-button:focus {
  outline: none;
  border-color: var(--accent);
}

#search:focus,
#sv-search:focus {
  outline: none;
  border-color: var(--accent);
}

#search::placeholder,
#sv-search::placeholder {
  color: var(--text-dim);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  font-family: inherit;
  border-radius: 0;
}

.chip:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

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

/* Strength chips always carry their color + heavier weight so they
   stand out from plain category chips even when inactive. Hover gets
   a matching-color border for continuity; active fills with the colour. */
.chip.strength-basic,
.chip.strength-moderate,
.chip.strength-strong {
  font-weight: 800;
}

.chip.strength-basic:not(.active)    { color: var(--basic); }
.chip.strength-moderate:not(.active) { color: var(--moderate); }
.chip.strength-strong:not(.active)   { color: var(--strong); }

.chip.strength-basic:not(.active):hover    { border-color: var(--basic);    color: var(--basic); }
.chip.strength-moderate:not(.active):hover { border-color: var(--moderate); color: var(--moderate); }
.chip.strength-strong:not(.active):hover   { border-color: var(--strong);   color: var(--strong); }

.chip.strength-basic.active {
  background: var(--basic);
  border-color: var(--basic);
  color: #000;
}

.chip.strength-moderate.active {
  background: var(--moderate);
  border-color: var(--moderate);
  color: #000;
}

.chip.strength-strong.active {
  background: var(--strong);
  border-color: var(--strong);
  color: #fff;
}

.stats {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}

/* ===== Entry cards (catalog) ===== */
.entry {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 28px 32px;
  margin-bottom: 20px;
  scroll-margin-top: 110px;
  transition: border-color 0.2s;
  border-radius: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}

.entry:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.entry-header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.entry-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  flex: 1;
  min-width: 200px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}

.entry-link {
  color: var(--text-dim);
  font-size: 14px;
  padding: 2px 6px;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.entry:hover .entry-link {
  opacity: 1;
}

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

.tag {
  font-size: 10px;
  padding: 3px 10px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-radius: 0;
}

.tag.strength-basic {
  background: transparent;
  color: var(--basic);
  border-color: var(--basic);
}

.tag.strength-moderate {
  background: transparent;
  color: var(--moderate);
  border-color: var(--moderate);
}

.tag.strength-strong {
  background: transparent;
  color: var(--strong);
  border-color: var(--strong);
}

.ref {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 1;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.ref a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: color 0.15s, border-color 0.15s;
}

.ref a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  border-bottom-style: solid;
}

/* In-body citation links (Quran / Bukhari / Muslim references inside entry
   paragraphs, blockquotes, list items). Dotted blue underline so they read
   as links without disrupting body prose. */
a.cite-link {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
  transition: color 0.15s, border-bottom-style 0.15s;
}

a.cite-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  border-bottom-style: solid;
}

/* External source links — cited scholarly/apologetic works, blue like
   cite-links but they open the source itself (archive.org, DOI, publisher…)
   in a new tab. */
a.src-link {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
  transition: color 0.15s, border-bottom-style 0.15s;
}

a.src-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  border-bottom-style: solid;
}

/* Interlinear word deep-links — distinct from cite-links; italic Arabic terms
   that open the word panel in the Interlinear Quran on click. */
a.interlinear-link {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dashed var(--link);
  transition: color 0.15s, border-bottom-style 0.15s;
}

a.interlinear-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  border-bottom-style: solid;
}

.entry section {
  margin-top: 16px;
}

.entry h4 {
  margin: 22px 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  font-weight: 700;
}

.entry p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.75;
}

.entry ul, .entry ol {
  color: var(--text);
}

blockquote {
  border-left: 2px solid var(--accent);
  margin: 16px 0;
  padding: 10px 22px;
  color: var(--text-muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  background: transparent;
  border-radius: 0;
  line-height: 1.6;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 80px 0;
  font-style: italic;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  /* The side padding keeps the centred footer text clear of the goat, which is
     absolutely positioned in the bottom-right corner (72px + 24px offset) and
     can swing outside that box during the chew/stretch animations. Symmetric,
     so the text stays centred. Narrow viewports are handled in the mobile
     block instead — reserving a side gutter there would leave too little room
     for the text, so the goat is given vertical clearance below it. */
  padding: 40px 116px;
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  /* Anchor for the goat, which lives in the footer's bottom-right corner. */
  position: relative;
}

.site-footer a {
  color: var(--text-muted);
}

/* Random catalog-fact line on community pages — visually distinct from
   the all-caps boilerplate footer everywhere else (sentence case,
   easier to read at a glance). */
.cf-footer-fact {
  display: inline-block;
  max-width: 760px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.cf-footer-fact strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}
.cf-footer-fact a {
  color: var(--accent);
  white-space: nowrap;
  margin-left: 6px;
}
.cf-footer-fact a:hover {
  color: var(--accent-hover);
}

/* ===== Screaming goat button (top-right of header) ===== */
.goat-scream {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  /* The goat lives in the footer's bottom-right corner on every page. It scrolls
     away with the page (it is not pinned to the viewport). */
  position: absolute;
  right: 24px;
  bottom: 8px;
  z-index: 2;
  overflow: visible;
}

.goat-scream:hover {
  transform: translateY(-2px);
}

.goat-scream:active {
  transform: translateY(0);
}

.goat-scream:focus {
  outline: none;
}
.goat-scream:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.goat-scream .goat-svg {
  width: 100%;
  height: 100%;
  display: block;
  /* image-rendering: pixelated keeps the crisp pixel look if the SVG is rasterized; */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Default: closed mouth visible, open mouth hidden */
.goat-scream .goat-mouth-open   { display: none; }
.goat-scream .goat-mouth-closed { display: block; }

/* Screaming: swap mouths and shake */
.goat-scream.is-screaming .goat-mouth-open   { display: block; }
.goat-scream.is-screaming .goat-mouth-closed { display: none; }

/* Apply the scream shake to the body group only — the grass stays rooted. */
.goat-scream .goat-body {
  transform-box: fill-box;
  transform-origin: 80% 100%;
  transition: transform 0.2s ease-out;
}

.goat-scream.is-screaming .goat-body {
  animation: goat-shake 1.6s steps(48) 0s 1;
  transform-origin: 50% 60%;
}

/* Let the goat rotate / scale beyond the viewBox without getting clipped. */
.goat-scream .goat-svg { overflow: visible; }

/* Idle: chew — full sequence: stoop to grass, grab a blade, stand up, chew. */
.goat-scream.is-chewing .goat-body {
  animation: goat-chew 3s ease-in-out 1;
  transform-origin: 85% 100%;
}

/* Idle: stretch — crouch, arch back, reach forward with the legs, release. */
.goat-scream.is-stretching .goat-body {
  animation: goat-stretch 3s ease-in-out 1;
  transform-origin: 85% 100%;
}

/*  CHEW keyframes
    Phase A  0–8%   anticipatory dip
    Phase B  8–25%  full stoop down to the grass (~-35°)
    Phase C  25–40% grab twitch at the bottom
    Phase D  40–58% rise back up to upright
    Phase E  58–100% chew bobs: jaw-work rocking the head up/down */
@keyframes goat-chew {
  0%   { transform: rotate(0deg)   translateY(0); }
  8%   { transform: rotate(-6deg)  translateY(0); }
  22%  { transform: rotate(-34deg) translateY(1px); }
  30%  { transform: rotate(-32deg) translateY(2px); }
  38%  { transform: rotate(-36deg) translateY(1px); }
  50%  { transform: rotate(-10deg) translateY(0); }
  58%  { transform: rotate(0deg)   translateY(0); }
  66%  { transform: rotate(-3deg)  translateY(0); }
  72%  { transform: rotate(2deg)   translateY(0); }
  78%  { transform: rotate(-2deg)  translateY(0); }
  84%  { transform: rotate(1deg)   translateY(0); }
  90%  { transform: rotate(-1deg)  translateY(0); }
  100% { transform: rotate(0deg)   translateY(0); }
}

/*  STRETCH keyframes
    Phase A  0–12%   brief crouch (squish Y)
    Phase B  12–28%  lift up, arch back
    Phase C  28–58%  PEAK — scale up Y, scale X, rotate back, reach forward
    Phase D  58–72%  release with slight lean
    Phase E  72–100% under-bounce and settle back to neutral */
@keyframes goat-stretch {
  0%   { transform: rotate(0deg)  scale(1, 1)       translateX(0); }
  12%  { transform: rotate(-3deg) scale(1, 0.92)    translateX(0); }
  28%  { transform: rotate(4deg)  scale(0.98, 1.08) translateX(-1px); }
  45%  { transform: rotate(9deg)  scale(1.06, 1.2)  translateX(-3px); }
  58%  { transform: rotate(9deg)  scale(1.07, 1.22) translateX(-3px); }
  72%  { transform: rotate(3deg)  scale(1.02, 1.08) translateX(-1px); }
  85%  { transform: rotate(-1deg) scale(0.99, 0.98) translateX(0); }
  100% { transform: rotate(0deg)  scale(1, 1)       translateX(0); }
}

/* Grass — decorative, no pointer events, but each blade sways like wind. */
.goat-grass {
  pointer-events: none;
}

.goat-grass .grass-blade {
  transform-box: fill-box;
  transform-origin: 50% 100%; /* pivot at the blade's root */
  animation: grass-sway 3.2s ease-in-out infinite;
  animation-delay: var(--sway-delay, 0s);
}

@keyframes grass-sway {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(11deg); }
  50%  { transform: rotate(-5deg); }
  75%  { transform: rotate(7deg); }
  100% { transform: rotate(0deg); }
}

@keyframes goat-shake {
  0%   { transform: translate(0, 0)    rotate(0deg); }
  3%   { transform: translate(-1px, 1px) rotate(-6deg); }
  6%   { transform: translate(1px, -1px) rotate(5deg); }
  10%  { transform: translate(-1px, 0)  rotate(-5deg); }
  14%  { transform: translate(1px, 1px) rotate(4deg); }
  18%  { transform: translate(-1px, -1px) rotate(-4deg); }
  22%  { transform: translate(1px, 0)  rotate(5deg); }
  26%  { transform: translate(-1px, 1px) rotate(-5deg); }
  30%  { transform: translate(1px, -1px) rotate(4deg); }
  35%  { transform: translate(-1px, 0)  rotate(-4deg); }
  40%  { transform: translate(1px, 1px) rotate(4deg); }
  45%  { transform: translate(-1px, -1px) rotate(-4deg); }
  50%  { transform: translate(1px, 0)  rotate(5deg); }
  55%  { transform: translate(-1px, 1px) rotate(-4deg); }
  60%  { transform: translate(1px, -1px) rotate(3deg); }
  65%  { transform: translate(-1px, 0)  rotate(-3deg); }
  70%  { transform: translate(1px, 1px) rotate(3deg); }
  75%  { transform: translate(-1px, -1px) rotate(-3deg); }
  80%  { transform: translate(1px, 0)  rotate(2deg); }
  85%  { transform: translate(-1px, 1px) rotate(-2deg); }
  90%  { transform: translate(1px, 0)  rotate(2deg); }
  95%  { transform: translate(0, 0)    rotate(-1deg); }
  100% { transform: translate(0, 0)    rotate(0deg); }
}

@media (max-width: 768px) {
  .site-brand {
    flex-basis: 100%;
    text-align: center;
    font-size: 28px;
  }
  .site-nav-inner {
    justify-content: center;
  }
  .site-nav-inner .auth-button {
    margin-left: 16px;
  }
  .site-nav-inner .goat-scream {
    margin-left: 8px;
  }
}

/* The scream animation is user-initiated (click) and short, so it runs
   regardless of reduced-motion preferences. */

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .goat-scream {
    width: 60px;
    height: 60px;
    right: 12px;
    bottom: 12px;
  }

  /* On a phone there isn't room for a side gutter next to the goat, so give it
     a lane of its own underneath the text: the extra bottom padding lifts the
     footer fact clear of the goat's 60px box (bottom: 12px) plus the headroom
     the chew/stretch rotations need to swing into. */
  .site-footer {
    padding: 32px 20px 104px;
  }

  .cf-footer-fact {
    font-size: 12.5px;
  }

  .hero {
    padding: 56px 0 40px;
  }

  .hero h1 {
    font-size: clamp(40px, 12vw, 72px);
  }

  .hero-tagline {
    font-size: 15px;
    margin-bottom: 32px;
  }

  h1 { font-size: 32px; }
  h2 { font-size: 24px; margin: 48px 0 16px; }

  .site-nav-inner {
    padding: 8px 20px;
  }

  .site-nav-links {
    /* Let the links wrap onto a second (or third) line when the seven
       items — Home, Catalog, Read, Compare, Stats, About, FAQ — no
       longer fit on one row. row-gap keeps breathing room between the
       wrapped rows; column-gap stays tight so we get more on each row. */
    gap: 10px 18px; /* row-gap | column-gap */
    flex-wrap: wrap;
  }

  /* Mobile: push the nav links onto their own row and centre them under
     the brand, instead of letting the desktop 80px offset shove FAQ
     past the edge of the viewport. */
  .site-nav-inner .site-nav-links {
    margin-left: 0;
    flex-basis: 100%;
    justify-content: center;
  }

  main {
    padding: 40px 20px 80px;
  }

  .container-narrow {
    padding: 40px 20px 80px;
  }

  .entry {
    padding: 22px 20px;
  }

  .entry-title {
    font-size: 18px;
  }

  .entry-header {
    gap: 6px 8px;
  }

  .ref {
    font-size: 11px;
    flex-basis: 100%;
    padding-top: 2px;
  }

  .tag {
    font-size: 9px;
    padding: 2px 8px;
    letter-spacing: 0.1em;
  }

  .catalog-header {
    padding: 18px;
  }

  .stats {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 28px 20px;
  }

  .stat-card:last-child {
    border-bottom: none;
  }

  .stat-card .number {
    font-size: 44px;
  }
}

/* ===== Auth button (injected into .site-nav-inner next to goat) ===== */
.auth-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  order: 98; /* just before the goat (order: 99) */
  margin-left: 24px;
  margin-right: 0;
  flex-shrink: 0;
  font-family: var(--sans);
}

.auth-button--signin {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.auth-button--signin:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--panel);
  text-decoration: none;
}

.auth-trigger {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
}

.auth-trigger:hover {
  border-color: var(--accent);
}

.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-label {
  color: var(--text-muted);
  /* Truncate very long @usernames so the chip stays on the same row
     as FAQ instead of wrapping to a second line. The full handle is
     still visible inside the account dropdown. */
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 50;
  overflow: hidden;
}

.auth-button.auth-open .auth-menu {
  display: block;
}

.auth-menu-email {
  padding: 14px 18px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.auth-menu-item {
  appearance: none;
  display: block;
  width: 100%;
  padding: 12px 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

/* The `hidden` attribute must win over `display: block` above, otherwise
   gated items (e.g. the creator-only Dashboard link) show for everyone. */
.auth-menu-item[hidden] { display: none; }

.auth-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  text-decoration: none;
}

.auth-menu-item.auth-signout {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.auth-menu-item.auth-signout:hover {
  color: #f4a4a4;
}

@media (max-width: 640px) {
  .auth-button--signin {
    padding: 6px 12px;
    font-size: 11px;
    margin-right: 8px;
  }
  .auth-trigger {
    padding: 4px 10px 4px 4px;
    font-size: 11px;
    /* Stays transparent like every other nav item — on the homepage the nav
       floats over the hero video, and an opaque fill read as a black card
       stuck in the middle of the tabs. */
    background: transparent;
  }
  .auth-avatar {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .auth-label {
    /* Keep the word "Account" visible on mobile too — the avatar alone
       isn't obvious enough. */
    display: inline;
  }

  /* The account dropdown defaults to right: 0 (aligned to the button's
     right edge), which makes it overflow the viewport on the left when
     the button itself sits on the left side of the mobile nav. Re-anchor
     it to viewport-centre so it opens as a floating popover roughly in
     the middle of the screen on phones. */
  .auth-button .auth-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    z-index: 200;
    min-width: 260px;
    max-width: calc(100vw - 40px);
  }
}

/* ===== Auth forms (login / signup / profile) ===== */
.auth-shell {
  max-width: 440px;
  margin: 60px auto 120px;
  padding: 0 20px;
}

.auth-shell h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.auth-shell .auth-lede {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 32px;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-family: var(--sans);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 600;
}

.auth-field input,
.auth-field textarea {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s, background 0.2s;
}

.auth-field textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}

.auth-field input:focus,
.auth-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #1a1a1a;
}

.auth-submit {
  appearance: none;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-family: var(--sans);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.auth-submit:hover {
  background: #9fc2fb;
}

.auth-submit:active {
  transform: translateY(1px);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--text-muted);
  text-decoration: underline;
}

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

.auth-message {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 0;
}

.auth-message--error {
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.35);
  color: #f4a4a4;
}

.auth-message--success {
  background: rgba(80, 220, 160, 0.10);
  border: 1px solid rgba(80, 220, 160, 0.30);
  color: #9fefc4;
}

.auth-message--info {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ===== Per-entry Save + Share actions ===== */
.entry-save-btn,
.entry-share-btn {
  appearance: none;
  margin-left: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  border-radius: 0;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.entry-save-btn:hover,
.entry-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.entry-save-btn.is-saved {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(122, 162, 247, 0.1);
}

.entry-share-btn.just-copied {
  color: var(--accent);
  border-color: var(--accent);
}

.entry-save-btn:disabled,
.entry-share-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== Saved-entries page ===== */
.saved-filters {
  display: grid;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.saved-row {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.saved-row-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.saved-row-title {
  flex: 1 1 auto;
  min-width: 260px;
}

.saved-row-title h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.saved-row-title h3 a {
  color: var(--text);
}

.saved-row-title h3 a:hover {
  color: var(--accent);
}

.saved-row-meta {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.saved-row-meta .strength-basic { color: var(--basic); }
.saved-row-meta .strength-moderate { color: var(--moderate); }
.saved-row-meta .strength-strong { color: var(--strong); }

.saved-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.saved-note-preview {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-left: 2px solid var(--accent);
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.saved-note-editor {
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--border);
  background: var(--panel);
}
.saved-note-editor[hidden] { display: none; }
.saved-note-editor textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}
.saved-note-editor textarea:focus { outline: none; border-color: var(--accent); }

/* ===== Compare page ===== */
.compare-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.compare-hero {
  margin-bottom: 28px;
}

.compare-hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: -0.025em;
  margin: 0 0 10px;
}

.compare-hero p {
  color: var(--text-muted);
  max-width: 720px;
  margin: 0;
}

.compare-panes {
  display: grid;
  grid-template-columns: var(--compare-left-w, 1fr) 20px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

/* The 20px middle column is the drag-to-resize splitter. A faint 1px line
   always shows so users can see where to grab; thickens to accent on
   hover/drag. ::after extends the hit area slightly. */
.compare-panes > .splitter {
  cursor: col-resize;
  background: transparent;
  user-select: none;
  touch-action: none;
  position: relative;
  z-index: 2;
}
.compare-panes > .splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--border);
  pointer-events: none;
  transition: background 0.15s, width 0.15s;
}
.compare-panes > .splitter:hover::before,
.compare-panes > .splitter:focus-visible::before,
.compare-panes > .splitter.is-dragging::before {
  background: var(--accent);
  width: 3px;
}
.compare-panes > .splitter:focus-visible { outline: none; }

.compare-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  min-height: 85vh;
}

.compare-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.compare-source,
.compare-search {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 0;
}
.compare-source { font-weight: 600; letter-spacing: 0.02em; }
.compare-source:focus,
.compare-search:focus { outline: none; border-color: var(--accent); }

.compare-search-wrap {
  position: relative;
}

.compare-search-results {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--accent);
  z-index: 20;
  font-size: 13px;
}

.compare-search-results[hidden] { display: none; }

.compare-search-result {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  line-height: 1.45;
  text-align: left;
  background: transparent;
  border-left: none;
  border-right: none;
  width: 100%;
  font-family: inherit;
}
.compare-search-result:last-child { border-bottom: none; }
.compare-search-result:hover {
  background: var(--panel-2);
  color: var(--accent);
}
.compare-search-result .ref {
  display: block;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.compare-search-result .snippet {
  color: var(--text-muted);
  display: block;
}
.compare-search-result mark {
  background: rgba(122, 162, 247, 0.25);
  color: var(--text);
  padding: 0 2px;
}
.compare-search-status {
  padding: 10px 14px;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

.compare-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 80vh;
  border: none;
  background: var(--bg);
}

/* Stack panes vertically on narrow viewports. */
@media (max-width: 900px) {
  .compare-panes {
    grid-template-columns: 1fr;
    gap: 20px;
    /* Break out of .compare-main's side padding so panes fill the screen. */
    margin-left: -24px;
    margin-right: -24px;
  }
  .compare-panes > .splitter {
    display: none;
  }
  .compare-pane {
    min-height: 75vh;
    border-left: none;
    border-right: none;
  }
}

/* Brief pulse applied inside the iframe when a search result is jumped to. */
@keyframes compare-jump-flash {
  0%   { background: rgba(122, 162, 247, 0.38); }
  100% { background: transparent; }
}

/* ===== Build tab — landing (how-this-works + my builds) ===== */
.build-how {
  margin-top: 48px;
}

.build-how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.build-how-step {
  padding: 28px 24px;
  border-right: 1px solid var(--border);
  position: relative;
}

.build-how-step:last-child {
  border-right: none;
}

.build-how-num {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.build-how-step h3 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.build-how-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.build-mybuilds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 72px 0 24px;
  flex-wrap: wrap;
}

.build-mybuilds-header h2 {
  font-family: var(--serif);
  font-size: 32px;
  margin: 0;
}

.build-create-btn {
  white-space: nowrap;
}

.build-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.build-card {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 0.2s;
}

.build-card:last-child {
  border-bottom: none;
}

.build-card:hover {
  background: var(--panel);
}

.build-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.build-card-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  flex: 1 1 auto;
  min-width: 200px;
}

.build-card-title a {
  color: var(--text);
}

.build-card-title a:hover {
  color: var(--accent);
}

.build-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.build-action {
  appearance: none;
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  text-decoration: none;
  border-radius: 0;
}

.build-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.build-action-danger:hover {
  border-color: #f4a4a4;
  color: #f4a4a4;
}

.build-card-meta {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.build-card-preview {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.build-card-preview--empty {
  color: var(--text-dim);
  font-style: italic;
}

.build-card-share-url {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--panel);
  border-left: 2px solid var(--accent);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.build-card-share-url input {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
}

/* ===== Build tab — editor ===== */
.build-editor-main {
  /* Full-bleed workspace: override the default main 1200px max-width
     and tight padding so the two panes have room. */
  max-width: 100%;
  padding: 16px 16px 32px;
}

.build-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.build-bar-name {
  flex: 1 1 280px;
  min-width: 220px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: 0;
}

.build-bar-name:focus {
  outline: none;
  border-color: var(--accent);
}

.build-bar-status {
  flex: 1 1 180px;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  min-width: 140px;
}

.build-bar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Small reminder under the build bar. Arabic / Hebrew selections track
   script direction — dragging left-to-right across RTL text gives a
   jumpy, partial highlight; dragging right-to-left just works. */
.build-tip {
  font-size: 11px;
  color: var(--text-dim);
  padding: 8px 14px;
  margin-bottom: 10px;
  border-left: 2px solid var(--accent);
  background: var(--panel);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.build-tip strong {
  color: var(--text-muted);
  font-weight: 700;
}

.build-panes {
  display: grid;
  grid-template-columns: var(--build-left-w, 1fr) 14px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: 78vh;
}

.build-panes > .splitter {
  cursor: col-resize;
  background: transparent;
  user-select: none;
  touch-action: none;
  position: relative;
  z-index: 2;
}
.build-panes > .splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--border);
  pointer-events: none;
  transition: background 0.15s, width 0.15s;
}
.build-panes > .splitter:hover::before,
.build-panes > .splitter:focus-visible::before,
.build-panes > .splitter.is-dragging::before {
  background: var(--accent);
  width: 3px;
}
.build-panes > .splitter:focus-visible { outline: none; }

.build-pane {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  min-height: 78vh;
  position: relative;
}

.build-pane-editor {
  position: relative;
}

/* Quill's injected toolbar sits in our editor-toolbar slot. */
.build-pane-editor .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.build-pane-editor .ql-container.ql-snow {
  border: 0;
  flex: 1;
  min-height: 68vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
}

.build-pane-editor .ql-editor {
  min-height: 68vh;
  padding: 24px 28px;
  line-height: 1.7;
}

.build-pane-editor .ql-editor.ql-blank::before {
  color: var(--text-dim);
  font-style: italic;
  left: 28px;
  right: 28px;
}

/* Quill toolbar visual tweak for dark theme — force icon colors white. */
.build-pane-editor .ql-snow .ql-stroke,
.build-pane-editor .ql-snow .ql-stroke-miter { stroke: var(--text-muted); }
.build-pane-editor .ql-snow .ql-fill { fill: var(--text-muted); }
.build-pane-editor .ql-snow .ql-picker { color: var(--text-muted); }
.build-pane-editor .ql-snow button:hover .ql-stroke,
.build-pane-editor .ql-snow button.ql-active .ql-stroke,
.build-pane-editor .ql-snow .ql-picker-label:hover,
.build-pane-editor .ql-snow .ql-picker-label.ql-active { color: var(--accent); }
.build-pane-editor .ql-snow button:hover .ql-stroke,
.build-pane-editor .ql-snow button.ql-active .ql-stroke { stroke: var(--accent); }
.build-pane-editor .ql-snow .ql-picker-options {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}
.build-pane-editor .ql-snow .ql-picker-item {
  color: var(--text-muted);
}
.build-pane-editor .ql-snow .ql-picker-item:hover,
.build-pane-editor .ql-snow .ql-picker-item.ql-selected {
  color: var(--accent);
  background: rgba(122, 162, 247, 0.08);
}
.build-pane-editor .ql-snow .ql-picker.ql-expanded .ql-picker-label {
  border-color: var(--accent);
}
/* The colour / background pickers draw tiny coloured squares; their
   wrapper needs the dark tile treatment too. */
.build-pane-editor .ql-snow.ql-toolbar .ql-color-picker .ql-picker-options,
.build-pane-editor .ql-snow.ql-toolbar .ql-background .ql-picker-options {
  padding: 6px;
  min-width: 180px;
}

/* Link + video tooltip — Quill's default is white-on-white-ish, which
   disappears on our dark editor. Rewire for the dark theme. */
.build-pane-editor .ql-snow .ql-tooltip {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-lg);
  z-index: 50;
}
.build-pane-editor .ql-snow .ql-tooltip::before {
  color: var(--text-muted);
}
.build-pane-editor .ql-snow .ql-tooltip input[type="text"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 8px;
}
.build-pane-editor .ql-snow .ql-tooltip input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}
.build-pane-editor .ql-snow .ql-tooltip a.ql-action,
.build-pane-editor .ql-snow .ql-tooltip a.ql-remove {
  color: var(--accent);
}
.build-pane-editor .ql-snow .ql-tooltip a.ql-action::after {
  border-right-color: var(--border);
}

/* Source pane reuses .compare-toolbar / .compare-frame from above. */
.build-pane-source .compare-frame {
  min-height: 68vh;
}

.build-source-hint {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 2px 0;
}

/* Right-click formatting toolbar (appears on contextmenu over any
   non-collapsed selection, and on mobile tap over a non-Latin word).
   Mirrors the capabilities of the top Quill toolbar in a compact
   floating popover anchored at the click/tap location. */
.build-format-menu {
  position: absolute;
  z-index: 40;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 8px;
  min-width: 280px;
  max-width: 420px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.build-format-menu[hidden] { display: none; }

.bfm-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.bfm-row[hidden] { display: none; }

.bfm-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 2px 4px;
}

.bfm-btn {
  appearance: none;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  padding: 4px 8px;
  min-width: 30px;
  height: 28px;
  font-size: 13px;
  font-family: var(--sans);
  cursor: pointer;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.bfm-btn:hover {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--accent);
}
.bfm-btn:active {
  background: var(--bg);
}

.bfm-sel {
  appearance: none;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--sans);
  height: 28px;
  cursor: pointer;
  border-radius: var(--radius-lg);
  min-width: 90px;
}
.bfm-sel:hover,
.bfm-sel:focus {
  border-color: var(--accent);
  outline: none;
}

/* Native colour picker — we hide the swatch control itself and show a
   small letter (A / H) as the affordance, while the invisible input
   covers the whole label so clicking it opens the browser's picker. */
.bfm-color-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
}
.bfm-color-picker:hover {
  background: var(--panel-2);
  border-color: var(--border);
}
.bfm-color-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
}
.bfm-highlight-picker .bfm-color-label {
  text-decoration: underline;
  text-decoration-color: #ffd24d;
  text-decoration-thickness: 3px;
  text-underline-offset: 2px;
}
.bfm-color-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  border: 0;
  cursor: pointer;
  padding: 0;
  background: transparent;
  width: 100%;
  height: 100%;
}

.bfm-translate-row {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.bfm-translate-btn {
  appearance: none;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  font-family: var(--sans);
  border-radius: var(--radius-lg);
  width: 100%;
}
.bfm-translate-btn:hover { background: var(--accent-hover); }

.build-translate-result {
  position: absolute;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--accent);
  /* Extra right padding reserves room for the close X so it never
     overlaps the translation text. */
  padding: 10px 30px 10px 12px;
  max-width: 340px;
  min-width: 200px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  max-height: 220px;
  overflow: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.build-translate-result[hidden] { display: none; }

.build-translate-close {
  position: absolute;
  top: 2px;
  right: 4px;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  font-family: var(--sans);
}
.build-translate-close:hover {
  color: var(--text);
}

.build-translate-text {
  margin: 0 0 10px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.build-translate-copy {
  appearance: none;
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  font-family: var(--sans);
}
.build-translate-copy:hover { background: var(--accent-hover); }
.build-translate-copy[hidden] { display: none; }

/* Desktop: lock the whole workspace to the viewport so each pane scrolls
   INDEPENDENTLY inside its own box instead of growing the page (which coupled
   the two columns — scrolling the source dragged the editor and vice-versa). */
@media (min-width: 901px) {
  .build-editor-main {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 44px); /* viewport minus the sticky nav */
    box-sizing: border-box;
    /* Trim the workspace chrome so the two panes get as much room as possible. */
    padding: 4px 10px 6px;
  }
  /* Compact the name-bar and RTL tip (padding + gaps) so the panes grow taller. */
  .build-bar { margin-bottom: 6px; padding: 7px 14px; }
  .build-bar-name { padding: 6px 10px; }
  .build-tip { margin-bottom: 4px; padding: 5px 12px; }
  /* The editor markup lives inside this wrapper, so the flex chain must pass
     THROUGH it — otherwise .build-panes can't fill the height and the panes
     collapse to their content (short columns with dead space below). */
  #build-editor-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
  .build-panes {
    flex: 1 1 auto;
    min-height: 0;      /* allow the grid to shrink so children can scroll */
    height: auto;
  }
  .build-pane {
    min-height: 0;      /* override the base 78vh so the pane fits its box */
    overflow: hidden;   /* the pane clips; its inner region scrolls */
  }
  /* Editor: Quill's own .ql-editor (height:100%, overflow-y:auto) scrolls once
     the container is height-bounded. */
  .build-pane-editor .ql-container.ql-snow {
    flex: 1 1 auto;
    min-height: 0;
  }
  .build-pane-editor .ql-editor {
    min-height: 0;
  }
  /* Source: the iframe fills the pane below its toolbar and scrolls natively. */
  .build-pane-source .compare-frame {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
}

@media (max-width: 900px) {
  .build-panes {
    grid-template-columns: 1fr;
    gap: 14px;
    /* Break out of .build-editor-main's side padding so panes fill the screen. */
    margin-left: -16px;
    margin-right: -16px;
  }
  .build-panes > .splitter {
    display: none;
  }
  .build-pane {
    min-height: 60vh;
    border-left: none;
    border-right: none;
  }
  .build-pane-editor .ql-editor,
  .build-pane-editor .ql-container.ql-snow,
  .build-pane-source .compare-frame {
    min-height: 55vh;
  }
}

/* ===== Build tab — save / share modal overlay ===== */
.build-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.build-modal-overlay[hidden] { display: none; }

.build-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 28px 32px;
  min-width: 320px;
  max-width: 520px;
  width: 100%;
}

.build-modal h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.build-modal-body p {
  color: var(--text-muted);
  font-size: 14px;
}

.build-modal-body input[type="text"] {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  margin-top: 6px;
}

.build-modal-body input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.build-modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ===== Build tab — shared viewer ===== */
.build-shared-wrap {
  max-width: 820px;
  margin: 48px auto 120px;
  padding: 0 24px;
}

.build-shared-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.build-shared-header h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.build-shared-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  font-weight: 600;
}

.build-shared-body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
}

.build-shared-body .ql-editor {
  padding: 28px 32px;
  min-height: 180px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

.build-shared-cta {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* ===== Profile page — avatar, sections, shares, danger zone ===== */

/* The nav avatar now also renders an uploaded image; cover-fill inside
   the existing circle. */
.auth-avatar--img {
  background: transparent;
  overflow: hidden;
}

.auth-avatar--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-menu-handle {
  padding: 14px 18px 4px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.auth-menu-handle + .auth-menu-email {
  padding-top: 0;
  border-top: 0;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
  color: var(--text-dim);
}

/* Small per-field hint under username inputs. */
.auth-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 1em;
}

.auth-hint--info    { color: var(--text-dim); }
.auth-hint--success { color: #78c07a; }
.auth-hint--error   { color: #f4a4a4; }

/* Profile header: avatar + identity block. */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 32px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
}

.profile-avatar--sm {
  width: 72px;
  height: 72px;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-initial {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 34px;
  text-transform: uppercase;
  line-height: 1;
}

.profile-avatar--sm .profile-avatar-initial {
  font-size: 28px;
}

.profile-header-text {
  min-width: 0;
}

.profile-header-name {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 2px;
}

.profile-header-email {
  color: var(--text-muted);
  font-size: 14px;
  word-break: break-all;
}

.profile-header-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Profile sections (avatar, username, shares, password, deactivate). */
.profile-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.profile-section h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}

.profile-section-lede {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 18px;
}

/* Avatar row on the Profile page — preview + actions. */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-avatar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-avatar-actions .btn {
  cursor: pointer;
}

/* Ghost-style button for destructive-but-minor actions (remove avatar). */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Danger-colored button variant used on Revoke and Deactivate. */
.btn-danger {
  color: #f4a4a4;
  border-color: #553333;
}

.btn-danger:hover {
  color: #ffd4d4;
  border-color: #884444;
}

.auth-submit--danger {
  background: #7a2b2b;
  border-color: #8f3838;
}

.auth-submit--danger:hover {
  background: #8f3838;
}

.auth-submit--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Share-link rows reused from the older profile layout. */
.profile-share-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.profile-share-row:last-child {
  border-bottom: 0;
}

.profile-share-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-share-meta {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.profile-share-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.profile-share-controls input {
  flex: 1 1 320px;
  min-width: 0;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}

/* Danger zone — visually offset so it doesn't blend with neutral sections. */
.profile-section--danger {
  border-color: rgba(220, 80, 80, 0.35);
  background: rgba(220, 80, 80, 0.04);
  padding: 24px;
  border-radius: var(--radius);
  border-left: 3px solid #a04444;
}

.profile-section--danger h2 {
  color: #f4a4a4;
}

.profile-section--danger code {
  background: rgba(220, 80, 80, 0.15);
  color: #f4a4a4;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}

/* ============================================================
   GOAT PAGE  (/goat.html)
   ============================================================ */

.goat-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.goat-page-back {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.goat-page-title {
  font-family: var(--serif);
  font-size: 38px;
  margin: 8px 0 4px;
}
.goat-page-tagline {
  color: var(--muted);
  margin: 0 0 28px;
}
.goat-page-tagline a { color: var(--accent); }
.goat-page-tagline a:hover { color: var(--accent-hover); }

.goat-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  align-items: start;
}

@media (max-width: 900px) {
  .goat-page-grid {
    grid-template-columns: 1fr;
  }
  .goat-stage {
    padding: 16px;
    min-height: 320px;
  }
  .goat-big {
    width: min(360px, 100%);
    height: auto;
    aspect-ratio: 6 / 5;
  }
}
@media (max-width: 480px) {
  .goat-page {
    padding-left: 12px;
    padding-right: 12px;
  }
  .goat-page-grid {
    gap: 16px;
  }
  .skins-grid {
    gap: 8px;
  }
}

.goat-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}
/* ---- Big-goat stage ---- */
.goat-stage {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 460px;
}

.goat-stage-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.goat-stage-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 16px 0 0;
}

.goat-big {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  width: 360px;
  height: 300px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.goat-big:focus { outline: none; }
.goat-big:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.goat-big .goat-svg-big {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  overflow: visible;
}

/* The big goat reuses the same animation classes as the nav goat
   (.is-screaming, .is-chewing, .is-stretching) and the same keyframes
   already defined further up the file. */
.goat-big .goat-mouth-open   { display: none; }
.goat-big .goat-mouth-closed { display: block; }
.goat-big.is-screaming .goat-mouth-open   { display: block; }
.goat-big.is-screaming .goat-mouth-closed { display: none; }

.goat-big .goat-body {
  transform-box: fill-box;
  transform-origin: 80% 100%;
  transition: transform 0.2s ease-out;
}
.goat-big.is-screaming .goat-body {
  animation: goat-shake 1.6s steps(48) 0s 1;
  transform-origin: 50% 60%;
}
.goat-big.is-chewing .goat-body {
  animation: goat-chew 3s ease-in-out 1;
  transform-origin: 85% 100%;
}
.goat-big.is-stretching .goat-body {
  animation: goat-stretch 3s ease-in-out 1;
  transform-origin: 85% 100%;
}

/* Quran-eater: mouth-page (page in mouth) is hidden by default. */
.goat-big .goat-mouth-page,
.skin-preview .goat-mouth-page {
  display: none;
}
.goat-big.qe-rise .goat-mouth-page,
.goat-big.qe-chew .goat-mouth-page,
.goat-big.qe-swallow .goat-mouth-page {
  display: block;
}

/* Quran-eater: torn page on the book disappears once it's been bitten off. */
.goat-big.qe-bite .goat-quran-page,
.goat-big.qe-tear .goat-quran-page,
.goat-big.qe-rise .goat-quran-page,
.goat-big.qe-chew .goat-quran-page,
.goat-big.qe-swallow .goat-quran-page {
  visibility: hidden;
}

/* ============================================================
   QURAN-EATING ANIMATION CHAIN  (slot 10 reward)

   Six discrete CSS-driven phases triggered by goat-page.js adding
   qe-* classes in order. Total chain ~2.4 seconds.

   Phase 1  qe-stoop    0–400ms   anticipation tilt + dip
   Phase 2  qe-bite     400–700ms full stoop, head touches the page
   Phase 3  qe-tear     700–1100ms snap-back rip, page disappears from book
   Phase 4  qe-rise     1100–1500ms upright + page appears in mouth
   Phase 5  qe-chew     1500–2000ms cheek-bulge chewing bobs
   Phase 6  qe-swallow  2000–2400ms vertical squash gulp, page goes
   ============================================================ */

.goat-big.is-eating-quran .goat-body {
  transform-origin: 85% 100%;
  animation: none;
}

.goat-big.qe-stoop .goat-body    { animation: qe-stoop 400ms ease-in-out forwards; }
.goat-big.qe-bite  .goat-body    { animation: qe-bite  300ms ease-in-out forwards; }
.goat-big.qe-tear  .goat-body    { animation: qe-tear  400ms ease-out    forwards; }
.goat-big.qe-rise  .goat-body    { animation: qe-rise  400ms ease-out    forwards; }
.goat-big.qe-chew  .goat-body    { animation: qe-chew-bulge 500ms ease-in-out forwards; }
.goat-big.qe-swallow .goat-body  { animation: qe-swallow 400ms ease-in-out forwards; }

@keyframes qe-stoop {
  0%   { transform: rotate(0deg)   translateY(0); }
  100% { transform: rotate(-26deg) translateY(2px); }
}
@keyframes qe-bite {
  0%   { transform: rotate(-26deg) translateY(2px); }
  60%  { transform: rotate(-38deg) translateY(4px); }
  100% { transform: rotate(-34deg) translateY(3px); }
}
@keyframes qe-tear {
  0%   { transform: rotate(-34deg) translateY(3px); }
  35%  { transform: rotate(-44deg) translateY(2px) translateX(1px); }
  70%  { transform: rotate(-22deg) translateY(0)   translateX(-1px); }
  100% { transform: rotate(-12deg) translateY(0); }
}
@keyframes qe-rise {
  0%   { transform: rotate(-12deg) translateY(0); }
  100% { transform: rotate(0deg)   translateY(0); }
}
@keyframes qe-chew-bulge {
  0%   { transform: rotate(0deg)   scale(1, 1); }
  20%  { transform: rotate(-3deg)  scale(1.04, 0.98); }
  40%  { transform: rotate(2deg)   scale(0.99, 1.02); }
  60%  { transform: rotate(-2deg)  scale(1.04, 0.98); }
  80%  { transform: rotate(1deg)   scale(0.99, 1.02); }
  100% { transform: rotate(0deg)   scale(1, 1); }
}
@keyframes qe-swallow {
  0%   { transform: rotate(0deg)  scale(1,    1); }
  40%  { transform: rotate(0deg)  scale(0.94, 1.10); }
  70%  { transform: rotate(0deg)  scale(1.04, 0.94); }
  100% { transform: rotate(0deg)  scale(1, 1); }
}

/* ---- Skin SIDE column ---- */
.goat-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.goat-page .card {
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.card-head {
  margin-bottom: 12px;
}
.card-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.card-sub {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
/* The `hidden` attribute must win over the grid display above, otherwise the
   skins leak through to signed-out visitors before the auth gate paints. */
.skins-grid[hidden] { display: none; }

.skin-slot {
  position: relative;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.skin-slot.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.skin-slot.is-highlight {
  animation: skin-highlight 2.4s ease-out 1;
}
@keyframes skin-highlight {
  0%, 30% { border-color: var(--accent); box-shadow: 0 0 14px var(--accent); }
  100%    { border-color: var(--border); box-shadow: 0 0 0 0 transparent; }
}

.skin-preview {
  width: 72px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.skin-preview .goat-svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  overflow: visible; /* hats/crowns/halos extend above the viewBox */
}

.skin-slot.is-locked .skin-preview {
  filter: brightness(0) saturate(0) opacity(0.45);
}
.skin-slot.is-locked .skin-name,
.skin-slot.is-locked .skin-blurb {
  visibility: hidden;
}

.skin-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.skin-blurb {
  font-size: 11px;
  color: var(--muted);
  min-height: 28px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.skin-action {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.skin-action:not(:disabled):hover {
  border-color: var(--accent);
}
.skin-action:disabled {
  cursor: default;
  opacity: 0.7;
}
.skin-action.is-selected {
  border-color: var(--accent);
  background: rgba(204,120,92,0.18);
  color: var(--accent);
  opacity: 1;
}

.skin-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.skin-lock-overlay .lock-glyph {
  font-size: 22px;
  opacity: 0.65;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
}

/* ---- Play card ---- */
.play-card {
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.play-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.play-card-cta {
  display: inline-block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}


/* ============================================================
   PLAY PAGE  (/play.html)
   ============================================================ */

.play-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.play-page-back {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.play-page-title {
  font-family: var(--serif);
  font-size: 36px;
  margin: 8px 0 4px;
}
.play-auth-gate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 32px 0 0;
}
.play-auth-message {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
}

.play-page-tagline {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 720px;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 760px) {
  .levels-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .levels-grid { grid-template-columns: 1fr; }
}

.level-tile {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 18px 14px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, opacity 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 140px;
}
.level-tile:not(:disabled):hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.level-tile.is-locked {
  cursor: not-allowed;
  opacity: 0.55;
}

.level-num {
  font-family: var(--serif);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.level-title {
  font-size: 17px;
  font-weight: 600;
}
.level-blurb {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  flex: 1;
}
.level-foot { margin-top: 6px; }
.level-tag {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.level-tag.is-ready    { color: var(--accent); border-color: var(--accent); }
.level-tag.is-cleared  { color: #6abf6a; border-color: #6abf6a; }
.level-tag.is-locked   { color: var(--muted); }

/* ---- Reset tile (compact bar, visually distinct from level cards) ---- */
.reset-tile {
  appearance: none;
  background: #000;
  border: 1px solid #3a1a1a;
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  align-self: start;
}
.reset-tile:hover {
  border-color: #c0392b;
  opacity: 0.85;
}
.reset-tile-title {
  font-size: 12px;
  font-weight: 600;
  color: #c0392b;
  white-space: nowrap;
}
.reset-tile-sub {
  font-size: 11px;
  color: var(--muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reset-tile-warn {
  font-size: 13px;
  color: #c0392b;
  opacity: 0.6;
  margin-left: auto;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .reset-tile {
    margin-top: 12px;
  }
}

/* ---- Quiz card ---- */
.quiz-view { max-width: 760px; margin: 0 auto; }
.quiz-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.quiz-head h2 {
  margin: 0;
  flex: 1;
  font-family: var(--serif);
  font-size: 22px;
}
.quiz-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 180px;
}
.quiz-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 28px 20px;
}
.quiz-question {
  font-size: 19px;
  line-height: 1.45;
  margin: 0 0 6px;
}
.quiz-ref {
  font-size: 11px;
  color: var(--text-dim, #777);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px;
}
.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.quiz-choice {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.quiz-choice:hover {
  border-color: var(--accent);
  background: rgba(204,120,92,0.08);
}
.quiz-choice:focus {
  outline: none;
  border-color: var(--border);
}
.quiz-choice:focus .quiz-choice-letter {
  background: var(--border);
  color: var(--text);
}
.quiz-choice-letter {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--serif);
  flex-shrink: 0;
}
.quiz-choice:hover .quiz-choice-letter {
  background: var(--accent);
  color: #fff;
}

.quiz-source {
  margin-top: 14px;
  font-size: 13px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.quiz-source a {
  color: var(--accent);
  text-decoration: none;
}
.quiz-source a:hover { color: var(--accent-hover); text-decoration: underline; }

.quiz-error {
  color: #f4a4a4;
  background: rgba(220,80,80,0.12);
  padding: 12px 14px;
  border-radius: 6px;
}


/* ============================================================
   RESULT MODAL  (pass / fail)
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modal-fade 0.2s ease-out;
}
.modal-backdrop[hidden] { display: none; }
@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: modal-pop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modal-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.result-title {
  font-family: var(--serif);
  font-size: 32px;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
  text-transform: uppercase;
}
.result-title.is-pass { color: #6abf6a; }
.result-title.is-fail { color: #e25555; }

.result-body {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}
.result-body strong { color: var(--text); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.result-actions .btn {
  min-width: 140px;
}

/* Ghost button variant used in quiz header */
.btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

