/* =====================================================
   한국어 Flash by OppaLingo — Styles
   Palette : cerise #D64E6E · violet #C9B8E8 · crème #FFF9F0
===================================================== */

/* ── Reset & Variables ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Les navigateurs appliquent par défaut une couleur de texte fixe
   (souvent noire) aux <button>, qui n'hérite pas automatiquement du
   thème — cause du texte invisible en mode sombre sur certains boutons
   sans couleur explicite. On force l'héritage ici, une fois pour toutes. */
button {
  font-family: inherit;
  color: inherit;
}

:root {
  --bg:           #FFF9F0;
  --card:         #FFFFFF;
  --primary:      #D64E6E;
  --primary-lt:   #FFB7C5;
  --secondary:    #C9B8E8;
  --success:      #2D9B6A;
  --success-lt:   #A8DFC4;
  --text:         #1A1A2E;
  --text-muted:   #8A8A9A;
  --border:       #EDE8F5;
  --shadow:       0 6px 24px rgba(26,26,46,.07);
  --shadow-lg:    0 16px 48px rgba(26,26,46,.13);
  --radius:       20px;
  --radius-sm:    12px;
}

/* Thème sombre — mêmes accents cerise/violet, fond nuit */
[data-theme="dark"] {
  --bg:           #181624;
  --card:         #221F33;
  --primary:      #F0688A;
  --primary-lt:   #6B3349;
  --secondary:    #C9B8E8;
  --success:      #4FCB95;
  --success-lt:   #1F4A38;
  --text:         #F4F1FA;
  --text-muted:   #9590AD;
  --border:       #332E4A;
  --shadow:       0 6px 24px rgba(0,0,0,.35);
  --shadow-lg:    0 16px 48px rgba(0,0,0,.45);
}

body { transition: background-color .3s, color .3s; }
.card, .add-card-form, .my-card-item, .center-card, .quick-stats,
.streak-card, .mastery-card, .history-card, .empty-state {
  transition: background-color .3s, border-color .3s, box-shadow .3s;
}

/* ── Base ───────────────────────────────────────── */
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100svh;
  background-image:
    radial-gradient(ellipse at 10% 90%, rgba(201,184,232,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 10%, rgba(255,183,197,.18) 0%, transparent 55%);
}

/* ── Header ─────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,249,240,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] header { background: rgba(24,22,36,.88); }

.header-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: .9rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
}

.logo-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.logo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: .35rem;
}

.logo-kr {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: 1.35rem;
  background: linear-gradient(130deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-en {
  font-weight: 700;
  font-size: 1.15rem;
}

.logo-blossom {
  font-size: .9rem;
  opacity: .75;
}

.logo-tagline {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: .8;
}

.btn-theme-toggle {
  background: var(--border);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, background .2s;
  flex-shrink: 0;
}

.btn-theme-toggle:hover { transform: scale(1.08); }

/* Navigation pills */
nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .3rem;
  background: var(--border);
  padding: .28rem;
  border-radius: 50px;
}

.nav-btn {
  background: transparent;
  border: none;
  padding: .42rem .95rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.nav-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(214,78,110,.15);
}

/* ── Main ───────────────────────────────────────── */
main {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.view        { display: none; }
.view.active { display: block; }
.hidden      { display: none !important; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.view-header h1 {
  font-size: 1.55rem;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════
   FLASHCARDS
══════════════════════════════════════════════════ */

.filters-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
}

.filter-bar {
  display: flex;
  gap: .35rem;
}

.select-input {
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: .3rem .9rem;
  font-family: 'Poppins', sans-serif;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--card);
  cursor: pointer;
  outline: none;
}

.select-input:focus { border-color: var(--primary); }

.filter-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  padding: .28rem .8rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.card-counter {
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Scène 3D */
.card-scene {
  perspective: 1100px;
  width: 100%;
  max-width: 440px;
  height: 290px;
  margin: 0 auto 2rem;
  cursor: pointer;
}

.card-flip {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
}

.card-flip.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.card-front {
  background: linear-gradient(140deg, #E04870 0%, #A87ED6 100%);
  color: #fff;
}

.card-category-badge {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(255,255,255,.22);
  padding: .18rem .6rem;
  border-radius: 50px;
}

.btn-speak {
  position: absolute;
  top: 1.1rem;
  left: 1.2rem;
  background: rgba(255,255,255,.22);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background .15s;
  z-index: 2;
}

.btn-speak:hover { transform: scale(1.1); background: rgba(255,255,255,.35); }

.btn-speak-dark {
  background: var(--bg);
  color: var(--primary);
}

.btn-speak-dark:hover { background: var(--border); }

.card-hangeul {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 3px 18px rgba(0,0,0,.18);
}

.card-hint {
  position: absolute;
  bottom: 1.1rem;
  font-size: .7rem;
  opacity: .65;
  letter-spacing: .04em;
}

.card-back {
  background: var(--card);
  transform: rotateY(180deg);
  gap: .45rem;
}

.card-hangeul-small {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.card-romanisation {
  font-style: italic;
  font-size: .95rem;
  color: var(--primary);
}

.card-divider {
  width: 38px;
  height: 2px;
  background: var(--primary-lt);
  border-radius: 2px;
  margin: .3rem 0;
}

.card-translation {
  font-size: 1.65rem;
  font-weight: 700;
  text-align: center;
}

.card-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  margin-bottom: 1rem;
}

.btn-icon {
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}

.btn-icon:hover { border-color: var(--primary); color: var(--primary); }

.card-actions { display: flex; gap: .55rem; }

.btn-review, .btn-mastered {
  padding: .55rem 1.15rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
}

.btn-review {
  background: var(--bg);
  color: var(--primary);
  border: 1.5px solid var(--primary-lt);
}

.btn-review:hover   { background: var(--primary); color: #fff; }

.btn-mastered {
  background: var(--bg);
  color: var(--success);
  border: 1.5px solid var(--success-lt);
}

.btn-mastered:hover { background: var(--success); color: #fff; }

.keyboard-hint {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  opacity: .7;
  margin-bottom: 1.75rem;
}

.quick-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.1rem 2rem;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.stat { display: flex; flex-direction: column; align-items: center; gap: .15rem; }

.stat-divider {
  width: 1px;
  height: 30px;
  background: var(--border);
}

.stat-num {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ══════════════════════════════════════════════════
   QUIZ
══════════════════════════════════════════════════ */

#quiz-start, #quiz-result {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 420px;
}

.center-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 100%;
}

.big-emoji {
  font-size: 3.2rem;
  margin-bottom: 1rem;
}

.center-card h2 {
  font-size: 1.75rem;
  margin-bottom: .5rem;
}

.center-card > p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #B03D5E);
  color: #fff;
  border: none;
  padding: .85rem 2.2rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .98rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 18px rgba(214,78,110,.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(214,78,110,.42);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: default;
  transform: none;
}

/* Variante compacte — pour les boutons "Ajouter/Enregistrer" dans des
   formulaires resserrés (Mes Cartes, panneau admin), où la taille "hero"
   de .btn-primary (pensée pour "Commencer le quiz" etc.) est trop imposante. */
.btn-primary.btn-compact {
  padding: .55rem 1.15rem;
  font-size: .83rem;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: .83rem;
  color: var(--text-muted);
  margin-bottom: .6rem;
}

.quiz-meta strong { color: var(--primary); }

.quiz-progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.8rem;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width .4s ease;
  width: 0%;
}

.quiz-word {
  background: linear-gradient(140deg, #E04870, #A87ED6);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  color: #fff;
  margin-bottom: 1.5rem;
  position: relative;
}

.quiz-hangeul {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 8vw, 3rem);
  margin-bottom: .4rem;
}

.quiz-romanisation {
  font-style: italic;
  font-size: .88rem;
  opacity: .85;
}

.quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}

.choice-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  padding: .95rem .75rem;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  line-height: 1.3;
  color: var(--text);
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg);
}

.choice-btn.correct {
  background: var(--success-lt);
  border-color: var(--success);
  color: var(--success);
  font-weight: 600;
}

.choice-btn.wrong {
  background: var(--primary-lt);
  border-color: var(--primary);
  color: var(--primary);
}

.choice-btn:disabled { cursor: default; }

.result-score {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .75rem;
  line-height: 1;
}

.result-total {
  font-size: 1.4rem;
  color: var(--text-muted);
  font-weight: 400;
}

.result-message {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-style: italic;
  line-height: 1.6;
}

/* Réglages du quiz */
.quiz-settings {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.8rem;
  text-align: left;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.setting-row label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

.pill-group {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

.option-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  padding: .4rem .9rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}

.option-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.quiz-settings .select-input {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: .55rem .85rem;
  font-size: .85rem;
}

/* Mode "Taper la réponse" */
.quiz-typing {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: center;
}

.typing-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  text-align: center;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.typing-input:focus { border-color: var(--primary); }
.typing-input:disabled { opacity: .7; }

.typing-feedback {
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
}

.typing-feedback.correct { color: var(--success); }
.typing-feedback.wrong   { color: var(--primary); }

/* ══════════════════════════════════════════════════
   MES CARTES
══════════════════════════════════════════════════ */

.add-card-form {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.form-title, .section-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .75rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .32rem;
}

.form-group label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

.form-group input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .58rem .85rem;
  font-family: 'Poppins', sans-serif;
  font-size: .88rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s;
}

.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--text-muted); opacity: .55; }

.form-buttons {
  display: flex;
  gap: .6rem;
  align-items: center;
}

.btn-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  padding: .5rem;
}

.btn-cancel:hover { color: var(--primary); }

.form-error {
  color: var(--primary);
  font-size: .8rem;
  margin-top: .5rem;
}

.empty-state {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
}

.empty-emoji { font-size: 2.4rem; margin-bottom: .85rem; }

.empty-state p {
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.65;
}

.my-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.my-card-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.1rem;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform .2s, box-shadow .2s;
  border-left: 3px solid var(--secondary);
}

.my-card-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.my-card-item.editing {
  border-left-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.my-card-kr {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: .2rem;
}

.my-card-roman {
  font-style: italic;
  font-size: .77rem;
  color: var(--text-muted);
  margin-bottom: .38rem;
}

.my-card-translation {
  font-weight: 600;
  font-size: .88rem;
}

.my-card-actions {
  position: absolute;
  top: .7rem;
  right: .7rem;
  display: flex;
  gap: .25rem;
}

.btn-edit, .btn-delete {
  background: none;
  border: none;
  font-size: .78rem;
  cursor: pointer;
  color: var(--text-muted);
  opacity: .45;
  padding: .15rem .3rem;
  border-radius: 4px;
  transition: all .2s;
}

.btn-edit:hover   { opacity: 1; color: var(--secondary); background: var(--bg); }
.btn-delete:hover { opacity: 1; color: var(--primary); background: var(--bg); }

/* ══════════════════════════════════════════════════
   STATS
══════════════════════════════════════════════════ */

.streak-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.streak-flame { font-size: 2.4rem; }

.streak-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}

.streak-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.streak-label {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
}

.streak-divider-v {
  width: 1px;
  height: 42px;
  background: var(--border);
}

.mastery-card, .history-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.mastery-bar-track {
  height: 12px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .65rem;
}

.mastery-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 8px;
  width: 0%;
  transition: width .5s ease;
}

.mastery-text {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
}

.history-chart {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  height: 130px;
  padding-top: .5rem;
}

.history-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.history-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--secondary), var(--primary));
  min-height: 4px;
  cursor: default;
  transition: opacity .2s;
}

.history-bar:hover { opacity: .8; }

.history-bar-label {
  font-size: .65rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .header-inner { padding: .75rem 1rem; gap: .6rem; }

  .nav-btn { padding: .38rem .65rem; font-size: .72rem; }

  main { padding: 1.25rem 1rem 3.5rem; }

  .card-scene { height: 250px; }

  .view-header { flex-direction: column; align-items: flex-start; }

  .form-grid { grid-template-columns: 1fr; }

  .quiz-choices { grid-template-columns: 1fr; }

  .quick-stats { gap: 1rem; padding: 1rem 1.25rem; }

  .card-actions { gap: .4rem; }
  .btn-review, .btn-mastered { padding: .5rem .85rem; font-size: .78rem; }
}

/* ══════════════════════════════════════════════════
   COMPTE UTILISATEUR (en-tête de l'app)
══════════════════════════════════════════════════ */

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

.account-wrap {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--border);
  border: none;
  padding: .3rem .7rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: transform .2s;
}

.user-chip:hover { transform: scale(1.04); }

.account-menu {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  z-index: 200;
  min-width: 200px;
}

.account-email {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
  word-break: break-all;
}

.account-menu-link {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: .5rem;
  box-sizing: border-box;
}

.account-menu-btn {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: .55rem 1rem;
  font-family: 'Poppins', sans-serif;
  font-size: .83rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all .2s;
}

.account-menu-btn:hover { background: var(--primary); color: #fff; }

/* ══════════════════════════════════════════════════
   PAGES D'AUTHENTIFICATION (connexion / inscription)
══════════════════════════════════════════════════ */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 2rem 1.25rem;
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.auth-logo {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .35rem;
  margin-bottom: .2rem;
}

.auth-tagline {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.auth-tabs {
  display: flex;
  gap: .3rem;
  background: var(--bg);
  padding: .28rem;
  border-radius: 50px;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: .55rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}

.auth-tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(214,78,110,.15);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form-title {
  font-size: 1.2rem;
  margin-bottom: .25rem;
}

.auth-form .form-group input {
  width: 100%;
}

.auth-helper {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.auth-error {
  color: var(--primary);
  font-size: .82rem;
  background: var(--primary-lt);
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
}

.auth-info {
  color: var(--text-muted);
  font-size: .82rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  text-align: center;
}

.auth-success {
  color: var(--success);
  font-size: .82rem;
  background: var(--success-lt);
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
}

.auth-submit { width: 100%; }

.auth-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
  padding: .3rem;
}

.auth-link:hover { color: var(--primary); }

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .5rem;
}

.avatar-option {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.4rem;
  padding: .5rem 0;
  cursor: pointer;
  transition: all .2s;
}

.avatar-option.selected {
  border-color: var(--primary);
  background: var(--primary-lt);
}

/* ══════════════════════════════════════════════════
   PANNEAU ADMINISTRATEUR
══════════════════════════════════════════════════ */

/* Mise en page plus large que l'app principale, pour laisser assez de
   place aux tableaux (utilisateurs, vocabulaire, audit) sans que leurs
   colonnes ne débordent ou n'obligent à défiler horizontalement. */
.admin-body .header-inner,
.admin-body main {
  max-width: 1180px;
}

.admin-body main {
  padding: 2rem 2rem 5rem;
}

.admin-back-link {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: .4rem .7rem;
  border-radius: 50px;
  background: var(--border);
  transition: all .2s;
}

.admin-back-link:hover { color: var(--primary); }

.admin-search {
  width: 240px;
  max-width: 100%;
}

/* Grille de statistiques */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.admin-stat-card.small { padding: .85rem .5rem; }

.admin-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.admin-stat-card.small .admin-stat-value { font-size: 1.2rem; }

.admin-stat-label {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .2rem;
}

/* Tableaux */
.admin-table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 1rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 560px;
}

.admin-table th {
  text-align: left;
  padding: .85rem 1rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem !important;
}

.admin-table-actions-cell {
  display: flex;
  gap: .3rem;
  white-space: nowrap;
}

.btn-table-action {
  background: var(--bg);
  border: 1.5px solid var(--border);
  padding: .35rem .75rem;
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all .2s;
}

.btn-table-action:hover { background: var(--primary); color: #fff; }

/* Badges */
.badge {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 50px;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-admin    { background: var(--secondary); color: #fff; }
.badge-user     { background: var(--border); color: var(--text-muted); }
.badge-active   { background: var(--success-lt); color: var(--success); }
.badge-suspended{ background: var(--primary-lt); color: var(--primary); }
.badge-premium  { background: linear-gradient(135deg, var(--secondary), var(--primary)); color: #fff; }

.premium-checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  cursor: pointer;
}

.premium-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-pagination-label {
  font-size: .8rem;
  color: var(--text-muted);
}

/* Modale fiche utilisateur */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.25rem;
}

.admin-modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.admin-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text-muted);
}

.admin-modal-close:hover { color: var(--primary); }

.admin-modal-title {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

.admin-modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: .6rem;
  margin-bottom: 1.5rem;
}

.admin-modal-actions {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-delete-account {
  background: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 50px;
  padding: .55rem 1rem;
  font-family: 'Poppins', sans-serif;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.btn-delete-account:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-delete-account:disabled, .account-menu-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.admin-audit-details {
  font-size: .72rem;
  color: var(--text-muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .admin-search { width: 100%; margin-top: .5rem; }
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════
   NIVEAU / XP
══════════════════════════════════════════════════ */

.level-chip {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: .35rem .75rem;
  border-radius: 50px;
  white-space: nowrap;
  flex-shrink: 0;
}

.xp-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.xp-level-badge {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  padding: .5rem .9rem;
  border-radius: 50px;
  flex-shrink: 0;
}

.xp-info { flex: 1; min-width: 0; }

.xp-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .5rem;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border-radius: 8px;
  width: 0%;
  transition: width .5s ease;
}

.xp-text {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════ */

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .75rem;
}

.badge-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .85rem .5rem;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: transform .2s;
}

.badge-tile:hover { transform: translateY(-2px); }

.badge-tile.badge-earned {
  background: linear-gradient(160deg, var(--primary-lt), var(--card));
  box-shadow: var(--shadow);
}

.badge-tile.badge-locked {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  opacity: .6;
}

.badge-tile-icon { font-size: 1.6rem; }

.badge-tile-label {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.badge-tile.badge-locked .badge-tile-label { color: var(--text-muted); }

/* Notification discrète de déblocage de badge */
.badge-toast {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  padding: .85rem 1.5rem;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transition: bottom .4s ease;
  white-space: nowrap;
}

.badge-toast.visible { bottom: 2rem; }

/* ══════════════════════════════════════════════════
   ALPHABET (HANGEUL)
══════════════════════════════════════════════════ */

.lesson-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

/* Carte verrouillée (contenu premium sans accès) */
.card-flip.card-locked .card-front {
  filter: grayscale(.4);
}

@media (max-width: 600px) {
  .badges-grid { grid-template-columns: repeat(3, 1fr); }
  .xp-card { padding: 1rem; gap: .75rem; }
}

/* ══════════════════════════════════════════════════
   GRAMMAIRE
══════════════════════════════════════════════════ */

.grammar-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem 2rem;
  max-width: 560px;
  margin: 0 auto 1.5rem;
  position: relative;
  text-align: center;
}

.grammar-level-badge {
  position: static;
  display: inline-block;
  background: var(--secondary);
  color: #fff;
  margin-bottom: .85rem;
}

.grammar-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: .85rem;
  color: var(--text);
}

.grammar-explanation {
  font-size: .92rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

.grammar-example {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

.grammar-example-korean {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: .3rem;
}

.grammar-example-romanisation {
  font-style: italic;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
}

.grammar-example-translation {
  font-size: .95rem;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════
   DIALOGUES
══════════════════════════════════════════════════ */

.dialogue-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.dialogue-tile {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  position: relative;
  text-align: left;
}

.dialogue-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.dialogue-tile-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .3rem;
}

.dialogue-tile-context {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: .6rem;
}

.dialogue-tile-status {
  font-size: .72rem;
  font-weight: 600;
  color: var(--success);
}

.dialogue-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 1rem 0 1.25rem;
}

.dialogue-detail-title { font-size: 1.3rem; font-weight: 700; }

.dialogue-lines {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-bottom: 1.5rem;
}

.dialogue-line {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  max-width: 85%;
}

.dialogue-line.speaker-b {
  align-self: flex-end;
  background: linear-gradient(140deg, var(--primary-lt), var(--card));
}

.dialogue-line-speaker {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .3rem;
}

.dialogue-line-korean {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.dialogue-line-romanisation {
  font-style: italic;
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .3rem;
}

.dialogue-line-translation {
  font-size: .85rem;
  margin-top: .2rem;
}

.dialogue-line-speak-btn {
  background: var(--bg);
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: .72rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   QUIZ — MODE ÉCOUTE
══════════════════════════════════════════════════ */

.quiz-word.listening-mode .quiz-hangeul {
  font-size: 3.5rem;
}

.quiz-word.listening-mode .quiz-romanisation {
  opacity: .7;
}

/* ══════════════════════════════════════════════════
   FORMULAIRES ADMIN ÉTENDUS (grammaire, dialogues)
══════════════════════════════════════════════════ */

.admin-form-full {
  margin-bottom: 1rem;
}

.admin-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  resize: vertical;
  transition: border-color .2s;
}

.admin-textarea:focus { border-color: var(--primary); }

.admin-form-full label code {
  background: var(--border);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .72rem;
}
