/* ============================================================
   TABLES 11-30 - feuille de style
   Aesthetic : carnet mathématique sombre, Fraunces + JetBrains Mono
   ============================================================ */

:root {
  /* Palette */
  --bg:           #0d0c0a;
  --bg-2:         #131210;
  --surface:      #181714;
  --surface-1:    #1a1814;
  --surface-2:    #221f1a;
  --surface-3:    #2b271f;
  --border:       #2a2620;
  --border-soft:  #1f1d18;
  --text:         #f3ede0;
  --text-2:       #c1b9a8;
  --text-dim:     #7a7367;
  --text-faint:   #4a4640;

  --accent:       #d4ff3a;     /* chartreuse électrique */
  --accent-dim:   #8aa424;
  --accent-soft:  rgba(212, 255, 58, 0.12);

  --warm:         #ffb35e;
  --warm-soft:    rgba(255, 179, 94, 0.12);

  --hot-1:        #ff5e5e;
  --hot-2:        #ff8a47;
  --hot-3:        #ffc83a;
  --hot-4:        #aedc55;
  --hot-5:        #4caf50;
  --hot-6:        #2bb38a;
  --hot-7:        #1fd6c4;

  /* Type */
  --f-display: 'Fraunces', Georgia, serif;
  --f-body:    'Manrope', system-ui, -apple-system, sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Radii */
  --r-1: 4px; --r-2: 8px; --r-3: 12px; --r-4: 16px; --r-pill: 999px;

  /* Safe area */
  --sa-top:    env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(212, 255, 58, 0.04), transparent 60%),
    radial-gradient(800px 400px at 90% 100%, rgba(255, 179, 94, 0.03), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, button, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

::selection { background: var(--accent); color: var(--bg); }

/* ============================================================
   APP SHELL
   ============================================================ */

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-top: var(--sa-top);
  padding-bottom: var(--sa-bottom);
  display: flex;
  flex-direction: column;
}

.boot {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-mark {
  font-family: var(--f-display);
  font-size: 64px;
  color: var(--accent);
  opacity: 0.3;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50%      { opacity: 0.8; transform: scale(1.05); }
}

/* Header générique */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--s-5) var(--s-4);
  gap: var(--s-3);
}
.topbar .crumb {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.topbar .crumb .crumb-sep { color: var(--text-faint); margin: 0 0.5em; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px; height: 36px;
  border-radius: var(--r-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }

.back-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0;
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.back-btn:hover { color: var(--text); }
.back-btn::before { content: '←'; }

.screen {
  padding: 0 var(--s-5) var(--s-7);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Typo */
h1.title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(36px, 9vw, 52px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: var(--s-4) 0 var(--s-2);
  color: var(--text);
}
h1.title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

h2.section-title {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: var(--s-6) 0 var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
h2.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.subtitle {
  font-family: var(--f-display);
  font-weight: 300;
  font-style: italic;
  font-size: 18px;
  color: var(--text-2);
  margin: 0 0 var(--s-5);
}

/* ============================================================
   HOME
   ============================================================ */

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  margin: var(--s-5) 0;
  padding: var(--s-4);
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
}
.home-stats.home-stats-4 {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}
@media (min-width: 540px) {
  .home-stats.home-stats-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.recap-row-4 {
  grid-template-columns: repeat(2, 1fr) !important;
}
@media (min-width: 540px) {
  .recap-row-4 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}
.home-stat {
  text-align: center;
  padding: var(--s-2);
}
.home-stat .v {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}
.home-stat .v.accent { color: var(--accent); }
.home-stat .l {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 6px;
}

.home-actions {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.action-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-5);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.action-card:hover, .action-card:active {
  border-color: var(--accent);
  background: var(--surface-2);
}
.action-card .ac-label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s-2);
}
.action-card .ac-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}
.action-card .ac-desc {
  margin-top: var(--s-2);
  font-size: 14px;
  color: var(--text-2);
}

.action-card .ac-progress {
  margin-top: var(--s-3);
}
.action-card .ac-bar {
  height: 4px;
  background: var(--border-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.action-card .ac-bar > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.action-card .ac-count {
  margin-top: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.action-card.primary {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
  border-color: var(--accent);
}
.action-card.primary .ac-title {
  font-style: italic;
  font-weight: 300;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */

.lb-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
}
.lb-title {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--s-3);
}
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lb-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: var(--r-2);
  transition: background 0.15s;
}
.lb-row.me {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.lb-row.first {
  background: var(--surface-3);
}
.lb-row.first.me {
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-3));
}
.lb-rank {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 18px;
  color: var(--text-dim);
  text-align: center;
}
.lb-row.first .lb-rank {
  color: var(--accent);
}
.lb-name {
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-tag {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.lb-val {
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}
.lb-empty {
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}

/* Home foot avec deux boutons */
.home-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-6);
}
.home-foot button { width: 100%; }

.phase-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  transition: opacity 0.2s, border-color 0.2s;
}
.phase-card.current {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
}
.phase-card.done {
  opacity: 0.55;
}
.phase-card.locked {
  opacity: 0.4;
}

.phase-card .ph-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.phase-card .ph-num {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ph-status-pill {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
}
.ph-status-pill.current {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.ph-status-pill.done {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.phase-card .ph-name {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.phase-card .ph-tagline {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: var(--s-3);
}
.phase-card .ph-tables {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--s-3);
}
.phase-card .ph-tag {
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 3px 9px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  color: var(--text-2);
}
.phase-card.current .ph-tag {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.phase-card .ph-progress {
  margin-top: var(--s-3);
}
.phase-card .ph-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.phase-card .ph-bar-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.phase-card .ph-bar-count {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-2);
}
.phase-card .ph-bar {
  height: 4px;
  background: var(--border-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.phase-card .ph-bar > div {
  height: 100%;
  background: var(--warm);
  transition: width 0.3s ease;
}
.phase-card .ph-bar > div.ph-bar-mastered {
  background: var(--accent);
}
.phase-card .ph-count {
  margin-top: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.parcours-foot {
  margin-top: var(--s-3);
}

.gate-banner {
  background: linear-gradient(135deg, rgba(255,138,90,0.12), var(--surface-1));
  border: 1px solid rgba(255,138,90,0.4);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin: var(--s-4) 0;
}
.gate-title {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ff8a5a;
  margin-bottom: 6px;
}
.gate-message {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.4;
}

/* Vue d'ensemble des parts */
.levels-overview {
  display: flex;
  gap: var(--s-2);
  justify-content: center;
  flex-wrap: wrap;
  margin: var(--s-3) 0;
}
.level-pip {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.level-pip:hover { background: var(--surface-2); color: var(--text-2); }
.level-pip.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.level-pip.done { border-color: var(--accent-dim); color: var(--accent-dim); }
.level-pip.locked { opacity: 0.45; }

/* Pop-up de niveau */
.lvl-pop-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
}
.lvl-pop {
  width: 100%; max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-4, 18px);
  padding: var(--s-5);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lvl-pop-title {
  font-family: var(--f-display); font-size: 24px; color: var(--text);
  margin-bottom: var(--s-3);
}
.lvl-pop-body, .lvl-pop-intro {
  font-size: 14.5px; line-height: 1.55; color: var(--text-2); margin: 0 0 var(--s-4);
}
.lvl-bars { margin-bottom: var(--s-4); }
.lvl-bar-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 5px; margin-top: var(--s-3);
}
.lvl-bar-label { font-size: 13px; color: var(--text-2); }
.lvl-bar-count { font-family: var(--f-mono); font-size: 12px; color: var(--text-dim); }
.lvl-bar-count.ok { color: var(--accent); }
.lvl-bar {
  height: 6px; background: var(--surface-3, var(--surface-2));
  border-radius: var(--r-pill); overflow: hidden;
}
.lvl-bar > div { height: 100%; background: var(--text-dim); border-radius: var(--r-pill); transition: width 0.3s; }
.lvl-bar > div.done { background: var(--accent); }
.lvl-pop-close { margin-top: var(--s-2); }

/* Phase de consolidation */
.phase-card.consolidation {
  background: linear-gradient(135deg, var(--surface-3), var(--surface-1));
  border-color: var(--warm);
}
.phase-card.consolidation .ph-num {
  color: var(--warm);
}

.cons-stats {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.cons-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cons-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.cons-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.cons-count {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--text-2);
}
.cons-count.ok {
  color: var(--accent);
  font-weight: 700;
}
.cons-bar {
  height: 5px;
  background: var(--border-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.cons-bar > div {
  height: 100%;
  background: var(--warm);
  transition: width 0.3s ease;
}
.cons-bar > div.done {
  background: var(--accent);
}

.phase-celebration.big {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border: none;
  color: var(--bg);
}
.phase-celebration.big .cel-mark {
  color: var(--bg);
  font-size: 28px;
}
.phase-celebration.big .cel-title {
  color: var(--bg);
  font-size: 28px;
}
.phase-celebration.big .cel-sub {
  color: var(--bg);
  opacity: 0.85;
}

/* Célébration de validation de phase, dans le recap */
.phase-celebration {
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--accent);
  border-radius: var(--r-3);
  padding: var(--s-5) var(--s-4);
  margin-bottom: var(--s-4);
  text-align: center;
  animation: fadeIn 0.5s ease;
}
.phase-celebration .cel-mark {
  font-family: var(--f-display);
  font-size: 36px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--s-2);
}
.phase-celebration .cel-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}
.phase-celebration .cel-sub {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  font-size: 14px;
  color: var(--text-2);
}

.home-foot {
  margin-top: var(--s-6);
}

/* ============================================================
   AUTH
   ============================================================ */

.auth-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-7) var(--s-5);
}
.auth-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-6);
}
.auth-card .logo {
  font-family: var(--f-display);
  font-size: 40px;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-2);
}
.auth-card .logo em {
  font-style: italic;
  color: var(--accent);
  font-weight: 300;
}
.auth-card .tagline {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  color: var(--text-2);
  margin: 0 0 var(--s-6);
}

.field {
  display: block;
  margin-bottom: var(--s-3);
}
.field .label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--r-2);
  font-family: var(--f-mono);
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}

.auth-toggle {
  margin-top: var(--s-4);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-toggle button {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
}

.error-banner {
  background: rgba(255, 94, 94, 0.1);
  border: 1px solid rgba(255, 94, 94, 0.3);
  color: #ffb3b3;
  padding: var(--s-3);
  border-radius: var(--r-2);
  font-size: 13px;
  margin-bottom: var(--s-3);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: 12px 18px;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover, .btn:active { background: var(--surface-3); border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:active {
  background: var(--accent-dim);
  color: var(--bg);
  border-color: var(--accent-dim);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}

.btn-block { width: 100%; }
.btn-large { padding: 16px 22px; font-size: 16px; }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(255, 94, 94, 0.4);
  color: #ff8a8a;
}
.btn-danger:hover { background: rgba(255, 94, 94, 0.1); }

/* ============================================================
   TIPS
   ============================================================ */

/* ============================================================
   ASTUCES - blocs pleine largeur par technique
   ============================================================ */

.tip-blocks { display: flex; flex-direction: column; gap: var(--s-3); margin: var(--s-3) 0 var(--s-5); }

.tip-block {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-4);
}
.tip-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s-3); }
.tip-block-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  border-radius: var(--r-2);
  font-family: var(--f-display); font-size: 20px; line-height: 1;
}
.tip-block-head h3 {
  margin: 0; font-family: var(--f-display); font-weight: 400;
  font-size: 21px; color: var(--text); line-height: 1.15;
}
.tip-principle { font-size: 14.5px; line-height: 1.6; color: var(--text-2); margin: 0 0 var(--s-3); }

.tip-examples {
  background: var(--bg-2, var(--surface-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--r-2);
  overflow: hidden;
}
.tip-ex {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 10px var(--s-3);
  border-top: 1px dashed var(--border-soft);
  font-family: var(--f-mono); font-size: 14px;
}
.tip-ex:first-child { border-top: none; }
.tip-ex-q { color: var(--accent); font-weight: 700; min-width: 72px; }
.tip-ex-a { color: var(--text-2); }
.tip-ex-note {
  display: block; color: var(--text-dim); font-size: 13px;
  line-height: 1.5; font-family: var(--f-sans, inherit);
}
.tip-when {
  margin: var(--s-3) 0 0; font-size: 13px; color: var(--text-dim);
  font-style: italic; line-height: 1.5;
}
.tip-when span {
  font-family: var(--f-mono); font-style: normal; font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
  margin-right: 6px;
}


/* ============================================================
   QUIZ SETUP
   ============================================================ */

.setup-grid-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin: var(--s-3) 0 var(--s-4);
}
.setup-col {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-3);
}
.setup-col .col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--s-3);
}
.setup-col .col-head button {
  background: none; border: none; padding: 0;
  color: var(--accent);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.setup-cells {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.setup-cell {
  aspect-ratio: 1.6;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--r-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-2);
  transition: all 0.12s;
}
.setup-cell.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.setup-cell:active { transform: scale(0.96); }

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: var(--s-3) 0;
}
.preset-row button {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.preset-row button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.setup-summary {
  text-align: center;
  margin: var(--s-5) 0;
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  color: var(--text-2);
  font-size: 14px;
}
.setup-summary strong {
  color: var(--accent);
  font-style: normal;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 13px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border-soft);
}
.option-row:first-child { border-top: none; }
.option-row .opt-label {
  font-size: 14px;
  color: var(--text);
}
.option-row .opt-sub {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.option-row .opt-control {
  display: flex; gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  padding: 3px;
}
.option-row .opt-control button {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.option-row .opt-control button.on {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.option-row input[type="number"] {
  width: 80px;
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: var(--r-2);
  font-family: var(--f-mono);
}

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

/* Lock body scroll quand une session quiz est active */
html:has(.quiz),
body:has(.quiz) {
  overflow: hidden;
  height: 100dvh;
  position: fixed;
  inset: 0;
  width: 100%;
}

.quiz {
  position: fixed;
  inset: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--sa-top);
  padding-bottom: var(--sa-bottom);
  background: var(--bg);
  overflow: hidden;
  z-index: 10;
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) var(--s-5);
  flex-shrink: 0;
}
.quiz-progress {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.quiz-progress .now { color: var(--text); }

.quiz-stop {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.quiz-stop:hover { border-color: var(--hot-1); color: var(--hot-1); }

.quiz-progressbar {
  margin: 0 var(--s-5);
  height: 2px;
  background: var(--border-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
  flex-shrink: 0;
}
.quiz-progressbar > div {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--s-4) var(--s-5);
  text-align: center;
  gap: var(--s-3);
}

.question {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(72px, 22vw, 140px);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--s-3);
  color: var(--text);
  transition: opacity 0.15s, transform 0.15s;
}
.question .qx { font-style: italic; color: var(--accent); margin: 0 0.1em; font-weight: 200; }
.question .qeq { color: var(--text-dim); margin-left: 0.15em; font-weight: 200; }

.answer-display {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: clamp(48px, 14vw, 72px);
  letter-spacing: 0.02em;
  min-height: 1.2em;
  min-width: 4ch;
  padding: var(--s-3) var(--s-5);
  border-bottom: 2px solid var(--border);
  color: var(--accent);
  transition: border-color 0.08s, color 0.08s, background 0.08s;
}
.answer-display.empty { color: var(--text-faint); }
.answer-display.empty::after { content: '_'; }

.answer-display.success {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  border-radius: var(--r-2);
}

.quiz-time {
  margin-top: var(--s-3);
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--text-dim);
}

.quiz-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5) calc(var(--sa-bottom) + var(--s-3));
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  flex-shrink: 0;
  /* Désactive toute interprétation de geste (pinch, scroll, zoom) sur le keypad */
  touch-action: none;
}
.key {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(28px, 6vw, 36px);
  min-height: clamp(54px, 8.5vh, 84px);
  padding: 0;
  border-radius: var(--r-3);
  transition: background 0.05s, transform 0.05s, border-color 0.05s;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.key.pressed,
.key:active {
  background: var(--accent-soft);
  border-color: var(--accent);
  /* Pas de transform : un scale rétrécit la zone tactile et fait rater le 2e tap rapide */
}
.key.alt {
  font-family: var(--f-mono);
  font-size: 18px;
  color: var(--text-dim);
}
.key.alt.pressed,
.key.alt:active { color: var(--accent); }

/* ============================================================
   RECAP
   ============================================================ */

.recap-hero {
  text-align: center;
  margin: var(--s-6) 0;
}
.recap-hero .big {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(54px, 14vw, 84px);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
}
.recap-hero .label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: var(--s-2);
}

.recap-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin: var(--s-4) 0;
}
.recap-row .home-stat { padding: 0; }

.recap-list {
  margin: var(--s-4) 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  overflow: hidden;
}
.recap-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-soft);
  background: var(--surface-1);
}
.recap-item:first-child { border-top: none; }
.recap-item .ri-pair { font-family: var(--f-mono); color: var(--text); font-size: 15px; }
.recap-item .ri-time { font-family: var(--f-mono); font-size: 13px; }
.recap-item .ri-time.fast { color: var(--hot-5); }
.recap-item .ri-time.mid  { color: var(--hot-3); }
.recap-item .ri-time.slow { color: var(--hot-1); }

/* ============================================================
   STATS
   ============================================================ */

.stats-tabs {
  display: flex;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  padding: 3px;
  margin: var(--s-4) 0;
  gap: 3px;
}
.stats-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 4px;
  border-radius: var(--r-pill);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.stats-tabs button.on {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

/* Sélecteur de parcours (Multiplication / Division) */
.course-tabs {
  display: flex;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  padding: 3px;
  margin: var(--s-4) 0 var(--s-3);
  gap: 3px;
}
.course-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 4px;
  border-radius: var(--r-pill);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.course-tabs button:hover { color: var(--text-2); }
.course-tabs button.on {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.filter-row {
  display: flex;
  gap: var(--s-2);
  margin: var(--s-3) 0 var(--s-4);
}
.filter-row button {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 4px;
  border-radius: var(--r-2);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.filter-row button.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.heatmap-wrap {
  margin: var(--s-3) 0;
  overflow-x: auto;
}

.part-tabs {
  display: flex;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  padding: 3px;
  margin: var(--s-3) 0;
  gap: 3px;
}
.part-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 7px 4px;
  border-radius: var(--r-pill);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.part-tabs button.on {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}
.heatmap {
  display: grid;
  grid-template-columns: 28px repeat(8, 1fr);
  gap: 3px;
  min-width: 280px;
}
.heatmap .h-corner,
.heatmap .h-colhead,
.heatmap .h-rowhead {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  padding: 4px 0;
  letter-spacing: 0.04em;
}
.heatmap .h-rowhead { text-align: right; padding-right: 6px; }
.heatmap .h-cell {
  aspect-ratio: 1;
  background: var(--surface-1);
  border-radius: 3px;
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
}
.heatmap .h-cell:active { transform: scale(0.9); }
.heatmap .h-cell[data-box="0"] { background: var(--surface-1); border-color: var(--border-soft); }
.heatmap .h-cell[data-box="1"] { background: var(--hot-1); border-color: transparent; }
.heatmap .h-cell[data-box="2"] { background: var(--hot-2); border-color: transparent; }
.heatmap .h-cell[data-box="3"] { background: var(--hot-3); border-color: transparent; }
.heatmap .h-cell[data-box="4"] { background: var(--hot-4); border-color: transparent; }
.heatmap .h-cell[data-box="5"] { background: var(--hot-5); border-color: transparent; }
.heatmap .h-cell[data-box="6"] { background: var(--hot-6); border-color: transparent; }
.heatmap .h-cell[data-box="7"] { background: var(--hot-7); border-color: transparent; }

.legend {
  display: flex;
  gap: var(--s-3);
  margin: var(--s-3) 0;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.legend .swatch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.legend .sw {
  width: 14px; height: 14px; border-radius: 2px;
}

.cell-detail {
  background: var(--surface-1);
  border: 1px solid var(--accent);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin: var(--s-3) 0;
}
.cell-detail h4 {
  font-family: var(--f-display);
  font-weight: 400;
  margin: 0 0 var(--s-2);
  font-size: 28px;
}
.cell-detail .cd-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.cell-detail .cd-stats > div { text-align: center; }
.cell-detail .cd-stats .v {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 18px;
  color: var(--text);
}
.cell-detail .cd-stats .l {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 2px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-4);
  margin: var(--s-3) 0;
}
.chart-card .ct {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--s-3);
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-soft);
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.history-item:first-child { border-top: none; }
.history-item:hover, .history-item.opened { background: var(--surface-2); }
.history-item.opened { border-left: 2px solid var(--accent); padding-left: calc(var(--s-4) - 2px); }
.history-item .hi-date {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.history-item.opened .hi-date { color: var(--text-2); }
.history-item .hi-mode {
  font-size: 13px;
  color: var(--text-2);
}
.history-item .hi-stats {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--accent);
  text-align: right;
}

.history-item-wrap {
  border-top: 1px solid var(--border-soft);
}
.history-item-wrap:first-child { border-top: none; }
.history-item-wrap .history-item { border-top: none; }

/* Détail session déplié */
.hd-detail {
  background: var(--bg-2);
  border-top: 1px solid var(--border-soft);
  padding: var(--s-4);
  animation: fadeIn 0.2s ease;
}
.hd-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.hd-k {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
}
.hd-v {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  text-align: center;
}
.hd-v.accent { color: var(--accent); }

.hd-meta {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.hd-meta-tag {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-soft);
}

.hd-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hd-item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: var(--s-3);
  align-items: baseline;
  padding: 6px 10px;
  background: var(--surface-1);
  border-radius: var(--r-2);
  font-family: var(--f-mono);
  font-size: 13px;
}
.hd-idx {
  color: var(--text-faint);
  font-size: 11px;
  text-align: right;
}
.hd-pair {
  color: var(--text);
}
.hd-result {
  color: var(--text-dim);
  font-size: 12px;
}
.hd-time {
  font-weight: 500;
  white-space: nowrap;
}
.hd-time.fast { color: var(--hot-5); }
.hd-time.mid  { color: var(--hot-3); }
.hd-time.slow { color: var(--hot-1); }

.history-list {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--surface-1);
  margin: var(--s-3) 0;
}

/* Mini line chart (SVG) */
.line-chart {
  width: 100%;
  height: 140px;
  display: block;
}
.line-chart .axis { stroke: var(--border-soft); stroke-width: 1; }
.line-chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.line-chart .area { fill: var(--accent-soft); }
.line-chart .point { fill: var(--accent); }
.line-chart .label { fill: var(--text-dim); font-family: var(--f-mono); font-size: 9px; }

/* ============================================================
   OPTIONS
   ============================================================ */

.options-section {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  padding: var(--s-3) var(--s-4);
  margin: var(--s-3) 0 var(--s-4);
}

.empty-state {
  text-align: center;
  padding: var(--s-7) var(--s-4);
  color: var(--text-dim);
}
.empty-state .es-mark {
  font-family: var(--f-display);
  font-size: 48px;
  color: var(--text-faint);
  margin-bottom: var(--s-3);
}
.empty-state .es-text {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
}

/* ============================================================
   TOAST / micro feedback
   ============================================================ */

.toast {
  position: fixed;
  bottom: calc(var(--sa-bottom) + var(--s-4));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  z-index: 1000;
  animation: toastIn 0.2s ease, toastOut 0.2s ease 1.8s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -8px); } }

/* ============================================================
   SCROLL & MISC
   ============================================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

@media (hover: none) {
  .action-card:hover,
  .btn:hover,
  .icon-btn:hover { background: inherit; }
}

/* Évite le double-tap zoom sur iOS */
input, button { touch-action: manipulation; }

/* ============================================================
   LANGUE - sélecteur dropdown + pills compactes auth
   ============================================================ */

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-2);
  padding: 10px 32px 10px 12px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  min-width: 140px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23999' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.lang-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lang-select option {
  background: var(--surface-2);
  color: var(--text);
}

/* Pills compactes pour la page auth (juste les drapeaux) */
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  color: var(--text-2);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.lang-pill:hover { background: var(--surface-2); border-color: var(--border); }
.lang-pill.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.lang-pill .lang-flag {
  font-size: 16px;
  line-height: 1;
}
.lang-pill.compact {
  padding: 7px 11px;
  font-size: 14px;
}
.lang-pill.compact .lang-label { display: none; }

/* Sur l'écran options, l'option-row avec dropdown */
.option-row.option-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-3);
}

/* Sélecteur sur l'écran auth */
.auth-lang {
  position: absolute;
  top: calc(var(--sa-top) + var(--s-3));
  right: var(--s-4);
  display: flex;
  gap: 6px;
  z-index: 2;
}

/* ============================================================
   SPLASH PREMIÈRE VISITE
   ============================================================ */

.welcome-splash {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5) var(--s-4);
}
.welcome-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.welcome-mark {
  font-family: var(--f-display);
  font-size: 56px;
  font-weight: 300;
  margin: 0 0 var(--s-5);
  letter-spacing: -0.02em;
}
.welcome-mark em {
  font-style: italic;
  color: var(--accent);
}
.welcome-multilang {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
  color: var(--text-2);
  margin-bottom: var(--s-3);
}
.welcome-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: var(--s-5);
}
.welcome-card .lang-select {
  width: 100%;
  font-size: 16px;
  padding: 14px 36px 14px 16px;
  margin-bottom: var(--s-4);
  background-position: right 16px center;
}

/* ============================================================
   BLITZ - mode chrono
   ============================================================ */

/* Session : tête score + horloge */
.blitz-score { font-family: var(--f-mono); font-size: 14px; color: var(--text); display: flex; align-items: baseline; gap: 5px; }
.blitz-score #blitzScore { font-size: 20px; font-weight: 700; color: var(--accent); }
.blitz-score-l { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.blitz-clock {
  font-family: var(--f-mono); font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}
.blitz .quiz-progressbar > div { background: var(--accent); transition: width 0.1s linear; }
/* Les problèmes Blitz peuvent être longs (1200 ÷ 12) → police un peu plus petite */
.blitz .question { font-size: clamp(48px, 15vw, 96px); }
.blitz-unranked {
  margin-top: var(--s-3); font-family: var(--f-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim);
}

/* Bannière record */
.blitz-record-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--r-3); padding: var(--s-3) var(--s-4); margin: var(--s-4) 0;
}
.brb-label { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.brb-value { font-family: var(--f-display); font-size: 34px; font-weight: 400; color: var(--accent); line-height: 1; }

/* Liste opérations */
.blitz-ops { display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-3) 0; }
.blitz-op {
  background: var(--surface-1); border: 1px solid var(--border-soft);
  border-radius: var(--r-3); padding: var(--s-3) var(--s-4); transition: border-color 0.15s, opacity 0.15s;
  opacity: 0.55;
}
.blitz-op.on { opacity: 1; border-color: var(--border); }
.blitz-op-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.blitz-op-head input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.blitz-op-name { font-family: var(--f-display); font-size: 19px; color: var(--text); }
.blitz-op-sub { margin-top: 4px; margin-left: 30px; font-size: 13px; color: var(--text-dim); font-style: italic; }
.blitz-range {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 10px; margin-left: 30px; font-family: var(--f-mono); font-size: 14px; color: var(--text-2);
}
.blitz-range input {
  width: 56px; text-align: center; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-2);
  color: var(--text); font-family: var(--f-mono); font-size: 14px; padding: 6px 4px;
}
.blitz-range input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Indicateur classé / hors classement */
.blitz-ranked-hint {
  margin: var(--s-3) 0 var(--s-4); padding: var(--s-3); border-radius: var(--r-2);
  font-family: var(--f-mono); font-size: 12px; text-align: center; letter-spacing: 0.03em;
}
.blitz-ranked-hint.ok  { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.blitz-ranked-hint.off { background: var(--surface-1); color: var(--text-dim); border: 1px solid var(--border-soft); }

/* Historique récent */
.blitz-history { display: flex; flex-direction: column; gap: 6px; }
.blitz-hist-row {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--surface-1); border: 1px solid var(--border-soft);
  border-radius: var(--r-2); padding: 10px var(--s-3);
}
.bh-score { font-family: var(--f-display); font-size: 22px; color: var(--accent); min-width: 44px; }
.bh-meta { flex: 1; font-family: var(--f-mono); font-size: 12px; color: var(--text-dim); }
.bh-date { font-family: var(--f-mono); font-size: 11px; color: var(--text-faint); }

/* Recap */
.blitz-recap-status {
  text-align: center; font-family: var(--f-mono); font-size: 13px;
  color: var(--text-dim); margin: var(--s-3) 0;
}
.blitz-recap-status.ranked { color: var(--accent); }
.blitz-recap-ops {
  text-align: center; font-family: var(--f-mono); font-size: 12px;
  color: var(--text-dim); margin-top: var(--s-3); text-transform: uppercase; letter-spacing: 0.06em;
}

/* ============================================================
   AIDE - page d'explications (accordéon natif)
   ============================================================ */

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.help-list { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-4); }

.help-section {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-3);
  overflow: hidden;
}
.help-section[open] { border-color: var(--border); }
.help-section > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4);
  font-family: var(--f-display); font-size: 21px; color: var(--text);
}
.help-section > summary::-webkit-details-marker { display: none; }
.help-section > summary:hover { background: var(--surface-2); }
.help-chevron { color: var(--accent); font-size: 16px; transition: transform 0.2s; }
.help-section[open] .help-chevron { transform: rotate(180deg); }

.help-body { padding: 0 var(--s-4) var(--s-4); }
.help-body h4 {
  font-family: var(--f-mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent);
  margin: var(--s-4) 0 var(--s-2);
}
.help-body h4:first-child { margin-top: 0; }
.help-body p { font-size: 14.5px; line-height: 1.6; color: var(--text-2); margin: 0 0 var(--s-2); }
.help-body ul { margin: 0 0 var(--s-2); padding-left: 1.2em; }
.help-body li { font-size: 14.5px; line-height: 1.55; color: var(--text-2); margin-bottom: 4px; }
.help-body strong { color: var(--text); font-weight: 600; }

/* ============================================================
   AUTH PROVIDERS + PSEUDO + NUDGE CLASSEMENT
   ============================================================ */
.btn-provider {
  width: 100%; margin-top: var(--s-3);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: var(--r-pill); font-size: 15px; font-weight: 600;
  border: 1px solid var(--border);
}
.btn-provider.apple  { background: #fff; color: #000; border-color: #fff; }
.btn-provider.apple:active  { background: #e7e7e7; }
.btn-provider.google { background: var(--surface-1); color: var(--text); }
.btn-provider.google:active { background: var(--surface-2); }
.auth-legal {
  margin-top: var(--s-4); font-size: 11px; line-height: 1.5;
  color: var(--text-dim); text-align: center;
}
.auth-legal a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-screen {
  padding-bottom: var(--s-8);
}
.legal-doc {
  max-width: 760px;
  margin: 0 auto;
  color: var(--text-2);
}
.legal-doc h1 {
  font-family: var(--f-display);
  font-size: 34px;
  line-height: 1.15;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 var(--s-2);
}
.legal-doc h2 {
  font-size: 18px;
  color: var(--text);
  margin: var(--s-6) 0 var(--s-2);
}
.legal-doc p,
.legal-doc li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
}
.legal-doc ul {
  padding-left: 20px;
}
.legal-doc a {
  color: var(--accent);
}
.legal-doc .muted {
  color: var(--text-dim);
}
.legal-doc .card {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-2);
  padding: var(--s-3);
  background: var(--surface-1);
  margin: var(--s-4) 0;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-soft);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-1);
}
.sync-badge.offline {
  color: #ffd2a1;
  border-color: rgba(240, 195, 106, 0.35);
}
.sync-badge.pending {
  color: var(--text-dim);
}

.lb-nudge {
  display: block; width: 100%; margin-top: var(--s-3);
  padding: 12px; border-radius: var(--r-2);
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer;
  text-align: center; line-height: 1.4;
}
.lb-nudge-soft {
  margin-top: var(--s-3); padding: 10px; text-align: center;
  font-family: var(--f-mono); font-size: 12px; color: var(--text-dim);
}

/* ============================================================
   FREEMIUM — paywall, astuces verrouillées, blitz figé
   ============================================================ */

/* Paywall (réutilise .lvl-pop-overlay / .lvl-pop) */
.paywall { text-align: center; }
.paywall-badge {
  display: inline-block; font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.18em; color: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r-pill);
  padding: 4px 12px; margin-bottom: var(--s-3);
}
.paywall .lvl-pop-title { text-align: center; }
.paywall-benefits { list-style: none; margin: var(--s-4) 0; padding: 0; text-align: left; }
.paywall-benefits li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14.5px; color: var(--text-2); margin-bottom: 10px; line-height: 1.4;
}
.pw-check { color: var(--accent); font-weight: 700; flex-shrink: 0; }
.paywall-price { margin: var(--s-3) 0 var(--s-4); }
.pw-amount { font-family: var(--f-display); font-size: 40px; color: var(--text); }
.pw-lifetime { display: block; font-family: var(--f-mono); font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.paywall #pwRestore { margin-top: var(--s-2); }
.paywall-close {
  display: block; width: 100%; margin-top: var(--s-3);
  background: none; border: none; color: var(--text-dim);
  font-size: 13px; cursor: pointer; padding: 8px;
}

/* Astuces verrouillées */
.tips-locked { margin-top: var(--s-4); }
.tips-locked-list { display: flex; flex-direction: column; gap: 8px; filter: blur(0.5px); opacity: 0.5; }
.tips-locked-family {
  background: var(--surface-1); border: 1px solid var(--border-soft);
  border-radius: var(--r-3); padding: var(--s-4);
  font-family: var(--f-display); font-size: 19px; color: var(--text-2);
}
.tips-locked-cta {
  margin-top: var(--s-4); text-align: center;
  background: var(--surface-1); border: 1px solid var(--accent);
  border-radius: var(--r-3); padding: var(--s-5);
}
.tlc-lock { font-size: 30px; margin-bottom: var(--s-2); }
.tlc-text { font-size: 14.5px; color: var(--text-2); margin-bottom: var(--s-4); line-height: 1.5; }

/* Contrôles Blitz figés (gratuit) */
.blitz-ops.locked, .filter-row.locked, .options-section.locked { opacity: 0.5; pointer-events: none; }
.blitz-premium-cta {
  display: block; width: 100%; margin: var(--s-3) 0 var(--s-4);
  padding: 14px; border-radius: var(--r-2);
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer;
  text-align: center;
}

/* ============================================================
   ONBOARDING — pop-up de bienvenue (1er lancement)
   ============================================================ */
.onboarding { text-align: left; }
.first-lang { text-align: center; }
.first-lang .lang-select {
  width: 100%;
  margin: 0 0 var(--s-4);
  font-size: 16px;
  padding: 14px 36px 14px 16px;
}
.onb-title {
  font-family: var(--f-display); font-size: 26px; color: var(--text);
  text-align: center; margin-bottom: var(--s-2);
}
.onb-lead { font-size: 14.5px; color: var(--text-2); text-align: center; margin-bottom: var(--s-4); line-height: 1.5; }
.onb-points { list-style: none; margin: 0 0 var(--s-4); padding: 0; }
.onb-points li { display: flex; gap: 12px; align-items: flex-start; margin-bottom: var(--s-3); }
.onb-ico { font-size: 22px; flex-shrink: 0; line-height: 1.3; }
.onb-points li div { display: flex; flex-direction: column; }
.onb-points li strong { font-size: 15px; color: var(--text); }
.onb-points li span { font-size: 13.5px; color: var(--text-dim); line-height: 1.45; }
.onb-full {
  font-size: 12.5px; color: var(--text-dim); line-height: 1.45;
  text-align: center; padding: var(--s-3); margin-bottom: var(--s-4);
  background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--r-2);
}
