/* ------------------------------------------------------------------ *
 * Thèmes — inspiration apple.com : neutres #f5f5f7 / #1d1d1f,
 * accent bleu, surfaces en verre dépoli (blur + saturation).
 * ------------------------------------------------------------------ */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-2: #ececf0;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --hairline: rgba(0, 0, 0, .1);
  --hairline-strong: rgba(0, 0, 0, .16);

  /* Verre : opacité suffisante pour garder un texte bien lisible */
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-row: rgba(255, 255, 255, .78);
  --glass-header: rgba(250, 250, 252, .74);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, .7);
  --blur: saturate(180%) blur(20px);

  --fill: rgba(118, 118, 128, .12);
  --fill-hover: rgba(118, 118, 128, .2);
  --segment-active: #ffffff;

  --accent: #0066cc;          /* liens, texte accentué (AA sur blanc) */
  --accent-strong: #0071e3;   /* fonds de boutons */
  --accent-hover: #0077ed;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(0, 113, 227, .1);
  --ring: rgba(0, 113, 227, .45);

  --ok: #248a3d;
  --ok-contrast: #ffffff;
  --danger: #d70015;
  --danger-contrast: #ffffff;
  --warning: #b25000;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow: 0 2px 6px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .07);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, .06), 0 24px 60px rgba(0, 0, 0, .12);

  --blob-1: rgba(0, 113, 227, .16);
  --blob-2: rgba(191, 90, 242, .13);
  --blob-3: rgba(255, 159, 10, .1);

  --radius-lg: 28px;
  --radius: 18px;
  --radius-sm: 12px;
  --pill: 980px;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #0b0b0f;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --hairline: rgba(255, 255, 255, .12);
  --hairline-strong: rgba(255, 255, 255, .2);

  --glass: rgba(28, 28, 30, .66);
  --glass-strong: rgba(36, 36, 40, .84);
  --glass-row: rgba(36, 36, 40, .72);
  --glass-header: rgba(18, 18, 20, .72);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, .06);

  --fill: rgba(118, 118, 128, .24);
  --fill-hover: rgba(118, 118, 128, .34);
  --segment-active: #636366;

  --accent: #2997ff;
  --accent-strong: #0071e3;
  --accent-hover: #0a84ff;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(41, 151, 255, .16);
  --ring: rgba(41, 151, 255, .55);

  --ok: #30d158;
  --ok-contrast: #002b0c;
  --danger: #ff6961;
  --danger-contrast: #2a0000;
  --warning: #ffb340;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 8px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5), 0 30px 70px rgba(0, 0, 0, .5);

  --blob-1: rgba(10, 132, 255, .22);
  --blob-2: rgba(191, 90, 242, .16);
  --blob-3: rgba(255, 159, 10, .08);
}

/* Navigateurs sans backdrop-filter, ou utilisateurs qui réduisent la
 * transparence : surfaces opaques, lisibilité maximale. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: #ffffff; --glass-strong: #ffffff; --glass-row: #ffffff; --glass-header: #fbfbfd; }
  :root[data-theme="dark"] { --glass: #1c1c1e; --glass-strong: #2c2c2e; --glass-row: #1c1c1e; --glass-header: #161617; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: #ffffff; --glass-strong: #ffffff; --glass-row: #ffffff; --glass-header: #fbfbfd; --blur: none; }
  :root[data-theme="dark"] { --glass: #1c1c1e; --glass-strong: #2c2c2e; --glass-row: #1c1c1e; --glass-header: #161617; }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  letter-spacing: -.01em;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Lumière d'ambiance derrière le verre */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42rem 32rem at 8% -6%, var(--blob-1), transparent 70%),
    radial-gradient(36rem 30rem at 96% 8%, var(--blob-2), transparent 70%),
    radial-gradient(44rem 30rem at 50% 108%, var(--blob-3), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }

h1, h2, h3 { line-height: 1.1; margin: 0 0 .35em; letter-spacing: -.022em; font-weight: 700; }

h1 { font-size: clamp(2rem, 1.35rem + 2.6vw, 3.5rem); }
h2 { font-size: clamp(1.2rem, 1.1rem + .4vw, 1.45rem); font-weight: 600; letter-spacing: -.015em; }

p { margin: 0 0 .6em; }

.muted { color: var(--muted); }
.small { font-size: .85rem; letter-spacing: 0; }

::selection { background: var(--accent-soft); }

/* Focus clavier visible partout, discret à la souris */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
  border-radius: var(--radius-sm);
}
a:focus-visible { border-radius: 6px; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  box-shadow: var(--glass-highlight), var(--shadow);
}

/* ------------------------------------------------------------------ *
 * Structure
 * ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--glass-header);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
}

.site-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 56px;
  padding: .45rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; opacity: .8; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; box-shadow: var(--shadow-sm); }

.brand-chalk { color: var(--text); }

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 36px;
  padding: .4rem .9rem;
  border-radius: var(--pill);
  background: var(--fill);
  color: var(--text);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background-color .2s var(--ease);
}
.header-link:hover { background: var(--fill-hover); text-decoration: none; }

.icon { flex: none; vertical-align: middle; }
.icon-button .icon { width: 1.15rem; height: 1.15rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 40px;
  min-height: 40px;
  padding: .4rem;
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--pill);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { background: var(--fill-hover); color: var(--accent); text-decoration: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.icon-btn.primary { background: var(--accent-strong); color: var(--accent-contrast); }
.icon-btn.primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn .icon { width: 1.05rem; height: 1.05rem; }

.admin-nav .icon { width: 1rem; height: 1rem; }

.admin-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .85rem;
  letter-spacing: 0;
}

.admin-nav a,
.admin-nav .link-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 36px;
  padding: .35rem .7rem;
  border-radius: var(--pill);
  color: var(--text);
  text-decoration: none;
  transition: background-color .2s var(--ease);
}
.admin-nav a:hover,
.admin-nav .link-button:hover { background: var(--fill); text-decoration: none; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.2rem 1.25rem 2.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-link { color: var(--muted); }

.page-head { margin-bottom: 2rem; }
.page-head .muted { font-size: clamp(1rem, .95rem + .35vw, 1.3rem); letter-spacing: -.01em; margin: 0; }

.eyebrow {
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: 0;
  margin-bottom: .4rem;
}

.hero { text-align: center; padding: 1rem 0 1.5rem; }
.hero h1 { font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4.5rem); letter-spacing: -.03em; }

/* Barre secondaire (style « local nav » d'Apple) */
.breadcrumb {
  max-width: 1080px;
  margin: 0 auto;
  padding: .55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  font-size: .85rem;
  letter-spacing: 0;
  color: var(--muted);
  border-top: 1px solid var(--hairline);
}
.breadcrumb a { color: var(--muted); text-decoration: none; padding: .15rem .1rem; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb [aria-current] { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------------------ *
 * Cartes / listes
 * ------------------------------------------------------------------ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-height: 150px;
  padding: 1.5rem 1.5rem 1.3rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover { text-decoration: none; transform: translateY(-3px) scale(1.01); box-shadow: var(--glass-highlight), var(--shadow-lg); }
.card:active { transform: scale(.99); }
.card:focus-visible { border-radius: var(--radius-lg); box-shadow: 0 0 0 4px var(--ring), var(--shadow); }
.card-kicker { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.card-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.card-cta {
  margin-top: auto;
  padding-top: .9rem;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  color: var(--accent);
  font-size: .95rem;
  font-weight: 500;
}
.card:hover .card-cta { text-decoration: underline; text-underline-offset: .15em; }

.list-stack {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--glass-highlight), var(--shadow);
}
.list-stack > li + li { border-top: 1px solid var(--hairline); }

.row-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
  padding: .9rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: background-color .2s var(--ease);
}
.row-link:hover { background: var(--fill); text-decoration: none; }
.row-link:focus-visible { border-radius: 0; box-shadow: inset 0 0 0 3px var(--ring); }
.row-title { font-weight: 600; flex: 1; min-width: 0; }
.row-meta { color: var(--muted); font-size: .88rem; letter-spacing: 0; white-space: nowrap; }
.chev { color: var(--muted); font-size: 1.4rem; line-height: 1; opacity: .7; }

/* ------------------------------------------------------------------ *
 * Progression
 * ------------------------------------------------------------------ */
.progress-panel {
  margin-bottom: 1.4rem;
  padding: 1.1rem 1.25rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .9rem;
  letter-spacing: 0;
  margin-bottom: .6rem;
  color: var(--muted);
}
.progress-head span:first-child { color: var(--text); font-weight: 600; }
#progress-count { font-variant-numeric: tabular-nums; }

.progress-track {
  height: 8px;
  background: var(--fill);
  border-radius: var(--pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0071e3, #5e5ce6);
  border-radius: var(--pill);
  transition: width .45s var(--ease);
}
:root[data-theme="dark"] .progress-fill { background: linear-gradient(90deg, #0a84ff, #8e8cff); }

/* ------------------------------------------------------------------ *
 * Boutons et formulaires — pilules façon apple.com
 * ------------------------------------------------------------------ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  padding: .6rem 1.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--text);
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--pill);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .15s var(--ease);
}
.button:hover { background: var(--fill-hover); text-decoration: none; }
.button:active { transform: scale(.97); }
.button:focus-visible { border-radius: var(--pill); }
.button.primary { background: var(--accent-strong); color: var(--accent-contrast); }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { background: var(--danger); color: var(--danger-contrast); }
.button.danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.button.ghost { background: transparent; border-color: var(--accent); color: var(--accent); }
.button.ghost:hover { background: var(--accent-soft); }
.button.small { padding: .35rem .85rem; min-height: 36px; font-size: .85rem; }
.button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--pill);
  border: none;
  background: var(--fill);
  color: var(--text);
  cursor: pointer;
  transition: background-color .2s var(--ease), transform .15s var(--ease);
}
.icon-button:hover { background: var(--fill-hover); }
.icon-button:active { transform: scale(.94); }
.icon-button:focus-visible { border-radius: var(--pill); }

/* Bascule de thème : lune en clair, soleil en sombre */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.link-button {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

input[type="text"], input[type="password"], input[type="file"], textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  min-height: 44px;
  width: 100%;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input[type="file"] { padding: .55rem .7rem; }
input[type="file"]::file-selector-button {
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  margin-right: .8rem;
  padding: .35rem .85rem;
  border: none;
  border-radius: var(--pill);
  background: var(--fill);
  color: var(--text);
  cursor: pointer;
}
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent-strong); cursor: pointer; }

textarea {
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem;
  line-height: 1.45;
}

input:focus, textarea:focus,
input:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--ring);
}

.inline-form { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inline-form input[type="text"] { width: auto; min-width: 10rem; }
.stack-form { display: grid; gap: 1rem; max-width: 460px; }
.stack-form label { display: grid; gap: .4rem; font-weight: 600; font-size: .9rem; letter-spacing: 0; }

.toolbar { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.4rem; align-items: center; }

.panel {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--glass-highlight), var(--shadow);
}

.panel h2 { margin-bottom: .9rem; }

.code-sample {
  background: var(--fill);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: .85rem;
  margin: 0 0 .7rem;
}

/* ------------------------------------------------------------------ *
 * Tableaux de mots
 * ------------------------------------------------------------------ */
.table-scroll { overflow-x: auto; border-radius: var(--radius); }

.word-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--glass-highlight), var(--shadow);
  overflow: hidden;
}

.word-table th, .word-table td {
  text-align: left;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

.word-table th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: color-mix(in srgb, var(--fill) 50%, transparent);
}

.word-table tbody tr:last-child td,
.word-table tfoot tr:last-child td { border-bottom: none; }
.word-table tbody tr { transition: background-color .2s var(--ease); }
.word-table tbody tr:hover { background: color-mix(in srgb, var(--fill) 55%, transparent); }
.word-table .col-status { width: 96px; text-align: center; }
.word-en { font-weight: 600; }

.word-row.is-learned { background: color-mix(in srgb, var(--ok) 9%, transparent); }
.word-row.is-learned:hover { background: color-mix(in srgb, var(--ok) 13%, transparent); }
.word-row.is-learned .word-en { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 45%, transparent); opacity: .7; }

.learn-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--pill);
  border: 2px solid var(--hairline-strong);
  background: transparent;
  color: transparent;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.learn-toggle:hover { border-color: var(--ok); color: color-mix(in srgb, var(--ok) 55%, transparent); }
.learn-toggle:active { transform: scale(.9); }
.learn-toggle:focus-visible { border-radius: var(--pill); }

.learn-toggle[aria-pressed="true"] {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--ok-contrast);
}

/* ------------------------------------------------------------------ *
 * Révision : plein écran, sans défilement (PC et mobile)
 * ------------------------------------------------------------------ */
body.is-review { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
body.is-review .site-header { flex: none; }
body.is-review .container {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-top: .9rem;
  padding-bottom: max(.9rem, env(safe-area-inset-bottom));
  overflow: visible; /* le body coupe déjà ; évite de rogner les ombres */
}
body.is-review .site-footer { display: none; }

#review {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.review-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  flex-wrap: wrap;
}

.review-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 40px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  max-width: 42%;
}
.review-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-back:hover { text-decoration: none; opacity: .8; }
.review-counter {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: .9rem;
  padding: .3rem .75rem;
  border-radius: var(--pill);
  background: var(--fill);
}

/* Contrôles segmentés (style iOS / macOS) */
.mode-tabs,
.dir-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--fill);
  border-radius: var(--pill);
}
.mode-tab,
.dir-tab {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 34px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: .88rem;
  letter-spacing: 0;
  padding: .35rem .85rem;
  border-radius: var(--pill);
  cursor: pointer;
  white-space: nowrap;
  opacity: .78;
  transition: background-color .25s var(--ease), box-shadow .25s var(--ease), opacity .2s var(--ease);
}
.dir-tab { font-weight: 600; font-size: .8rem; padding: .35rem .7rem; }
.mode-tab:hover,
.dir-tab:hover { opacity: 1; }
.mode-tab:focus-visible,
.dir-tab:focus-visible { border-radius: var(--pill); }
.mode-tab.is-active,
.dir-tab.is-active {
  opacity: 1;
  background: var(--segment-active);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .08);
}

.review-track { flex: none; margin: 0; height: 6px; }

.review-stage { position: relative; flex: 1; min-height: 0; }
.mode-panel { position: absolute; inset: 0; display: flex; flex-direction: column; gap: .75rem; }

/* Flashcards */
.flashcard-face {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--shadow-lg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.flashcard-face:hover { transform: translateY(-2px); }
.flashcard-face:active { transform: scale(.995); }
.flashcard-face:focus-visible { border-radius: var(--radius-lg); box-shadow: 0 0 0 4px var(--ring), var(--shadow-lg); }
.flashcard-term {
  font-size: clamp(1.9rem, 1.1rem + 4.4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.flashcard-translation {
  font-size: clamp(1.6rem, 1rem + 3.6vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.15;
  color: var(--accent);
  border-top: 1px solid var(--hairline);
  padding-top: 1rem;
  width: min(100%, 36rem);
  overflow-wrap: anywhere;
  animation: reveal-in .35s var(--ease);
}
.flashcard-hint { color: var(--muted); font-size: .95rem; letter-spacing: 0; }

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* QCM */
.quiz-prompt {
  flex: none;
  text-align: center;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-size: clamp(1.7rem, 1.1rem + 3.2vw, 2.6rem);
  overflow-wrap: anywhere;
  padding: .3rem 0;
}
.qcm-options {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  gap: .65rem;
}
.qcm-option {
  display: flex;
  align-items: center;
  gap: .8rem;
  text-align: left;
  min-height: 0;
  overflow: hidden;
  font: inherit;
  font-size: clamp(1rem, .9rem + .7vw, 1.35rem);
  font-weight: 500;
  padding: .8rem 1.1rem;
  background: var(--glass-row);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), transform .15s var(--ease);
}
.qcm-option:hover:not(:disabled) { border-color: var(--accent-strong); }
.qcm-option:active:not(:disabled) { transform: scale(.985); }
.qcm-option:focus-visible { border-radius: var(--radius); }
.qcm-key {
  flex: none;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: var(--pill);
  background: var(--fill);
  font-weight: 600;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.qcm-option.is-correct {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, var(--glass-strong));
}
.qcm-option.is-correct .qcm-key { background: var(--ok); color: var(--ok-contrast); }
.qcm-option.is-wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--glass-strong));
}
.qcm-option.is-wrong .qcm-key { background: var(--danger); color: var(--danger-contrast); }
.qcm-option:disabled { cursor: default; }
.qcm-option:disabled:not(.is-correct):not(.is-wrong) { opacity: .6; }

/* Écriture libre */
.write-form { flex: none; display: flex; gap: .6rem; }
.write-form input { flex: 1; font-size: 1.15rem; min-height: 52px; border-radius: var(--pill); padding: .65rem 1.25rem; }
.write-form .button { min-height: 52px; }
.write-answer { flex: none; text-align: center; font-weight: 600; }
.write-answer strong { color: var(--accent); }

.quiz-feedback { flex: none; min-height: 1.6rem; text-align: center; font-weight: 600; }
.quiz-feedback.is-ok { color: var(--ok); }
.quiz-feedback.is-no { color: var(--danger); }
.quiz-feedback.is-ok::before { content: "✓  "; }
.quiz-feedback.is-no::before { content: "✗  "; }

/* Navigation bas de carte */
.review-bottom { flex: none; display: flex; gap: .6rem; }
.review-nav { flex: 1; display: flex; gap: .6rem; }
.review-nav .button { flex: 1; }
.review-bottom .button.learn { flex: none; white-space: nowrap; }

.button.learn { background: transparent; border-color: var(--ok); color: var(--ok); }
.button.learn:hover { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.button.learn.is-active { background: var(--ok); border-color: var(--ok); color: var(--ok-contrast); }

@media (min-width: 700px) {
  .qcm-options { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  #review { max-width: 1080px; }
  .flashcard-face { padding: 3rem; }
  .flashcard-term { font-size: clamp(3rem, 6vw, 6rem); }
  .flashcard-translation { font-size: clamp(2.4rem, 5vw, 5rem); width: min(100%, 52rem); }
  .flashcard-hint { font-size: 1.15rem; }
  .quiz-prompt { font-size: clamp(2.4rem, 4vw, 4rem); }
  .qcm-option { font-size: clamp(1.4rem, 1.8vw, 2rem); padding: 1.2rem 1.4rem; }
  .review-bottom .button { min-height: 56px; font-size: 1.05rem; }
}

@media (max-width: 560px) {
  .review-bottom { flex-direction: column; }
  .review-back { max-width: 55%; }
}

/* Félicitations de fin de liste */
.congrats {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  animation: congrats-fade .25s ease;
}

.congrats-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 440px;
  text-align: center;
  padding: 2.4rem 1.6rem 1.8rem;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), var(--shadow-lg);
  animation: congrats-pop .45s cubic-bezier(.2, .9, .3, 1.2);
}

.congrats-emoji {
  font-size: 3.2rem;
  line-height: 1;
  animation: congrats-bounce .7s ease;
}

.congrats-card h2 { margin: .7rem 0 .25rem; font-size: 2rem; font-weight: 700; letter-spacing: -.025em; }
.congrats-progress { color: var(--accent); font-weight: 600; }

.congrats-actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.congrats-confetti { position: absolute; inset: 0; pointer-events: none; }

.confetti {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 1.6s ease-in forwards;
}

@keyframes congrats-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes congrats-pop {
  from { transform: translateY(14px) scale(.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes congrats-bounce {
  0% { transform: scale(.4); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes confetti-fall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(380px) rotate(600deg); }
}

/* ------------------------------------------------------------------ *
 * Import
 * ------------------------------------------------------------------ */
.import-summary { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pill {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: var(--pill);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: 0;
  background: var(--fill);
  color: var(--text);
}
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.pill.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.import-table tr.status-error { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.import-table tr.status-warning { background: color-mix(in srgb, var(--warning) 9%, transparent); }
.import-actions { margin-top: 1.2rem; }

/* ------------------------------------------------------------------ *
 * QR / auth / états vides
 * ------------------------------------------------------------------ */
.qr-panel {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--glass-highlight), var(--shadow);
}
.qr-panel .toolbar { justify-content: center; margin-bottom: 0; }

.qr-image { background: #fff; padding: .8rem; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 100%; height: auto; }
.share-url { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; font-size: .95rem; word-break: break-all; margin: 0; }

.auth-card {
  max-width: 400px;
  margin: 2rem auto;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.8rem;
  box-shadow: var(--glass-highlight), var(--shadow-lg);
}
.auth-card h1 { font-size: clamp(1.8rem, 1.5rem + 1vw, 2.3rem); }
.auth-card .stack-form { margin-top: 1.4rem; }
.auth-card .button { width: 100%; margin-top: .3rem; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1.25rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-lg);
}
.empty-state h1 { color: var(--text); }

.flashes { display: grid; gap: .5rem; margin-bottom: 1.4rem; }
.flash {
  padding: .8rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  animation: reveal-in .3s var(--ease);
}
.flash-success { border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }

/* ------------------------------------------------------------------ *
 * Administration : arborescence
 * ------------------------------------------------------------------ */
.tree {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  margin-bottom: 1rem;
  box-shadow: var(--glass-highlight), var(--shadow);
}

.tree > summary {
  min-height: 52px;
  padding: .85rem 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  list-style: none;
  border-radius: var(--radius);
}
.tree > summary::-webkit-details-marker { display: none; }
.tree > summary::before {
  content: "";
  flex: none;
  width: .5rem;
  height: .5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .2s var(--ease);
  margin-right: .15rem;
}
.tree[open] > summary::before { transform: rotate(45deg); }
.tree > summary:hover { background: color-mix(in srgb, var(--fill) 50%, transparent); }

.tree-body { padding: .2rem 1.15rem 1.15rem; display: grid; gap: .8rem; }
.tree-folder {
  background: color-mix(in srgb, var(--fill) 45%, transparent);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  margin: 0;
}
.tree-title { font-weight: 600; }

.tag {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--fill);
  border-radius: var(--pill);
  padding: .15rem .55rem;
}

.tree-controls { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }

.add-form { margin: .2rem 0; }
.add-form input[type="text"] { min-width: 14rem; }

.admin-list-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
  padding: .6rem .8rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--glass-row);
}
.admin-list-main { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.admin-list-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.admin-list-sub { padding: 0 .2rem .4rem; }

.word-editor { display: grid; gap: .5rem; }
.word-edit-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .55rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--fill) 45%, transparent);
}
.word-edit-form { display: flex; gap: .45rem; flex: 1; flex-wrap: wrap; min-width: 260px; }
.word-edit-form input { flex: 1; min-width: 8rem; }
.word-row-tools { display: flex; gap: .35rem; }
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ *
 * Statistiques
 * ------------------------------------------------------------------ */
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  border-radius: var(--pill);
  padding: .15rem .55rem;
  background: var(--fill);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat-badge .icon { width: .85rem; height: .85rem; }

.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--glass-highlight), var(--shadow);
}
.stat-card .icon { width: 1.5rem; height: 1.5rem; color: var(--accent); }
.stat-value { display: block; font-size: 2.2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .82rem; letter-spacing: 0; }
.stats-total-row td { font-weight: 700; }

/* ------------------------------------------------------------------ *
 * Responsive & accessibilité
 * ------------------------------------------------------------------ */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .container { padding: 1.6rem 1rem 3rem; }
  .site-header-inner { flex-wrap: wrap; padding: .4rem 1rem; }
  .breadcrumb {
    padding: .5rem 1rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }
  .admin-nav { flex-wrap: wrap; }
  .word-edit-form { min-width: 0; }
  .header-link span { display: none; }
  .header-link { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .word-table th, .word-table td { padding: .75rem .8rem; }
  .card { min-height: 120px; }
  .panel { padding: 1.2rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .card:hover, .flashcard-face:hover { transform: none; }
  .confetti { display: none; }
}

@media print {
  body::before { display: none; }
  .site-header, .site-footer { position: static; backdrop-filter: none; }
  .card, .panel, .word-table, .list-stack { box-shadow: none; backdrop-filter: none; background: #fff; }
}
