/* ============ Design tokens (mirror of web/landing/styles.css :root) ============ */
:root {
  --bg: #0A1512;
  --bg-elev: #111D18;
  --bg-elev-2: #15221C;
  --border: #1E2E27;
  --border-strong: #2A3D34;
  --text: #F2F5F3;
  --text-dim: #B4C1BB;
  --text-mute: #8A9892;

  --wa-green: #25D366;
  --wa-green-deep: #128C7E;
  --accent: #00CC66;
  --accent-2: #7FE7B5;

  --danger: #FF4444;
  --warn: #FFB020;

  --radius-card: 22px;
  --radius-pill: 999px;

  --shadow-soft: 0 2px 12px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-glow: 0 0 0 1px rgba(0,204,102,0.18), 0 18px 60px -20px rgba(0,204,102,0.35);

  --ff-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 17px;
  --fs-md: 19px;
  --fs-lg: 22px;
  --fs-xl: 28px;
  --fs-2xl: 36px;
  --fs-3xl: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  min-height: 100vh;
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0,204,102,0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(18,140,126,0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
img, svg { display: block; max-width: 100%; }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
}
@media (min-width: 720px) { .nav-inner { padding: 14px 24px; } }

.brand {
  display: inline-flex; align-items: center;
}
.brand:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; border-radius: 4px; }
.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}
@media (min-width: 720px) {
  .brand-logo { height: 30px; }
}

.btn-wa-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  transition: border-color 160ms ease, background 160ms ease;
}
@media (hover: hover) {
  .btn-wa-ghost:hover { border-color: var(--wa-green); }
}
.btn-wa-ghost:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.btn-wa-ghost .wa-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--wa-green);
  box-shadow: 0 0 8px var(--wa-green);
  flex-shrink: 0;
}

/* ============ Page container ============ */
.page {
  padding: 48px 16px;
}
@media (min-width: 720px) {
  .page { padding: 80px 24px; }
}
.page-inner { width: 100%; }
@media (min-width: 720px) {
  .page-inner { max-width: 720px; margin: 0 auto; }
}

/* ============ Hero ============ */
.hero-h1 {
  font-family: var(--ff-sans);
  font-weight: 700;
  font-size: var(--fs-2xl);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
  color: var(--text);
}
@media (min-width: 720px) {
  .hero-h1 { font-size: var(--fs-3xl); line-height: 1.10; text-align: center; }
}
.hero-sub {
  margin: 12px 0 0;
  font-size: var(--fs-md);
  color: var(--text-dim);
  font-weight: 500;
  line-height: 1.4;
}
@media (min-width: 720px) {
  .hero-sub { text-align: center; }
}

/* ============ Paste input (C-02) ============ */
.paste-wrap { margin-top: 32px; }
@media (min-width: 720px) { .paste-wrap { margin-top: 48px; } }

.paste-form { margin: 0; }

.paste-input {
  position: relative;
  min-height: 56px;
  display: flex;
  align-items: flex-start;
  padding: 8px 8px 8px 16px;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  transition: border-color 120ms ease, box-shadow 200ms ease, border-radius 120ms ease;
}
/* Single-line content keeps the original pill silhouette; the wrapper
   stays pill-radius until the textarea grows past one line, at which
   point JS hasn't toggled anything but border-radius is already 22px
   so the visual is identical regardless. */
.paste-input:focus-within { border-color: var(--border-strong); }
.paste-input.is-valid { border-color: var(--accent); }
.paste-input.is-invalid { border-color: var(--danger); }
.paste-input.is-loading { border-color: var(--accent); opacity: 0.96; }

.paste-input-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--ff-mono);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: 0.04em;
  color: var(--text);
  text-transform: uppercase;
  padding: 0;
  min-width: 0;
  resize: none;
  overflow-y: auto;
  /* Match the original 56px wrapper visual: line-height 38 + 8px
     padding above/below = 54, with 1.5px borders ≈ 56. */
  line-height: 38px;
  min-height: 38px;
  max-height: 260px;
}
.paste-input-field::placeholder {
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-mute);
  text-transform: none;
}
.paste-input.is-loading .paste-input-field { opacity: 0.6; }

.paste-submit {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  color: var(--text-mute);
  display: grid; place-items: center;
  transition: background 200ms, color 200ms, box-shadow 200ms;
  /* Pin to top so the submit button stays aligned with the first line
     of the textarea even as it grows. */
  align-self: flex-start;
  margin-top: -1px;
}
.paste-submit svg { width: 18px; height: 18px; }
.paste-submit:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.paste-input.is-valid .paste-submit,
.paste-input.is-loading .paste-submit {
  background: var(--accent);
  color: var(--bg);
  box-shadow: var(--shadow-glow);
}

/* spinner */
.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--bg) 50%, transparent);
  border-top-color: var(--bg);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Helper line ============ */
.helper {
  margin: 8px 0 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-mute);
  padding: 0 4px;
}
@media (min-width: 720px) {
  .helper { text-align: center; }
}
.helper.is-detected { color: var(--accent); font-weight: 600; }
.helper.is-invalid { color: var(--danger); font-weight: 500; }
.helper code {
  font-family: var(--ff-mono);
  font-size: 13px;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  color: var(--text);
}

/* ============ Section header (C-10) ============ */
.section-head {
  margin: 48px 0 12px;
  font-family: var(--ff-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  display: flex; align-items: center; gap: 12px;
}
@media (min-width: 720px) { .section-head { margin: 64px 0 16px; justify-content: center; } }
.section-head::before,
.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
@media (min-width: 720px) {
  .section-head::before,
  .section-head::after { max-width: 80px; }
}

/* ============ Recently-parsed list (C-09) ============ */
.parsed-list {
  display: flex; flex-direction: column;
  gap: 12px;
}
@media (min-width: 720px) {
  .parsed-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}
.parsed-row {
  display: block;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: border-color 160ms ease;
}
@media (hover: hover) {
  .parsed-row:hover { border-color: var(--border-strong); }
}
.parsed-row:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.parsed-row-line1 {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--ff-mono);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  text-transform: uppercase;
}
.live-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--ff-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--danger);
  text-transform: none;
}
.live-chip .live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
.parsed-row-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
  margin-top: 4px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.4;
}
.parsed-row-meta .num { font-family: var(--ff-mono); }
.parsed-row-ago {
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--text-mute);
  white-space: nowrap;
}

/* ============ Views (paste / parsed swap) ============ */
.view { animation: viewfade 180ms ease-out both; }
.view[hidden] { display: none !important; }
@keyframes viewfade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ============ Parsed view ============ */

.btn-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  font-weight: 500;
  background: transparent;
  transition: border-color 160ms ease, color 160ms ease;
}
.btn-back svg { width: 16px; height: 16px; }
@media (hover: hover) {
  .btn-back:hover { border-color: var(--border-strong); color: var(--text); }
}
.btn-back:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Hero block on parsed view */
.parsed-head { margin-top: 32px; text-align: left; }
@media (min-width: 720px) { .parsed-head { text-align: center; margin-top: 48px; } }

.parsed-book {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* Code block (C-01) — large */
.code-block {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev-2);
  border-radius: var(--radius-card);
  padding: 16px 32px;
}
.code-block-lg {
  min-width: 200px;
  padding: 20px 40px;
}
.code-block-text {
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: var(--fs-2xl);
  letter-spacing: 0.04em;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}
@media (min-width: 720px) {
  .code-block-text { font-size: var(--fs-3xl); }
}
.code-block-bracket {
  position: absolute;
  width: 12px; height: 12px;
  border: 1.5px solid var(--border-strong);
}
.bracket-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; border-top-left-radius: 4px; }
.bracket-br { bottom: -1px; right: -1px; border-left: none; border-top: none; border-bottom-right-radius: 4px; }

.parsed-meta {
  margin-top: 16px;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
}
.parsed-meta .num { font-family: var(--ff-mono); font-weight: 600; }

/* Section header inside parsed view */
.section-head-inner { justify-content: flex-start; }
@media (min-width: 720px) { .section-head-inner { justify-content: center; } }

/* Selections list (C-08) */
.selections-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.leg-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.leg-row:first-child { border-top: none; }
.leg-index {
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-mute);
  line-height: 1.4;
}
.leg-body { min-width: 0; }
.leg-teams {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.leg-market {
  margin-top: 2px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.4;
}
.leg-kickoff {
  margin-top: 4px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-mute);
}
.leg-kickoff.is-live {
  color: var(--danger);
  font-weight: 600;
}
.leg-odds {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  align-self: center;
}

/* WhatsApp CTA (C-07) */
.cta-wa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding: 16px 20px 16px 18px;
  height: 56px;
  background: var(--wa-green);
  color: #FFFFFF;
  font-family: var(--ff-sans);
  font-size: var(--fs-md);
  font-weight: 600;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, box-shadow 200ms ease;
}
@media (hover: hover) {
  .cta-wa:hover { transform: scale(1.02); box-shadow: 0 0 0 1px rgba(37,211,102,0.30), 0 18px 60px -20px rgba(37,211,102,0.45); }
}
.cta-wa:active { transform: scale(0.98); }
.cta-wa:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.cta-wa-glyph { width: 22px; height: 22px; flex-shrink: 0; color: #FFFFFF; }
.cta-wa-label { flex: 1; }
.cta-wa-arrow { width: 18px; height: 18px; flex-shrink: 0; }

.cta-wa-sub {
  margin: 10px 4px 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.5;
  text-align: left;
}
@media (min-width: 720px) { .cta-wa-sub { text-align: center; } }

/* Secondary action row (C-11) */
.parsed-secondary {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--ff-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease;
}
@media (hover: hover) {
  .btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
}
.btn-ghost:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn-ghost.is-success { border-color: var(--accent); color: var(--accent); }

/* ============ Code tools (status / analyse / best / convert) ============ */
/* Surfaces the codeweb API endpoints as inline action buttons under
   the parsed slip. Each button toggles a result panel below the
   grid. One panel at a time — clicking a second tool replaces the
   content; re-clicking the active tool closes the panel.

   The buttons sit between the selections list and the primary
   WhatsApp CTA so the funnel flow is: parse → explore tools →
   convert/book on WhatsApp. */

.tools {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.tools-head {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 14px;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 540px) {
  .tools-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-family: var(--ff-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
@media (hover: hover) {
  .tool-btn:hover { border-color: var(--border-strong); color: var(--text); }
}
.tool-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.tool-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 204, 102, 0.06);
}
.tool-btn-emoji {
  font-size: 22px;
  line-height: 1;
}
.tool-btn-label {
  font-size: var(--fs-sm);
}

.tool-panel {
  margin-top: 16px;
  padding: 18px 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  animation: viewfade 180ms ease-out;
}
.tool-panel[hidden] { display: none !important; }
.tool-panel-loading {
  text-align: center;
  color: var(--text-mute);
  font-size: var(--fs-sm);
  padding: 14px 0;
}
.tool-panel-error {
  color: #FF8080;
  font-size: var(--fs-sm);
  text-align: center;
  padding: 10px 0;
}

/* Status panel */
.status-verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 14px;
}
.status-verdict.is-ok   { background: rgba(0, 204, 102, 0.12); color: var(--accent); }
.status-verdict.is-warn { background: rgba(255, 196, 0, 0.12); color: #FFC400; }
.status-verdict.is-bad  { background: rgba(255, 80, 80, 0.12); color: #FF8080; }
.status-leg {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.status-leg:first-child { border-top: none; }
.status-leg-emoji { font-size: 18px; line-height: 1.4; flex-shrink: 0; }
.status-leg-body { min-width: 0; flex: 1; }
.status-leg-teams { color: var(--text); font-weight: 500; }
.status-leg-meta { color: var(--text-mute); font-size: var(--fs-xs); margin-top: 2px; }

/* Analyse panel */
.analyse-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 540px) {
  .analyse-grid { grid-template-columns: 1fr 1fr; }
}
.analyse-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.analyse-card-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.analyse-payout-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  color: var(--text);
  padding: 4px 0;
}
.analyse-payout-row .num-win { color: var(--accent); font-weight: 600; }
.analyse-market-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  padding: 4px 0;
  color: var(--text-dim);
}
.analyse-market-row .num { font-family: var(--ff-mono); color: var(--text); }
.analyse-leg-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.analyse-leg-info .num { font-family: var(--ff-mono); color: var(--text); }

/* Best-platform panel */
.bp-winner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(0, 204, 102, 0.12);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 14px;
}
.bp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.bp-row:first-child { border-top: none; }
.bp-row-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bp-row-prov { color: var(--text); font-weight: 600; }
.bp-row-prov .is-source { color: var(--text-mute); font-weight: 400; font-size: var(--fs-xs); }
.bp-row-meta { color: var(--text-mute); font-size: var(--fs-xs); }
.bp-row-odds { font-family: var(--ff-mono); font-weight: 600; color: var(--text); flex-shrink: 0; }
.bp-row.is-best { background: rgba(0, 204, 102, 0.04); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.bp-row.is-best .bp-row-odds { color: var(--accent); }

/* Convert panel */
.convert-targets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.convert-target-btn {
  flex: 1 1 auto;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--ff-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
@media (hover: hover) {
  .convert-target-btn:hover { border-color: var(--border-strong); color: var(--text); }
}
.convert-target-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.convert-result {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--accent);
}
.convert-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.convert-result-code {
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--accent);
}
.convert-result-miss {
  font-size: var(--fs-xs);
  color: #FFC400;
  margin-top: 6px;
}

.tool-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 0 16px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #0A1512;
  font-family: var(--ff-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: filter 160ms ease;
}
@media (hover: hover) {
  .tool-cta:hover { filter: brightness(1.08); }
}

/* ============ Rate-limit panel (429 surface) ============
   Rendered by rateLimitHTML(). Shown inline in two places:
     - inside .tool-panel when an API tool call hits the daily cap
     - inside .conflict-block (paste-box slot) when a fresh parse
       lands on a 429
   The visual leans warm (amber border, accent CTA) instead of
   red so the moment doesn't feel like an error — it's a funnel
   nudge, not a failure. */

.rl-card {
  text-align: center;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rl-icon {
  font-size: 38px;
  line-height: 1;
}
.rl-msg {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  max-width: 36ch;
}
.rl-reset {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  margin-top: 4px;
}

/* When the rate-limit card lands inside the conflict-block (paste
   page), give it the warm-toned card chrome the conflict block uses,
   so it sits naturally on the page. */
.conflict-block .rl-card {
  border: 1px solid #FFC400;
  border-radius: 16px;
  background: rgba(255, 196, 0, 0.04);
  padding: 18px 18px 22px;
}

/* ============ Share image modal ============ */
.share-modal {
  position: fixed; inset: 0;
  z-index: 60;
  display: grid; place-items: center;
  background: rgba(6, 11, 10, 0.78);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  padding: 16px;
  animation: viewfade 180ms ease-out;
}
.share-modal[hidden] { display: none !important; }

.share-modal-content {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 14px;
}

.share-modal-head {
  display: flex; align-items: center; justify-content: space-between;
}
.share-modal-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.share-modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-mute);
  border: 1px solid var(--border);
  transition: color 160ms ease, border-color 160ms ease;
  flex-shrink: 0;
}
.share-modal-close svg { width: 18px; height: 18px; }
@media (hover: hover) {
  .share-modal-close:hover { color: var(--text); border-color: var(--border-strong); }
}
.share-modal-close:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.share-modal-preview {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  background: var(--bg);
  object-fit: contain;
}

.share-modal-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-ghost.is-primary {
  border-color: var(--accent);
  color: var(--accent);
}
@media (hover: hover) {
  .btn-ghost.is-primary:hover { background: rgba(0,204,102,0.08); border-color: var(--accent); color: var(--accent); }
}

.share-modal-hint {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-mute);
  line-height: 1.5;
}

/* ============ Conflict surface (paste view) ============ */
.conflict-block {
  margin: 20px 0 0;
  padding: 16px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-card);
  animation: viewfade 200ms ease-out;
}
.conflict-block[hidden] { display: none !important; }

.conflict-title {
  font-family: var(--ff-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 10px;
}

.conflict-row {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255, 68, 68, 0.06);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.conflict-row:first-child { margin-top: 0; }
.conflict-row strong { color: var(--text); font-weight: 600; }
.conflict-row code {
  font-family: var(--ff-mono);
  font-size: 12.5px;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  color: var(--text);
}

/* Toast (network / 5xx) */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  padding: 12px 18px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  max-width: calc(100% - 32px);
}
.toast.is-error { border-color: color-mix(in oklab, var(--danger) 50%, var(--border-strong)); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .view { animation-duration: 1ms; }
  *, *::before, *::after {
    transition-duration: 1ms !important;
  }
}
