/* 1AI TRADER — Blocs 3D (voir algo-3d.js) */
.a3d { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 78vh; }
.a3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; opacity: 0; transition: opacity .8s ease; }
.a3d.is-ready canvas { opacity: 1; }
.a3d::before { /* halo derrière l'objet */
  content: ""; position: absolute; inset: 8%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--algo-accent) 34%, transparent), transparent 72%);
  filter: blur(18px);
}
.a3d.is-failed::before { opacity: .5; }
.a3d--sm { max-width: 220px; margin-inline: auto; }

/* Bloc « histoire 3D » : la scène reste collée à l'écran pendant que le texte défile */
.a3d-story { position: relative; height: 320vh; overflow: visible !important; }
.a3d-story__sticky { position: sticky; top: calc(var(--algo-nav-h) + 12px); height: calc(100vh - var(--algo-nav-h) - 24px); display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.a3d-story__steps { position: relative; min-height: 300px; }
.a3d-story__step { position: absolute; inset-inline: 0; top: 46%; transform: translateY(-50%) translateY(24px); opacity: 0; transition: opacity .5s ease, transform .5s ease; pointer-events: none; }
.a3d-story__step.is-on { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
.a3d-story__dots { display: flex; gap: 8px; position: absolute; inset-inline-start: 0; bottom: 0; }
.a3d-story__dots i { width: 28px; height: 4px; border-radius: 4px; background: var(--algo-border); transition: background .3s ease; }
.a3d-story__dots i.is-on { background: var(--algo-accent); }
@media (max-width: 820px) {
  .a3d-story { height: 280vh; }
  .a3d-story__sticky { grid-template-columns: 1fr; grid-template-rows: 46% 1fr; gap: 8px; }
  .a3d { max-height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .a3d-story { height: auto; }
  .a3d-story__sticky { position: static; height: auto; }
  .a3d-story__step { position: static; opacity: 1; transform: none; margin-bottom: 20px; }
}

/* Carte « profondeur du marché » (pages Marchés et tableau de bord) */
.a3d-card { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: center; padding: 28px; margin-top: 28px; }
.a3d-card h2 { margin-top: 10px; font-size: 1.5rem; }
.a3d--wide { aspect-ratio: 16 / 10; max-height: 440px; }
@media (max-width: 820px) { .a3d-card { grid-template-columns: 1fr; padding: 20px; } .a3d--wide { aspect-ratio: 4 / 3; } }

/* Écran d'application illustratif (accueil) : dessiné en code, aucune donnée réelle */
.am-mock { display: flex; flex-direction: column; background: var(--algo-surface); color: var(--algo-ink); font-size: .78rem; overflow: hidden; }
.am-mock__bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; border-bottom: 1px solid var(--algo-border); }
.am-mock__live { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--algo-positive); }
.am-mock__live i { width: 8px; height: 8px; border-radius: 50%; background: var(--algo-positive); animation: amPulse 1.6s ease-in-out infinite; }
@keyframes amPulse { 50% { opacity: .35; transform: scale(.7); } }
.am-mock__tabs { display: flex; gap: 6px; padding: 10px 12px; overflow: hidden; }
.am-mock__tabs span { white-space: nowrap; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--algo-border); color: var(--algo-muted); font-weight: 600; }
.am-mock__tabs span.is-on { color: var(--algo-accent); border-color: var(--algo-accent); background: var(--algo-accent-soft); }
.am-mock__pair { display: flex; align-items: baseline; gap: 8px; padding: 4px 14px 8px; }
.am-mock__pair small { color: var(--algo-muted); }
.am-mock__plot { position: relative; flex: 1; min-height: 0; margin: 0 8px; border-radius: 12px; background: linear-gradient(var(--algo-border) 1px, transparent 1px) 0 0 / 100% 25%, var(--algo-bg); border: 1px solid var(--algo-border); }
.am-mock__chart { position: absolute; inset: 6%; width: 88%; height: 88%; overflow: visible; }
.am-mock__chart .k { transform-box: fill-box; transform-origin: center bottom; animation: amGrow 7s ease-in-out infinite; animation-delay: var(--d); }
.am-mock__chart .u line, .am-mock__chart .u rect { stroke: var(--algo-positive); fill: var(--algo-positive); }
.am-mock__chart .d line, .am-mock__chart .d rect { stroke: var(--algo-negative); fill: var(--algo-negative); }
.am-mock__chart line { stroke-width: 1.4; }
.am-mock__chart .ln { fill: none; stroke: var(--algo-accent); stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: 1; animation: amLine 7s ease-in-out infinite; vector-effect: non-scaling-stroke; }
@keyframes amGrow { 0% { transform: scaleY(0); opacity: 0; } 14%, 86% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes amLine { 0% { stroke-dashoffset: 1; } 55%, 90% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.am-mock__sig { position: absolute; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-weight: 700; font-size: .7rem; background: var(--algo-surface); border: 1px solid var(--algo-border); }
.am-mock__sig--buy { inset-inline-start: 14%; inset-block-end: 14%; color: var(--algo-accent); }
.am-mock__sig--sell { inset-inline-end: 12%; inset-block-start: 12%; color: var(--algo-negative); }
.am-mock__tools { display: flex; justify-content: space-around; padding: 12px 8px; border-top: 1px solid var(--algo-border); color: var(--algo-muted); font-size: 1rem; }
@media (prefers-reduced-motion: reduce) { .am-mock__chart .k, .am-mock__chart .ln, .am-mock__live i { animation: none; stroke-dashoffset: 0; } }

/* Décor 3D plein écran (couloir de chandeliers) */
.a3d-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
.a3d-bg.is-ready { opacity: 1; }
.a3d-bg canvas { width: 100% !important; height: 100% !important; display: block; }
:root[data-theme="light"] .a3d-bg.is-ready { opacity: .55; }

/* Pages d'outils (graphiques, assistant, trading) : pas de couloir 3D derrière, pour une lecture nette */
.algo-tool .a3d-bg { display: none !important; }

/* Ligne d'état du carnet d'ordres réel */
.a3d-live { margin: 10px 0 0; font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.a3d-live[hidden] { display: none; }
.a3d-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: #94a3b8; }
.a3d-live.is-live { color: #34d399; }
.a3d-live.is-live::before { background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: a3dpulse 2s infinite; }
.a3d-live.is-demo { color: var(--muted, #94a3b8); font-weight: 500; }
@keyframes a3dpulse { 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
@media (prefers-reduced-motion: reduce) { .a3d-live.is-live::before { animation: none; } }
