:root {
    --bg: #0a0b0f;
    --surface: #12141a;
    --surface-raised: #181b23;
    --border: #262a35;
    --text: #e7e9ee;
    --text-dim: #8a90a3;
    --accent: #22d3ee;
    --accent-dim: #22d3ee22;
    --buy: #34d399;
    --sell: #fb7185;
    --hold: #fbbf24;
}

[data-theme="light"] {
    --bg: #f2f3f7;
    --surface: #ffffff;
    --surface-raised: #eaecef;
    --border: #d4d6dd;
    --text: #1a1a2e;
    --text-dim: #6b6b7d;
    --accent: #0891b2;
    --accent-dim: #0891b222;
    --buy: #059669;
    --sell: #dc2626;
    --hold: #b45309;
}

body:has(#rl-page) {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

[data-theme="dark"] body:has(#rl-page) {
    background:
        radial-gradient(ellipse 1100px 600px at 85% -10%, #123b4233 0%, transparent 55%),
        radial-gradient(ellipse 900px 500px at 5% 30%, #123b4222 0%, transparent 60%),
        var(--bg);
}

#rl-page { font-family: "Inter", ui-sans-serif, system-ui, sans-serif; }

.rl-display { font-family: "Space Grotesk", "Inter", sans-serif; }
.rl-mono { font-family: "IBM Plex Mono", ui-monospace, "SF Mono", monospace; font-variant-numeric: tabular-nums; }

.rl-eyebrow {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ── Nav ─────────────────────────────────────────────── */
.rl-nav { border-bottom: 1px solid var(--border); }
.rl-nav a { color: var(--text-dim); transition: color 120ms; }
.rl-nav a:hover { color: var(--text); }

/* ── Hero ────────────────────────────────────────────── */
.rl-hero-trace {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--surface-raised), var(--surface));
    border: 1px solid var(--border);
}
.rl-hero-trace .rl-track {
    position: absolute;
    top: 0; left: 0; height: 100%;
    display: flex;
    will-change: transform;
    animation: rl-scroll 22s linear infinite;
}
.rl-hero-trace svg { display: block; height: 100%; }
@keyframes rl-scroll { from { transform: translateX(0); } to { transform: translateX(var(--rl-scroll-w, -1200px)); } }
@media (prefers-reduced-motion: reduce) {
    .rl-hero-trace .rl-track { animation: none; }
}
.rl-rupture-dot {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 999px;
    background: var(--buy);
    top: var(--y, 40px);
    transform: translate(-50%, -50%);
}
.rl-rupture-dot::after {
    content: "";
    position: absolute; inset: -7px;
    border-radius: 999px;
    background: inherit;
    opacity: 0.35;
    animation: rl-pulse 1.8s ease-out infinite;
}
@keyframes rl-pulse { 0% { transform: scale(0.6); opacity: 0.45; } 100% { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rl-rupture-dot::after { animation: none; display: none; } }

/* ── Cards / sections ────────────────────────────────── */
.rl-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.rl-section { padding-top: 5rem; padding-bottom: 5rem; }
.rl-divider { border-top: 1px solid var(--border); }

#beta {
    background: radial-gradient(ellipse 900px 500px at 50% 0%, var(--accent-dim) 0%, transparent 65%);
}

.rl-formula {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-family: "IBM Plex Mono", monospace;
    font-size: 1rem;
    overflow-x: auto;
}

.rl-axis-lane {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 1rem;
}
.rl-axis-lane .rl-axis-bar {
    height: 5rem;
    border-radius: 8px;
    background:
        repeating-linear-gradient(90deg, transparent, transparent 11px, var(--border) 11px, var(--border) 12px),
        var(--surface-raised);
    position: relative;
    overflow: hidden;
}
.rl-axis-lane .rl-axis-bar svg { display: block; width: 100%; height: 100%; }

/* ── Théorie : pipeline de dérivation ─────────────────── */
.rl-derivation { display: flex; flex-direction: column; }
.rl-derivation-step {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
}
.rl-derivation-arrow {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim);
    font-size: 1.1rem;
    padding: 0.35rem 0;
    transform: rotate(90deg);
}
@media (min-width: 640px) {
    .rl-derivation { flex-direction: row; align-items: stretch; gap: 0; }
    .rl-derivation-arrow { padding: 0 0.75rem; transform: rotate(0deg); }
}

/* ── Validation checklist ────────────────────────────── */
.rl-criterion {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.rl-criterion .rl-num {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.55;
}
.rl-criterion .rl-expected {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
    color: var(--buy);
}

/* ── Buttons ──────────────────────────────────────────── */
.rl-btn { border-radius: 9px; font-weight: 600; font-size: 0.9rem; padding: 0.75rem 1.35rem; transition: all 120ms; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; }
.rl-btn-primary { background: var(--accent); color: #04222b; border: none; }
.rl-btn-primary:hover { filter: brightness(1.1); }
.rl-btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.rl-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.rl-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.rl-input { background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: "IBM Plex Mono", monospace; padding: 0.6rem 0.75rem; width: 100%; }
.rl-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ── Auth modal ──────────────────────────────────────── */
.rl-modal-backdrop {
    position: fixed; inset: 0;
    background: #000000cc;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    z-index: 100;
}
.rl-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 1.75rem;
}
.rl-modal-tab { flex: 1; text-align: center; padding: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); border-bottom: 2px solid var(--border); cursor: pointer; }
.rl-modal-tab.active { color: var(--accent); border-color: var(--accent); }
.rl-field-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); display: block; margin-bottom: 0.35rem; }
.rl-hint { font-size: 0.72rem; color: var(--text-dim); }
.rl-error { font-size: 0.78rem; color: var(--sell); min-height: 1.1rem; }

a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
