/* ==========================================================================
   Calculatrix — cahier quadrillé (clair) / tableau d'écolier (sombre),
   calculatrice et étude de fonction en direct
   ========================================================================== */

.page-calc {
  --paper: #fbfcfa;
  --paper-2: #eef4f4;
  --grid: rgba(3, 92, 111, 0.075);
  --grid-major: rgba(3, 92, 111, 0.15);
  --ink: #0f2a33;
  --muted: #4b6670;
  --teal: #035c6f;
  --teal-2: #024152;
  --teal-3: #013040;
  --teal-soft: #e1ebee;
  --accent: #035c6f;
  --curve: #e5484d;
  --mark: #7e57c2;
  --c-green: #43a047;
  --c-red: #e53935;
  --c-yellow: #f6b90e;
  --c-purple: #7e57c2;
  --card: #ffffff;
  --card-line: rgba(3, 92, 111, 0.14);
  --shadow: 0 24px 50px -30px rgba(1, 48, 64, 0.45);
  --screen: #b0bec5;
  --screen-2: #cfd8dc;
  --key-num: #e1ebee;
  --key-op: #0b0d0e;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --nav-fg: var(--ink);
  --nav-bg: rgba(251, 252, 250, 0.86);
  --nav-border: rgba(3, 92, 111, 0.12);
  --nav-accent: var(--teal);
  --nav-cta-fg: #fff;
  --footer-bg: #013040;
  --footer-fg: #c7dbe0;
  --footer-head: #fff;
  --footer-line: rgba(255, 255, 255, 0.08);

  background: var(--paper);
  color: var(--ink);
}
.page-calc ::selection { background: var(--teal); color: #fff; }

/* Papier quadrillé */
.cx-paper {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
}

.cx-section { position: relative; padding: clamp(80px, 10vw, 128px) 0; }
.cx-band { background: var(--paper-2); }
.cx-head { max-width: 760px; margin: 0 auto clamp(40px, 6vw, 60px); text-align: center; }
.cx-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.cx-kicker::before { content: "//"; opacity: 0.55; }
.cx-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: -0.035em;
  line-height: 1.04;
}
.cx-title em { font-style: normal; color: var(--accent); }
.cx-lead { margin-top: 18px; font-size: clamp(17px, 1.5vw, 19px); color: var(--muted); }

/* Boutons */
.cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  color: #fff;
  background: var(--teal);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 14px 30px -14px rgba(3, 92, 111, 0.8);
  transition: transform 0.25s var(--ease-bounce), filter 0.2s, box-shadow 0.25s;
}
.cx-btn:hover { transform: translateY(-3px); filter: brightness(1.08); }
.cx-btn svg { width: 20px; height: 20px; }
.cx-btn--ghost { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1.5px var(--card-line), 0 12px 26px -18px rgba(1, 48, 64, 0.5); }

/* ---------- HERO ---------- */
.cx-hero {
  position: relative;
  min-height: max(760px, 100svh);
  padding: calc(var(--nav-h) + 40px) 0 90px;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.cx-hero-plot { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.cx-hero-plot .axis { stroke: var(--grid-major); stroke-width: 2; }
.cx-hero-plot .asym { stroke: var(--teal); stroke-width: 2; stroke-dasharray: 10 10; opacity: 0.4; fill: none; }
.cx-hero-plot .curve { stroke: var(--curve); stroke-width: 3.5; fill: none; stroke-linecap: round; opacity: 0.9; }
.cx-hero-plot .dot { fill: var(--paper); stroke: var(--mark); stroke-width: 3; }
.cx-hero-plot .note { font-family: var(--font-hand); font-size: 30px; font-weight: 700; fill: var(--mark); }
.cx-hero-plot .note--teal { fill: var(--teal); }
html.js .cx-hero-plot .curve { stroke-dasharray: var(--len, 4000); stroke-dashoffset: var(--len, 4000); animation: cx-draw 2.6s var(--ease) 0.3s forwards; }
html.js .cx-hero-plot .late { opacity: 0; animation: cx-fade 0.8s ease forwards; animation-delay: var(--d, 1.8s); }
@keyframes cx-draw { to { stroke-dashoffset: 0; } }
@keyframes cx-fade { to { opacity: 1; } }

.cx-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(30px, 5vw, 70px);
}
.cx-copy { max-width: 600px; }
.cx-icon {
  width: 92px; height: 92px;
  border-radius: 24%;
  margin-bottom: 26px;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--card-line), 0 22px 40px -16px rgba(1, 48, 64, 0.55);
  animation: cx-bob 5s ease-in-out infinite;
}
@keyframes cx-bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}
.cx-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(58px, 9vw, 116px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}
.cx-h1 .x {
  display: inline-block;
  margin-left: 0.02em;
  font-family: "Times New Roman", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--c-purple);
}
.cx-quad { display: flex; gap: 8px; margin-top: 22px; }
.cx-quad i { width: 46px; height: 7px; border-radius: 4px; transform-origin: left; }
.cx-quad i:nth-child(1) { background: var(--c-green); }
.cx-quad i:nth-child(2) { background: var(--c-red); }
.cx-quad i:nth-child(3) { background: var(--c-yellow); }
.cx-quad i:nth-child(4) { background: var(--c-purple); }
html.js .cx-quad i { transform: scaleX(0); animation: cx-grow 0.6s var(--ease-bounce) forwards; animation-delay: calc(0.5s + var(--i) * 0.1s); }
@keyframes cx-grow { to { transform: scaleX(1); } }
.cx-sub { margin-top: 24px; font-size: clamp(18px, 1.7vw, 21px); line-height: 1.55; color: var(--muted); }
.cx-sub strong { color: var(--ink); }
.cx-ctas { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.cx-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.cx-badges > span {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-line);
}
.cx-badges .star { color: var(--c-yellow); }

/* Visuel : téléphone + fiches flottantes */
.cx-visual { position: relative; display: grid; place-items: center; min-height: 600px; }
.cx-phone {
  position: relative;
  width: min(300px, 64vw);
  padding: 10px;
  border-radius: 50px;
  background: linear-gradient(145deg, #2c3138, #0b0d10 60%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 50px 80px -40px rgba(1, 30, 40, 0.7);
  transform: rotate(3deg) translate3d(var(--px, 0), var(--py, 0), 0);
  transition: transform 0.3s var(--ease);
}
.cx-phone img { width: 100%; height: auto; border-radius: 40px; }
.cx-float {
  position: absolute;
  z-index: 2;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-line), var(--shadow);
  transform: translate3d(var(--px, 0), var(--py, 0), 0);
  transition: transform 0.3s var(--ease);
}
.cx-float small {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.cx-float b { font-family: var(--font-mono); font-size: 15px; font-weight: 600; white-space: nowrap; }
.cx-float--deriv { top: 12%; left: -4%; rotate: -4deg; }
.cx-float--live { bottom: 16%; left: 0; rotate: 3deg; }
.cx-float--live b { font-size: 22px; color: var(--teal); }
.cx-float--table { bottom: 2%; right: -12%; rotate: 3deg; padding: 10px 12px 8px; }
.cx-float--table svg { width: auto; max-width: 330px; height: auto; }
.cx-float--table text { font-family: var(--font-body); fill: var(--ink); }
.cx-float--table .lbl { font-weight: 700; fill: var(--accent); }
.cx-float--table .rule { stroke: var(--card-line); fill: none; }
.cx-float--table .bar, .cx-float--table .arrow { stroke: var(--ink); stroke-width: 1.2; fill: none; }
.cx-float--table .head { fill: var(--ink); }
.cx-float > * { animation: cx-bob-soft 6s ease-in-out infinite; animation-delay: var(--fd, 0s); }
@keyframes cx-bob-soft {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

/* ---------- DEUX MODES ---------- */
.cx-modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.cx-mode {
  position: relative;
  overflow: hidden;
  padding: 34px 32px 32px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-line), var(--shadow);
}
.cx-mode::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--bar); }
.cx-mode--algebra { --bar: linear-gradient(90deg, var(--c-green) 0 50%, var(--c-red) 50%); }
.cx-mode--study { --bar: linear-gradient(90deg, var(--c-yellow) 0 50%, var(--c-purple) 50%); }
.cx-mode-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.cx-mode-num { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--accent); }
.cx-mode h3 { margin-top: 6px; font-family: var(--font-display); font-size: 32px; letter-spacing: -0.03em; }
.cx-mode-art { flex: none; width: 120px; height: 96px; }
.cx-mode-art svg { width: 100%; height: 100%; }
.cx-mode > p { margin-top: 14px; color: var(--muted); }
.cx-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 11px; }
.cx-list li { position: relative; padding-left: 32px; line-height: 1.5; }
.cx-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 2px;
  width: 21px; height: 21px;
  border-radius: 7px;
  background: var(--teal-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23035c6f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.cx-list code, .cx-mode code { font-family: var(--font-mono); font-size: 0.92em; padding: 1px 6px; border-radius: 6px; background: var(--teal-soft); color: var(--teal-3); }

/* ---------- DÉMO ---------- */
.cx-demo { background: var(--paper-2); }
.cx-app {
  max-width: 1120px;
  margin: 0 auto;
  border-radius: 30px;
  overflow: hidden;
  background: var(--teal);
  box-shadow: 0 0 0 1px rgba(1, 48, 64, 0.2), 0 50px 90px -50px rgba(1, 48, 64, 0.8);
}
.cx-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--teal);
}
.cx-tabs {
  display: inline-flex;
  flex: 1;
  max-width: 460px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(179, 206, 212, 0.7);
  box-shadow: inset 0 0 0 1px #b3ced4;
}
.cx-tabs button {
  flex: 1;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15.5px;
  color: #013040;
  background: transparent;
  transition: background 0.25s, color 0.25s;
}
.cx-tabs button[aria-selected="true"] { background: #035467; color: #b3ced4; }
.cx-app-dots { display: flex; gap: 6px; }
.cx-app-dots i { width: 11px; height: 11px; border-radius: 50%; }
.cx-app-dots i:nth-child(1) { background: #66bb6a; }
.cx-app-dots i:nth-child(2) { background: #e53935; }
.cx-app-dots i:nth-child(3) { background: #fcc72a; }
.cx-app-dots i:nth-child(4) { background: #7e57c2; }
.cx-panel[hidden] { display: none; }

/* Calculatrice (mode Algèbre) */
.cx-calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--teal); }
.cx-screen { display: flex; flex-direction: column; min-height: 540px; background: var(--screen); }
.cx-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 440px;
  padding: 12px 10px 4px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.cx-hist {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-radius: 7px;
  text-align: left;
  color: #024a5c;
  background: #e1ebee;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s;
}
.cx-hist:hover { transform: translateX(4px); box-shadow: inset 4px 0 0 #035c6f; }
.cx-hist span { display: block; font-size: 15px; word-break: break-all; }
.cx-hist b { display: block; font-size: 20px; font-weight: 700; word-break: break-all; }
.cx-hist--last { text-align: right; background: transparent; }
.cx-hist--last:hover { transform: none; box-shadow: none; background: rgba(225, 235, 238, 0.35); }
.cx-hist--last span { font-size: 19px; }
.cx-hist--last b { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.15; }
.cx-history > :first-child { margin-top: auto; }
.cx-hist-empty { margin: auto; padding: 20px; text-align: center; color: #297485; }
.cx-editor {
  position: relative;
  padding: 26px 18px 18px;
  text-align: right;
  background: #cfd8dc;
}
.cx-editor::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -13px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 14' preserveAspectRatio='none'%3E%3Cpath d='M0 9C50 1 110 1 160 7S270 14 320 6V14H0z' fill='%23cfd8dc'/%3E%3C/svg%3E") 0 0 / 320px 14px repeat-x;
}
.cx-expr {
  overflow-x: auto;
  white-space: nowrap;
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 700;
  color: #024a5c;
  scrollbar-width: none;
}
.cx-expr.is-empty { color: #81aeb7; }
.cx-preview { min-height: 1.5em; font-size: 20px; font-weight: 600; color: #4f8d9a; }

.cx-keys {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 12px;
  background: var(--teal);
  align-content: center;
}
.cx-key {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 0 2px;
  border: 0;
  border-radius: 8px;
  font-size: 23px;
  font-weight: 500;
  line-height: 1;
  color: #e1ebee;
  background: var(--key-op);
  box-shadow: inset 0 0 0 1px rgba(129, 174, 183, 0.35), 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, filter 0.15s;
  touch-action: manipulation;
}
.cx-key:hover { filter: brightness(1.25); }
.cx-key:active, .cx-key.is-press { transform: translateY(2px); box-shadow: inset 0 0 0 1px rgba(129, 174, 183, 0.35); }
.cx-key--sm { font-size: 19px; }
.cx-key--num { color: #024a5c; background: var(--key-num); font-size: 27px; }
.cx-key--num:hover { filter: brightness(1.05); }
.cx-key--admin { background: #b71c1c; color: #fff; }
.cx-key--clean { background: #ff7043; color: #fff; }
.cx-key--eval { background: #2e7d32; color: #fff; }
.cx-key svg { width: 26px; height: 26px; }

/* Étude de fonction */
.cx-study { background: #b0bec5; }
.cx-study-input {
  padding: 14px 16px 12px;
  background: #e1ebee;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.cx-fx-row { display: flex; align-items: center; gap: 10px; }
.cx-fx-row label { font-size: 19px; font-weight: 900; color: #024a5c; white-space: nowrap; }
.cx-fx-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid #81aeb7;
  border-radius: 9px;
  font: 700 18px var(--font-body);
  color: #013040;
  background: #fff;
}
.cx-fx-row input:focus { outline: none; border-color: #035c6f; box-shadow: 0 0 0 3px rgba(3, 92, 111, 0.2); }
.cx-go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  color: #fff;
  background: #035c6f;
  transition: filter 0.2s, transform 0.2s var(--ease-bounce);
}
.cx-go:hover { filter: brightness(1.15); transform: translateY(-1px); }
.cx-go svg { width: 19px; height: 19px; }
.cx-chips { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.cx-chips button {
  flex: none;
  min-width: 42px;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  font-size: 16px;
  font-weight: 500;
  color: #e1ebee;
  background: #000;
  transition: filter 0.15s, transform 0.15s;
}
.cx-chips button:hover { filter: brightness(1.4); transform: translateY(-1px); }
.cx-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.cx-presets > span { font-size: 13px; font-weight: 700; color: #297485; text-transform: uppercase; letter-spacing: 0.06em; }
.cx-presets button {
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: #024a5c;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px #b3ced4;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.cx-presets button:hover { box-shadow: inset 0 0 0 1.5px #035c6f; }
.cx-presets button[aria-pressed="true"] { color: #fff; background: #035c6f; box-shadow: none; }
.cx-error { margin-top: 8px; font-weight: 600; color: #b71c1c; }
.cx-error:empty { display: none; }

.cx-study-body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  align-items: start;
}
.cx-card {
  min-width: 0;
  padding: 14px;
  border-radius: 10px;
  color: #024a5c;
  background: #e1ebee;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.cx-card-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; }
.cx-card-title svg { width: 20px; height: 20px; color: #035c6f; flex: none; }
.cx-graph { position: sticky; top: calc(var(--nav-h) + 12px); }
.cx-canvas-wrap { position: relative; margin-top: 10px; border-radius: 8px; overflow: hidden; background: #fff; }
.cx-canvas-wrap canvas { width: 100%; height: clamp(280px, 34vw, 400px); cursor: crosshair; touch-action: pan-y; }
.cx-zoom { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.cx-zoom button {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  color: #024a5c;
  background: rgba(225, 235, 238, 0.92);
  box-shadow: inset 0 0 0 1px #b3ced4;
}
.cx-zoom button:hover { background: #fff; }
.cx-graph-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 8px; font-family: var(--font-mono); font-size: 13px; color: #297485; }
.cx-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.cx-legend i { display: inline-block; width: 16px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 3px solid #e5484d; }
.cx-legend .asym i { border-top: 2px dashed #035c6f; }
.cx-legend .pt i { width: 10px; height: 10px; border: 2.5px solid #7e57c2; border-radius: 50%; }

.cx-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cx-step-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: #035c6f;
}
.cx-step p { margin-top: 6px; font-size: 14.5px; color: #024152; }
.cx-step .f {
  margin-top: 6px;
  padding: 7px 11px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  color: #013040;
  background: #fff;
  overflow-x: auto;
  white-space: nowrap;
}
.cx-vt { margin-top: 10px; padding: 8px; border-radius: 6px; background: #fff; overflow-x: auto; }
.cx-vt svg { display: block; margin: 0 auto; max-width: none; }
.cx-vt text { font-family: var(--font-body); font-size: 14px; fill: #013040; }
.cx-vt .lbl { font-weight: 700; fill: #024a5c; }
.cx-vt .rule { stroke: #035c6f; stroke-width: 1.2; }
.cx-vt .bar { stroke: #013040; stroke-width: 1.4; }
.cx-vt .arrow { stroke: #013040; stroke-width: 1.4; fill: none; }
.cx-vt .head { fill: #013040; }
.cx-vt .excl { fill: url(#cx-hatch); }
.cx-note { font-size: 14.5px; color: #024152; }
.cx-note a { color: #035c6f; font-weight: 700; }
.cx-note p + p { margin-top: 8px; }
.cx-loading { padding: 30px; text-align: center; font-weight: 700; color: #297485; }

.cx-demo-hint { margin-top: 18px; text-align: center; font-size: 15px; color: var(--muted); }
.cx-demo-hint kbd {
  display: inline-block;
  min-width: 24px;
  padding: 0 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-line), 0 2px 0 var(--card-line);
}

.cx-toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 250;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  background: rgba(1, 48, 64, 0.94);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 30px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-bounce), opacity 0.25s;
}
.cx-toast.is-error { background: rgba(183, 28, 28, 0.95); }
.cx-toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* ---------- ATOUTS ---------- */
.cx-perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.cx-perk {
  padding: 26px 24px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-line), var(--shadow);
  transition: transform 0.35s var(--ease-bounce);
}
.cx-perk:hover { transform: translateY(-5px); }
.cx-perk-ico {
  display: grid;
  place-items: center;
  width: 50px; height: 50px;
  margin-bottom: 16px;
  border-radius: 14px;
  color: #fff;
  background: var(--c, var(--teal));
}
.cx-perk-ico svg { width: 26px; height: 26px; }
.cx-perk h3 { font-family: var(--font-display); font-size: 21px; letter-spacing: -0.02em; }
.cx-perk p { margin-top: 8px; color: var(--muted); font-size: 15.5px; }
.cx-perk code { font-family: var(--font-mono); font-size: 0.9em; color: var(--accent); }

/* ---------- GALERIE ---------- */
.cx-gallery { overflow: hidden; }
.cx-gallery-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.cx-gallery-head .cx-head { margin: 0; text-align: left; }
.cx-gallery .gallery > * { width: min(300px, 70vw); }
.cx-gallery .gallery > .is-tablet { width: min(460px, 84vw); }
.cx-gallery .device { background: linear-gradient(145deg, #2c3138, #0b0d10 60%); transition: transform 0.4s var(--ease-bounce); }
.cx-gallery .device--phone { --dr: 46px; --dp: 9px; }
.cx-gallery a:hover .device { transform: translateY(-8px); }
.cx-gallery figcaption { margin-top: 14px; text-align: center; font-size: 14.5px; font-weight: 600; color: var(--muted); }
.cx-round {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--card-line), 0 10px 20px -14px rgba(1, 48, 64, 0.6);
  transition: transform 0.2s var(--ease-bounce);
}
.cx-round:hover { transform: scale(1.08); }
.cx-round svg { width: 22px; height: 22px; }

/* ---------- FICHE ---------- */
.cx-facts-card {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 44px);
  border-radius: 30px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-line), var(--shadow);
}
.cx-facts-card h2 { text-align: center; font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -0.03em; margin-bottom: 26px; }
.cx-facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; border-radius: 18px; background: var(--card-line); box-shadow: inset 0 0 0 1px var(--card-line); }
.cx-fact { padding: 18px 12px 16px; text-align: center; background: var(--card); }
.cx-fact small { display: block; font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cx-fact strong { display: block; margin-top: 6px; font-family: var(--font-display); font-size: 21px; letter-spacing: -0.01em; color: var(--ink); }
.cx-privacy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 20px;
  padding: 16px 22px;
  border-radius: 18px;
  color: var(--teal-3);
  background: var(--teal-soft);
}
.cx-privacy p { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.cx-privacy svg { width: 28px; height: 28px; flex: none; }
.cx-privacy a { font-weight: 800; color: inherit; white-space: nowrap; }

/* ---------- CTA ---------- */
.cx-cta { text-align: center; overflow: hidden; isolation: isolate; }
.cx-cta-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(50px, 7vw, 86px) clamp(24px, 5vw, 60px);
  border-radius: 34px;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(50% 80% at 90% 0%, rgba(126, 87, 194, 0.55), transparent 60%),
    radial-gradient(40% 70% at 0% 100%, rgba(67, 160, 71, 0.4), transparent 60%),
    linear-gradient(150deg, #04677c, #024152 55%, #012532);
  box-shadow: 0 50px 90px -50px rgba(1, 48, 64, 0.9);
}
.cx-cta-card h2 { font-family: var(--font-display); font-size: clamp(34px, 5vw, 58px); letter-spacing: -0.04em; line-height: 1.05; }
.cx-cta-card p { max-width: 46ch; margin: 18px auto 0; font-size: 18px; color: #c7dbe0; }
.cx-cta-card .cx-ctas { justify-content: center; }
.cx-cta-card .cx-btn--ghost { color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.cx-cta-formula {
  position: absolute;
  z-index: -1;
  font-family: var(--font-hand);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.16);
  white-space: nowrap;
  pointer-events: none;
}
.cx-cta-formula:nth-of-type(1) { top: 10%; left: 4%; rotate: -8deg; }
.cx-cta-formula:nth-of-type(2) { bottom: 10%; right: 5%; rotate: 6deg; }
.cx-cta-formula:nth-of-type(3) { bottom: 14%; left: 8%; rotate: 4deg; }
.cx-cta-formula:nth-of-type(4) { top: 12%; right: 8%; rotate: -5deg; }

/* ---------- Responsive ---------- */
@media (max-width: 1060px) {
  .cx-hero-inner { grid-template-columns: minmax(0, 1fr); }
  .cx-copy { max-width: 680px; }
  .cx-visual { min-height: 0; padding: 30px 0 10px; }
  .cx-float--table { right: 0; }
  .cx-hero-plot { opacity: 0.55; }
  .cx-calc { grid-template-columns: minmax(0, 1fr); }
  .cx-screen { min-height: 380px; }
  .cx-history { max-height: 300px; }
  .cx-study-body { grid-template-columns: minmax(0, 1fr); }
  .cx-graph { position: static; }
  .cx-perks { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .cx-modes { grid-template-columns: minmax(0, 1fr); }
  .cx-facts-grid { grid-template-columns: repeat(2, 1fr); }
  .cx-gallery-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .cx-perks { grid-template-columns: minmax(0, 1fr); }
  .cx-mode { padding: 28px 22px 24px; }
  .cx-mode-art { width: 84px; height: 68px; }
  .cx-app { border-radius: 22px; margin-inline: -4px; }
  .cx-app-dots { display: none; }
  .cx-tabs { max-width: none; }
  .cx-keys { gap: 5px; padding: 8px; }
  .cx-key { min-height: 52px; font-size: 20px; }
  .cx-key--sm { font-size: 16px; }
  .cx-key--num { font-size: 23px; }
  .cx-float--deriv { left: -2%; top: 4%; }
  .cx-float--table { display: none; }
  .cx-float--live { left: -2%; }
  .cx-fx-row { flex-wrap: wrap; }
  .cx-fx-row input { flex-basis: calc(100% - 70px); }
  .cx-go { width: 100%; justify-content: center; }
}

/* ==========================================================================
   Mode sombre — « tableau noir »
   ========================================================================== */
:root[data-theme="dark"] .page-calc {
  --paper: #071a20;
  --paper-2: #0a222a;
  --grid: rgba(127, 211, 227, 0.05);
  --grid-major: rgba(127, 211, 227, 0.11);
  --ink: #e6f1f3;
  --muted: #9db8bf;
  --accent: #7fd3e3;
  --teal-soft: rgba(127, 211, 227, 0.12);
  --curve: #ff7a6b;
  --mark: #b39ddb;
  --c-purple: #a78bfa;
  --card: #0d2830;
  --card-line: rgba(127, 211, 227, 0.14);
  --shadow: 0 28px 56px -32px rgba(0, 0, 0, 0.9);
  --nav-fg: #e6f1f3;
  --nav-bg: rgba(7, 26, 32, 0.86);
  --nav-border: rgba(127, 211, 227, 0.12);
  --nav-accent: #7fd3e3;
  --nav-cta-fg: #013040;
  --footer-bg: #04131a;
}
:root[data-theme="dark"] .page-calc .cx-hero-plot .asym { stroke: #7fd3e3; opacity: 0.35; }
:root[data-theme="dark"] .page-calc .cx-hero-plot .note--teal { fill: #7fd3e3; }
:root[data-theme="dark"] .page-calc .cx-hero-plot .curve { filter: drop-shadow(0 0 8px rgba(255, 122, 107, 0.55)); }
:root[data-theme="dark"] .page-calc .cx-btn { color: #013040; background: #7fd3e3; box-shadow: 0 14px 30px -14px rgba(127, 211, 227, 0.6); }
:root[data-theme="dark"] .page-calc .cx-btn--ghost { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1.5px var(--card-line); }
:root[data-theme="dark"] .page-calc .cx-cta-card .cx-btn--ghost { color: #fff; background: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .page-calc .cx-list li::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237fd3e3' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .page-calc .cx-list code,
:root[data-theme="dark"] .page-calc .cx-mode code { color: #bfe9f1; }
:root[data-theme="dark"] .page-calc .cx-privacy { color: #bfe9f1; }
:root[data-theme="dark"] .page-calc .cx-app { box-shadow: 0 0 0 1px rgba(127, 211, 227, 0.18), 0 50px 90px -50px #000; }
:root[data-theme="dark"] .page-calc .cx-float--live b { color: #7fd3e3; }
:root[data-theme="dark"] .page-calc .cx-icon { box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--card-line), 0 22px 40px -16px #000; }
