/* ============================================================
   Hiragana — DA « Matsuri »
   Tokens et valeurs issus du handoff (README + maquette HTML).
   Mobile-first (référence 402×874), extension desktop ≥ 900px.
   ============================================================ */

:root {
  --bg: #FAF1E3;
  --surface: #FFFDF8;
  --border: #F0E3CB;
  --border-light: #EFE3CB;
  --separator: #F7EEDC;
  --track: #F3E8D2;
  --border-dashed: #E4D5B8;
  --ink: #2A2118;
  --text-2: #8A7A5F;
  --text-3: #A6957A;
  --text-4: #B4A385;
  --text-off: #C9B896;
  --vermilion: #DE3E23;
  --vermilion-dark: #C23318;
  --vermilion-light: #F0603F;
  --indigo: #26437E;
  --gold: #E7A63A;
  --gold-dark: #D68F25;
  --gold-text: #B07A17;
  --teal: #338E7E;
  --teal-dark: #2A7568;
  --teal-light: #3FA891;
  --chip-vermilion: rgba(222, 62, 35, 0.1);
  --chip-gold: rgba(231, 166, 58, 0.14);
  --chip-teal: rgba(51, 142, 126, 0.12);
  --chip-indigo: rgba(38, 67, 126, 0.1);
  --grad-hero: radial-gradient(circle at 78% -20%, #F0603F 0%, #DE3E23 55%, #C23318 100%);
  --grad-hero-teal: radial-gradient(circle at 78% -20%, #3FA891 0%, #338E7E 55%, #2A7568 100%);
  --grad-streak: radial-gradient(circle at 82% -30%, #F0B54F, #E7A63A 60%, #D68F25);
  --grad-progress: linear-gradient(90deg, #E7A63A, #DE3E23);
  --shadow-cta: 0 6px 0 rgba(0, 0, 0, 0.12);
  --shadow-srs: 0 5px 0 rgba(0, 0, 0, 0.12);
  --shadow-card: 0 18px 40px rgba(194, 51, 24, 0.1);
  --font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;
  --pad-x: 20px;
  --pad-top: calc(env(safe-area-inset-top, 0px) + 26px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

input {
  font-family: inherit;
}

.app { min-height: 100vh; min-height: 100dvh; }

/* Contenu de secours SEO (remplacé par l'app dès le chargement du JS) */
.seo-fallback {
  max-width: 520px;
  margin: 0 auto;
  padding: 80px 28px;
  text-align: center;
  color: var(--ink);
}
.seo-fallback h1 { font-size: 26px; font-weight: 800; line-height: 1.25; }
.seo-fallback p { font-size: 15px; font-weight: 600; color: var(--text-2); line-height: 1.6; margin-top: 12px; }

/* ---------- Structure écran (mobile) ---------- */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--pad-top) var(--pad-x) 0;
  max-width: 520px;
  margin: 0 auto;
  animation: screen-in 0.32s ease-out both;
}

.screen--tabs { padding-bottom: 118px; }
.screen--session { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 34px); }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Boutons signature (pilule + ombre dure) ---------- */

.btn {
  display: block;
  width: 100%;
  border-radius: 999px;
  padding: 17px;
  text-align: center;
  font-size: 16.5px;
  font-weight: 800;
  box-shadow: var(--shadow-cta);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
}

.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.btn--vermilion { background: var(--vermilion); color: var(--surface); }
.btn--white { background: var(--surface); color: var(--vermilion-dark); }
.btn--white-teal { background: var(--surface); color: var(--teal-dark); }
.btn--ghost {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
  padding: 14px;
  box-shadow: none;
}
.btn--ghost:active { transform: translateY(2px); }

.link-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-2);
  padding: 16px 0;
}

/* ============================================================
   ONBOARDING
   ============================================================ */

.onboarding {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% -12%, #F0603F 0%, #DE3E23 52%, #C23318 100%);
  padding: var(--pad-top) 28px calc(env(safe-area-inset-bottom, 0px) + 40px);
  font-family: var(--font);
  color: var(--surface);
  overflow: hidden;
  z-index: 40;
}

.onboarding__ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid rgba(255, 253, 248, 0.2);
  width: 260px;
  height: 260px;
  left: -70px;
  bottom: -120px;
  pointer-events: none;
}
.onboarding__ring--2 { left: -30px; bottom: -160px; border-color: rgba(255, 253, 248, 0.13); }

.onboarding__watermark {
  position: absolute;
  right: -54px;
  top: 34px;
  font-size: 230px;
  font-weight: 800;
  color: rgba(255, 253, 248, 0.1);
  line-height: 1;
  pointer-events: none;
}

.onboarding__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  animation: screen-in 0.35s ease-out both;
}

.onboarding__disc {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}

.onboarding__disc-kana { font-size: 104px; font-weight: 800; color: var(--vermilion-dark); line-height: 1; }

.onboarding__eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 253, 248, 0.85);
  margin-top: 30px;
}

.onboarding__title { font-size: 30px; font-weight: 800; line-height: 1.3; margin-top: 6px; }

.onboarding__text {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.65;
  color: rgba(255, 253, 248, 0.88);
  margin-top: 12px;
  max-width: 280px;
}

.onboarding__footer { position: relative; width: 100%; max-width: 400px; margin: 0 auto; }

.onboarding .btn--white { box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15); }

.onboarding__dots { display: flex; gap: 7px; justify-content: center; margin-top: 18px; }
.onboarding__dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 253, 248, 0.45); transition: all 0.25s ease; }
.onboarding__dot--active { width: 20px; border-radius: 99px; background: var(--surface); }

/* Slide 2 : démonstration de la réponse tapée */
.onboarding__answer-demo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  background: rgba(255, 253, 248, 0.14);
  border: 2px solid rgba(255, 253, 248, 0.35);
  border-radius: 999px;
  padding: 10px 18px;
}
.onboarding__answer-demo-kana { font-size: 30px; font-weight: 800; }
.onboarding__answer-demo-input {
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 22px;
  font-size: 16px;
  font-weight: 800;
}
.onboarding__answer-demo-check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Slide 3 : prénom */
.onboarding__input {
  width: 100%;
  max-width: 280px;
  margin-top: 26px;
  background: rgba(255, 253, 248, 0.16);
  border: 2px solid rgba(255, 253, 248, 0.45);
  border-radius: 999px;
  padding: 15px 22px;
  font-size: 17px;
  font-weight: 800;
  color: var(--surface);
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.onboarding__input::placeholder { color: rgba(255, 253, 248, 0.55); font-weight: 700; }
.onboarding__input:focus { border-color: var(--surface); background: rgba(255, 253, 248, 0.22); }

/* ============================================================
   HEADERS & CHIPS COMMUNS
   ============================================================ */

.header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.header > div:first-child { min-width: 0; }
.header__eyebrow { font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 2px; }
.header__title { font-size: 26px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.header__sub { font-size: 12px; font-weight: 700; color: var(--text-2); }

.streak-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  flex-shrink: 0;
}
.streak-chip__count {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--vermilion);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}
.streak-chip__label { font-size: 12px; font-weight: 700; color: var(--text-2); }

/* Sélecteur de langue (pilule segmentée FR / EN) */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}
.lang-switch__btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.lang-switch__btn:hover { color: var(--ink); }
.lang-switch__btn.is-active { background: var(--vermilion); color: var(--surface); }

/* Sélecteur de langue posé sur le fond coloré de l'onboarding */
.onboarding__lang { position: absolute; top: 16px; right: 16px; z-index: 4; }
.onboarding__lang .lang-switch {
  background: rgba(255, 253, 248, 0.16);
  border-color: rgba(255, 253, 248, 0.30);
}
.onboarding__lang .lang-switch__btn { color: rgba(255, 253, 248, 0.82); }
.onboarding__lang .lang-switch__btn:hover { color: #FFFDF8; }
.onboarding__lang .lang-switch__btn.is-active { background: #FFFDF8; color: var(--vermilion); }

/* ============================================================
   ACCUEIL
   ============================================================ */

.hero {
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  border-radius: 28px;
  background: var(--grad-hero);
  padding: 26px 24px 24px;
  color: var(--surface);
}
.hero--teal { background: var(--grad-hero-teal); }

.hero__watermark {
  position: absolute;
  right: -28px;
  top: -40px;
  font-size: 210px;
  font-weight: 800;
  color: rgba(255, 253, 248, 0.13);
  line-height: 1;
  pointer-events: none;
}
.hero__ring {
  position: absolute;
  left: -46px;
  bottom: -92px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid rgba(255, 253, 248, 0.22);
  pointer-events: none;
}
.hero__ring--2 { left: -16px; bottom: -122px; border-color: rgba(255, 253, 248, 0.16); }
.hero--teal .hero__watermark { font-size: 200px; right: -24px; top: -44px; color: rgba(255, 253, 248, 0.12); }

.hero__eyebrow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 253, 248, 0.85);
}
.hero__check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero__count-line { position: relative; display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.hero__count { font-size: 56px; font-weight: 800; line-height: 1; }
.hero__count-label { font-size: 16px; font-weight: 700; }
.hero__title { position: relative; font-size: 30px; font-weight: 800; line-height: 1.25; margin-top: 10px; }
.hero__sub { position: relative; font-size: 13px; font-weight: 500; color: rgba(255, 253, 248, 0.85); margin-top: 4px; }
.hero--teal .hero__sub { font-size: 13.5px; font-weight: 600; }

.hero__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  background: var(--surface);
  color: var(--vermilion-dark);
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: var(--shadow-cta);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hero__cta:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.hero--teal .hero__cta { color: var(--teal-dark); }

/* Lignes de kana */

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.section-head__title { font-size: 15px; font-weight: 800; }
.section-head__count { font-size: 12px; font-weight: 700; color: var(--text-4); }

.rows { display: flex; flex-direction: column; gap: 10px; }

.row-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 12px 16px;
}
.row-card--locked {
  background: rgba(255, 253, 248, 0.6);
  border: 2px dashed var(--border-dashed);
  color: var(--text-3);
}
.row-card--practice {
  width: 100%;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.row-card--practice:active { transform: scale(0.98); }
.row-card__chev { flex-shrink: 0; }

.rows-hint { font-size: 12px; font-weight: 600; color: var(--text-3); margin: -4px 0 10px; }

.row-card__tile {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  flex-shrink: 0;
  color: var(--surface);
}
.row-card__tile--locked { background: var(--border-light); color: var(--text-3); }

.row-card__body { flex: 1; min-width: 0; }
.row-card__title { font-size: 15px; font-weight: 800; }
.row-card__stars { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.row-card__hint { font-size: 12px; font-weight: 600; }

.row-card__bar { height: 8px; background: var(--track); border-radius: 99px; margin-top: 7px; overflow: hidden; }
.row-card__bar-fill { height: 100%; background: var(--gold); border-radius: 99px; transition: width 0.4s ease-out; }

.row-card__chip { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 5px 10px; flex-shrink: 0; }
.chip--teal { color: var(--teal); background: var(--chip-teal); }
.chip--teal-dark { color: var(--teal-dark); background: var(--chip-teal); }
.chip--vermilion { color: var(--vermilion-dark); background: var(--chip-vermilion); }
.chip--gold { color: var(--gold-text); background: var(--chip-gold); }
.chip--indigo { color: var(--indigo); background: var(--chip-indigo); }
.chip--neutral { color: var(--text-2); background: var(--track); }

/* ============================================================
   TAB BAR (mobile) / SIDEBAR (desktop)
   ============================================================ */

.tabbar {
  position: fixed;
  left: max(20px, env(safe-area-inset-left, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 10px 8px;
  display: flex;
  justify-content: space-around;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(42, 33, 24, 0.08);
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-4);
  min-width: 72px;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 800;
  transition: transform 0.12s ease;
}
.tabbar__item:active { transform: scale(0.94); }
.tabbar__item--active { color: var(--vermilion); }

.sidebar { display: none; }

/* ============================================================
   TABLEAU DES KANAS
   ============================================================ */

.legend { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.legend__item { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--text-2); }
.legend__dot { width: 10px; height: 10px; border-radius: 4px; }
.legend__dot--new { background: var(--surface); border: 1.5px solid var(--border-dashed); }

.kana-grid { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }

.kana-grid__row { display: flex; align-items: center; gap: 10px; }
.kana-grid__label { width: 34px; font-size: 13px; font-weight: 800; color: var(--text-4); text-align: center; flex-shrink: 0; }
.kana-grid__label span { font-size: 10px; }
.kana-grid__cells { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

.kana-tile {
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--surface);
  transition: transform 0.12s ease;
  user-select: none;
}
.kana-tile:active { transform: scale(0.94); }
.kana-tile--acquired { background: var(--indigo); }
.kana-tile--fragile { background: var(--gold); }
.kana-tile--due { background: var(--vermilion); box-shadow: 0 0 0 3px rgba(222, 62, 35, 0.25); }
.kana-tile--new { background: var(--surface); border: 2px solid var(--border-light); color: var(--text-off); }

.kanas-fade {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 130px;
  background: linear-gradient(to bottom, rgba(250, 241, 227, 0), var(--bg) 70%);
  pointer-events: none;
  z-index: 10;
}

/* ============================================================
   SESSION
   ============================================================ */

.session-head { display: flex; align-items: center; gap: 14px; }

.session-head__close {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}
/* Zone tactile élargie à 48px sans changer le visuel */
.session-head__close::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; }
.session-head__close:active { transform: scale(0.92); }

.session-head__bar { flex: 1; height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.session-head__fill { height: 100%; background: var(--grad-progress); border-radius: 99px; transition: width 0.3s ease-out; }
.session-head__fill--gold { background: var(--gold); }
.session-head__fill--indigo { background: var(--indigo); }
.session-head__count { font-size: 13px; font-weight: 800; color: var(--text-2); flex-shrink: 0; }

.session-label {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-4);
  letter-spacing: 0.5px;
  margin-top: 12px;
}

.session-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 0;
  perspective: 1200px;
  min-height: 0;
}

/* Carte flashcard — flip 3D */
.flashcard-wrap { position: relative; transform-style: preserve-3d; transition: transform 0.4s ease-out; }
.flashcard-wrap.is-flipped { transform: rotateY(180deg); }
.flashcard-wrap.slide-in { animation: card-in 0.3s ease-out both; }
.flashcard-wrap.slide-out { animation: card-out 0.25s ease-in both; }

@keyframes card-in {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: none; }
}
@keyframes card-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(-60px); }
}

.flashcard {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 34px;
  padding: 34px 24px 30px;
  text-align: center;
  box-shadow: var(--shadow-card);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flashcard--back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flashcard--intro { padding-bottom: 28px; }

.flashcard__hanko {
  position: absolute;
  top: 22px;
  left: 22px;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
}
.hanko--question { background: var(--vermilion); }
.hanko--answer { background: var(--teal); }
.hanko--new { background: var(--gold); }

.flashcard__row-chip {
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-4);
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 12px;
}

.flashcard__disc {
  width: min(280px, 70vw);
  height: min(280px, 70vw);
  margin: 14px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(222, 62, 35, 0.14) 0%, rgba(222, 62, 35, 0.14) 62%, transparent 63%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.flashcard__disc--gold {
  background: radial-gradient(circle, rgba(231, 166, 58, 0.16) 0%, rgba(231, 166, 58, 0.16) 62%, transparent 63%);
  width: min(250px, 64vw);
  height: min(250px, 64vw);
  margin-top: 6px;
}

.flashcard__kana { font-size: min(190px, 48vw); font-weight: 800; line-height: 1; color: var(--indigo); }
.flashcard__kana--new { font-size: min(170px, 43vw); }

.flashcard__question { font-size: 19px; font-weight: 800; margin-top: 10px; }
.flashcard__meta { font-size: 13px; font-weight: 600; color: var(--text-3); margin-top: 6px; }

/* Face réponse */
.flashcard__kana-sm { font-size: 110px; font-weight: 800; line-height: 1.1; color: var(--indigo); }
.flashcard__romaji { font-size: 60px; font-weight: 800; color: var(--vermilion); line-height: 1.1; }
.flashcard__divider { height: 2px; background: var(--border); border-radius: 2px; margin: 18px 40px; }
.flashcard__word { font-size: 16px; font-weight: 800; }
.flashcard__word span { color: var(--text-3); font-weight: 700; }
.flashcard__word-meaning { font-size: 13px; font-weight: 600; color: var(--text-3); margin-top: 2px; }

/* Nouveau kana */
.flashcard__new-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-text);
  background: var(--chip-gold);
  border-radius: 999px;
  padding: 6px 14px;
  margin-top: 6px;
}
.flashcard__romaji--new { font-size: 52px; margin-top: 2px; line-height: 1; }
.flashcard__example {
  display: inline-block;
  background: var(--bg);
  border-radius: 16px;
  padding: 11px 18px;
  margin-top: 18px;
}
.flashcard__example b { font-size: 15px; font-weight: 800; }
.flashcard__example .rj { color: var(--text-3); font-weight: 700; font-size: 15px; }
.flashcard__example .mean { font-size: 13px; font-weight: 600; color: var(--text-3); }
.flashcard__note { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-top: 14px; }

/* Barre de réponse (l'utilisateur tape le rōmaji) */
.answer-bar { display: flex; gap: 10px; align-items: center; }
.answer-bar__input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 15px 22px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease;
}
.answer-bar__input::placeholder { color: var(--text-4); font-weight: 700; }
.answer-bar__input:focus { border-color: var(--gold); }
.answer-bar__submit {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--vermilion);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-srs);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.answer-bar__submit:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }

/* ---------- Clavier intégré (tactile) ---------- */

.session-kbd {
  position: sticky;
  bottom: 0;
  z-index: 15;
  background: var(--bg);
  padding: 10px 0 4px;
  margin: 0 -4px;
}
.session-kbd.is-hidden { display: none; }

.kbd { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.kbd__row {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin: 0 auto;
}
.kbd__key {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  padding: 0;
}
.kbd__key:active { transform: translateY(2px); box-shadow: none; background: var(--track); }
.kbd__bottom {
  display: flex;
  gap: 5px;
  width: 100%;
}
.kbd__key--back { font-size: 18px; color: var(--text-2); }
.kbd__key--layout { flex: 1; font-size: 11.5px; font-weight: 800; color: var(--text-2); letter-spacing: 0.5px; }
.kbd__key--go { flex: 2; background: var(--vermilion); border-color: var(--vermilion); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12); }
.kbd__key--go:active { background: var(--vermilion-dark); }

/* Zone d'affichage de la saisie (au-dessus du clavier) */
.kbd-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--ink);
}
.kbd-slot--empty { color: var(--text-4); font-size: 14px; font-weight: 700; letter-spacing: 0; }
.kbd-slot__caret {
  display: inline-block;
  width: 2px;
  height: 22px;
  margin-left: 3px;
  background: var(--vermilion);
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.feedback__next-hint {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
  padding: 2px 0 4px;
}
.feedback__next-hint b { color: var(--vermilion-dark); }

/* Écrans bas : clavier plus compact */
@media (max-height: 700px) {
  .kbd__key { min-height: 38px; font-size: 14px; border-radius: 9px; }
  .kbd-slot { min-height: 44px; font-size: 17px; }
}

/* Tactile : la session doit tenir SANS défilement — carte dimensionnée sur la
   hauteur réellement visible (dvh suit la barre d'adresse mobile), sinon le
   clavier sticky recouvre la zone de saisie. */
html.touch-ui .screen--session { padding-top: calc(env(safe-area-inset-top, 0px) + 14px); }
html.touch-ui .session-body { padding: 8px 0; }
html.touch-ui .flashcard { padding: 24px 20px 20px; }
html.touch-ui .flashcard--intro { padding-bottom: 18px; }
html.touch-ui .flashcard__disc {
  width: min(280px, 70vw, 30dvh);
  height: min(280px, 70vw, 30dvh);
  margin-top: 10px;
}
html.touch-ui .flashcard__kana { font-size: min(190px, 48vw, 21dvh); }
html.touch-ui .flashcard__disc--gold {
  width: min(250px, 64vw, 28dvh);
  height: min(250px, 64vw, 28dvh);
  margin-top: 4px;
}
html.touch-ui .flashcard__kana--new { font-size: min(170px, 43vw, 19dvh); }
html.touch-ui .flashcard__kana-sm { font-size: min(110px, 16dvh); }
html.touch-ui .flashcard__romaji { font-size: min(60px, 9dvh); }
html.touch-ui .flashcard__question { font-size: 17px; margin-top: 6px; }
html.touch-ui .flashcard__meta { margin-top: 4px; }
html.touch-ui .session-kbd { padding-bottom: max(4px, env(safe-area-inset-bottom, 0px)); }
html.touch-ui .feedback { padding: 9px 14px; margin-bottom: 6px; }
html.touch-ui .feedback__title { font-size: 15px; }
html.touch-ui .feedback__sub { font-size: 12px; margin-top: 1px; }

/* La touche → pulse quand la réponse est révélée : « appuie pour continuer » */
.kbd__key--next { animation: go-pulse 1.3s ease-in-out infinite; }
@keyframes go-pulse {
  0%, 100% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12); }
  50% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12), 0 0 0 5px rgba(222, 62, 35, 0.22); }
}

/* Verdict après la réponse tapée */
.feedback { border-radius: 20px; padding: 13px 16px; text-align: center; margin-bottom: 10px; }
.feedback--ok { background: var(--chip-teal); color: var(--teal-dark); }
.feedback--ko { background: var(--chip-vermilion); color: var(--vermilion-dark); }
.feedback__title { font-size: 16.5px; font-weight: 800; }
.feedback__sub { font-size: 12.5px; font-weight: 700; opacity: 0.9; margin-top: 2px; }

.new-actions { display: flex; flex-direction: column; gap: 9px; }

/* ============================================================
   FIN DE SESSION
   ============================================================ */

.confetti { position: absolute; pointer-events: none; animation: confetti-drift 2.4s ease-out both; }
@keyframes confetti-drift {
  from { opacity: 0; transform: translateY(-30px) rotate(0deg); }
  30% { opacity: 1; }
  to { opacity: 1; transform: translateY(6px) rotate(50deg); }
}

.end-hero { display: flex; flex-direction: column; align-items: center; margin-top: 26px; }

.end-hero__sun {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F0603F, #C23318);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 34px rgba(194, 51, 24, 0.32);
  animation: sun-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes sun-pop {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.end-hero__sun--indigo { background: radial-gradient(circle at 35% 30%, #3A5CA8, #26437E); box-shadow: 0 14px 34px rgba(38, 67, 126, 0.32); }
.end-hero__sun-glyph { font-size: 58px; font-weight: 800; color: var(--surface); }

.practice-note {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 14px 18px;
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  line-height: 1.5;
}

.end-hero__eyebrow { font-size: 14px; font-weight: 700; color: var(--gold); letter-spacing: 2px; margin-top: 18px; }
.end-hero__title { font-size: 27px; font-weight: 800; margin-top: 2px; }

.end-hero__chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.end-hero__chips .chip { border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 800; }

/* Carte bilan */
.recap-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px;
  margin-top: 24px;
}
.recap-card__cols { display: flex; gap: 14px; }
.recap-card__col { flex: 1; min-width: 0; }
.recap-card__divider { width: 2px; background: var(--border); border-radius: 2px; }
.recap-card__label { font-size: 11.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.recap-card__label--soon { color: var(--vermilion-dark); }
.recap-card__label--spaced { color: var(--teal); }
.recap-card__tiles { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }

.mini-tile {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 800;
  color: var(--surface);
}
.mini-tile--empty { font-size: 12px; font-weight: 700; color: var(--text-4); width: auto; padding: 0 4px; }

/* Carte prochaine révision */
.next-review-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px;
  margin-top: 10px;
}
.next-review-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chip-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.next-review-card__title { font-size: 14.5px; font-weight: 800; }
.next-review-card__sub { font-size: 12px; font-weight: 600; color: var(--text-3); }

.end-footer { margin-top: auto; padding-top: 24px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }

/* ============================================================
   PROFIL
   ============================================================ */

.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--indigo);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  flex-shrink: 0;
}
.profile-head > div:nth-child(2) { min-width: 0; }
.profile-head__name { font-size: 22px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.profile-head__since { font-size: 12px; font-weight: 700; color: var(--text-2); }
.profile-head__lang { margin-left: auto; flex-shrink: 0; align-self: flex-start; }

.streak-card {
  position: relative;
  overflow: hidden;
  background: var(--grad-streak);
  border-radius: 24px;
  padding: 18px 20px;
  margin-top: 16px;
  color: var(--surface);
}
.streak-card__watermark {
  position: absolute;
  right: -20px;
  bottom: -54px;
  font-size: 130px;
  font-weight: 800;
  color: rgba(255, 253, 248, 0.16);
  line-height: 1;
  pointer-events: none;
}
.streak-card__count-line { display: flex; align-items: baseline; gap: 9px; position: relative; }
.streak-card__count { font-size: 44px; font-weight: 800; line-height: 1; }
.streak-card__label { font-size: 15px; font-weight: 800; }

.streak-card__week { display: flex; gap: 7px; margin-top: 12px; position: relative; }
.streak-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.streak-day__dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}
.streak-day__dot--empty { background: rgba(255, 253, 248, 0.35); border: 2px dashed rgba(255, 253, 248, 0.8); }
.streak-day__label { font-size: 10px; font-weight: 800; opacity: 0.9; }

.stat-cards { display: flex; gap: 10px; margin-top: 12px; }
.stat-card {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 14px 8px;
  text-align: center;
}
.stat-card__value { font-size: 22px; font-weight: 800; }
.stat-card__value small { font-size: 13px; color: var(--text-4); font-weight: 800; }
.stat-card__value--indigo { color: var(--indigo); }
.stat-card__value--teal { color: var(--teal); }
.stat-card__value--vermilion { color: var(--vermilion); }
.stat-card__label { font-size: 11px; font-weight: 700; color: var(--text-2); margin-top: 2px; }

.upcoming-title { font-size: 15px; font-weight: 800; margin: 20px 0 10px; }

.upcoming-card { background: var(--surface); border: 2px solid var(--border); border-radius: 24px; padding: 6px 16px; }
.upcoming-row { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-bottom: 2px solid var(--separator); }
.upcoming-row:last-child { border-bottom: none; }
.upcoming-row__tile {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--surface);
  flex-shrink: 0;
}
.upcoming-row__name { flex: 1; font-size: 14px; font-weight: 800; min-width: 0; }
.upcoming-row__name span { font-weight: 700; color: var(--text-4); }
.upcoming-row__chip { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 5px 11px; flex-shrink: 0; }
.upcoming-empty { padding: 18px 0; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-3); }

.reset-link {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-4);
  padding: 22px 0 8px;
}

/* Sauvegarde en ligne (profil) */
.sync-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sync-card__text { font-size: 13.5px; font-weight: 600; color: var(--text-2); line-height: 1.55; }
.sync-card__row { display: flex; align-items: center; gap: 12px; }
.sync-card__dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--text-4); }
.sync-card__dot--synced { background: var(--teal); }
.sync-card__dot--syncing { background: var(--gold); }
.sync-card__dot--offline { background: var(--text-4); }
.sync-card__dot--error { background: var(--vermilion); }
.sync-card__body { min-width: 0; }
.sync-card__email { font-size: 14.5px; font-weight: 800; overflow-wrap: anywhere; }
.sync-card__status { font-size: 12px; font-weight: 700; color: var(--text-2); }
.sync-card__delete {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-4);
  padding: 4px 0 0;
}

/* Formulaire compte (modale) */
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.auth-form__input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  outline: none;
}
.auth-form__input::placeholder { color: var(--text-4); font-weight: 600; }
.auth-form__input:focus { border-color: var(--gold); }
.auth-form__error { min-height: 18px; font-size: 12.5px; font-weight: 700; color: var(--vermilion-dark); line-height: 1.4; }
.auth-form__error.is-ok { color: var(--teal-dark); }
.auth-form__alt {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-2);
  padding: 9px 0 0;
}

.auth-form__sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 10px;
  color: var(--text-4);
  font-size: 12px;
  font-weight: 700;
}
.auth-form__sep::before, .auth-form__sep::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--separator);
  border-radius: 2px;
}
.auth-form__google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  transition: transform 0.12s ease;
}
.auth-form__google:active { transform: scale(0.98); }

/* Porte d'entrée « compte obligatoire » + splash de connexion */
.auth-gate {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 22px calc(32px + env(safe-area-inset-bottom));
  background: var(--bg);
  overflow: hidden;
}
.auth-gate__lang { position: absolute; top: 16px; right: 16px; z-index: 4; }
.auth-gate__inner { width: 100%; max-width: 360px; text-align: center; }
.auth-gate__logo {
  width: 72px; height: 72px; margin: 0 auto 18px;
  border-radius: 24px; background: var(--vermilion); color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; box-shadow: var(--shadow-card);
}
.auth-gate__title { font-size: 26px; font-weight: 800; line-height: 1.2; color: var(--ink); }
.auth-gate__text { margin-top: 10px; font-size: 14.5px; font-weight: 600; color: var(--text-2); line-height: 1.55; }
.auth-gate .auth-form { margin-top: 22px; text-align: left; }

.auth-loading {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: var(--bg);
}
.auth-loading__logo {
  width: 72px; height: 72px; border-radius: 24px;
  background: var(--vermilion); color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800;
}
.auth-loading__spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--track); border-top-color: var(--vermilion);
  animation: auth-spin 0.8s linear infinite;
}
.auth-loading__text { font-size: 13px; font-weight: 700; color: var(--text-3); letter-spacing: 0.02em; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.app-credit { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-4); line-height: 1.6; padding: 4px 10px 8px; }
.app-credit a { color: var(--text-3); font-weight: 700; }
.app-version { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-off); padding-bottom: 6px; }

.ahead-btn { margin-top: 10px; }

/* Fond des tuiles par statut */
.bg-status--acquired, .bg-status--solid { background: var(--indigo); }
.bg-status--fragile { background: var(--gold); }
.bg-status--due { background: var(--vermilion); }
.bg-status--ongoing { background: var(--teal); }
.bg-status--new { background: var(--border-light); color: var(--text-3); }

/* ============================================================
   MODALES
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 33, 24, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: overlay-in 0.2s ease-out both;
  padding: 20px;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 28px;
  padding: 26px 22px calc(env(safe-area-inset-bottom, 0px) + 22px);
  animation: modal-up 0.28s cubic-bezier(0.34, 1.3, 0.64, 1) both;
  text-align: center;
}
@keyframes modal-up { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal__title { font-size: 19px; font-weight: 800; }
.modal__text { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-top: 8px; line-height: 1.55; }
.modal__actions { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

.modal__kana-disc {
  width: 150px;
  height: 150px;
  margin: 6px auto 0;
  border-radius: 50%;
  background: rgba(222, 62, 35, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__kana { font-size: 92px; font-weight: 800; color: var(--indigo); line-height: 1; }
.modal__romaji { font-size: 34px; font-weight: 800; color: var(--vermilion); margin-top: 6px; line-height: 1.1; }
.modal__status-line { display: flex; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
}

/* ============================================================
   SÉLECTEUR DE SYLLABAIRE (hiragana / katakana)
   ============================================================ */

.syll-switch {
  display: flex;
  gap: 6px;
  background: var(--track);
  border-radius: 999px;
  padding: 4px;
  margin: 14px 0 4px;
}
.syll-switch__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  transition: background 0.15s ease, color 0.15s ease;
}
.syll-switch__btn span { font-size: 15px; }
.syll-switch__btn b { font-weight: 800; }
.syll-switch__btn.is-active { background: var(--surface); color: var(--vermilion); box-shadow: 0 2px 6px rgba(42, 33, 24, 0.08); }

/* Aide-mémoire personnel sur les cartes (note utilisateur) */
.note-slot { margin-top: 14px; }
.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  color: var(--text-3);
  background: var(--track);
  border: 2px dashed var(--border-dashed);
  transition: transform 0.12s ease;
}
.note-chip:active { transform: scale(0.97); }
.note-chip__icon { flex-shrink: 0; font-size: 13px; }
.note-chip--has {
  color: var(--gold-text);
  background: var(--chip-gold);
  border-style: solid;
  border-color: transparent;
}
.note-chip--has span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Bouton audio */
.speaker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--chip-indigo);
  margin-left: 6px;
  transition: transform 0.12s ease;
}
.speaker-btn:active { transform: scale(0.9); }
.modal__romaji .speaker-btn { background: var(--chip-vermilion); }

/* Contraste des sosies (après une erreur) */
.contrast {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.contrast__note { font-size: 12.5px; font-weight: 700; color: var(--text-2); text-align: center; margin-bottom: 10px; }
.contrast__note b { color: var(--vermilion-dark); }
.contrast__row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.contrast__item {
  min-width: 56px;
  border-radius: 14px;
  padding: 8px 6px;
  text-align: center;
  background: var(--bg);
  border: 2px solid var(--border);
}
.contrast__item.is-target { background: var(--chip-teal); border-color: transparent; }
.contrast__item.is-confused { background: var(--chip-vermilion); border-color: var(--vermilion); }
.contrast__kana { font-size: 30px; font-weight: 800; line-height: 1.1; }
.contrast__item.is-target .contrast__kana { color: var(--teal-dark); }
.contrast__rj { font-size: 12px; font-weight: 800; color: var(--text-3); margin-top: 2px; }
.contrast__item.is-target .contrast__rj { color: var(--teal-dark); }

/* Édition de l'aide-mémoire (modale) */
.mn-edit { margin-top: 18px; text-align: left; }
.mn-edit__label { display: block; font-size: 11px; font-weight: 800; color: var(--text-4); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.mn-edit__area {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  resize: none;
  outline: none;
  margin-bottom: 8px;
}
.mn-edit__area:focus { border-color: var(--gold); }

/* Drill des sosies (tableau) */
.drill-btn {
  display: block;
  width: 100%;
  margin: 14px 0 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 15px;
  text-align: center;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--indigo);
  transition: transform 0.12s ease;
}
.drill-btn:active { transform: scale(0.98); }

.streak-card__note { position: relative; font-size: 11.5px; font-weight: 600; color: rgba(255, 253, 248, 0.85); margin-top: 12px; }

/* ============================================================
   DESKTOP ≥ 900px — sidebar + contenu élargi, même DA
   ============================================================ */

@media (min-width: 900px) {
  body::after {
    content: 'あ';
    position: fixed;
    right: -100px;
    bottom: -150px;
    font-size: 560px;
    font-weight: 800;
    font-family: var(--font);
    color: rgba(42, 33, 24, 0.025);
    line-height: 1;
    pointer-events: none;
    z-index: 0;
  }

  .app { position: relative; z-index: 1; }

  .app--nav {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 0;
    max-width: 1080px;
    margin: 0 auto;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 36px 22px 28px;
  }

  .sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; }
  .sidebar__logo {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: var(--grad-hero);
    color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
  }
  .sidebar__brand-name { font-size: 17px; font-weight: 800; line-height: 1.1; }
  .sidebar__brand-sub { font-size: 11px; font-weight: 700; color: var(--gold); letter-spacing: 1.5px; }

  .sidebar__item {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 16px;
    padding: 13px 16px;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-4);
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  }
  .sidebar__item:hover { background: rgba(222, 62, 35, 0.06); color: var(--text-2); }
  .sidebar__item:active { transform: scale(0.97); }
  .sidebar__item--active { background: var(--chip-vermilion); color: var(--vermilion); }
  .sidebar__item--active:hover { background: var(--chip-vermilion); color: var(--vermilion); }

  .sidebar__foot { margin-top: auto; padding: 0 6px; }

  .tabbar, .kanas-fade { display: none; }

  .screen {
    max-width: 680px;
    margin: 0;
    padding: 44px 40px 60px;
    min-height: 100vh;
    animation: none;
  }
  .screen--tabs { padding-bottom: 60px; }

  .screen--session, .screen--onboardless {
    max-width: 560px;
    margin: 0 auto;
    padding: 44px 24px;
  }

  .header__title { font-size: 30px; }

  .hero { padding: 32px 34px 30px; border-radius: 30px; }
  .hero__count { font-size: 64px; }
  .hero__watermark { font-size: 240px; }
  .hero__cta { cursor: pointer; }
  .hero__cta:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0, 0, 0, 0.12); }
  .hero__cta:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }

  .rows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .row-card { border-radius: 22px; }

  .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0, 0, 0, 0.12); }
  .btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
  .btn--ghost:hover { transform: none; background: var(--bg); }

  .answer-bar__submit { cursor: pointer; }
  .answer-bar__submit:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(0, 0, 0, 0.12); }
  .answer-bar__submit:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }

  .kana-grid { max-width: 560px; }
  .kana-tile { font-size: 32px; border-radius: 18px; cursor: pointer; }
  .kana-tile--new { cursor: default; }
  .kana-tile:hover:not(.kana-tile--new) { transform: translateY(-3px); }

  .stat-cards { gap: 12px; }

  .syll-switch { max-width: 340px; }
  .syll-switch__btn { cursor: pointer; }
  .drill-btn { cursor: pointer; }
  .drill-btn:hover { background: var(--bg); }
  .speaker-btn { cursor: pointer; }
  .note-chip { cursor: pointer; }
  .note-chip:hover { border-color: var(--gold); }

  .onboarding__footer { max-width: 320px; }
}

@media (min-width: 1200px) {
  .app--nav { max-width: 1160px; }
  .screen { max-width: 740px; }
  .kana-grid { max-width: 600px; }
}

/* Écrans bas (clavier mobile ouvert) : la carte se compacte */
@media (max-height: 700px) {
  .flashcard__disc { width: min(200px, 52vw); height: min(200px, 52vw); margin-top: 6px; }
  .flashcard__disc--gold { width: min(190px, 48vw); height: min(190px, 48vw); }
  .flashcard__kana { font-size: min(135px, 35vw); }
  .flashcard__kana--new { font-size: min(125px, 32vw); }
  .flashcard { padding-top: 26px; }
  .session-body { padding: 10px 0; }
}
