/* =====================================================
   YUKI App — Design System v3 « Gaming Addictif »
   Tokens source : www/docs/design/tokens_gaming_v3.css
   Intégration : F-92 (#372) — Frontend, 2026-04-24
   Autorité : mockup dashboard_style2_gaming_addictif.html

   Stratégie de migration : les tokens v3 sont la source. Les alias v2
   (--bg, --surface, --accent, --neutral-*, --success, --danger, etc.)
   sont conservés comme PROXIES vers les tokens v3 pour ne pas casser
   les classes existantes pendant la bascule progressive des pages.
   Les pages refondues selon les spec_*_v3.md doivent utiliser les
   tokens v3 directement (--red, --black, --gray-*, --font-disp…).
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Syne:wght@700;800&family=Space+Grotesk:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Serif+JP:wght@400;500;700&display=swap');

:root {

  /* =========================================================================
     1. PALETTE — ROUGE / NOIR / GRAYS / BLANC  (tokens v3)
     ========================================================================= */

  /* Rouge signature (triplet) */
  --red:         #E60033;
  --red-light:   #FF1A4D;
  --red-dark:    #B91C1C;
  --red-soft:    #FEE2E5;

  /* Noir / Charbon (duo hero) */
  --black:       #0A0E1A;
  --charcoal:    #1C2333;

  /* Grayscale (9 niveaux) */
  --gray-50:     #F8FAFC;
  --gray-100:    #F1F5F9;
  --gray-200:    #E2E8F0;
  --gray-300:    #CBD5E1;
  --gray-500:    #64748B;
  --gray-700:    #334155;
  --gray-900:    #1E293B;
  --white:       #FFFFFF;

  /* Alias sémantiques v3 */
  --ink:             var(--black);
  --ink-soft:        var(--charcoal);
  --paper:           var(--white);
  --paper-2:         var(--gray-50);
  --primary:         var(--red);
  --primary-hover:   var(--red-dark);
  --primary-soft:    var(--red-soft);
  --primary-contrast:var(--white);
  --text:            var(--black);
  --text-muted:      var(--gray-500);
  --border:          var(--gray-200);

  /* ── Alias rétro-compat v2 (pages non encore refondues) ────────────────── */
  --bg:            var(--gray-100);
  --surface:       var(--white);
  --surface-2:     var(--gray-50);
  --sidebar-bg:    var(--black);
  --sidebar-hover: var(--charcoal);
  --primary-light: var(--red-soft);
  --accent:        #F59E0B;       /* amber — stat-card.amber et usages ponctuels */
  --success:       #22C55E;       /* non touché par v3 : sémantique positive */
  --success-light: #DCFCE7;
  --danger:        #EF4444;
  --danger-light:  #FEE2E2;
  --warning:       #D97706;
  --warning-soft:  #FEF3C7;
  --info:          #2563EB;
  --info-soft:     #DBEAFE;
  --neutral-50:    var(--gray-50);
  --neutral-100:   var(--gray-100);
  --neutral-200:   var(--gray-200);
  --neutral-300:   var(--gray-300);
  --neutral-400:   #94A3B8;
  --neutral-500:   var(--gray-500);
  --neutral-600:   #475569;
  --neutral-700:   var(--gray-700);
  --neutral-800:   var(--charcoal);
  --neutral-900:   var(--gray-900);
  --border-strong: var(--gray-300);

  /* =========================================================================
     2. SRS — palette 6 niveaux (conservée depuis v2)
     ========================================================================= */
  --srs-0: #94A3B8;
  --srs-1: #F59E0B;
  --srs-2: #EA580C;
  --srs-3: #7C3AED;
  --srs-4: #2563EB;
  --srs-5: #059669;

  /* =========================================================================
     3. TYPOGRAPHIE — familles v3
     ========================================================================= */
  --font-disp:    "Space Grotesk", system-ui, sans-serif;
  --font-body:    "Noto Sans JP", "Space Grotesk", system-ui, sans-serif;
  --font-jp:      "Noto Serif JP", serif;
  /* Alias rétro-compat v2 — display = Space Grotesk v3, fallback Syne v2 */
  --font-display: var(--font-disp);

  /* =========================================================================
     4. TYPOGRAPHIE — échelles v3
     ========================================================================= */
  --text-xs:    12px;
  --text-sm:    13px;
  --text-base:  14px;
  --text-md:    15px;
  --text-lg:    18px;
  --text-xl:    22px;
  --text-2xl:   28px;
  --text-3xl:   36px;
  --text-4xl:   64px;

  /* Échelle JP v3 — kanji display géants (hero + filigranes) */
  --jp-xs:   14px;
  --jp-sm:   18px;
  --jp-md:   24px;
  --jp-lg:   32px;
  --jp-xl:   48px;
  --jp-xl-new: 72px;       /* alias rétro-compat v2 */
  --jp-2xl:  64px;
  --jp-3xl:  88px;
  --jp-hero: 160px;        /* kanji detail hero */
  --jp-wm:   380px;        /* filigrane hero mission */

  /* =========================================================================
     5. ESPACEMENT
     ========================================================================= */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;

  /* =========================================================================
     6. RADIUS — Gaming Addictif
     ========================================================================= */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --radius-2xl:  20px;
  --radius-3xl:  22px;
  --radius-4xl:  28px;
  --radius-pill: 100px;
  --radius-full: 9999px;
  /* Alias rétro-compat v2 */
  --radius-sm-new: var(--radius-sm);
  --radius-md-new: var(--radius-md);
  --radius-lg-new: var(--radius-2xl);

  /* =========================================================================
     7. SHADOWS — subtiles sur cards, intenses sur CTA rouge
     ========================================================================= */
  --shadow-xs:       0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:       0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-card:     0 2px 20px rgba(15, 23, 42, 0.04);
  --shadow-card-hv:  0 12px 40px rgba(15, 23, 42, 0.10);
  --shadow-md:       0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg:       0 20px 40px rgba(15, 23, 42, 0.08);
  --shadow-red-sm:   0 4px 14px rgba(230, 0, 51, 0.35);
  --shadow-red-md:   0 8px 24px rgba(230, 0, 51, 0.30);
  --shadow-red-lg:   0 8px 24px rgba(230, 0, 51, 0.40);
  --shadow-red-xl:   0 12px 32px rgba(230, 0, 51, 0.55);
  /* Alias rétro-compat v2 */
  --shadow-primary:  var(--shadow-red-lg);

  /* =========================================================================
     8. MOTION — durées + courbes (v3 resserre base/slow)
     ========================================================================= */
  --motion-fast:       150ms;
  --motion-base:       200ms;
  --motion-slow:       300ms;
  --motion-celebrate:  600ms;
  --ease-out-expo:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-standard:     cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:       cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-back:      cubic-bezier(0.36, 0, 0.66, -0.56);

  /* =========================================================================
     9. GRADIENTS RÉUTILISABLES
     ========================================================================= */
  --gradient-red:       linear-gradient(135deg, var(--red), var(--red-light));
  --gradient-red-deep:  linear-gradient(135deg, var(--red), var(--red-dark));
  --gradient-hero:      linear-gradient(135deg, var(--black) 0%, var(--charcoal) 100%);
  --gradient-card:      linear-gradient(135deg, var(--gray-50), var(--white));
  --gradient-bar:       linear-gradient(to top, var(--gray-200) 0%, var(--gray-300) 100%);
  --gradient-bar-peak:  linear-gradient(to top, var(--red-dark) 0%, var(--red) 60%, var(--red-light) 100%);
  --gradient-bar-today: linear-gradient(to top, var(--black), var(--charcoal));

  /* =========================================================================
     10. LAYOUT — shell global v3
     ========================================================================= */
  --shell-max:     1320px;
  --shell-pad-x:   40px;
  --shell-pad-y:   32px;
  --sidebar-w:     230px;
  --topbar-h:      76px;
}

/* =============================================================================
   RESPONSIVE — shell padding + typo hero adaptés par breakpoint (v3)
   ============================================================================= */
@media (max-width: 1200px) {
  :root { --shell-pad-x: 32px; --shell-pad-y: 24px; }
}
@media (max-width: 1024px) {
  :root { --shell-pad-x: 24px; --shell-pad-y: 20px; }
}
@media (max-width: 768px) {
  :root { --shell-pad-x: 14px; --shell-pad-y: 14px; --text-4xl: 36px; --jp-3xl: 48px; }
}
@media (max-width: 480px) {
  :root { --shell-pad-x: 10px; --shell-pad-y: 10px; --text-4xl: 28px; --jp-3xl: 40px; }
}
@media (max-width: 380px) {
  :root { --shell-pad-x: 8px; --shell-pad-y: 8px; --text-4xl: 24px; --jp-3xl: 32px; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Japonais ── */
.jp { font-family: var(--font-jp); }
.jp-xl  { font-family: var(--font-jp); font-size: 48px; font-weight: 700; line-height: 1.2; }
.jp-lg  { font-family: var(--font-jp); font-size: 32px; font-weight: 700; }
.jp-md  { font-family: var(--font-jp); font-size: 20px; font-weight: 500; }
.jp-sm  { font-family: var(--font-jp); font-size: 16px; }
ruby rt { font-family: var(--font-jp); font-size: 11px; color: var(--text-muted); }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}

.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-logo-mark { width: 32px; height: 32px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--font-jp); font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-logo-name { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: #fff; }

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #475569; padding: 0 8px; margin-bottom: 4px; display: block; }

.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: #94a3b8; transition: background .15s, color .15s; text-decoration: none; }
.sidebar-nav a:hover  { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .65; }
.sidebar-nav a:hover .sidebar-nav-icon, .sidebar-nav a.active .sidebar-nav-icon { opacity: 1; }

.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.sidebar-avatar { width: 32px; height: 32px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-sub  { font-size: 11px; color: #475569; }
.sidebar-logout { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #475569; transition: background .15s, color .15s; flex-shrink: 0; text-decoration: none; }
.sidebar-logout:hover { background: rgba(239,68,68,.15); color: #ef4444; text-decoration: none; }

/* ── Main ── */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ── Topbar ── */
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.topbar-actions { display: flex; gap: 8px; }

/* ── Content ── */
.content { padding: 28px; flex: 1; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 34px; font-weight: 800; font-family: var(--font-display); letter-spacing: -1px; line-height: 1; }
.stat-card.red    .stat-value { color: var(--primary); }
.stat-card.amber  .stat-value { color: var(--accent); }
.stat-card.green  .stat-value { color: var(--success); }
.stat-card.blue   .stat-value { color: #3b82f6; }

/* ── Table ── */
.table-wrap { border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
thead th { background: var(--surface-2); padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-N5 { background: #dbeafe; color: #1d4ed8; }
.badge-N4 { background: #dcfce7; color: #15803d; }
.badge-N3 { background: #fef3c7; color: #92400e; }
.badge-N2 { background: #ede9fe; color: #5b21b6; }
.badge-N1 { background: #fee2e2; color: #991b1b; }

.level-pill { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 20px; border-radius: 4px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.level-N5 { background: #dbeafe; color: #1d4ed8; }
.level-N4 { background: #dcfce7; color: #15803d; }
.level-N3 { background: #fef3c7; color: #92400e; }
.level-N2 { background: #ede9fe; color: #5b21b6; }
.level-N1 { background: #fee2e2; color: #991b1b; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; font-family: var(--font-body); cursor: pointer; border: none; transition: background .15s, transform .1s; text-decoration: none; white-space: nowrap; line-height: 1; }
.btn:active { transform: scale(.98); }
.btn:hover  { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-ink {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  transition: transform var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-base) var(--ease-standard),
              background var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard);
}
.btn-ink:hover {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--paper);
}
.btn-ink:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-input, .form-select, .form-textarea { display: block; width: 100%; padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font-body); color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s; outline: none; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(225,29,72,.1); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── Section header ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 15px; font-weight: 700; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; margin-bottom: 20px; }
.alert-error   { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; }

/* ── Flip Card SRS (styles de base — affichage conditionnel via .flipped, voir bloc session plus bas) ── */
.flip-container { width: 100%; max-width: 520px; margin: 0 auto; }
.flip-hint      { font-size: 12px; color: var(--text-muted); margin-top: 16px; }

/* Indice visuel pour les raccourcis clavier sur les boutons (SRS + flip). */
.kbd-hint { display: inline-block; margin-left: 6px; padding: 1px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; font-weight: 700; line-height: 1.4; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; }
@media (pointer: coarse) { .kbd-hint { display: none; } }

/* Boutons SRS */
.srs-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
.btn-easy { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; font-weight: 700; padding: 10px 24px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 14px; transition: background .15s; }
.btn-easy:hover  { background: var(--success); color: #fff; }
.btn-good { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; font-weight: 700; padding: 10px 24px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 14px; transition: background .15s; }
.btn-good:hover  { background: #3b82f6; color: #fff; }
.btn-hard { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; font-weight: 700; padding: 10px 24px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 14px; transition: background .15s; }
.btn-hard:hover  { background: var(--danger); color: #fff; }
/* #328 — Again : orange plus vif que Hard pour signaler l'oubli total (reset SRS vers niveau 0). */
.btn-again { background: #fed7aa; color: #9a3412; border: 1px solid #fdba74; font-weight: 700; padding: 10px 24px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 14px; transition: background .15s; }
.btn-again:hover { background: #ea580c; color: #fff; }

/* #330 — Mode write_jp_fr : textarea FR + feedback correct/incorrect. */
.fr-input { width: 100%; max-width: 420px; margin: 20px auto 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 16px; resize: vertical; min-height: 60px; display: block; }
.fr-input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.feedback-badge { display: inline-block; padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 14px; margin-bottom: 16px; }
.feedback-badge[data-state="ok"] { background: var(--success-light); color: #15803d; }
.feedback-badge[data-state="ko"] { background: var(--danger-light); color: #991b1b; }
.user-answer { color: var(--text-muted); font-size: 13px; font-style: italic; margin-top: 6px; }

/* ── SRS Progress bar ── */
.srs-bar { display: flex; gap: 4px; align-items: center; }
.srs-bar-item { height: 6px; flex: 1; border-radius: 99px; background: var(--border); }
.srs-bar-item.filled { background: var(--primary); }

/* ── Card grid ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; text-decoration: none; color: var(--text); display: block; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }

/* ── Kanji display ── */
.kanji-big { font-family: var(--font-jp); font-size: 80px; font-weight: 700; line-height: 1; }
.kanji-card .kanji-big { font-size: 56px; }

/* ── Progress graph ── */
.progress-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); }

/* ── Login ── */
body.login-body { background: linear-gradient(135deg, #0f172a 0%, #4c0519 60%, #0f172a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 40px; width: 100%; max-width: 420px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-logo-mark { width: 44px; height: 44px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--font-jp); font-size: 20px; font-weight: 700; color: #fff; }
.login-logo-text { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); background: var(--surface); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 14px; margin-bottom: 20px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 20px; }
.page-btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; text-decoration: none; }
.page-btn:hover { background: var(--surface-2); text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Topbar mobile (#252) : cachée par défaut, visible en dessous de 768px. ── */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 12px;
    background: var(--sidebar-bg);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.mobile-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    flex: 1;
}
.mobile-topbar-brand:hover { text-decoration: none; color: #fff; }
.mobile-topbar-brand .logo-jp { font-size: 22px; color: var(--primary); }
.mobile-topbar .level-badge { margin: 0; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 4px; }

/* ── Bouton burger (44x44 zone tactile — loi de Fitts) ── */
.drawer-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-toggle:hover, .drawer-toggle:focus-visible {
    background: rgba(255, 255, 255, .08);
    outline: none;
}
.drawer-toggle:focus-visible {
    box-shadow: 0 0 0 2px rgba(225, 29, 72, .6);
}
.drawer-toggle-bars {
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
}
.drawer-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
    transform-origin: 50% 50%;
}
/* Transition en croix quand ouvert — feedback visuel du toggle. */
.drawer-toggle[aria-expanded="true"] .drawer-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.drawer-toggle[aria-expanded="true"] .drawer-toggle-bar:nth-child(2) {
    opacity: 0;
}
.drawer-toggle[aria-expanded="true"] .drawer-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Bouton de fermeture dans le drawer (visible seulement en mode mobile) ── */
.drawer-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    transition: background .12s, color .12s;
    z-index: 1;
}
.drawer-close:hover, .drawer-close:focus-visible {
    background: rgba(255, 255, 255, .1);
    color: #fff;
    outline: none;
}

/* ── Overlay semi-transparent derrière le drawer ── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 99;
    opacity: 0;
    /* pointer-events: none tant que l'overlay est invisible : empêche le
       clic initial sur le burger de se propager sur l'overlay (sinon le
       drawer s'ouvre puis se ferme dans la même frame). */
    pointer-events: none;
    transition: opacity .25s cubic-bezier(.4, 0, .2, 1);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}
.drawer-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.drawer-overlay[hidden] { display: none; }

/* Empêche le scroll du document quand le drawer est ouvert. */
body.drawer-open {
    overflow: hidden;
}

/* ── Responsive global ── */
@media (max-width: 768px) {
    /* Affichage de la topbar mobile + burger */
    .mobile-topbar { display: flex; }

    /* La sidebar devient un drawer qui glisse depuis la gauche. */
    .sidebar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, .25);
        will-change: transform;
    }
    .sidebar.is-open {
        transform: translateX(0);
    }
    .drawer-close { display: inline-flex; }

    /* Le contenu principal occupe toute la largeur sur mobile. */
    .layout { display: block; }
    :root   { --sidebar-w: 0px; }
    .main   { margin-left: 0; }
    .content { padding: 16px; }
    .topbar  { padding: 0 16px; }
    .kanji-big { font-size: 56px; }
    .flip-inner .flip-front, .flip-inner .flip-back { padding: 20px; min-height: 220px; }
}

/* ── Desktop ≥ 768px : pas de burger, pas de drawer ── */
@media (min-width: 769px) {
    .drawer-overlay { display: none !important; }
    .sidebar { transform: none !important; }
}

/* ── Mouvement réduit : coupe l'animation du drawer ── */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .drawer-overlay,
    .drawer-toggle-bar { transition: none !important; }
}

/* ── Sidebar YUKI (header.php) ── */
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 12px; }
.logo-jp   { font-family: var(--font-jp); font-size: 28px; font-weight: 700; color: var(--primary); line-height:1; }
.logo-text { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: #fff; }
.sidebar .level-badge { display: inline-block; margin: 0 8px 16px; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 4px; }
.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: #94a3b8; transition: background .15s, color .15s; text-decoration: none; }
.nav-item:hover  { background: rgba(255,255,255,.07); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-footer  { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 8px; }
.user-info  { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar { width: 30px; height: 30px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-meta  { display: flex; flex-direction: column; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-level { font-size: 11px; color: #475569; }
.logout-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #475569; transition: background .15s, color .15s; text-decoration: none; flex-shrink: 0; }
.logout-btn:hover { background: rgba(239,68,68,.15); color: #ef4444; text-decoration: none; }

/* ── Main content ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px; min-height: 100vh; }

/* ── Onboarding débutant pur (#265) ── */
.onboarding-banner { display: flex; gap: 20px; align-items: center; padding: 20px 24px; margin-bottom: 24px; background: linear-gradient(135deg, var(--primary-light, #fee2e2) 0%, #fff 100%); border: 1px solid var(--primary); border-left-width: 4px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.onboarding-icon { flex: 0 0 auto; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--primary); border-radius: 50%; }
.onboarding-icon .jp { font-family: var(--font-jp); font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1; }
.onboarding-body { flex: 1; min-width: 0; }
.onboarding-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.onboarding-text { font-size: 14px; line-height: 1.55; color: var(--text); margin-bottom: 12px; }
.onboarding-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) {
    .onboarding-banner { flex-direction: column; align-items: flex-start; padding: 16px; gap: 14px; }
    .onboarding-icon   { width: 48px; height: 48px; }
    .onboarding-icon .jp { font-size: 24px; }
}

/* ── Page header ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.page-title  { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Section ── */
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.section > .section-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

/* ── Buttons supplémentaires ── */
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

/* ── Auth ── */
.auth-body { background: linear-gradient(135deg,#0f172a 0%,#4c0519 60%,#0f172a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-container { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo  { font-family: var(--font-jp); font-size: 48px; font-weight: 700; color: var(--primary); display: block; line-height: 1; }
.auth-title { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: #fff; letter-spacing: -1px; margin-top: 4px; }
.auth-subtitle { font-size: 14px; color: #94a3b8; margin-top: 4px; }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 36px; }
.auth-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 24px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.auth-form .hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.auth-form .form-error { display: block; margin-top: 6px; font-size: 13px; color: #991b1b; }

/* Message d'aide en pied de navigation quand on masque les items avancés (#266). */
.nav-beginner-hint { margin: 16px 12px 0; padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--text-muted); background: var(--surface-2); border-radius: var(--radius-sm); }
.auth-form input, .auth-form select { display: block; width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font-body); color: var(--text); background: var(--surface); outline: none; transition: border-color .15s; }
.auth-form input:focus, .auth-form select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(225,29,72,.1); }
.auth-link { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 20px; }
.level-hint { margin-top: 8px; }
.level-hint summary { font-size: 12px; color: var(--primary); cursor: pointer; user-select: none; }
.level-hint summary:hover { text-decoration: underline; }
.level-hint-body { margin-top: 8px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-muted); }
.level-hint-body ul { margin: 8px 0 8px 16px; padding: 0; }
.level-hint-body li { margin-bottom: 4px; }
.level-hint-body p { margin: 0 0 6px; }
.level-hint-body p:last-child { margin-bottom: 0; }

/* ── Stats card (dashboard) ── */
.stat-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; width: 120px; height: 120px;
    background: radial-gradient(circle at top right, var(--stat-accent, transparent), transparent 70%);
    opacity: .18;
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-icon  {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    background: var(--stat-bg, var(--primary-light));
    color: var(--stat-accent, var(--primary));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px var(--stat-shadow, rgba(225, 29, 72, .15));
}
.stat-body  { display: flex; flex-direction: column; position: relative; z-index: 1; }
.stat-value {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-display);
    line-height: 1;
    letter-spacing: -1px;
    color: var(--stat-accent, var(--text));
}
.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: .03em;
}

/* Identité visuelle par carte (#211) — chaque compteur a son palette. */
.stat-card--due {
    --stat-accent: var(--primary);
    --stat-bg:     var(--primary-light);
    --stat-shadow: rgba(225, 29, 72, .2);
    border-left-color: var(--primary);
}
.stat-card--words {
    --stat-accent: #3b82f6;
    --stat-bg:     #dbeafe;
    --stat-shadow: rgba(59, 130, 246, .2);
    border-left-color: #3b82f6;
}
.stat-card--learned {
    --stat-accent: var(--success);
    --stat-bg:     var(--success-light);
    --stat-shadow: rgba(34, 197, 94, .2);
    border-left-color: var(--success);
}
.stat-card--mastered {
    --stat-accent: var(--accent);
    --stat-bg:     #fef3c7;
    --stat-shadow: rgba(245, 158, 11, .25);
    border-left-color: var(--accent);
}

/* Ancien sélecteur conservé pour compat (profile et autres) */
.stat-due {
    --stat-accent: var(--primary);
    --stat-bg:     var(--primary-light);
    --stat-shadow: rgba(225, 29, 72, .2);
    border-left-color: var(--primary);
}

/* ── SRS levels bars ── */
.srs-levels { display: flex; flex-direction: column; gap: 10px; }
.srs-level-row { display: flex; align-items: center; gap: 12px; }
.srs-level-label { font-size: 12px; font-weight: 600; width: 100px; flex-shrink: 0; }
.srs-bar-track { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.srs-bar-fill  { height: 100%; border-radius: 99px; transition: width .4s; }
.srs-level-count { font-size: 13px; font-weight: 700; width: 36px; text-align: right; flex-shrink: 0; }

/* ── Chart ── */
.chart-container canvas { width: 100% !important; display: block; }

/* ── Shortcuts ── */
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px; }
.shortcut-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 16px; text-align: center; text-decoration: none; color: var(--text); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.shortcut-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.shortcut-icon  { font-size: 32px; font-family: var(--font-jp); }
.shortcut-label { font-size: 13px; font-weight: 600; }
.shortcut-mode  { font-size: 11px; color: var(--text-muted); }

/* ── Recherche vocab (#332) ── */
.vocab-search {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    max-width: 520px;
}
.vocab-search input[type="search"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--surface);
}
.vocab-search input[type="search"]:focus {
    outline: 2px solid var(--primary);
    outline-offset: 0;
    border-color: var(--primary);
}
.vocab-search .btn { flex-shrink: 0; }

/* ── Category chips (filtre vocab) ── */
.category-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 120ms, color 120ms, border-color 120ms;
    cursor: pointer;
}
.chip:hover { background: var(--primary-light); color: var(--text); border-color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Vocab list (liste linéaire) ── */
.vocab-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    margin-bottom: 24px;
}
.vocab-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background 120ms;
}
.vocab-item:last-child { border-bottom: none; }
.vocab-item:hover { background: var(--primary-light); text-decoration: none; }
.vocab-jp-col { flex-shrink: 0; width: 120px; min-width: 80px; }
.vocab-jp-text {
    font-size: 22px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vocab-reading { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; }
.vocab-meaning { flex: 1; min-width: 0; font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.vocab-tags    { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ── Kanji grid ── */
.kanji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 12px; margin-bottom: 24px; }
.kanji-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; text-align: center; text-decoration: none; color: var(--text); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kanji-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.kanji-char    { line-height: 1.1; }
.kanji-meaning { font-size: 13px; color: var(--text-muted); }
.kanji-reading { color: var(--text-muted); margin-top: 2px; }

/* ── Badges supplémentaires ── */
.badge-sm { padding: 2px 7px; font-size: 10px; font-weight: 700; border-radius: 99px; }
.tag { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); border-radius: 99px; font-size: 11px; padding: 2px 8px; }
.hint { font-size: 12px; color: var(--text-muted); }

/* ── Level switcher ── */
.level-switcher { display: flex; gap: 4px; flex-wrap: wrap; }
.level-btn { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; cursor: pointer; border: 2px solid transparent; text-decoration: none; transition: opacity .15s; }
.level-btn:not(.active) { opacity: .5; }
.level-btn.active { border-color: currentColor; opacity: 1; }

/* ── Detail layout ── */
.detail-layout  { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.word-detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px; text-align: center; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.word-detail-jp      { margin-bottom: 8px; }
.word-detail-reading { color: var(--text-muted); margin-bottom: 12px; }
.word-detail-meaning { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.word-detail-meta    { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.example-row { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 8px; }
.example-jp  { margin-bottom: 4px; }
.example-fr  { font-size: 14px; color: var(--text-muted); }
.sidebar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.sidebar-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.srs-badge-large { display: flex; flex-direction: column; align-items: center; padding: 16px; border-radius: var(--radius-md); font-weight: 700; font-size: 15px; gap: 4px; }
.srs-level-num { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.srs-level-0 { background: #f1f5f9; color: #64748b; }
.srs-level-1 { background: #fef3c7; color: #92400e; }
.srs-level-2 { background: #ffedd5; color: #9a3412; }
.srs-level-3 { background: #ede9fe; color: #5b21b6; }
.srs-level-4 { background: #dbeafe; color: #1d4ed8; }
.srs-level-5 { background: #dcfce7; color: #15803d; }
.mnemonic-textarea { width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px; font-size: 13px; font-family: var(--font-body); min-height: 80px; resize: vertical; outline: none; transition: border-color .15s; margin-bottom: 8px; display: block; }
.mnemonic-textarea:focus { border-color: var(--primary); }
.save-feedback { font-size: 13px; color: var(--success); margin-left: 8px; }
.kanji-readings-grid { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.reading-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.reading-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.associated-words { display: flex; gap: 12px; flex-wrap: wrap; }
.associated-word { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; }
.associated-word:hover { background: var(--primary-light); border-color: var(--primary); }

/* ── Session SRS ── */
.session-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; gap: 16px; flex-wrap: wrap; }
.session-progress { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 400px; }
.progress-bar  { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.session-mode  { display: flex; gap: 4px; }
.mode-btn { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; text-decoration: none; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.session-container { display: flex; justify-content: center; width: 100%; }
.session-empty, .session-end { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 400px; text-align: center; width: 100%; }
.session-empty h2, .session-end h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.end-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ── Flip card (session — JS toggle, pas CSS 3D) ── */
.flip-card { width: 100%; max-width: 560px; }
.flip-inner .flip-front,
.flip-inner .flip-back  { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-lg); padding: 40px 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 280px; box-shadow: var(--shadow-md); position: relative; }
.flip-inner .flip-back  { border-color: var(--primary); display: none; }
.flip-inner.flipped .flip-front { display: none; }
.flip-inner.flipped .flip-back  { display: flex; }
.flip-btn  { margin-top: 16px; }
.audio-btn { position: absolute; top: 16px; right: 16px; background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; padding: 6px; border-radius: 6px; }
.audio-btn:hover { background: var(--surface-2); color: var(--primary); }
.card-prompt  { font-size: 20px; font-weight: 600; text-align: center; }
.card-hint    { font-size: 13px; color: var(--text-muted); }
.card-jp      { text-align: center; }
.card-reading { color: var(--text-muted); }
.card-meaning { font-size: 18px; font-weight: 600; text-align: center; }

/* ── Kana keyboard ── */
.kana-keyboard { position: fixed; bottom: 0; left: var(--sidebar-w); right: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 16px 24px; z-index: 50; }
.kana-input-row { display: flex; align-items: center; gap: 10px; max-width: 500px; margin: 0 auto; }
.kana-input { flex: 1; padding: 10px 14px; border: 2px solid var(--primary); border-radius: var(--radius-sm); font-family: var(--font-jp); font-size: 18px; outline: none; }

/* ── QCM ── */
.qcm-container { max-width: 640px; margin: 0 auto; }
.qcm-progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.qcm-fill    { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.qcm-counter { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.qcm-score   { font-size: 13px; font-weight: 600; margin-bottom: 28px; }
.qcm-word    { text-align: center; font-size: 56px; cursor: pointer; font-family: var(--font-jp); line-height: 1.2; margin-bottom: 8px; }
.qcm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.qcm-choice  { padding: 14px 18px; border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: 15px; font-weight: 500; cursor: pointer; text-align: left; font-family: var(--font-body); transition: background .15s, border-color .15s; }
.qcm-choice:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.qcm-choice.correct { background: var(--success-light); border-color: var(--success); color: #15803d; }
.qcm-choice.wrong   { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }
.qcm-choice:disabled { cursor: default; }
.qcm-end { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 40px 0; }
.qcm-end h2 { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.qcm-final-score { font-size: 48px; font-weight: 800; font-family: var(--font-display); color: var(--primary); }

/* ── Grammar ── */
.grammar-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.grammar-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 20px; display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text); transition: box-shadow .15s; }
.grammar-row:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.grammar-pattern { font-family: var(--font-jp); font-size: 20px; font-weight: 700; min-width: 140px; }
.grammar-desc { flex: 1; font-size: 14px; color: var(--text-muted); }
.grammar-cat { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 2px 8px; color: var(--text-muted); flex-shrink: 0; }

/* ── Profile ── */
.profile-grid { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; text-align: center; box-shadow: var(--shadow-sm); }
.profile-avatar { width: 72px; height: 72px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: #fff; margin: 0 auto 12px; }
.profile-name  { font-size: 18px; font-weight: 700; }
.profile-level { display: inline-block; margin-top: 6px; padding: 3px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.profile-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.profile-stat-row { display: flex; justify-content: space-between; font-size: 13px; }
.profile-stat-label { color: var(--text-muted); }
.profile-stat-value { font-weight: 700; }

/* ── Exercise hub ── */
.exercise-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.exercise-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 20px; text-decoration: none; color: var(--text); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; gap: 12px; }
.exercise-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.exercise-icon { font-size: 36px; }
.exercise-name { font-size: 16px; font-weight: 700; }
.exercise-desc { font-size: 13px; color: var(--text-muted); }
.exercise-score { font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; }

/* ── Landing page ── */
.landing-body { background: var(--bg); }
.hero { background: linear-gradient(135deg,#0f172a,#4c0519); padding: 80px 24px; text-align: center; color: #fff; }
.hero-logo { font-family: var(--font-jp); font-size: 72px; font-weight: 700; color: var(--primary); line-height: 1; display: block; margin-bottom: 8px; }
.hero-title { font-family: var(--font-display); font-size: 40px; font-weight: 800; color: #fff; letter-spacing: -1px; }
.hero-sub   { font-size: 18px; color: #94a3b8; margin: 12px auto; max-width: 560px; }
.hero-cta   { display: flex; gap: 12px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 20px; padding: 60px 24px; max-width: 1100px; margin: 0 auto; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.feature-icon { font-size: 32px; margin-bottom: 12px; }
.feature-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.feature-desc  { font-size: 13px; color: var(--text-muted); }
.levels-section { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 48px 24px; text-align: center; }
.levels-title { font-family: var(--font-display); font-size: 28px; font-weight: 800; margin-bottom: 24px; }
.levels-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.level-feature-card { background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-md); padding: 16px 20px; min-width: 120px; text-align: center; }
.level-feature-card .badge { display: block; margin: 0 auto 8px; width: fit-content; }
.level-feature-card small { font-size: 12px; color: var(--text-muted); }
.landing-footer { background: #0f172a; color: #94a3b8; text-align: center; padding: 24px; font-size: 13px; }

/* ── Furigana ── */
ruby { ruby-align: center; }
ruby rt { font-family: var(--font-jp); font-size: 10px; color: var(--text-muted); }
.furigana-toggle { font-size: 12px; cursor: pointer; color: var(--primary); }
.furigana-off ruby rt { display: none; }

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --surface: #1e293b; --surface-2: #0f172a;
    --text: #f1f5f9; --text-muted: #64748b;
    --border: #334155;
  }
}
body.dark {
  --bg: #0f172a; --surface: #1e293b; --surface-2: #0f172a;
  --text: #f1f5f9; --text-muted: #64748b; --border: #334155;
}

/* ── Responsive mobile ── */
@media (max-width: 1024px) {
  .detail-layout { grid-template-columns: 1fr; }
  .profile-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .main-content { margin-left: 0; padding: 16px; }
  .qcm-choices  { grid-template-columns: 1fr; }
  /* Vocab list : réduit les colonnes JP sur mobile. */
  .vocab-jp-col  { width: 80px; min-width: 60px; }
  .vocab-jp-text { font-size: 18px; }
  .vocab-meaning { font-size: 13px; }
  .vocab-tags    { display: none; }
  .kana-keyboard { left: 0; }
  .hero-title   { font-size: 28px; }
  .hero-logo    { font-size: 56px; }

  /* #252 follow-up : les 4 stat-cards du dashboard débordent en mobile (auto-fit
     calcule 4 colonnes mais le contenu des cartes nécessite ~240px chacune →
     overflow horizontal). On force une grille 2×2 et on compresse un peu. */
  .stats-grid   { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card    { padding: 14px 12px; gap: 12px; }
  .stat-icon    { width: 40px; height: 40px; }
  .stat-icon svg { width: 20px; height: 20px; }
  .stat-value   { font-size: 26px; }
  .stat-label   { font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
}

/* #252 follow-up : garde-fou anti-scroll horizontal parasite — couvre tous
   les débordements résiduels (grilles, cartes mal dimensionnées, images). */
html, body { overflow-x: hidden; }

/* Écrans très étroits (< 380px) : on empile en 1 colonne pour lisibilité. */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── Compréhension écrite / orale / examen ── */
.reading-container { max-width: 760px; margin: 0 auto; }
.reading-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.exam-q .qcm-choices { grid-template-columns: 1fr; }
.exam-q .qcm-choice { cursor: pointer; }
.exam-q .qcm-choice input { accent-color: var(--primary); }
.data-table { font-size: 14px; }
.data-table th { font-weight: 700; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.data-table tr:hover td { background: var(--surface-2); }
.audio-btn { width: 36px; height: 36px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.audio-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ── Titre de section avec bouton info (#212) ── */
.section-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.section-title-row .section-title { margin: 0; }
.srs-info-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .12s, color .12s, background .12s;
}
.srs-info-btn:hover,
.srs-info-btn:focus-visible {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    outline: none;
}

/* ── Modale SRS (#212) ── */
.srs-info-modal {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .2s ease;
}
.srs-info-modal[hidden] { display: none; }
.srs-info-modal.is-open { opacity: 1; }
.srs-info-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .65);
    cursor: pointer;
}
.srs-info-card {
    position: relative;
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 32px 28px 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
    transform: scale(.96) translateY(8px);
    transition: transform .2s ease;
}
.srs-info-modal.is-open .srs-info-card { transform: scale(1) translateY(0); }
.srs-info-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: background .12s, color .12s;
}
.srs-info-close:hover { background: var(--surface-2); color: var(--text); }

.srs-info-card h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 10px;
    color: var(--text);
}
.srs-info-intro {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 16px;
}
.srs-info-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}
.srs-info-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.srs-info-item:last-child { border-bottom: none; }
.srs-info-dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-top: 4px;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px currentColor;
    opacity: .9;
}
.srs-info-interval {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    background: var(--surface-2);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}
.srs-info-item p {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.srs-info-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    .srs-info-modal, .srs-info-card { transition: none !important; }
}
@media (pointer: coarse) {
    .srs-info-btn   { width: 40px; height: 40px; }
    .srs-info-close { width: 44px; height: 44px; }
}

/* ── Tableau kana (gojuon + dakuten/handakuten) — leçons hiragana / katakana ── */
.kana-section-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}
.kana-section-count {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}
.kana-section-sub {
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.5;
    margin: 0 0 12px;
}
.kana-section-sub strong { color: var(--text); }

.kana-grid {
    display: grid;
    grid-template-columns: 40px repeat(5, 1fr);
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.kana-grid--derived {
    background: linear-gradient(180deg, #fff7ed 0%, var(--surface) 80%);
    border-color: var(--accent);
}
.kana-grid--yoon {
    grid-template-columns: 40px repeat(3, 1fr);
    background: linear-gradient(180deg, #eff6ff 0%, var(--surface) 80%);
    border-color: var(--primary);
}
.kana-row { display: contents; }
.kana-cell {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    aspect-ratio: 1 / 1;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 6px 4px;
    min-height: 56px;
    transition: background 140ms, transform 140ms;
}
.kana-cell:not(.kana-empty):not(.kana-axis):hover {
    background: var(--primary-light);
    transform: scale(1.04);
    cursor: default;
}
.kana-grid--derived .kana-cell:not(.kana-empty):not(.kana-axis) {
    background: #fffbeb;
}
.kana-grid--derived .kana-cell:not(.kana-empty):not(.kana-axis):hover {
    background: #fef3c7;
}
.kana-row--handakuten .kana-cell:not(.kana-empty):not(.kana-axis) {
    background: #fef2f2;
}
.kana-row--handakuten .kana-cell:not(.kana-empty):not(.kana-axis):hover {
    background: var(--primary-light);
}
.kana-axis {
    background: transparent;
    color: var(--text-muted);
    font-size: 12px; font-weight: 700;
    text-transform: uppercase;
}
.kana-empty { background: transparent; }
.kana-char { font-size: 24px; line-height: 1.1; }
.kana-romaji { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
/* Romaji masqué visuellement mais conservé en DOM pour les lecteurs d'écran (aria-label compense). */
.kana-romaji--hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mobile : on garde la grille mais on réduit les cellules. */
@media (max-width: 540px) {
    .kana-grid { grid-template-columns: 28px repeat(5, 1fr); gap: 4px; padding: 8px; }
    .kana-grid--yoon { grid-template-columns: 28px repeat(3, 1fr); }
    .kana-cell { min-height: 44px; padding: 4px 2px; }
    .kana-char { font-size: 18px; }
    .kana-romaji { font-size: 9px; }
}

/* ── Furigana (ruby) ── */
ruby { ruby-align: center; ruby-position: over; }
ruby rt { font-size: 0.55em; color: var(--text-muted); font-weight: 400; user-select: none; letter-spacing: 0.02em; padding: 0 1px; }
.furigana-hidden ruby rt { visibility: hidden; }
.furigana-toggle { display: inline-flex; align-items: center; gap: 6px; }

/* =====================================================
   Motion v2 (F-64) — keyframes + utilitaires animation
   ===================================================== */

@keyframes yuki-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes yuki-scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes yuki-pulse-success {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes yuki-shake-error {
  0%, 100%    { transform: translateX(0); }
  20%, 60%    { transform: translateX(-6px); }
  40%, 80%    { transform: translateX(6px); }
}
@keyframes yuki-skeleton-shine {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ── Keyframes v3 (F-92 #372) — direction Gaming Addictif ── */
@keyframes yuki-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%      { opacity: 0.6; transform: scale(1.3); }
}
@keyframes yuki-flame {
  0%, 100% { transform: scale(1);    }
  50%      { transform: scale(1.05); }
}
@keyframes yuki-xp-pop {
  0%   { transform: scale(1);    }
  40%  { transform: scale(1.15); }
  100% { transform: scale(1);    }
}

.fade-up   { animation: yuki-fade-up var(--motion-slow) var(--ease-out-expo) both; }
.scale-in  { animation: yuki-scale-in var(--motion-base) var(--ease-out-expo) both; }
.pulse-ok  { animation: yuki-pulse-success 500ms var(--ease-spring); }
.shake-err { animation: yuki-shake-error 400ms var(--ease-standard); }

/* Garde-fou global accessibilité — désactive toute animation pour les
   utilisateurs ayant configuré "réduire les animations". */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
