/* =====================================================================
   TangaFast — feuille de style
   Interface sombre et épurée : fond noir profond, panneaux « verre »,
   accent jaune, typographie Inter.
   ===================================================================== */

:root {
  color-scheme: dark;
  --bg: #171717;
  --bg-2: #1c1c1c;
  --surface: #1f1f1f;
  --surface-2: #262626;
  --surface-3: #2e2e2e;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --ink: #ffffff;
  --ink-2: #d6d6d6;
  --muted: #a5a5a5;
  --faint: #6f6f6f;

  --gold: #ffda2a;
  --gold-ink: #171717;

  --c-yellow: #ffda2a;
  --c-orange: #ff8a3d;
  --c-red: #ff6b6b;
  --c-violet: #a58bff;
  --c-blue: #5ba8ff;
  --c-green: #4fd18b;

  --st-new: var(--c-blue);
  --st-learning: var(--c-orange);
  --st-young: var(--c-yellow);
  --st-mastered: var(--c-green);

  --r-again: var(--c-red);
  --r-hard: var(--c-orange);
  --r-good: var(--c-green);
  --r-easy: var(--c-blue);

  --good: #4fd18b;
  --bad: #ff6b6b;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Inter Tight", "Inter", "Segoe UI", system-ui, sans-serif;

  --radius-xl: 32px;
  --radius: 22px;
  --radius-sm: 14px;
  --glass: rgba(23, 23, 23, 0.75);
  --glass-edge: inset 1px 1px 1px 0 rgba(255, 255, 255, 0.28);
  --shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.8);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(255, 218, 42, 0.7);
  --maxw: 1120px;
  --tabbar-h: 68px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "cv11", "ss01";
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
::selection { background: rgba(255, 218, 42, 0.3); }

.ico { display: inline-flex; flex: none; }
.ico svg { display: block; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--gold); color: var(--gold-ink); padding: 10px 14px; border-radius: 999px; text-decoration: none; font-weight: 500; }
.skip:focus { top: 12px; }
.noscript { padding: 24px; text-align: center; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; }
.stack { display: flex; flex-direction: column; gap: 24px; position: relative; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.row-center { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.subhead { font-size: 1rem; font-weight: 500; margin-top: 8px; }
.eyebrow { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.14em; }

/* Lueur d'ambiance en haut de page */
.glow {
  position: fixed; inset: 0 0 auto 0; height: 70vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(50% 60% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(30% 40% at 50% 8%, rgba(255, 218, 42, 0.05), transparent 70%);
}

/* ---------- Démarrage ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot__logo { font-family: var(--display); font-weight: 600; font-size: 1.4rem; letter-spacing: -0.02em; }
.boot__logo b { font-weight: 600; color: var(--gold); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 64px 16px; color: var(--muted); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo__mark { position: relative; width: 24px; height: 24px; flex: none; }
.logo__mark span { position: absolute; width: 16px; height: 20px; border-radius: 4px; }
.logo__mark span:first-child { left: 0; top: 3px; background: rgba(255, 255, 255, 0.22); transform: rotate(-10deg); }
.logo__mark span:last-child { right: 0; top: 0; background: var(--gold); transform: rotate(8deg); }
.logo__word { font-family: var(--display); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.02em; }
.logo--sm .logo__word { font-size: 1rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: 0.94rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn.is-disabled { opacity: 0.4; cursor: not-allowed; }
.btn--gold, .btn--primary {
  color: var(--gold-ink); background-color: #f0c81e;
  background-image: radial-gradient(at 50% 110%, #ffda2a 33%, rgba(255, 218, 42, 0.8) 66%, rgba(255, 228, 110, 0.9) 100%);
  box-shadow: inset 0 1px 12px -5px #ffed9a, inset -5px -7px 3px -6px rgba(255, 255, 140, 0.9), inset 5px 7px 3px -6px #fff;
}
.btn--gold:hover:not(:disabled), .btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--light { background: #fff; color: #171717; }
.btn--light:hover:not(:disabled) { background: #ececec; }
.btn--dark { background: var(--surface-3); color: var(--ink); border-color: var(--line); }
.btn--dark:hover:not(:disabled) { background: #363636; }
.btn--ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.btn--ghost.is-on { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); }
.btn--danger { background: var(--bad); color: #1a0d0d; }
.btn.danger { color: var(--bad); }
.btn--sm { min-height: 36px; padding: 6px 15px; font-size: 0.86rem; }
.btn--lg { min-height: 54px; padding: 14px 28px; font-size: 1rem; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: none; background: transparent; color: var(--ink); text-decoration: none; transition: background 0.15s;
}
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.is-on { background: var(--gold); color: var(--gold-ink); }
.icon-btn--soft { background: rgba(255, 255, 255, 0.06); }
.icon-btn--danger { color: var(--bad); }
.link-sm { background: none; border: none; padding: 4px 0; color: var(--muted); font-size: 0.86rem; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }
.link-sm:hover { color: var(--ink); }
.link-sm.danger { color: var(--bad); }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.05); color: inherit; border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; font-weight: 500; }

/* ---------- Puces ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 0.86rem; font-weight: 500; text-decoration: none; white-space: nowrap;
}
a.chip:hover, .chip--select:hover { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.chip--select { position: relative; cursor: pointer; padding-right: 12px; max-width: 260px; }
.chip-select { appearance: none; -webkit-appearance: none; background: transparent; border: none; color: inherit; font-size: 0.86rem; font-weight: 500; max-width: 180px; text-overflow: ellipsis; cursor: pointer; padding: 0; }
.chip-select:focus { outline: none; }
.chip-select option { background: #262626; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-weight: 500; font-size: 0.88rem; }
.chip-btn:hover { color: var(--ink); }
.chip-btn.is-on { color: var(--ink); background-image: linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.18) 100%); border-color: rgba(255, 255, 255, 0.22); box-shadow: inset 1px 2px 0.5px -1.8px rgba(255, 255, 255, 0.9); }

/* ---------- Langues (facultatif) ---------- */
.lang { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 6px; border-radius: 6px; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-2); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); }
.langpair { display: inline-flex; align-items: center; gap: 5px; }
.langpair__arrow { color: var(--faint); font-size: 0.8rem; }

/* ---------- Couleurs des decks ---------- */
.deck--yellow, .deck--saffron { --deck: var(--c-yellow); }
.deck--orange, .deck--terracotta { --deck: var(--c-orange); }
.deck--red { --deck: var(--c-red); }
.deck--violet, .deck--plum, .deck--indigo { --deck: var(--c-violet); }
.deck--blue, .deck--teal { --deck: var(--c-blue); }
.deck--green, .deck--forest { --deck: var(--c-green); }

/* ---------- Navigation en pilule « verre » ---------- */
.pillnav {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 40px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), radial-gradient(34.57% 51.92% at 49.87% 95.19%, rgba(247, 247, 252, 0.08) 33.17%, rgba(247, 247, 252, 0) 100%);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.pillnav__link {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: 40px;
  color: var(--muted); text-decoration: none; font-size: 0.88rem; font-weight: 500; white-space: nowrap; transition: color 0.15s;
}
.pillnav__link .ico { display: none; }
.pillnav__link:hover { color: var(--ink); }
.pillnav__link.is-on {
  color: var(--ink);
  background-image: linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.18) 2.45%, rgba(255, 255, 255, 0) 126.14%);
  box-shadow: inset 1.1px 2.2px 0.5px -1.8px rgba(255, 255, 255, 0.9), inset -1px -2.2px 0.5px -1.8px rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ---------- Application connectée ---------- */
.shell { min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(180deg, rgba(23, 23, 23, 0.95) 40%, rgba(23, 23, 23, 0));
}
.topbar__logo { text-decoration: none; flex: none; }
.topbar__nav { display: none; position: absolute; left: 50%; transform: translateX(-50%); }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.topbar__cta { display: none; }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; text-decoration: none;
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--ink); font-weight: 600; font-size: 0.9rem;
}
.avatar.is-on, .avatar:hover { border-color: var(--gold); }
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(calc(100% - 24px), 440px); justify-content: space-between;
}
.tabbar .pillnav__link { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: 50px; padding: 0 6px; font-size: 0.7rem; }
.tabbar .pillnav__link .ico { display: inline-flex; }
@media (min-width: 900px) {
  .topbar__nav { display: inline-flex; }
  .topbar__cta { display: inline-flex; }
  .tabbar { display: none; }
  .shell { padding-bottom: 48px; }
}
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 500; color: var(--muted); padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); }
.sync--off { color: var(--bad); }
.sync__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: 0.3; } }

.page { max-width: var(--maxw); margin: 0 auto; padding: 18px 20px 32px; position: relative; z-index: 1; }
.public { min-height: 100vh; position: relative; }
.public > .stack, .public > .page { max-width: var(--maxw); margin: 0 auto; padding: 20px 20px 56px; }
.publicbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.publicbar a:first-child { text-decoration: none; }

.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.pagehead__title { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.pagehead__sub { color: var(--muted); margin-top: 8px; max-width: 620px; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.88rem; align-self: flex-start; }
.backlink:hover { color: var(--ink); }
.sectionbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.sectionbar__title { font-size: 1.25rem; }
.sectionbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.panel__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.panel__title { font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.count { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 0.76rem; font-family: var(--font); }

.empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.015); }
.empty__icon { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, 0.06); display: grid; place-items: center; color: var(--gold); }
.empty__title { font-size: 1.15rem; }
.empty__text { color: var(--muted); max-width: 440px; }
.empty .row-center, .empty .btn { margin-top: 8px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field__label { font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.input {
  width: 100%; min-height: 46px; padding: 11px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.input:focus { outline: none; border-color: rgba(255, 218, 42, 0.6); background: rgba(255, 255, 255, 0.06); }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
select.input option { background: #262626; }
.input--lg { min-height: 54px; font-size: 1.06rem; }
.input--sm { min-height: 40px; padding: 8px 12px; font-size: 0.92rem; }
.input--search { max-width: 280px; min-height: 40px; padding: 8px 16px; border-radius: 999px; }
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 90px; }
.input-addon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: rgba(255, 255, 255, 0.08); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; font-size: 0.78rem; font-weight: 500; }
.form-msg { font-size: 0.88rem; padding: 10px 14px; border-radius: 12px; }
.form-msg--error { background: rgba(255, 107, 107, 0.12); color: #ffb0b0; }
.form-msg--ok { background: rgba(79, 209, 139, 0.12); color: #9ff0c4; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.notice p { margin-top: 2px; color: var(--ink-2); }
.notice--ok .ico { color: var(--good); }
.notice--warn { background: rgba(255, 218, 42, 0.07); border-color: rgba(255, 218, 42, 0.2); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); margin-top: 3px; flex: none; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range { flex: 1; accent-color: var(--gold); }
.range__out { font-weight: 500; min-width: 52px; text-align: right; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); border-radius: 999px; align-self: flex-start; }
.segmented__opt { border: none; background: transparent; border-radius: 999px; padding: 8px 15px; font-weight: 500; font-size: 0.86rem; color: var(--muted); min-height: 36px; }
.segmented__opt.is-on { color: var(--ink); background-image: linear-gradient(0deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.16)); box-shadow: inset 1px 2px 0.5px -1.8px rgba(255, 255, 255, 0.9); }
.tabs { display: inline-flex; gap: 2px; padding: 4px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); border-radius: 999px; flex-wrap: wrap; }
.tab { border: none; background: transparent; border-radius: 999px; padding: 7px 14px; font-weight: 500; font-size: 0.84rem; color: var(--muted); }
.tab.is-on { color: var(--ink); background-image: linear-gradient(0deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.16)); box-shadow: inset 1px 2px 0.5px -1.8px rgba(255, 255, 255, 0.9); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--surface); background: var(--deck); box-shadow: 0 0 0 1px var(--line-2); display: grid; place-items: center; color: #171717; }
.swatch.is-on { box-shadow: 0 0 0 2px #fff; }

details.advanced { border-top: 1px solid var(--line); padding-top: 14px; }
details.advanced > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); font-size: 0.88rem; font-weight: 500; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary:hover { color: var(--ink); }
details.advanced[open] > summary { color: var(--ink); margin-bottom: 12px; }
details.advanced > * + * { margin-top: 12px; }
details.advanced--panel { border-top: 1px solid var(--line); padding-top: 22px; }

/* ---------- Notifications et fenêtres ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #2a2a2a; color: var(--ink); padding: 11px 18px; border-radius: 999px; font-size: 0.88rem; font-weight: 500; border: 1px solid var(--line-2); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: opacity 0.25s, transform 0.25s; text-align: center; }
.toast.is-in { opacity: 1; transform: none; }
.toast--ok { border-color: rgba(79, 209, 139, 0.45); }
.toast--error { border-color: rgba(255, 107, 107, 0.5); color: #ffc4c4; }
@media (min-width: 900px) { .toasts { bottom: 28px; } }

.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.18s; }
.modal-overlay.is-in { opacity: 1; }
.modal { background: #1e1e1e; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; border-radius: 28px 28px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line-2); box-shadow: var(--glass-edge), var(--shadow); transform: translateY(20px); transition: transform 0.2s; }
.modal-overlay.is-in .modal { transform: none; }
.modal--wide { max-width: 760px; }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal__title { font-size: 1.15rem; }
.modal__body { display: flex; flex-direction: column; gap: 12px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 28px; padding: 22px 24px; }
}

/* ---------- Zone de saisie (composer) ---------- */
.composer {
  position: relative; width: 100%; max-width: 820px; margin: 0 auto; text-align: left;
  background: var(--glass); border-radius: var(--radius-xl); box-shadow: var(--glass-edge), var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06); padding: 18px 18px 14px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.composer__fields { display: flex; flex-direction: column; gap: 4px; padding: 2px 6px 10px; }
.composer__input { width: 100%; border: none; background: transparent; resize: none; color: var(--ink); font-size: 1.05rem; line-height: 1.5; padding: 4px 0; overflow: hidden; min-height: 32px; }
.composer__input:focus { outline: none; }
.composer__input::placeholder { color: var(--faint); }
.composer__input--q { font-size: 1.15rem; font-weight: 500; }
.composer__sep { height: 1px; background: var(--line); margin: 4px 0; }
.composer__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer__chips { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 16px; }
.composer__chips::-webkit-scrollbar { display: none; }
.send {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; display: grid; place-items: center; color: var(--gold-ink);
  background-color: #f0c81e; background-image: radial-gradient(at 50% 110%, #ffda2a 33%, rgba(255, 218, 42, 0.8) 66%, rgba(255, 228, 110, 0.9) 100%);
  box-shadow: inset 0 1px 12px -5px #ffed9a, inset -5px -7px 3px -6px rgba(255, 255, 140, 0.9), inset 5px 7px 3px -6px #fff;
  transition: transform 0.12s, filter 0.15s;
}
.send:hover { filter: brightness(1.06); }
.send:active { transform: scale(0.94); }
.send:disabled { opacity: 0.5; }
@media (max-width: 560px) { .chip--wide { display: none; } }

/* ---------- Page de présentation ---------- */
.landing { position: relative; overflow: hidden; }
.landing > *:not(.glow) { position: relative; z-index: 1; }
.lnav { max-width: 1280px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 20px 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lnav__logo { text-decoration: none; }
.lnav__center { display: none; }
.lnav__right { display: flex; align-items: center; gap: 16px; }
.lnav__link { text-decoration: none; color: var(--ink); font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.lnav__link:hover { color: var(--gold); }
@media (min-width: 900px) { .lnav__center { display: inline-flex; } }
@media (max-width: 600px) { .lnav__link { display: none; } }

.hero { max-width: 900px; margin: 0 auto; padding: clamp(64px, 14vh, 140px) 20px 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.hero__title { font-size: clamp(2.3rem, 6.4vw, 4rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.04; }
.hero__lead { color: var(--ink-2); font-size: clamp(1rem, 2vw, 1.12rem); max-width: 600px; margin-bottom: 18px; }
.composer--hero { margin-top: 8px; }
.tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; margin-top: 10px; }
.tray:empty { display: none; }
.tray__hint { color: var(--muted); font-size: 0.86rem; }
.tray__hint a { color: var(--gold); text-decoration: none; font-weight: 500; }
.mini { width: 220px; height: 150px; perspective: 1000px; border: none; padding: 0; background: none; animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.mini__inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1); }
.mini.is-flipped .mini__inner { transform: rotateY(180deg); }
.mini__face { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 16px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line-2); text-align: center; -webkit-backface-visibility: hidden; backface-visibility: hidden; box-shadow: var(--glass-edge); }
.mini__face--back { transform: rotateY(180deg); background: #fff; color: #171717; }
.mini__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.mini__face--back .mini__label { color: #777; }
.mini__text { font-size: 0.98rem; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }

.uses { max-width: 1000px; margin: 0 auto; padding: 32px 20px 24px; text-align: center; }
.uses__label { color: var(--faint); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 16px; }
.uses__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; }
.uses__item { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); font-size: 0.9rem; }

.lsection { max-width: var(--maxw); margin: 0 auto; padding: 80px 20px 20px; display: flex; flex-direction: column; gap: 32px; }
.lsection__title { font-size: clamp(1.8rem, 4.4vw, 2.8rem); text-align: center; letter-spacing: -0.03em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.tile { border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); padding: 14px 14px 26px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--glass-edge); }
.tile__visual { height: 200px; border-radius: 22px; background: radial-gradient(80% 90% at 50% 100%, rgba(255, 255, 255, 0.06), transparent 70%), #141414; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; margin-bottom: 8px; }
.tile__title { font-size: 1.2rem; padding: 0 10px; }
.tile__text { color: var(--muted); padding: 0 10px; }
.v-cards { position: relative; width: 200px; height: 130px; }
.v-card { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-3); border: 1px solid var(--line-2); }
.v-card--3 { transform: rotate(-9deg) translate(-14px, 8px); opacity: 0.5; }
.v-card--2 { transform: rotate(-4deg) translate(-6px, 4px); opacity: 0.75; }
.v-card--1 { background: #fff; color: #171717; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; transform: rotate(3deg); }
.v-card__label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; color: #888; }
.v-card__text { font-weight: 600; font-size: 0.95rem; }
.v-ink, .v-curve { width: 100%; height: 100%; display: grid; place-items: center; }
.v-ink svg, .v-curve svg { width: 90%; height: auto; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.step { padding: 26px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); display: flex; flex-direction: column; gap: 8px; }
.step__n { font-family: var(--display); font-size: 0.86rem; color: var(--gold); font-weight: 600; letter-spacing: 0.08em; }
.step__title { font-size: 1.25rem; }
.step__text { color: var(--muted); }
.lcta { max-width: var(--maxw); margin: 80px auto 40px; padding: 72px 24px; border-radius: 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; background: radial-gradient(60% 80% at 50% 100%, rgba(255, 218, 42, 0.12), transparent 70%), var(--surface); border: 1px solid var(--line); box-shadow: var(--glass-edge); }
@media (max-width: 1160px) { .lcta { margin-left: 20px; margin-right: 20px; } }
.lcta__title { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -0.03em; }
.lcta__text { color: var(--muted); margin-bottom: 8px; }
.lfooter { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px calc(36px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--faint); font-size: 0.84rem; border-top: 1px solid var(--line); }

/* ---------- Connexion / inscription ---------- */
.auth { min-height: 100vh; position: relative; display: flex; flex-direction: column; align-items: center; padding: calc(20px + env(safe-area-inset-top)) 20px 48px; }
.auth > *:not(.glow) { position: relative; z-index: 1; }
.auth__logo { text-decoration: none; align-self: flex-start; }
.auth__box {
  width: 100%; max-width: 440px; margin: auto; display: flex; flex-direction: column; gap: 16px;
  background: var(--glass); border-radius: var(--radius-xl); box-shadow: var(--glass-edge), var(--shadow); border: 1px solid rgba(255, 255, 255, 0.06); padding: 30px 26px;
}
.auth__title { font-size: clamp(1.7rem, 5vw, 2.1rem); text-align: center; }
.auth__sub { color: var(--muted); text-align: center; margin-top: -6px; }
.auth__foot { color: var(--muted); font-size: 0.9rem; text-align: center; }
.auth__foot a { color: var(--gold); font-weight: 500; text-decoration: none; }

/* ---------- Accueil connecté ---------- */
.home__hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: clamp(24px, 6vh, 64px) 0 8px; }
.home__title { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.03em; }
.home__sub { color: var(--muted); margin-bottom: 14px; }
.todaybar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); max-width: 820px; width: 100%; margin: 0 auto; }
.todaybar > div { display: flex; align-items: center; gap: 12px; }
.todaybar strong { display: block; font-weight: 500; font-size: 0.95rem; }
.todaybar span { color: var(--muted); font-size: 0.82rem; }
.todaybar__ring { position: relative; width: 56px; height: 56px; }
.todaybar__ring > span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink) !important; font-weight: 600; font-size: 0.95rem !important; }
.todaybar__streak .ico { color: var(--faint); }
.todaybar__streak.is-on .ico { color: var(--c-orange); }
.todaybar > .btn, .todaybar__ok { margin-left: auto; }
.todaybar__ok { display: inline-flex; align-items: center; gap: 6px; color: var(--good) !important; font-weight: 500; }
.notesteaser { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); text-decoration: none; transition: background 0.15s; }
.notesteaser:hover { background: rgba(255, 255, 255, 0.05); }
.notesteaser__icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 218, 42, 0.12); color: var(--gold); flex: none; }
.notesteaser__text { flex: 1; display: flex; flex-direction: column; }
.notesteaser__text span { color: var(--muted); font-size: 0.88rem; }
.notesteaser > .ico { color: var(--muted); }

.ring__track { stroke: rgba(255, 255, 255, 0.1); }
.ring__fill { stroke: var(--gold); transition: stroke-dashoffset 0.8s cubic-bezier(0.3, 0.7, 0.2, 1); }
.ring--done .ring__fill { stroke: var(--good); }
.pbar { display: flex; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.pbar__seg { height: 100%; transition: width 0.4s; }
.pbar__seg--mastered { background: var(--st-mastered); }
.pbar__seg--young { background: var(--st-young); }
.pbar__seg--learning { background: var(--st-learning); }

.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.decktile {
  position: relative; display: flex; flex-direction: column; gap: 12px; text-align: left; min-height: 172px;
  padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); overflow: hidden; transition: transform 0.15s, border-color 0.15s, background 0.15s; font: inherit;
}
.decktile::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--deck), transparent 70%); opacity: 0.14; pointer-events: none; }
.decktile:hover { transform: translateY(-2px); border-color: var(--line-2); background: #232323; }
.decktile__top { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.decktile__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--deck); flex: none; box-shadow: 0 0 12px var(--deck); }
.decktile__cat { color: var(--muted); font-size: 0.8rem; }
.decktile__count { margin-left: auto; font-size: 0.8rem; color: var(--muted); }
.decktile__top .tag { margin-left: auto; }
.decktile__title { font-size: 1.12rem; }
.decktile__desc { color: var(--muted); font-size: 0.9rem; flex: 1; }
.decktile__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.84rem; color: var(--muted); flex: 1; align-content: flex-start; }
.decktile__progress { font-size: 0.76rem; color: var(--faint); }
.decktile__cta { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 0.86rem; color: var(--deck); }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 500; background: rgba(255, 255, 255, 0.07); color: var(--ink-2); }
.pill--due { background: rgba(255, 138, 61, 0.15); color: #ffb383; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 500; color: var(--muted); background: rgba(255, 255, 255, 0.06); padding: 3px 9px; border-radius: 999px; }
.tag--light { background: rgba(255, 255, 255, 0.1); color: var(--ink); }

/* ---------- Fiche d'un deck ---------- */
.deckhead { position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: 26px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--glass-edge); }
.deckhead::before { content: ""; position: absolute; inset: auto -10% -60% auto; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, var(--deck), transparent 65%); opacity: 0.16; pointer-events: none; }
.deckhead > * { position: relative; }
.deckhead__top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 22px; }
.deckhead__top:empty { display: none; }
.deckhead__title { font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -0.03em; }
.deckhead__desc { color: var(--ink-2); max-width: 640px; }
.deckhead__stats { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: 6px; }
.deckhead__stat { display: flex; flex-direction: column; }
.deckhead__stat strong { font-family: var(--display); font-size: 1.7rem; font-weight: 500; line-height: 1.1; }
.deckhead__stat span { font-size: 0.8rem; color: var(--muted); }
.deckactions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.deckactions__more { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
@media (max-width: 640px) { .deckactions__more { margin-left: 0; } }
.copyrow { display: flex; gap: 8px; }
.copyrow .input { flex: 1; min-width: 0; }
.cardlist { display: flex; flex-direction: column; gap: 8px; }
.cardrow { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cardrow__img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; flex: none; background: #141414; }
.cardrow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cardrow__front { font-weight: 500; overflow-wrap: anywhere; }
.cardrow__back { color: var(--muted); overflow-wrap: anywhere; font-size: 0.92rem; }
.cardrow__note { color: var(--faint); font-size: 0.8rem; }
.cardrow__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.cardrow__when { font-size: 0.74rem; color: var(--faint); }
.state { padding: 2px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 500; white-space: nowrap; background: color-mix(in srgb, var(--sc) 15%, transparent); color: var(--sc); }
.state--new { --sc: var(--st-new); }
.state--learning { --sc: var(--st-learning); }
.state--young { --sc: var(--st-young); }
.state--mastered { --sc: var(--st-mastered); }

/* ---------- Éditeur ---------- */
.editor { padding-bottom: 90px; }
.langrow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.langrow .icon-btn { margin-bottom: 3px; }
@media (max-width: 560px) { .langrow { grid-template-columns: 1fr; } .langrow .icon-btn { justify-self: center; transform: rotate(90deg); } }
.addrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
@media (max-width: 640px) { .addrow { grid-template-columns: 1fr; } }
.editlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.editlist__empty { color: var(--muted); text-align: center; padding: 18px; }
.editrow { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); }
.editrow__n { width: 26px; text-align: right; color: var(--faint); font-size: 0.78rem; font-weight: 500; padding-top: 11px; flex: none; }
.editrow__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.editrow__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .editrow__pair { grid-template-columns: 1fr; } }
.editrow__extra { display: flex; flex-direction: column; gap: 8px; }
.editrow__tools { display: flex; align-items: center; gap: 2px; color: var(--muted); }
.imgbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imgbox__img { width: 80px; height: 80px; object-fit: contain; border-radius: 12px; background: #141414; border: 1px solid var(--line); }
.savebar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); z-index: 15; display: flex; justify-content: center; pointer-events: none; }
.savebar__in { pointer-events: auto; display: flex; gap: 8px; padding: 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line-2); box-shadow: var(--glass-edge), var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
@media (min-width: 900px) { .savebar { bottom: 24px; } }

/* ---------- Révision ---------- */
.focus { min-height: 100vh; background: var(--bg); position: relative; }
.focus__in { max-width: 720px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom)); }
.focus--wide .focus__in { max-width: 980px; }
.study { display: flex; flex-direction: column; gap: 18px; }
.study__top, .quiz__head { display: flex; align-items: center; gap: 12px; }
.study__progress { flex: 1; }
.study__bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.study__bar span { display: block; height: 100%; background: var(--gold); border-radius: 999px; transition: width 0.35s; }
.study__count { font-weight: 500; font-size: 0.86rem; color: var(--muted); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.study__tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.study__stage { perspective: 1600px; }
.study__keys { text-align: center; color: var(--faint); font-size: 0.78rem; }
@media (hover: none) { .study__keys { display: none; } }
.study__nav { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; }

.flash { width: 100%; min-height: 340px; aspect-ratio: 4 / 3; cursor: pointer; border-radius: var(--radius-xl); -webkit-tap-highlight-color: transparent; }
@media (max-width: 520px) { .flash { aspect-ratio: auto; height: min(60vh, 440px); } }
.flash__inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1); }
.flash.is-flipped .flash__inner { transform: rotateY(180deg); }
.flash__face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: var(--radius-xl); padding: 20px 22px; display: flex; flex-direction: column; overflow: hidden; }
.flash__front { background: radial-gradient(70% 60% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 70%), var(--surface); border: 1px solid var(--line-2); box-shadow: var(--glass-edge), var(--shadow); }
.flash__back { background: radial-gradient(70% 60% at 50% 100%, rgba(255, 218, 42, 0.08), transparent 70%), #222; border: 1px solid rgba(255, 218, 42, 0.25); transform: rotateY(180deg); box-shadow: var(--glass-edge), var(--shadow); }
.flash__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.flash__lang { display: inline-flex; align-items: center; gap: 8px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.flash__back .flash__lang { color: var(--gold); }
.flash__body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 8px 0; min-height: 0; }
.flash__text { font-family: var(--display); font-size: clamp(1.8rem, 6vw, 2.7rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.flash__text--long { font-size: clamp(1.2rem, 3.8vw, 1.6rem); line-height: 1.35; }
.flash__img { max-height: 46%; max-width: 86%; object-fit: contain; border-radius: 14px; }
.flash__example { color: var(--ink-2); font-size: 1rem; max-width: 520px; font-style: italic; }
.flash__note { font-size: 0.86rem; color: var(--muted); }
.flash__bottom { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
.flash__hint { font-size: 0.76rem; color: var(--faint); }

.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; min-height: 62px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); transition: transform 0.1s, background 0.15s, border-color 0.15s; }
.rate:hover { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 10%, var(--surface)); }
.rate:active { transform: scale(0.96); }
.rate__label { font-weight: 500; font-size: 0.92rem; display: inline-flex; align-items: center; gap: 7px; }
.rate__label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rc); }
.rate__when { font-size: 0.76rem; color: var(--muted); }
.rate--again { --rc: var(--r-again); }
.rate--hard { --rc: var(--r-hard); }
.rate--good { --rc: var(--r-good); }
.rate--easy { --rc: var(--r-easy); }
@media (max-width: 420px) { .rate__label::before { display: none; } }

.finish { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 28px 8px; }
.finish__ring { position: relative; width: 150px; height: 150px; }
.finish__ringtext, .today__ringtext { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.finish__ringtext strong { font-family: var(--display); font-size: 2.2rem; font-weight: 500; line-height: 1; }
.finish__ringtext span { color: var(--muted); font-size: 0.78rem; max-width: 100px; }
.finish__title { font-size: clamp(1.6rem, 5vw, 2.2rem); }
.finish__text { color: var(--muted); }
.finish__score { font-family: var(--display); font-size: clamp(3rem, 12vw, 4.6rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1; color: var(--gold); }
.finish__tally { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 4px 0 10px; }
.tally { display: flex; flex-direction: column; min-width: 80px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.tally strong { font-family: var(--display); font-size: 1.4rem; font-weight: 500; color: var(--rc); }
.tally span { font-size: 0.76rem; color: var(--muted); }
.tally--again { --rc: var(--r-again); }
.tally--hard { --rc: var(--r-hard); }
.tally--good { --rc: var(--r-good); }
.tally--easy { --rc: var(--r-easy); }

/* ---------- Quiz ---------- */
.quiz { display: flex; flex-direction: column; gap: 18px; }
.quiz__body { display: flex; flex-direction: column; gap: 14px; }
.quiz__foot { min-height: 54px; }
.quiz__timer { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 6px; font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.quiz__timer.is-low { color: var(--bad); animation: pulse 0.5s ease-in-out infinite alternate; }
.quiz__prompt { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 30px 18px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--glass-edge); }
.quiz__label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; }
.quiz__q { font-family: var(--display); font-size: clamp(1.6rem, 5.6vw, 2.4rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.quiz__pair { font-size: clamp(1.2rem, 4vw, 1.6rem); color: var(--gold); }
.quiz__feedback { display: flex; flex-direction: column; gap: 4px; min-height: 24px; text-align: center; color: var(--ink-2); }
.quiz__feedback .good { color: var(--good); font-weight: 500; }
.quiz__feedback .bad { color: var(--bad); font-weight: 500; }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); transition: transform 0.15s, border-color 0.15s; }
.mode:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(255, 218, 42, 0.5); }
.mode:disabled { opacity: 0.45; cursor: not-allowed; }
.mode__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 218, 42, 0.12); color: var(--gold); }
.mode__title { font-weight: 500; font-size: 1rem; margin-top: 4px; }
.mode__text { color: var(--muted); font-size: 0.86rem; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; min-height: 56px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); font-size: 1rem; transition: border-color 0.15s, background 0.15s; }
.opt:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.4); }
.opt:disabled { cursor: default; }
.opt__key { width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); display: grid; place-items: center; font-size: 0.78rem; font-weight: 600; flex: none; color: var(--muted); }
.opt__text { flex: 1; overflow-wrap: anywhere; }
.opt.is-right { border-color: var(--good); background: rgba(79, 209, 139, 0.12); }
.opt.is-wrong { border-color: var(--bad); background: rgba(255, 107, 107, 0.12); }
.opt:disabled:not(.is-right):not(.is-wrong) { opacity: 0.45; }
.tfrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tfbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; font-size: 1.05rem; }
.tfbtn--yes .ico { color: var(--good); }
.tfbtn--no .ico { color: var(--bad); }
.tfbtn.is-right { background: rgba(79, 209, 139, 0.12); border-color: var(--good); }
.tfbtn.is-wrong { background: rgba(255, 107, 107, 0.12); border-color: var(--bad); }
.listen-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; border: none; border-radius: 50%; width: 116px; height: 116px; justify-content: center; background: var(--gold); color: var(--gold-ink); font-weight: 500; font-size: 0.82rem; }
.missed { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.missed__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.missed__list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }

/* ---------- Statistiques ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 2px; }
.kpi__icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 218, 42, 0.12); color: var(--gold); display: grid; place-items: center; margin-bottom: 10px; }
.kpi__value { font-family: var(--display); font-size: 1.8rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.kpi__label { color: var(--ink-2); }
.kpi__sub { font-size: 0.78rem; color: var(--faint); }
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: rgba(255, 255, 255, 0.22); }
.chart .bar--goal { fill: var(--gold); }
.chart__goal { stroke: var(--faint); stroke-dasharray: 4 4; stroke-width: 1; }
.chart__goaltext, .chart__axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.states { display: flex; flex-direction: column; gap: 14px; }
.states__bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.states__seg--mastered, .dot--mastered { background: var(--st-mastered); }
.states__seg--young, .dot--young { background: var(--st-young); }
.states__seg--learning, .dot--learning { background: var(--st-learning); }
.states__seg--new, .dot--new { background: var(--st-new); }
.states__legend { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.states__legend li { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; column-gap: 6px; }
.states__legend .hint { grid-column: 1 / -1; padding-left: 18px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; align-self: center; }
.decklines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.deckline { display: grid; grid-template-columns: auto 1fr minmax(80px, 30%) 44px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; min-height: 44px; }
.deckline:hover { background: rgba(255, 255, 255, 0.04); }
.deckline__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deckline__bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.deckline__bar span { display: block; height: 100%; background: var(--st-mastered); border-radius: 999px; }
.deckline__pct { font-size: 0.82rem; text-align: right; color: var(--muted); }
@media (max-width: 520px) { .deckline { grid-template-columns: auto 1fr 44px; } .deckline__bar { display: none; } }
.hardlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hardlist li { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); }
.hardlist__front { font-weight: 500; }
.hardlist__back { color: var(--muted); }
.hardlist__meta { grid-column: 1 / -1; font-size: 0.76rem; color: var(--faint); }

/* ---------- Profil ---------- */
.voicelist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.voicelist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.voicelist li.is-off { opacity: 0.5; }

/* ---------- Bibliothèque et partage ---------- */
.previewlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.previewlist li { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.previewlist__img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #141414; }
.previewlist__front { font-weight: 500; grid-column: 2; overflow-wrap: anywhere; }
.previewlist li:not(:has(img)) .previewlist__front { grid-column: 1 / 3; }
.previewlist__back { color: var(--muted); overflow-wrap: anywhere; }
.previewlist__more { display: block !important; text-align: center; color: var(--muted); background: transparent !important; border: none !important; }

/* ---------- Bloc-notes ---------- */
.notegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.notegrid--empty { display: block; }
.notetile { display: flex; flex-direction: column; gap: 10px; padding: 18px; min-height: 150px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: transform 0.15s, border-color 0.15s; }
.notetile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.notetile__icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 218, 42, 0.12); color: var(--gold); }
.notetile__title { font-family: var(--display); font-size: 1.05rem; font-weight: 500; flex: 1; overflow-wrap: anywhere; }
.notetile__meta { color: var(--faint); font-size: 0.8rem; }

.note { display: flex; flex-direction: column; gap: 14px; }
.note__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note__title { flex: 1 1 200px; min-width: 0; border: none; background: transparent; color: var(--ink); font-family: var(--display); font-size: 1.4rem; font-weight: 500; padding: 6px 4px; border-radius: 10px; }
.note__title:focus { outline: none; background: rgba(255, 255, 255, 0.04); }
.note__title::placeholder { color: var(--faint); }
.note__status { font-size: 0.78rem; color: var(--faint); white-space: nowrap; }
.note__status--ok { color: var(--muted); }
.note__status--warn { color: var(--gold); }
.note__status--error { color: var(--bad); white-space: normal; }
.note__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.note__tools { position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 5; display: flex; justify-content: center; }
.note__sheet { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.note__paper { border-radius: 18px; background: #1b1b1b; border: 1px solid var(--line); padding: 22px; }
.note__text { width: 100%; min-height: 420px; border: none; background: transparent; resize: none; color: var(--ink); font-size: 1.05rem; line-height: 1.75; }
.note__text:focus { outline: none; }
.note__text::placeholder { color: var(--faint); }
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager__n { color: var(--muted); font-size: 0.86rem; min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; }

.sheet { position: relative; width: 100%; background: #1b1b1b; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sheet__layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sheet__live { touch-action: none; cursor: crosshair; }
.sheet[data-tool="eraser"] .sheet__live { cursor: cell; }

.inkbar { display: inline-flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line-2); box-shadow: var(--glass-edge), var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); max-width: 100%; }
.inkbar::-webkit-scrollbar { display: none; }
.inkbar__group { display: inline-flex; align-items: center; gap: 2px; padding: 0 4px; flex: none; }
.inkbar__group + .inkbar__group { border-left: 1px solid var(--line); }
.inkbtn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: none; background: transparent; color: var(--ink-2); }
.inkbtn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.inkbtn.is-on { background: var(--gold); color: var(--gold-ink); }
.inkdot { width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent; display: grid; place-items: center; }
.inkdot::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.inkdot.is-on::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--dot); }
.inksize { width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent; display: grid; place-items: center; }
.inksize span { border-radius: 50%; background: var(--muted); }
.inksize.is-on { background: rgba(255, 255, 255, 0.1); }
.inksize.is-on span { background: var(--ink); }
.inkbar .chip { height: 34px; }

.drawdlg { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.drawdlg__sheet { width: 100%; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.picklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; }
.picklist li { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }

/* ---------- Confettis ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; } }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .confetti { display: none; }
}
