*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #ebebeb;
  --surface-3: #e0e0e0;
  --accent: #e8a435;
  --accent-2: #c98b25;
  --accent-light: #f5c76a;
  --accent-glow: rgba(232, 164, 53, 0.18);
  --text: #111111;
  --text-muted: #666;
  --text-dim: #aaa;
  --green: #3a9e08;
  --red: #dc2626;
  --border: rgba(0, 0, 0, 0.1);
  --border-2: rgba(0, 0, 0, 0.2);
  --r: 6px;
  --r-sm: 4px;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

html, body {
  width: 100%; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* ─── APP LAYOUT ───────────────────────────────────────────── */
#app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.sb-logo {
  padding: 28px 18px 24px;
  flex-shrink: 0;
}
.sb-logo-text {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 900;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #4db20b; line-height: 0.95;
  display: block;
}

.sb-nav {
  display: flex; flex-direction: column;
  padding: 16px 0;
  flex: 1;
}

.sb-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px 11px 18px;
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; text-align: left;
  transition: background 0.12s, color 0.12s;
  width: 100%; border-radius: 0;
  position: relative;
}
.sb-card:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.sb-card:active { background: rgba(0,0,0,0.08); }
.sb-card.sb-active {
  background: rgba(77, 178, 11, 0.08);
  color: var(--text);
  outline: 2px solid #4db20b;
  outline-offset: -2px;
  border-radius: 4px;
}

.sb-icon {
  font-size: 20px; flex-shrink: 0; width: 26px; text-align: center;
}
.kana-icon { font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif; }

.sb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.sb-name-row {
  display: flex; align-items: center; gap: 5px; flex-wrap: nowrap;
}
.sb-name {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: inherit; white-space: nowrap;
}

.sb-prog-wrap {
  display: flex; align-items: center; gap: 6px;
}
.sb-prog-bar {
  flex: 1; height: 3px; background: rgba(0,0,0,0.08);
  border-radius: 99px; overflow: hidden; min-width: 30px;
}
.sb-prog-label {
  font-size: 10px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0;
}

/* ─── CONTENT AREA ─────────────────────────────────────────── */
.content-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

/* ─── TOP BAR ──────────────────────────────────────────────── */
.top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 0 24px 18px;
  background: var(--bg);
  flex-shrink: 0;
}
.tb-xp {
  display: flex; flex-direction: column; gap: 5px;
  min-width: 180px; max-width: 260px; flex: 1;
}
.tb-xp-labels {
  display: flex; justify-content: space-between;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
}
.tb-xp-track {
  height: 6px; background: var(--surface-2);
  border-radius: 99px; overflow: hidden;
}
.tb-xp-fill {
  height: 100%; width: 0%;
  background: #4db20b;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.tb-right { display: flex; align-items: center; gap: 28px; }
.tb-streak { display: flex; align-items: center; gap: 8px; }
.tb-flame { width: 28px; height: 28px; flex-shrink: 0; }
.tb-streak-num {
  font-size: 28px; font-weight: 800; color: #f97316;
  font-family: var(--font-display); letter-spacing: 0.02em; min-width: 22px;
}
.tb-lives { display: flex; align-items: center; gap: 8px; }
.tb-heart { width: 28px; height: 28px; flex-shrink: 0; }
.tb-lives-num {
  font-size: 28px; font-weight: 800; color: #f87171;
  font-family: var(--font-display); letter-spacing: 0.02em; min-width: 22px;
  transition: color 0.2s;
}
.tb-flag { width: 44px; height: 30px; object-fit: cover; border-radius: 4px; }
.tb-lives.lives-danger .tb-lives-num { color: var(--red); animation: pulse-danger 0.9s infinite; }
.tb-lives.lives-warning .tb-lives-num { color: #fb923c; }
@keyframes pulse-danger {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* ─── SCREENS ─────────────────────────────────────────────── */
.screen {
  position: absolute;
  top: 80px; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
  overflow-y: auto;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ─── HOMEPAGE ─────────────────────────────────────────────── */
.hp-wrap {
  width: 100%;
  padding: 0 40px 80px;
  display: flex; flex-direction: column;
}

/* Sections */
.hp-section {
  display: flex; flex-direction: column; gap: 28px;
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}
.hp-section:first-child { border-top: 1px solid var(--border); }

.hp-intro-tag {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #4db20b;
}
.hp-intro-text {
  font-size: 15px; color: var(--text-muted); line-height: 1.7;
}

.hp-hero {
  display: flex; gap: 32px; align-items: stretch;
  min-height: 280px;
}
.hp-hero-illustration {
  flex: 1;
  border-radius: 16px;
}
.fuji-cloud-left {
  animation: cloud-drift 4s ease-in-out infinite alternate;
}
.fuji-cloud-right {
  animation: cloud-drift 5s ease-in-out infinite alternate-reverse;
}
@keyframes cloud-drift {
  from { transform: translateX(0px); }
  to   { transform: translateX(28px); }
}
.hp-hero-text { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.hp-title {
  font-family: var(--font-display);
  font-size: 52px; font-weight: 900;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #4db20b; line-height: 0.95;
  margin-bottom: 12px;
}
.hp-subtitle {
  font-size: 18px; font-weight: 600; color: var(--text); line-height: 1.5;
}
.hp-hero-btns {
  display: flex; flex-direction: column; gap: 12px; margin-top: 24px;
  width: 320px;
}
.hp-btn-login, .hp-btn-signup {
  width: 100%; padding: 12px 0;
  border-radius: 8px;
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer;
}
.hp-btn-login {
  background: #4db20b; color: #fff; border: none;
  transition: opacity 0.15s;
}
.hp-btn-login:hover { opacity: 0.85; }
.hp-btn-signup {
  background: #fff; color: #7FB2F0;
  border: 2px solid #e0e0e0;
  transition: border-color 0.15s;
}
.hp-btn-signup:hover { border-color: #7FB2F0; }

/* Section title */
.hp-section-title {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 900;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text); text-align: center;
}

/* Upcoming languages */
.hp-langs { display: flex; flex-direction: column; gap: 14px; }
.hp-langs-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); text-align: center;
}
.hp-langs-flags { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.hp-lang-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
}
.hp-lang-flag { width: 32px; height: 22px; object-fit: cover; border-radius: 3px; }
.hp-lang-name { font-size: 14px; font-weight: 600; color: var(--text-muted); }

/* Draw feature */
.hp-draw {
  display: flex; gap: 32px; align-items: stretch;
  min-height: 280px;
  padding-top: 24px;
}
.hp-draw-illustration {
  flex: 1;
  border-radius: 16px;
}
.hp-draw-text { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.hp-draw-title {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 900; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text);
  margin-bottom: 8px;
}
.hp-draw-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* Newsletter / Feedback */
.hp-section-last { display: flex; flex-direction: column; align-items: center; min-height: 280px; justify-content: center; }
.hp-feedback-sub {
  font-size: 14px; color: var(--text-muted); margin-top: -12px; text-align: center;
}
.hp-form {
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; max-width: 640px;
}
.hp-input, .hp-textarea {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 14px 18px;
  font-size: 15px; font-family: inherit; resize: none;
  outline: none; transition: border-color 0.15s;
}
.hp-textarea { rows: 5; min-height: 120px; }
.hp-input:focus, .hp-textarea:focus { border-color: #4db20b; }
.hp-submit {
  align-self: center;
  padding: 13px 40px;
  background: #4db20b; border: none; border-radius: 8px;
  color: #fff; font-family: var(--font-display);
  font-size: 16px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s;
}
.hp-submit:hover { opacity: 0.85; }
.welcome-hint {
  font-size: 14px; color: var(--text-dim);
  font-family: var(--font-display); letter-spacing: 0.05em; text-transform: uppercase;
}

/* (old home styles kept for compatibility but hidden) */
.home-wrap { display: none; }
.logo-glow { display: none; }
.logo-text { display: none; }
.tagline { display: none; }

/* ─── STATS BAR (legacy, kept for xp-bar-fill) ──────────────── */
.home-stats { display: none; }
.stat-streak { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.streak-flame { font-size: 22px; }
.streak-count { font-size: 26px; font-weight: 800; color: #f97316; line-height: 1; }
.streak-label { font-size: 11px; color: var(--text-muted); }
.stat-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.1); flex-shrink: 0; }
.stat-xp { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.xp-level { font-size: 12px; font-weight: 700; color: #f5c76a; white-space: nowrap; flex-shrink: 0; }
.xp-bar-wrap {
  flex: 1; height: 6px; background: rgba(0,0,0,0.08);
  border-radius: 99px; overflow: hidden; min-width: 40px;
}
.xp-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #e8a435, #fde68a);
  border-radius: 99px;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.xp-text { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ─── MASTERY FLASH ──────────────────────────────────────────── */
#mastery-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: radial-gradient(circle at center, rgba(245,199,106,0.45) 0%, transparent 65%);
  opacity: 0;
}
#mastery-flash.active { animation: masteryPulse 0.65s ease-out forwards; }
@keyframes masteryPulse {
  0%   { opacity: 0; transform: scale(0.85); }
  25%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  width: 100%; max-width: 600px;
  border: 1px solid var(--border);
}
#group-droit-finance { grid-column: 1 / -1; }

.card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: none;
  border-radius: 0;
  padding: 22px 18px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.card::before { display: none; }
.card:hover { background: rgba(0,0,0,0.04); }
.card:active { background: rgba(0,0,0,0.07); }

.card-emoji { font-size: 26px; flex-shrink: 0; opacity: 0.85; }
.card-body { flex: 1; }
.card-body h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 900; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text); margin-bottom: 0;
}
.card-body p { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }
.card-arrow { font-size: 18px; color: var(--text-muted); font-weight: 400; }

/* groupe Espagnol / Japonais */
.card-group {
  flex-direction: column; align-items: stretch;
  padding: 0; cursor: default; gap: 0;
  background: var(--surface); border: none;
}
.card-group:hover { background: var(--surface); }
.card-group:hover::before { opacity: 0; }
.card-group-header {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px 10px;
}
.card-group-header .card-emoji { font-size: 22px; }
.card-group-header .card-body h2 { margin-bottom: 0; }
.card-group-items { display: flex; flex-direction: column; padding-bottom: 6px; }
.card-sub {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 20px 11px 52px;
  background: transparent; border: none; border-top: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; text-align: left;
  transition: background 0.12s, color 0.12s; width: 100%;
}
.card-sub:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.card-sub:active { background: rgba(0,0,0,0.07); }
.sub-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sub-body { flex: 1; display: flex; flex-direction: column; gap: 0; }
.sub-name {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: inherit;
}
.sub-desc { display: none; }
.sub-arrow { font-size: 14px; color: var(--text-dim); }

/* ─── LANGS GRID ─────────────────────────────────────────────── */
.langs-grid {
  grid-column: 1 / -1;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.langs-headers {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.langs-col-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px;
}
.langs-col-header:first-child { border-right: 1px solid var(--border); }
.langs-col-header .card-emoji { font-size: 20px; }
.langs-col-header .card-body h2 { font-size: 18px; }

.langs-row {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.langs-row:last-child { border-bottom: none; }
.langs-row > .card-sub {
  border-top: none;
  padding: 10px 10px;
}
.langs-row > .card-sub:first-child { border-right: 1px solid var(--border); }

.langs-kana-split {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
}
.langs-kana-split .card-sub {
  border-top: none; padding: 8px 8px; flex: 1;
}
.langs-kana-split .card-sub:first-child {
  border-bottom: 1px solid var(--border);
}

.escape-link {
  font-size: 13px; color: var(--text-dim);
  text-decoration: none; transition: color 0.15s;
}
.escape-link:hover { color: var(--text-muted); }

/* ─── SCREEN HEADER ────────────────────────────────────────── */
.screen-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  flex-shrink: 0;
}

.back-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--r-sm);
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.back-btn:hover { border-color: var(--border-2); color: var(--text); }

.screen-title {
  font-family: var(--font-display); font-size: 20px; font-weight: 900;
  letter-spacing: 0.06em; text-transform: uppercase;
  flex: 1; text-align: center;
}
.progress-label { font-size: 14px; color: var(--text-muted); white-space: nowrap; min-width: 60px; text-align: right; }

/* ─── TIMER RING ───────────────────────────────────────────── */
.timer-wrap {
  position: relative; width: 44px; height: 44px; flex-shrink: 0;
}
.timer-ring { width: 44px; height: 44px; }
.timer-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent-light);
}
#math-ring { transition: stroke-dashoffset 1s linear, stroke 0.3s; }

/* ─── GAME CONTENT ─────────────────────────────────────────── */
.game-content {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 24px;
  padding: 32px 24px; max-width: 600px; width: 100%; margin: 0 auto;
}

.math-difficulty {
  display: flex; gap: 6px; width: 100%; justify-content: center;
  margin-bottom: 12px;
}
.diff-btn {
  flex: 1; padding: 7px 4px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(0,0,0,0.04); color: var(--text-muted);
  cursor: pointer; transition: all 0.18s;
}
.diff-btn:hover { background: rgba(232,164,53,0.12); color: var(--text); border-color: rgba(245,199,106,0.4); }
.diff-btn.active {
  background: rgba(232,164,53,0.22); color: #f5c76a;
  border-color: rgba(245,199,106,0.6); box-shadow: 0 0 10px rgba(232,164,53,0.25);
}
.diff-btn[data-level="3"].active { background: rgba(251,146,60,0.18); color: #fb923c; border-color: rgba(251,146,60,0.5); box-shadow: 0 0 10px rgba(251,146,60,0.2); }
.diff-btn[data-level="4"].active { background: rgba(239,68,68,0.18); color: #f87171; border-color: rgba(239,68,68,0.5); box-shadow: 0 0 10px rgba(239,68,68,0.2); }

.score-bar {
  display: flex; align-items: center; gap: 24px; width: 100%;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.stat-val { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-val.green { color: var(--green); }

.progress-track {
  flex: 1; height: 6px; background: var(--surface-3);
  border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ─── MATH ─────────────────────────────────────────────────── */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 48px 40px;
  text-align: center; width: 100%;
}

.big-question {
  font-size: 64px; font-weight: 900; letter-spacing: -2px;
  color: var(--text);
  line-height: 1;
}

.math-feedback {
  margin-top: 16px; font-size: 20px; font-weight: 700;
  min-height: 28px; transition: all 0.2s;
}
.math-feedback.correct { color: var(--green); }
.math-feedback.wrong { color: var(--red); }

.math-input-area {
  display: flex; gap: 10px; width: 100%;
}
.math-input-area input {
  flex: 1; padding: 16px 20px; font-size: 22px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  outline: none; transition: border-color 0.15s;
  text-align: center;
  -moz-appearance: textfield;
}
.math-input-area input::-webkit-outer-spin-button,
.math-input-area input::-webkit-inner-spin-button { -webkit-appearance: none; }
.math-input-area input:focus { border-color: var(--accent-light); }
.math-input-area button {
  padding: 16px 28px; font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; border-radius: var(--r-sm); color: white;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.math-input-area button:hover { opacity: 0.9; }
.math-input-area button:active { transform: scale(0.97); }

/* ─── FLAGS ─────────────────────────────────────────────────── */
.flag-card {
  text-align: center; padding: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); width: 100%;
}
.flag-display {
  font-size: 110px; line-height: 1;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.5));
  display: block;
}
.flag-hint { margin-top: 16px; font-size: 15px; color: var(--text-muted); }

.choices-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%;
}
.choice-btn {
  padding: 16px 12px; font-size: 15px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: center; line-height: 1.3;
}
.choice-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-2); transform: translateY(-1px); }
.choice-btn:disabled { cursor: default; }
.choice-btn.correct { background: rgba(52,211,153,0.12); border-color: var(--green); color: var(--green); }
.choice-btn.wrong { background: rgba(248,113,113,0.12); border-color: var(--red); color: var(--red); }

/* ─── FLASHCARDS ───────────────────────────────────────────── */
.flashcards-content { gap: 20px; }

.flashcard {
  width: 100%; max-width: 460px;
  height: 340px;
  perspective: 1200px;
  cursor: pointer;
  flex-shrink: 0;
}
.flashcard-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--r);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px;
  gap: 12px;
}
.flashcard-front {
  background: var(--surface);
}
.flashcard-back {
  background: var(--surface-2);
  transform: rotateY(180deg);
}

.fc-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); position: absolute; top: 18px;
}
.fc-main {
  font-size: 52px; font-weight: 900; letter-spacing: -1px;
  color: var(--text);
}
.fc-category {
  font-size: 13px; color: var(--accent-light);
  background: rgba(232,164,53,0.12);
  padding: 4px 12px; border-radius: 99px;
}
.fc-trad {
  font-size: 32px; font-weight: 800;
  color: var(--accent-light);
  margin-bottom: 8px;
}
.fc-conj {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px 24px; width: 100%;
  max-width: 300px;
}
.conj-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: 14px;
}
.conj-pro { color: var(--text-muted); font-style: italic; }
.conj-form { color: var(--text); font-weight: 700; }

.fc-controls {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 460px;
}
.fc-nav-btn {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; color: var(--accent-light);
  font-size: 24px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.fc-nav-btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.fc-learned-btn {
  flex: 1; padding: 14px;
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.3);
  border-radius: var(--r-sm);
  color: var(--green); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.fc-learned-btn:hover { background: rgba(52,211,153,0.18); border-color: var(--green); }
.fc-learned-btn.learned {
  background: rgba(52,211,153,0.2); border-color: var(--green);
  box-shadow: 0 0 16px rgba(52,211,153,0.2);
}

.fc-learned-count {
  font-size: 13px; color: var(--text-muted); text-align: center;
}

/* ─── END OVERLAY ──────────────────────────────────────────── */
.end-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17,16,9,0.85);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.end-overlay.hidden { display: none; }

.end-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 40px 32px;
  text-align: center;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.end-emoji { font-size: 56px; }
.end-card h2 { font-size: 26px; font-weight: 800; }
.end-score {
  font-family: var(--font-display);
  font-size: 72px; font-weight: 900; letter-spacing: -1px;
  color: var(--text);
}
.end-msg { font-size: 15px; color: var(--text-muted); line-height: 1.5; }

.btn-primary {
  width: 100%; padding: 15px;
  background: var(--text);
  border: none; border-radius: var(--r-sm);
  color: var(--bg); font-size: 15px; font-weight: 700;
  font-family: var(--font-display); letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  width: 100%; padding: 14px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-muted);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }

/* ─── PULSE ANIM ───────────────────────────────────────────── */
@keyframes pulse-correct {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
  100% { box-shadow: 0 0 0 16px rgba(52,211,153,0); }
}
@keyframes pulse-wrong {
  0% { box-shadow: 0 0 0 0 rgba(248,113,113,0.5); }
  100% { box-shadow: 0 0 0 16px rgba(248,113,113,0); }
}
.anim-correct { animation: pulse-correct 0.4s ease-out; }
.anim-wrong { animation: pulse-wrong 0.4s ease-out; }

/* ─── UTILITY ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── MODE TABS ─────────────────────────────────────────────── */
.mode-tabs {
  display: flex; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.mode-tab {
  flex: 1; padding: 12px 16px;
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  margin-bottom: -1px;
}
.mode-tab.active { color: var(--accent-light); border-bottom-color: var(--accent-light); }
.mode-tab:not(.active):hover { color: var(--text); background: rgba(0,0,0,0.03); }

.tense-tabs {
  display: flex; flex-shrink: 0; gap: 6px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tense-tab {
  flex: 1; padding: 6px 8px;
  background: rgba(0,0,0,0.04); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.tense-tab.active {
  background: rgba(232,164,53,0.18); border-color: var(--accent);
  color: var(--accent-light);
}
.tense-tab:not(.active):hover { color: var(--text); background: rgba(0,0,0,0.07); }

.prac-cat-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.tense-badge {
  padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 700;
  background: rgba(232,164,53,0.18); border: 1px solid var(--accent);
  color: var(--accent-light); letter-spacing: 0.03em;
}

/* ─── PRACTICE MODE ──────────────────────────────────────────── */
.practice-content { gap: 20px; }

.practice-card {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px;
  display: flex; flex-direction: column; gap: 20px;
}

.prac-verb-header {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 6px;
}
.prac-verb {
  font-size: 40px; font-weight: 900; letter-spacing: -1px;
  color: var(--text); line-height: 1;
}
.prac-trad { font-size: 18px; color: var(--accent-light); font-weight: 600; }

.prac-grid { display: flex; flex-direction: column; gap: 7px; }

.prac-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 8px;
  transition: background 0.2s;
}
.prac-row.prac-correct { background: rgba(52,211,153,0.09); }
.prac-row.prac-wrong   { background: rgba(248,113,113,0.08); }

.prac-pro {
  font-size: 13px; color: var(--text-muted); font-style: italic;
  text-align: right; white-space: nowrap;
}
.prac-inp {
  padding: 7px 11px; font-size: 15px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); outline: none;
  transition: border-color 0.15s; width: 100%;
}
.prac-inp:focus { border-color: var(--accent-light); }
.prac-inp:disabled { opacity: 0.85; cursor: default; }
.prac-row.prac-correct .prac-inp { border-color: var(--green); color: var(--green); }
.prac-row.prac-wrong   .prac-inp { border-color: var(--red); color: var(--red); text-decoration: line-through; }

.prac-mark {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; min-width: 20px; text-align: center;
}
.prac-row.prac-correct .prac-mark { color: var(--green); }
.prac-row.prac-wrong   .prac-mark { color: var(--green); font-size: 12px; }

.prac-actions {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; max-width: 460px;
}

/* ─── VOCAB BADGES & EXAMPLE ────────────────────────────────── */
.vc-example {
  font-size: 14px; font-style: italic; color: var(--text-muted);
  text-align: center; line-height: 1.5; margin-top: 4px;
  padding: 6px 12px; background: rgba(0,0,0,0.04);
  border-radius: 8px;
}

/* ─── FINANCE FLASHCARDS ────────────────────────────────────── */
.flashcard-finance { height: 400px; }

.flashcard-finance .flashcard-front,
.flashcard-finance .flashcard-back {
  padding: 28px 32px; gap: 10px;
}

.fin-term {
  font-size: 28px; font-weight: 900; letter-spacing: -0.5px;
  color: var(--text); line-height: 1.25; text-align: center;
}

.fin-def {
  font-size: 14px; line-height: 1.65; color: var(--text);
  text-align: center; max-width: 360px;
}

.fin-ex {
  font-size: 12.5px; font-style: italic; color: var(--text-muted);
  text-align: center; line-height: 1.5; margin-top: 2px;
  padding: 5px 10px; background: rgba(0,0,0,0.04); border-radius: 8px;
  max-width: 360px;
}

.fin-cat-banque     { background: rgba(56,189,248,0.12);  color: #38bdf8; }
.fin-cat-marche     { background: rgba(45,212,191,0.12);  color: #2dd4bf; }
.fin-cat-invest     { background: rgba(52,211,153,0.12);  color: #34d399; }
.fin-cat-entreprise { background: rgba(253,186,116,0.12); color: #fb923c; }

/* ─── CAPITALS QUIZ ─────────────────────────────────────────── */
.country-card {
  text-align: center; padding: 40px 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); width: 100%;
  box-shadow: 0 0 40px rgba(232,164,53,0.06);
}
.country-display {
  font-size: 34px; font-weight: 900; letter-spacing: -0.5px;
  color: var(--text); line-height: 1.2;
}

.type-adjectif   { background: rgba(251,191,36,0.12);  color: #fbbf24; }
.type-nom        { background: rgba(99,179,237,0.12);   color: #63b3ed; }
.type-connecteur { background: rgba(52,211,153,0.12);   color: #34d399; }
.type-adverbe    { background: rgba(245,199,106,0.15);  color: #f5c76a; }
.type-pronom     { background: rgba(249,115,22,0.12);   color: #fb923c; }
.type-expression { background: rgba(45,212,191,0.12);   color: #2dd4bf; }

/* ─── VOCAB QUIZ ─────────────────────────────────────────────── */
.vocab-q-card {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 32px 24px; text-align: center;
  box-shadow: 0 0 40px rgba(232,164,53,0.06);
}
.vq-hint {
  margin: 0 0 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.vq-word {
  font-size: 32px; font-weight: 900; color: var(--text);
  letter-spacing: -0.5px; margin-bottom: 12px;
}

/* ─── PHRASES ────────────────────────────────────────────────── */
.phrases-content { gap: 18px; }

.phrase-card {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 28px 24px; text-align: center;
  box-shadow: 0 0 40px rgba(232,164,53,0.06);
  position: relative;
}
.phrase-lang {
  margin: 0 0 12px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.phrase-text {
  margin: 0; font-size: 22px; font-weight: 700;
  color: var(--text); line-height: 1.4;
}

.ph-input {
  width: 100%; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-size: 16px; font-family: inherit; resize: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.ph-input:focus { outline: none; border-color: var(--accent); }
.ph-input.ph-correct { border-color: var(--green); background: rgba(52,211,153,0.06); }
.ph-input.ph-wrong   { border-color: var(--red);   background: rgba(248,113,113,0.06); }

.ph-feedback {
  min-height: 22px; font-size: 15px; font-weight: 600;
  text-align: center; transition: all 0.2s;
}
.ph-fb-correct { color: var(--green); }
.ph-fb-wrong   { color: var(--red); }
.ph-fb-hint    { color: var(--accent); }
.ph-fb-reveal  {
  color: var(--accent-light); font-size: 16px;
  background: rgba(232,164,53,0.08); border-radius: 8px;
  padding: 10px 14px; line-height: 1.5;
}

.ph-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

/* ─── JAPANESE ───────────────────────────────────────────────── */
.kana-icon {
  font-size: 22px !important; font-style: normal;
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}
.kana-flashcard .flashcard-front,
.kanji-flashcard { height: 480px; }
.kanji-flashcard .flashcard-front { justify-content: center; }
.kj-back {
  justify-content: center !important;
  align-items: center !important;
  padding: 28px 20px 20px !important;
  gap: 10px !important;
  overflow-y: auto;
}
.kj-ai-img { display: none; }
.kj-gen-btn { display: none; }
.kj-words-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: #4db20b;
  width: 100%; margin: 4px 0 0;
}
.kj-meaning-line {
  width: 100%;
  justify-content: center;
  gap: 10px;
}
.kana-char {
  font-size: 100px; font-weight: 400; line-height: 1;
  color: var(--text); margin: 12px 0;
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}
.kana-rom {
  font-size: 44px; font-weight: 700; color: var(--accent-light);
  letter-spacing: 0.08em;
}
.kj-readings-row {
  display: flex; align-items: center; gap: 0; width: 100%;
  background: rgba(0,0,0,0.04); border-radius: 8px; overflow: hidden;
}
.kj-reading-block {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 6px;
}
.kj-reading-divider { width: 1px; background: var(--border); align-self: stretch; }
.reading-label {
  font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px;
  background: rgba(245,199,106,0.15); color: #f5c76a;
  font-family: 'Hiragino Sans', 'Yu Gothic', sans-serif; flex-shrink: 0;
}
.reading-val {
  font-size: 17px; color: var(--text);
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}
.reading-rom { font-size: 11px; color: var(--text-muted); font-style: italic; }
.kj-meaning-line {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 8px;
}
.kj-meaning {
  font-size: 22px; font-weight: 700; color: var(--text);
}
.kj-words {
  width: 100%; display: flex; flex-direction: column; gap: 3px;
}
.kj-word-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px;
  border-left: 2px solid rgba(245,199,106,0.3);
}
.kj-word-kanji {
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  font-size: 15px; font-weight: 700; color: var(--accent-light);
  min-width: 44px; flex-shrink: 0;
}
.kj-word-reading {
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  font-size: 11px; color: var(--text-muted); flex: 1;
}
.kj-word-fr {
  font-size: 11px; color: var(--text-muted); text-align: right; flex-shrink: 0;
}

.kj-inputs {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 8px;
  margin: 10px auto 0;
}
.kj-input-row {
  display: flex; align-items: center; gap: 10px;
}
.kj-input-label {
  font-size: 16px; width: 24px; text-align: center; flex-shrink: 0;
  color: var(--text-muted);
}
.kj-input-field {
  flex: 1; padding: 8px 12px;
  background: rgba(0,0,0,0.06); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px;
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  outline: none; transition: border-color 0.2s, background 0.2s;
}
.kj-input-field:focus { border-color: var(--accent); background: rgba(232,164,53,0.08); }
.kj-input-field.input-correct { border-color: #10b981; background: rgba(16,185,129,0.1); color: #34d399; }
.kj-input-field.input-wrong   { border-color: #ef4444; background: rgba(239,68,68,0.08); color: #f87171; }
/* ── Phrases JP TTS ─────────────────────────────────────────────────────── */
.header-right { display: flex; align-items: center; gap: 8px; }
.phj-mute-btn {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: 18px;
  cursor: pointer; opacity: 0.7; transition: opacity 0.2s;
  padding: 2px 4px;
}
.phj-mute-btn:hover { opacity: 1; }
.phj-reveal-top {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.phj-speak-btn {
  background: rgba(232,164,53,0.12);
  border: 1px solid rgba(245,199,106,0.25);
  border-radius: 50%; width: 34px; height: 34px;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  transition: background 0.2s;
}
.phj-speak-btn:hover { background: rgba(232,164,53,0.28); }

/* ── Phrases JP mode toggle ─────────────────────────────────────────────── */
.phj-mode-btn {
  position: absolute; bottom: 10px; right: 12px;
  font-size: 11px; padding: 3px 10px;
  background: rgba(0,0,0,0.07);
  border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 20px;
  cursor: pointer; transition: background 0.2s;
}
.phj-mode-btn:hover { background: rgba(0,0,0,0.14); color: var(--text); }

/* ── Tile mode phrases JP ────────────────────────────────────────────────── */
.phj-answer-row {
  width: 100%; max-width: 500px;
  min-height: 52px;
  border-bottom: 2px solid var(--accent);
  display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; padding: 8px 4px;
  margin: 4px 0 10px;
}
.phj-answer-row.phj-row-empty::before {
  content: 'Tape les mots pour construire la phrase…';
  color: var(--text-dim); font-size: 13px; font-style: italic;
}
.phj-word-bank {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  width: 100%; max-width: 500px;
  min-height: 44px; padding: 6px 0 10px;
}
.phj-tile {
  background: var(--surface-3);
  border: 1.5px solid var(--border-2);
  border-bottom: 3px solid rgba(0,0,0,0.18);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; user-select: none;
  transition: transform 0.1s, background 0.15s;
}
.phj-tile:active { transform: scale(0.93); }
.phj-tile.in-answer {
  background: rgba(232,164,53,0.12);
  border-color: var(--accent);
  border-bottom-color: var(--accent-2);
}
.phj-tile.tile-dragging { opacity: 0.25; }
.phj-tile.tile-correct  { background: rgba(16,185,129,0.15); border-color: #10b981; color: #34d399; }
.phj-tile.tile-wrong    { background: rgba(239,68,68,0.08);  border-color: #ef4444; color: #f87171; }
.phj-tile-ghost {
  position: fixed; z-index: 9999; pointer-events: none;
  opacity: 0.9; transform: rotate(2deg) scale(1.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  background: var(--surface-3); border: 1.5px solid var(--accent);
  border-radius: 8px; padding: 8px 14px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.phj-drop-caret {
  width: 3px; min-height: 36px; align-self: stretch;
  background: var(--accent); border-radius: 2px;
  pointer-events: none; flex-shrink: 0;
}

.kj-verify-btn {
  margin-top: 4px; padding: 9px 20px;
  background: rgba(232,164,53,0.18); border: 1px solid rgba(245,199,106,0.35);
  border-radius: 10px; color: #f5c76a; font-size: 14px; font-weight: 600;
  cursor: pointer; align-self: center; transition: background 0.2s, border-color 0.2s;
}
.kj-verify-btn:hover { background: rgba(232,164,53,0.30); border-color: #f5c76a; }

.kanji-cat-nombre    { background: rgba(251,191,36,0.12);  color: #fbbf24; }
.kanji-cat-temps     { background: rgba(99,179,237,0.12);  color: #63b3ed; }
.kanji-cat-personne  { background: rgba(52,211,153,0.12);  color: #34d399; }
.kanji-cat-nature    { background: rgba(52,211,153,0.10);  color: #34d399; }
.kanji-cat-direction { background: rgba(245,199,106,0.15); color: #f5c76a; }
.kanji-cat-qualite   { background: rgba(249,115,22,0.12);  color: #fb923c; }
.kanji-cat-education { background: rgba(45,212,191,0.12);  color: #2dd4bf; }
.kanji-cat-action    { background: rgba(248,113,113,0.12); color: #f87171; }
.kanji-cat-corps     { background: rgba(253,186,116,0.12); color: #fb923c; }
.kanji-cat-divers    { background: rgba(232,164,53,0.12);  color: #f5c76a; }

.vj-cat-nom   { background: rgba(52,211,153,0.15);  color: #34d399; }
.vj-cat-verbe { background: rgba(245,199,106,0.15); color: #f5c76a; }
.vj-cat-adj   { background: rgba(96,165,250,0.15);  color: #60a5fa; }


/* ─── CONJUGAISON ───────────────────────────────────────────── */
.cj-tense-filter {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  width: 100%; margin-bottom: 14px;
}
.cj-tense-btn {
  padding: 5px 10px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 20px;
  background: rgba(0,0,0,0.04); color: var(--text-muted);
  cursor: pointer; transition: all 0.16s;
}
.cj-tense-btn.active { background: rgba(232,164,53,0.2); color: #f5c76a; border-color: rgba(245,199,106,0.5); }
.cj-tense-btn:not(.active):hover { background: rgba(0,0,0,0.07); color: var(--text); }

.cj-card {
  width: 100%; background: rgba(0,0,0,0.04);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 24px 20px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.cj-verb-line { display: flex; align-items: baseline; gap: 10px; }
.cj-verb  { font-size: 26px; font-weight: 800; color: var(--text); font-style: italic; }
.cj-trans { font-size: 13px; color: var(--text-muted); }
.cj-question {
  display: flex; align-items: center; gap: 10px;
  background: rgba(232,164,53,0.08); border: 1px solid rgba(245,199,106,0.2);
  border-radius: 12px; padding: 10px 18px;
}
.cj-pronoun  { font-size: 18px; font-weight: 700; color: #f5c76a; min-width: 110px; text-align: center; }
.cj-arrow    { font-size: 16px; color: var(--text-dim); }
.cj-tense-lbl { font-size: 15px; font-weight: 600; color: var(--text); min-width: 100px; }
.cj-input {
  width: 100%; padding: 12px 16px; font-size: 18px; text-align: center;
  background: rgba(0,0,0,0.06); border: 1.5px solid var(--border);
  border-radius: 12px; color: var(--text); outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.cj-input:focus  { border-color: var(--accent); background: rgba(232,164,53,0.08); }
.cj-input.cj-correct { border-color: #10b981; background: rgba(16,185,129,0.1); color: #34d399; }
.cj-input.cj-wrong   { border-color: #ef4444; background: rgba(239,68,68,0.08);  color: #f87171; }
.cj-feedback { font-size: 16px; font-weight: 600; min-height: 22px; }
.cj-feedback.correct { color: #34d399; }
.cj-feedback.wrong   { color: #f87171; }

.cj-score-header { font-size: 18px; font-weight: 700; color: #f5c76a; }
.cj-sep { color: var(--text-dim); font-weight: 400; }
.cj-controls { display: flex; gap: 12px; width: 100%; justify-content: center; margin-top: 4px; }
.cj-btn {
  flex: 1; max-width: 200px; padding: 12px 20px;
  background: rgba(232,164,53,0.2); border: 1px solid rgba(245,199,106,0.4);
  border-radius: 14px; color: #f5c76a; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.cj-btn:hover { background: rgba(232,164,53,0.35); }

/* ─── PHRASES JP ────────────────────────────────────────────── */
ruby { ruby-align: center; }
.kana-char ruby rt { font-size: 22px; color: var(--text-muted); font-weight: 400; }
rt   { font-size: 0.52em; color: var(--text-muted); }

.phj-flashcard { min-height: 220px; }
.phj-flashcard .flashcard-front,
.phj-flashcard .flashcard-back {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px 24px; gap: 10px;
}
.phj-fr-text {
  font-size: 20px; font-weight: 600; color: var(--text);
  text-align: center; line-height: 1.5; padding: 0 8px;
}
.phj-hint {
  font-size: 12px; color: var(--text-muted); margin: 0;
}
.phj-japanese {
  font-size: 24px; line-height: 2.6; text-align: center;
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  color: var(--text);
}
.phj-romaji {
  font-size: 14px; color: var(--text-muted); font-style: italic;
  text-align: center; letter-spacing: 0.02em;
}
.phj-level-badge {
  font-size: 10px; font-weight: 700; color: var(--accent);
  font-family: var(--font-display); letter-spacing: 0.05em;
  text-transform: uppercase; margin-left: 6px;
}
.level-up-toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #000;
  font-family: var(--font-display); font-weight: 900; font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 24px; border-radius: var(--r);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 300; white-space: nowrap;
}
.level-up-toast.show { opacity: 1; }
.level-up-toast.down { background: var(--red); color: var(--text); }
/* ─── KANJI POPUP ─────────────────────────────────────────────── */
.kanji-backdrop {
  position: fixed; inset: 0; z-index: 199;
}
.kanji-backdrop.hidden { display: none; }
.kanji-popup {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(80vw, 320px);
  background: var(--surface-2);
  border-left: 2px solid var(--border-2);
  padding: 20px 16px 28px;
  z-index: 200; overflow-y: auto;
  animation: kp-slide 0.22s cubic-bezier(0.4,0,0.2,1);
}
.kanji-popup.hidden { display: none; }
@keyframes kp-slide {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.kanji-popup-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.kp-header {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 12px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.kp-group {
  font-size: 30px; line-height: 1.2;
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}
.kp-reading { font-size: 14px; color: var(--text-muted); font-style: italic; }
.kp-entry {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.kp-entry:last-child { border-bottom: none; }
.kp-char {
  font-size: 40px; line-height: 1.1; min-width: 48px; text-align: center;
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}
.kp-char.kp-unknown { font-size: 32px; color: var(--text-muted); }
.kp-info { flex: 1; padding-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.kp-lbl {
  display: inline-block; width: 18px; font-size: 11px;
  color: var(--text-muted); margin-right: 6px; font-style: normal;
}
.kp-val { font-size: 14px; color: var(--text); }
.kp-fr {
  font-size: 17px; font-weight: 700; color: var(--text);
  font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: 0.05em; margin-top: 4px;
}
.kp-outside { color: var(--text-muted); font-size: 13px; font-weight: 400; text-transform: none; }
.kanji-tappable { cursor: pointer; border-radius: 3px; transition: background 0.15s; }
.kanji-tappable:active { background: var(--accent-glow); }

.phj-answer-reveal {
  margin: 8px 0; padding: 12px 16px;
  background: var(--surface-2); border-radius: var(--r);
  text-align: center;
}
.phj-romaji-small {
  font-size: 13px; color: var(--text-muted); font-style: italic;
  margin-top: 6px; letter-spacing: 0.02em;
}

/* ─── FISCALITÉ ──────────────────────────────────────────────── */
.fisc-flashcard { min-height: 260px; }
.fisc-flashcard .flashcard-front,
.fisc-flashcard .flashcard-back {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 20px; gap: 16px;
}
.fisc-question {
  font-size: 17px; font-weight: 600; color: var(--text);
  text-align: center; line-height: 1.45;
}
.fisc-answer {
  font-size: 20px; font-weight: 700; color: #10b981;
  text-align: center; line-height: 1.4;
}
.fisc-answer-long {
  font-size: 14px; font-weight: 400; color: var(--text);
  text-align: left; line-height: 1.55; max-width: 340px;
}
.fisc-fill { background: linear-gradient(90deg, #059669, #34d399); }
.penal-fill { background: linear-gradient(90deg, #b91c1c, #f87171); }
.penal-answer { color: #f87171; }
.sub-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 8px 14px 2px;
  border-top: 1px solid var(--border);
}
.sub-section-label:first-child { border-top: none; padding-top: 4px; }

/* ─── MASTERY DOTS ───────────────────────────────────────────── */
.hits-dots {
  font-size: 1.1rem; letter-spacing: 0.35em;
  color: #f5c76a; font-weight: 600;
}

/* ─── DUE BADGE ─────────────────────────────────────────────── */
.due-badge {
  display: inline-block; background: #f87171; color: #fff;
  font-size: 10px; font-weight: 800; padding: 1px 6px;
  border-radius: 10px; margin-left: 6px; vertical-align: middle;
}

/* ─── MIX TAB ───────────────────────────────────────────────── */
.tense-mix { font-weight: 700; }
.tense-mix.active { background: linear-gradient(135deg, #e8a435, #2563eb); }

/* ─── HOME PROGRESS ─────────────────────────────────────────── */
.sub-prog-wrap {
  display: flex; align-items: center; gap: 8px; margin-top: 5px;
}
.sub-prog-bar {
  flex: 1; height: 3px; background: rgba(0,0,0,0.08);
  border-radius: 2px; overflow: hidden;
}
.sub-prog-fill {
  height: 100%; width: 0%; background: #f5c76a;
  border-radius: 2px; transition: width 0.5s ease;
}
.sub-prog-label {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; font-weight: 600;
}

/* ── Révision erreurs ───────────────────────────────────────────────────── */
.err-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.fc-wrong-btn {
  background: rgba(239,68,68,0.12); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3); border-radius: 8px;
  padding: 8px 14px; font-size: 16px; cursor: pointer; transition: background 0.15s;
}
.fc-wrong-btn:hover { background: rgba(239,68,68,0.22); }

/* ── Vocab QCM ──────────────────────────────────────────────────────────── */
.vjq-word {
  font-size: 72px; text-align: center; display: block;
  margin: 8px 0 4px;
}
.kjq-char {
  font-size: 96px; text-align: center; display: block;
  margin: 4px 0 8px; line-height: 1;
}
.kjq-choice-btn {
  grid-column: 1 / -1;
  font-size: 15px !important;
  letter-spacing: 0.02em;
}
.vjq-reading {
  text-align: center; margin-bottom: 8px; font-size: 13px;
}
.vjq-choices {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%; max-width: 480px; margin: 0 auto;
}
.vjq-choice-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px;
  padding: 16px 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: center; line-height: 1.3;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  min-height: 64px;
}
.vjq-choice-btn:hover:not(:disabled) {
  background: var(--surface-3); border-color: var(--border-2);
  transform: translateY(-1px);
}
.vjq-choice-btn:disabled { cursor: default; }
.vjq-choice-btn.vjq-correct {
  background: rgba(74,222,128,0.15); border-color: #4ade80; color: #4ade80;
}
.vjq-choice-btn.vjq-wrong {
  background: rgba(248,113,113,0.15); border-color: #f87171; color: #f87171;
}

/* ─── LIVES SHAKE ──────────────────────────────────────────────── */
@keyframes lives-shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(3px); }
}
.lives-shake { animation: lives-shake 0.38s ease; }

/* ─── GAME OVER OVERLAY ─────────────────────────────────────────── */
.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-over-overlay.hidden { display: none; }
.game-over-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 32px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 320px;
  width: 90%;
}
.go-emoji { font-size: 56px; line-height: 1; }
.game-over-card h2 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 900;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--red);
}
.game-over-card p { color: var(--text-muted); font-size: 15px; }

/* ─── FOOTER ─────────────────────────────────────────────────── */
.hp-footer {
  padding: 40px 32px 24px;
  background: #4db20b;
  border-radius: 16px;
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 20px;
}
.hp-footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 32px; flex-wrap: wrap;
}
.hp-footer-brand { display: flex; flex-direction: column; gap: 8px; }
.hp-footer-logo {
  font-family: var(--font-display); font-size: 22px; font-weight: 900;
  letter-spacing: 0.06em; text-transform: uppercase; color: #fff;
}
.hp-footer-tagline {
  font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.6;
}
.hp-footer-nav {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.hp-footer-link {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.85);
  background: none; border: none; cursor: pointer; padding: 6px 12px;
  border-radius: var(--r-sm); text-decoration: none;
  transition: background 0.13s, color 0.13s;
}
.hp-footer-link:hover { background: rgba(255,255,255,0.15); color: #fff; }
.hp-footer-bottom { display: flex; justify-content: center; }
.hp-footer-copy {
  font-size: 11px; color: rgba(255,255,255,0.55); letter-spacing: 0.03em;
}

/* ─── ABOUT PAGE ────────────────────────────────────────────── */
.about-wrap {
  padding: 48px 40px 80px;
  display: flex; flex-direction: column; gap: 56px;
  max-width: 900px; margin: 0 auto; width: 100%;
}
.about-hero {
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: 0;
}
.about-title {
  font-family: var(--font-display); font-size: 48px; font-weight: 900;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--text);
  line-height: 1.0;
}
.about-title span { color: #4db20b; }
.about-lead {
  font-size: 17px; color: var(--text-muted); line-height: 1.7; max-width: 600px;
}
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.about-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.about-card-icon { font-size: 32px; line-height: 1; }
.about-card-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 900;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text);
}
.about-card-text { font-size: 14px; color: var(--text-muted); line-height: 1.65; }
.about-section-title {
  font-family: var(--font-display); font-size: 24px; font-weight: 900;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--text);
  margin-bottom: 16px;
}
.about-mission, .about-contact {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.about-text { font-size: 15px; color: var(--text-muted); line-height: 1.7; }
.about-email-btn {
  display: inline-block; margin-top: 8px;
  padding: 12px 24px; background: #4db20b; color: #fff;
  border-radius: 8px; font-family: var(--font-display);
  font-size: 14px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; text-decoration: none;
  transition: opacity 0.15s; align-self: flex-start;
}
.about-email-btn:hover { opacity: 0.85; }

@media (max-width: 768px) {
  .about-wrap { padding: 32px 20px 60px; gap: 36px; }
  .about-title { font-size: 32px; }
  .about-grid { grid-template-columns: 1fr; }
  .hp-footer-inner { flex-direction: column; gap: 20px; }
}

/* ─── BOTTOM NAV ─────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 60px; z-index: 50;
  background: var(--bg); border-top: 1px solid var(--border);
  flex-direction: row; align-items: stretch;
}
.bn-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: none; cursor: pointer; padding: 0;
  color: var(--text-muted); transition: color 0.12s;
}
.bn-btn.bn-active { color: #4db20b; }
.bn-icon { font-size: 20px; line-height: 1; }
.bn-icon.kana-icon { font-family: 'Hiragana Sans', 'Noto Sans JP', sans-serif; }
.bn-label { font-size: 10px; font-weight: 600; letter-spacing: 0.03em; }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Layout */
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .top-bar { height: 56px; padding: 0 16px 10px; }
  .tb-xp { display: none; }
  .screen { top: 56px; bottom: 60px; }

  /* Homepage */
  .hp-wrap { padding: 0 20px 40px; }
  .hp-section { padding: 32px 0; gap: 20px; }
  .hp-hero { flex-direction: column; min-height: auto; gap: 20px; }
  .hp-hero-illustration { height: 200px; flex: none; width: 100%; }
  .hp-hero-text { align-items: center; text-align: center; }
  .hp-title { font-size: 36px; }
  .hp-subtitle { font-size: 15px; }
  .hp-hero-btns { width: 100%; }
  .hp-draw { flex-direction: column-reverse; min-height: auto; gap: 20px; padding-top: 0; }
  .hp-draw-illustration { height: 180px; flex: none; width: 100%; }
  .hp-section-last { min-height: auto; }
  .hp-langs-flags { gap: 8px; }

  /* Quiz */
  .vjq-choices { grid-template-columns: 1fr; }
  .kana-char { font-size: 72px; }
  .game-content { padding: 16px; }
  .mode-tabs { gap: 4px; padding: 8px 16px 0; }
}

@media (max-width: 400px) {
  .tb-flame, .tb-heart { width: 22px; height: 22px; }
  .tb-streak-num, .tb-lives-num { font-size: 20px; }
  .tb-flag { width: 32px; height: 22px; }
}

/* ── AUTH ─────────────────────────────────────────────────────────────────── */
.tb-user-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.75); padding: 4px;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.tb-user-btn:hover { color: #fff; }
.tb-user-btn.logged-in { color: #4db20b; }

.auth-wrap {
  max-width: 400px; margin: 40px auto; padding: 0 20px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}

/* Connecté */
.auth-logged {
  width: 100%; display: flex; flex-direction: column;
  align-items: center; gap: 16px; text-align: center;
}
.auth-avatar { font-size: 56px; }
.auth-email { font-size: 16px; font-weight: 700; color: #111; }
.auth-sync-status { font-size: 13px; color: #888; }

/* Form */
.auth-form-wrap { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.auth-tabs { display: flex; border-bottom: 2px solid #e8e8e8; }
.auth-tab {
  flex: 1; padding: 12px; background: none; border: none;
  font-size: 15px; font-weight: 700; color: #aaa; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab.active { color: #4db20b; border-bottom-color: #4db20b; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
  width: 100%; padding: 14px 16px; border-radius: 10px;
  border: 2px solid #e0e0e0; font-size: 16px; outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus { border-color: #4db20b; }

.auth-error { color: #dc2626; font-size: 13px; font-weight: 600; }

.auth-btn {
  width: 100%; padding: 14px; border-radius: 10px; border: none;
  font-size: 16px; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
}
.auth-btn:hover { opacity: 0.88; }
.auth-btn-primary { background: #4db20b; color: #fff; }
.auth-btn-danger { background: #fee2e2; color: #dc2626; }

/* ── Language toggle ── */
.lang-toggle { display:flex; gap:2px; background:#1e293b; border-radius:6px; padding:2px; }
.lang-btn { background:transparent; border:none; color:#64748b; font-size:11px; font-weight:700;
  padding:3px 7px; border-radius:4px; cursor:pointer; transition:all 0.15s; letter-spacing:.5px; }
.lang-btn.lang-active { background:#334155; color:#f8fafc; }
.lang-btn:hover:not(.lang-active) { color:#94a3b8; }
