@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Raleway:wght@600;700;800&display=swap');
/* Outils « visuels » (respiration, timer, pomodoro, subliminal) : une seule présentation.
   Une carte : titre, zone centrale, rangée [action principale] [action secondaire] [Réglages].
   Tout le reste vit dans la fenêtre « Réglages » (réglages + presets enregistrables). Polices : Raleway (titres), Inter (le reste). */

body.avt {
  --bg: #f7f6fb; --surface: #ffffff; --surface2: #f0eef8; --text: #17151f; --muted: #5f5b72; --line: rgba(30, 20, 60, .12);
  --accent: #7c3aed; --accent-soft: rgba(124, 58, 237, .1); --accent-text: #6d28d9;
  --lilac: #8f78f0;
  --track: rgba(124, 58, 237, .16); --shadow: 0 10px 40px rgba(40, 20, 90, .1);
  --ok: #15803d; --bad: #dc2626; --warn-bg: rgba(251, 146, 60, .1); --warn-line: rgba(251, 146, 60, .25); --warn-text: #c2410c;
  color-scheme: light;
}
body.avt[data-theme="dark"], body.avt.dark-mode, body.avt[data-avt="dark"] {
  --bg: #0d0c13; --surface: #17161f; --surface2: #211f2c; --text: #f2f1f8; --muted: #a8a4bb; --line: rgba(255, 255, 255, .11);
  --accent: #a78bfa; --accent-soft: rgba(167, 139, 250, .14); --accent-text: #c4b5fd;
  --track: rgba(167, 139, 250, .22); --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  --ok: #4ade80; --bad: #f87171; --warn-bg: rgba(251, 191, 36, .08); --warn-line: rgba(251, 191, 36, .22); --warn-text: #fbbf24;
  color-scheme: dark;
}
body.avt[data-theme="light"], body.avt[data-avt="light"]:not(.dark-mode) { color-scheme: light; }

body.avt {
  margin: 0; min-height: 100dvh; box-sizing: border-box; padding: 24px 16px 32px;
  background: var(--bg) !important; background-image: none !important; color: var(--text);
  font: 400 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  -webkit-text-size-adjust: 100%;
}
body.avt *, body.avt *::before, body.avt *::after { box-sizing: border-box; }
html:has(body.avt) { background: #f7f6fb; }
html:has(body.avt[data-theme="dark"]), html:has(body.avt.dark-mode), html:has(body.avt[data-avt="dark"]) { background: #0d0c13; }
body.avt button, body.avt input, body.avt select, body.avt textarea { font-family: inherit; }
body.avt h1, body.avt h2, body.avt h3 { font-family: 'Raleway', 'Inter', sans-serif; color: var(--text); letter-spacing: 0; }

/* ---------- carte ---------- */
.avt-card {
  width: 100%; max-width: 460px; margin: 0 auto; padding: 22px 20px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
}
.avt-head { width: 100%; }
.avt-head h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.avt-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.avt-stage { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.avt-meta { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; }
.avt-meta .lab { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.avt-meta .num { display: block; font: 700 26px/1.15 'Raleway', 'Inter', sans-serif; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: 'lnum' 1, 'tnum' 1; color: var(--text); }
.avt-note { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- boutons ---------- */
.avt-actions { width: 100%; display: flex; gap: 8px; justify-content: center; align-items: stretch; }
.avt-actions .avt-btn:not(.icon) { flex: 1 1 0; min-width: 0; }
.avt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; margin: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 600 14px/1 'Inter', sans-serif; color: var(--text);
  background: var(--surface2); border: 1px solid var(--line); border-radius: 12px;
  transition: background .15s, border-color .15s, transform .1s, filter .15s;
}
.avt-btn:hover { border-color: var(--accent); }
.avt-btn:active { transform: scale(.98); }
.avt-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avt-btn.primary { color: #fff; border: 0; background: var(--lilac); }
.avt-btn.primary:hover { filter: brightness(1.07); }
.avt-btn.danger { color: #fff; border: 0; background: #e5484d; }
.avt-btn.danger.recording { animation: avtPulse 1.4s ease-in-out infinite; }
.avt-btn.icon { flex: 0 0 44px; width: 44px; padding: 0; }
.avt-btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.avt-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.avt-btn:disabled:hover { border-color: var(--line); }
.avt-btn .fas, .avt-btn .fa-solid { font-size: 14px; }
@keyframes avtPulse { 50% { box-shadow: 0 0 0 6px rgba(244, 63, 94, .22); } }

/* ---------- curseurs (même habillage partout) ---------- */
body.avt input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; padding: 0; background: transparent; cursor: pointer; --fill: 50%;
}
body.avt input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--fill), var(--track) var(--fill)); }
body.avt input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
body.avt input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--track); }
body.avt input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
body.avt input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
body.avt input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
body.avt input[type=number], body.avt input[type=text] {
  height: 40px; padding: 0 12px; font: 500 14px 'Inter', sans-serif; color: var(--text);
  background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; outline: none;
}
body.avt input[type=number]:focus, body.avt input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
body.avt select { font: 500 14px 'Inter', sans-serif; height: 40px; }

/* ---------- fenêtre « Réglages » ---------- */
.avt-sheet {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 12px;
  background: rgba(8, 8, 12, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.avt-sheet[hidden] { display: none !important; }
.avt-box {
  width: min(100%, 440px); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
  text-align: left;
}
.avt-box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.avt-box-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.avt-x { position: relative; flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 0; cursor: pointer; font-size: 0; color: var(--muted); background: var(--surface2); }
.avt-x::before, .avt-x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; border-radius: 1px; background: currentColor; transform: rotate(45deg); }
.avt-x::after { transform: rotate(-45deg); }
.avt-x:hover { color: var(--text); }
.avt-box-body { padding: 16px 20px 6px; overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 14px; }
.avt-sec { display: flex; flex-direction: column; gap: 10px; }
.avt-sec > h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-family: 'Inter', sans-serif; }
.avt-field { display: grid; grid-template-columns: minmax(84px, 118px) minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.avt-field > label, .avt-field > .lab { font-size: 13px; font-weight: 500; color: var(--muted); }
.avt-field > .val { min-width: 38px; text-align: right; font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.avt-field > select, .avt-field > input[type=number], .avt-field > .wide { grid-column: 2 / -1; width: 100%; min-width: 0; }
.avt-field > input[type=range]:last-child { grid-column: 2 / -1; }
.avt-field.stack { grid-template-columns: 1fr auto; }
.avt-field.stack > label { grid-column: 1 / 2; }
.avt-field.stack > .val { grid-column: 2 / 3; }
.avt-field.stack > input[type=range] { grid-column: 1 / -1; }
.avt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.avt-row > span { font-size: 14px; font-weight: 500; }
.avt-hint { margin: 0; font-size: 12px; color: var(--muted); }

/* puces (rythmes, modes) */
.avt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.avt-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; margin: 0; cursor: pointer;
  font: 600 13px/1 'Inter', sans-serif; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 999px;
}
.avt-chip:hover { border-color: var(--accent); }
.avt-chip.on, .avt-chip.active { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent); }
.avt-chip .del { margin-left: 2px; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.avt-chip .del:hover { color: var(--bad); background: rgba(248, 113, 113, .16); }
.avt-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; }
.avt-seg button { height: 36px; margin: 0; padding: 0 8px; cursor: pointer; font: 600 13px/1 'Inter', sans-serif; color: var(--muted); background: transparent; border: 0; border-radius: 9px; }
.avt-seg button.active { color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* presets enregistrés */
.avt-presets { padding: 16px 20px 20px; display: none; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1 1 auto; }
.avt-box.pv .avt-presets { display: flex; }
.avt-box.pv .avt-box-body { display: none; }
.avt-back { display: none; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 8px; border: 0; border-radius: 999px; cursor: pointer; font: 600 13px/1 'Inter', sans-serif; color: var(--text); background: var(--surface2); }
.avt-back::before { content: ''; width: 7px; height: 7px; margin-left: 3px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.avt-box.pv .avt-back { display: inline-flex; }
.avt-box.pv .avt-title-main { display: none; }
.avt-row.nav { cursor: pointer; }
.avt-open-presets { justify-content: space-between; width: 100%; height: 44px; }
.avt-open-presets::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); }
.avt-presets > h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-family: 'Inter', sans-serif; }
.avt-presets .empty { margin: 0; font-size: 13px; color: var(--muted); }
.avt-save { display: flex; gap: 8px; }
.avt-save input { flex: 1 1 auto; min-width: 0; }
.avt-err { margin: 0; font-size: 12px; font-weight: 500; color: var(--bad); }
.avt-toast { position: fixed; left: 50%; bottom: 16px; z-index: 1100; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; font: 500 13px/1.3 'Inter', sans-serif; color: var(--text); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.avt-toast[hidden] { display: none; }

/* thème (reste dans les réglages ; la console le masque et le pilote elle-même) */
body.avt .theme-toggle { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; cursor: pointer; text-decoration: none; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; font: 600 13px 'Inter', sans-serif; }
body.avt .theme-toggle:hover { border-color: var(--accent); }
body.avt .theme-toggle .small { font-size: 13px; color: inherit; }

/* ---------- questions fréquentes ---------- */
.avt-below { width: 100%; max-width: 460px; margin: 18px auto 0; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.faq-section { margin: 0; }
.faq-toggle-button { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.faq-toggle-button h2 { margin: 0 !important; font-size: 15px !important; }
.faq-toggle-button #faqToggleIcon { color: var(--accent) !important; transition: transform .25s; }
.faq-item-simple { margin: 10px 0 0 !important; padding: 14px 16px !important; background: var(--surface) !important; border: 1px solid var(--line); border-radius: 14px !important; }
.faq-item-simple h2 { margin: 0 0 6px !important; font-size: 14px !important; font-weight: 700; }
.faq-item-simple p { margin: 0; font-size: 13px !important; line-height: 1.55 !important; color: var(--muted) !important; }
.disclaimer { margin-top: 14px; padding: 14px 16px; font-size: 13px; line-height: 1.5; color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 14px; }

/* ===== respiration : bulle ===== */
.avt-bubble { width: 100%; max-width: 240px; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.avt-bubble svg { width: 100%; height: auto; max-width: 100%; }
.avt-bubble .pulse { transform-origin: center; transition: transform .5s cubic-bezier(.2, .9, .2, 1); }
.avt-bubble .ringline { stroke: var(--accent); stroke-opacity: .55; }

/* ===== timer : anneau ===== */
.avt-ring { position: relative; width: 210px; height: 210px; max-width: 100%; }
.avt-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.avt-ring .progress-bg, .avt-ring .progress-ring-circle { fill: none; stroke: var(--track); stroke-width: 7; }
.avt-ring .progress-ring, .avt-ring .progress-ring-progress { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .4s linear, stroke .3s; }
.avt-ring .avt-ringtext { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.avt-ring .avt-time { font: 700 44px/1 'Raleway', 'Inter', sans-serif; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: 'lnum' 1, 'tnum' 1; color: var(--text); }
.avt-ring .avt-mode { display: inline-block; padding: 3px 12px; font-size: 12px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border-radius: 999px; }
.avt-ring.bell-animation { animation: avtBell .6s ease; }
@keyframes avtBell { 30% { transform: scale(1.04); } }
.status-indicator { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.status-indicator.status-active { background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }
.status-indicator.status-paused { background: #f59e0b; }

/* ===== subliminal ===== */
.avt-steps { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.avt-steps .avt-btn { width: 100%; height: 48px; }
.avt-btn.success { color: #fff; border: 0; background: #2f9e6e; }
.avt-btn.success.changed { background: #d98a1f; }
.avt-btn.success:disabled { color: var(--muted); background: var(--surface2); border: 1px solid var(--line); opacity: .7; }
.audio-controls { width: 100%; display: none; gap: 8px; justify-content: center; }
.audio-controls.visible { display: flex; }
.audio-controls button { width: 48px; height: 44px; margin: 0; cursor: pointer; font-size: 15px; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; }
.audio-controls button:hover { border-color: var(--accent); }
.audio-controls button.active { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent); }
.audio-progress { display: none; width: 100%; height: 6px; overflow: hidden; background: var(--track); border-radius: 6px; }
.audio-progress-bar { height: 100%; width: 0; background: var(--lilac); border-radius: 6px; }

body.avt .hidden, body.avt [hidden] { display: none !important; }
body.avt .faq-panel { padding: 0; }
body.avt .faq-item { margin: 10px 0 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
body.avt .faq-item h2 { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
body.avt .faq-item p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
body.avt .pill { font-weight: 700; color: var(--text); }
body.avt .avt-below .faq-section.hidden { display: none; }

/* ---------- petites fenêtres (console) ---------- */
@media (max-width: 480px), (max-height: 520px) {
  body.avt { padding: 10px 10px 16px; }
  .avt-card { padding: 16px 14px 14px; gap: 12px; border-radius: 18px; }
  .avt-head h1 { font-size: 17px; }
  .avt-bubble { max-width: 190px; }
  .avt-ring { width: 170px; height: 170px; }
  .avt-ring .avt-time { font-size: 36px; }
  .avt-meta .num { font-size: 22px; }
  .avt-btn { height: 42px; padding: 0 12px; }
  .avt-field { grid-template-columns: minmax(70px, 96px) minmax(0, 1fr) auto; gap: 8px; }
}
@media (max-height: 420px) {
  .avt-bubble { max-width: 130px; }
  .avt-ring { width: 130px; height: 130px; }
  .avt-ring .avt-time { font-size: 28px; }
  .avt-card { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .avt-btn.danger.recording { animation: none; } }
