/* =====================================================================
   Mnemo — application
   Mobile d'abord ; la barre latérale apparaît à partir de 960 px.
   ===================================================================== */

/* ---------- Coquille ---------- */
.shell { min-height: 100dvh; }
.sidebar { display: none; }
.main { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; }
.page { padding-top: 8px; animation: page-in 0.32s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 16px; margin: 0 -16px 8px;
  padding-top: env(safe-area-inset-top); box-sizing: content-box;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.topbar .brand-sm { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.02em; }
.topbar .spacer { flex: 1; }
.topbar .search-trigger { display: none; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0 4px; border-radius: 10px; color: var(--text-3);
  font-size: 11px; font-weight: 500; letter-spacing: -0.005em;
  transition: color 0.15s;
}
.bottom-nav a.active { color: var(--text); }
.bottom-nav a.active svg { stroke-width: 2.2; }
.bottom-nav .daily-dot { position: relative; }
.bottom-nav .daily-dot::after { content: ''; position: absolute; top: -1px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--flame); border: 2px solid var(--surface); }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100dvh; padding: 18px 12px;
    border-right: 1px solid var(--border); background: var(--surface-2);
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
  .sidebar .nav-item {
    display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
    border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; font-weight: 450;
    transition: background 0.12s, color 0.12s;
  }
  .sidebar .nav-item:hover { background: var(--surface-hover); color: var(--text); }
  .sidebar .nav-item.active { background: var(--surface); color: var(--text); font-weight: 520; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
  .sidebar .nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
  .sidebar .nav-sep { height: 1px; background: var(--border); margin: 10px 10px; }
  .sidebar .push { flex: 1; }
  .sidebar .me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); }
  .sidebar .me:hover { background: var(--surface-hover); }
  .main { padding: 0 40px 64px; width: 100%; }
  .topbar { margin: 0 -40px 16px; padding: 0 40px; height: 64px; }
  .topbar .brand-sm { display: none; }
  .topbar .search-trigger {
    display: flex; align-items: center; gap: 8px; width: 320px; height: 36px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
    color: var(--text-3); font-size: 14px; cursor: pointer; box-shadow: var(--shadow-sm);
  }
  .topbar .search-trigger kbd { margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; }
  .bottom-nav { display: none; }
}

/* ---------- Éléments ---------- */
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 15px; height: 15px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 28px; height: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 520; letter-spacing: -0.01em; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease), box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; position: relative;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 560; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--text-3); }
.card-link { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 2px; }
.card-link:hover { color: var(--text); }
:where(a.card, button.card) { display: block; }
a.card, button.card { text-align: left; transition: border-color 0.15s, box-shadow 0.2s, transform 0.2s var(--ease); cursor: pointer; color: inherit; }
a.card:hover, button.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
button.card { width: 100%; font: inherit; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -0.03em; }
.page-head .sub { color: var(--text-2); margin-top: 6px; font-size: 14px; }
@media (min-width: 960px) { .page-head h1 { font-size: 30px; } }
.eyebrow { font-size: 12px; font-weight: 520; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--text); }

.section { margin-top: 36px; }
.section-title { font-size: 13px; font-weight: 560; color: var(--text-2); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }

.grid { display: grid; gap: 12px; }
.grid-2 { display: grid; gap: 12px; }
.grid-3 { display: grid; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid { gap: 16px; } .grid-2, .grid-3 { gap: 16px; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; background: var(--bg-sunken); color: var(--text-2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip .icon { width: 13px; height: 13px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.success { background: var(--success-soft); color: var(--success); }
.chip.warning { background: var(--warning-soft); color: var(--warning); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.flame { background: var(--flame-soft); color: var(--flame); }
.chip.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.subject-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.subject-tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 600; font-size: 13px; letter-spacing: -0.02em; }

.progress { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.7s var(--ease); }
.progress.thin { height: 4px; }

.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease); }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--bg-sunken); color: var(--text-2); font-weight: 560; font-size: 13px; object-fit: cover; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl { width: 88px; height: 88px; font-size: 30px; }
.avatar-stack { display: flex; }
.avatar-stack > * { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack > *:first-child { margin-left: 0; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row:last-child { padding-bottom: 0; }
a.list-row:hover .list-title { color: var(--accent-text); }
.list-title { font-size: 14px; font-weight: 500; }
.list-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty .icon-wrap { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-sunken); color: var(--text-3); }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 14px; max-width: 340px; margin: 0 auto; }

.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 520; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none; -webkit-appearance: none;
}
.textarea { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b8b93' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.input.code { font-family: var(--mono); font-size: 24px; letter-spacing: 0.4em; text-align: center; height: 56px; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 13px; color: var(--danger); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-sunken); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }

.pick {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
  text-align: left; cursor: pointer; font: inherit; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.pick:hover { background: var(--surface-hover); }
.pick.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.pick .check { margin-left: auto; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; flex: none; transition: all 0.15s; }
.pick.on .check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

.range { width: 100%; accent-color: var(--accent); }

/* ---------- Authentification / onboarding ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .logo { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 36px; letter-spacing: -0.02em; }
.auth-box h1 { font-size: 26px; letter-spacing: -0.03em; margin-bottom: 8px; }
.auth-box .lead { color: var(--text-2); margin-bottom: 28px; }
.auth-box form { display: flex; flex-direction: column; gap: 16px; }
.auth-foot { margin-top: 24px; font-size: 14px; color: var(--text-2); text-align: center; }
.auth-foot a, .link { color: var(--accent-text); font-weight: 500; }

.onb { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.onb-top { display: flex; align-items: center; gap: 12px; height: 64px; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
.onb-progress { flex: 1; height: 4px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.onb-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.4s var(--ease); }
.onb-body { flex: 1; padding: 24px 0; animation: page-in 0.3s var(--ease); }
.onb-body h1 { font-size: 26px; letter-spacing: -0.03em; margin-bottom: 8px; }
.onb-body .lead { color: var(--text-2); margin-bottom: 28px; }
.onb-foot { position: sticky; bottom: 0; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 10px; }

.day-grid { display: grid; gap: 8px; }
.day-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.day-row .d { font-weight: 560; font-size: 14px; }
.day-row .mins { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-2); min-width: 54px; text-align: right; }

/* ---------- Dashboard ---------- */
.hello { margin: 8px 0 20px; }
.hello h1 { font-size: 24px; letter-spacing: -0.03em; }
.hello p { color: var(--text-2); margin-top: 4px; font-size: 14px; }
@media (min-width: 960px) { .hello h1 { font-size: 28px; } }

.dash { display: grid; gap: 12px; }
@media (min-width: 1100px) {
  .dash { grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
  .dash .span-2 { grid-column: span 2; }
}

.daily-card { position: relative; overflow: hidden; padding: 24px; border-radius: var(--radius-lg); background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-lg); }
.daily-card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 100% 0%, rgba(124, 116, 242, 0.35), transparent 55%); pointer-events: none; }
:root[data-theme="dark"] .daily-card::before { background: radial-gradient(120% 90% at 100% 0%, rgba(79, 70, 229, 0.16), transparent 55%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .daily-card::before { background: radial-gradient(120% 90% at 100% 0%, rgba(79, 70, 229, 0.16), transparent 55%); } }
.daily-card > * { position: relative; }
.daily-card .eyebrow { color: color-mix(in srgb, var(--on-ink) 55%, transparent); }
.daily-card h2 { font-size: 24px; letter-spacing: -0.03em; margin: 8px 0 16px; }
.daily-card .meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; color: color-mix(in srgb, var(--on-ink) 70%, transparent); margin-bottom: 22px; }
.daily-card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.daily-card .btn-start { background: var(--on-ink); color: var(--ink); height: 46px; padding: 0 22px; border-radius: 12px; font-size: 15px; }
.daily-card .btn-start:hover { opacity: 0.92; }
.daily-card .done { display: inline-flex; align-items: center; gap: 8px; font-weight: 520; }
.daily-card .streak-mini { position: absolute; top: 22px; right: 22px; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; }
.daily-card .streak-mini .icon { color: var(--flame); fill: var(--flame); stroke: var(--flame); }
.daily-card .week-dots { display: flex; gap: 6px; margin-top: 20px; }
.week-dots .wd { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 10.5px; color: color-mix(in srgb, var(--on-ink) 45%, transparent); font-weight: 500; }
.week-dots .wd i { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--on-ink) 10%, transparent); }
.week-dots .wd i.on { background: var(--flame); color: #fff; }
.week-dots .wd i.joker { background: color-mix(in srgb, var(--on-ink) 25%, transparent); }
.week-dots .wd i .icon { width: 12px; height: 12px; stroke-width: 2.6; }

.mastery-big { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.mastery-big .ring-wrap { position: relative; width: 84px; height: 84px; flex: none; }
.mastery-big .ring-wrap .v { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600; font-size: 20px; letter-spacing: -0.03em; }
.subj-bars { display: flex; flex-direction: column; gap: 14px; }
.subj-bar .top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 7px; }
.subj-bar .top .v { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 560; }

.prio { font-size: 11.5px; font-weight: 560; padding: 2px 8px; border-radius: 6px; }
.prio.high { background: var(--danger-soft); color: var(--danger); }
.prio.medium { background: var(--warning-soft); color: var(--warning); }
.prio.low { background: var(--bg-sunken); color: var(--text-2); }

.exam-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.exam-row:first-child { border-top: 0; padding-top: 0; }
.exam-days { width: 52px; text-align: center; flex: none; }
.exam-days b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.exam-days small { font-size: 11px; color: var(--text-3); }

.grade { display: flex; align-items: baseline; gap: 4px; }
.grade b { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.grade small { color: var(--text-3); font-size: 13px; }

.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 10.5px; font-family: var(--font); }
.chart .area { fill: url(#curveFill); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .threshold { stroke: var(--warning); stroke-width: 1; stroke-dasharray: 3 4; }

/* ---------- Cours ---------- */
.subject-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-height: 172px; }
.subject-card .name { font-size: 15.5px; font-weight: 560; letter-spacing: -0.015em; line-height: 1.3; }
.subject-card .meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-3); margin-top: auto; }
.subject-card .m-row { display: flex; align-items: center; gap: 10px; }
.subject-card .m-row .progress { flex: 1; }
.subject-card.soon { opacity: 0.62; }

.week-list { display: flex; flex-direction: column; gap: 8px; }
.week-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; }
.week-num { width: 48px; height: 48px; border-radius: 12px; background: var(--bg-sunken); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.week-num small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 560; }
.week-num b { font-size: 18px; font-weight: 600; margin-top: 2px; }
.week-item .stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-3); margin-top: 6px; flex-wrap: wrap; }
.status { font-size: 12px; font-weight: 520; display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.new { color: var(--text-3); }
.status.review { color: var(--warning); }
.status.mastered { color: var(--success); }

.week-hero { padding: 20px; margin-bottom: 16px; }
.week-hero .row-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.week-hero .row-stats > div { padding: 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 20px; padding: 0 16px; border-bottom: 1px solid var(--border); position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 12px; border: 0; background: none; color: var(--text-3); font-size: 14px; font-weight: 500; cursor: pointer; position: relative; }
.tabs button .n { font-size: 11.5px; color: var(--text-3); background: var(--bg-sunken); padding: 0 6px; border-radius: 6px; }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }
@media (min-width: 960px) { .tabs { margin: 0 0 24px; padding: 0; top: 64px; } }

/* ---------- Contenu rédigé (résumés, fiches) ---------- */
.prose { font-size: 15.5px; line-height: 1.7; color: var(--text); max-width: 70ch; }
.prose > * + * { margin-top: 0.85em; }
.prose h2 { font-size: 19px; margin-top: 1.8em; letter-spacing: -0.02em; }
.prose h3 { font-size: 16px; margin-top: 1.5em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.3em; }
.prose strong { font-weight: 620; }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); border: 0; color: var(--text); }
.prose code { font-family: var(--mono); font-size: 0.88em; padding: 1px 6px; border-radius: 5px; background: var(--bg-sunken); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.prose th { font-weight: 560; color: var(--text-2); font-size: 13px; }
.prose img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.prose mark { background: var(--warning-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.prose.compact { font-size: 14.5px; line-height: 1.6; }

.concept-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.sheet-card { padding: 20px; }
.sheet-card .kind { margin-bottom: 10px; }
.sheet-card h3 { font-size: 16px; margin-bottom: 12px; }

/* ---------- Quiz ---------- */
.focus-mode { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; overflow-y: auto; animation: page-in 0.25s var(--ease); }
.quiz-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; height: 60px; padding: env(safe-area-inset-top) 16px 0; box-sizing: content-box; max-width: 720px; width: 100%; margin: 0 auto; background: var(--bg); }
.quiz-top .progress { flex: 1; height: 6px; }
.quiz-top .count { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.quiz-body { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 16px 200px; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.q-prompt { font-size: 20px; font-weight: 560; letter-spacing: -0.02em; line-height: 1.4; margin-bottom: 24px; }
@media (min-width: 640px) { .q-prompt { font-size: 22px; } }
.q-prompt .katex { font-size: 1.05em; }
.q-image { margin: -8px 0 20px; border-radius: var(--radius); border: 1px solid var(--border); max-width: 100%; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 12px 16px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface);
  font: inherit; font-size: 15.5px; text-align: left; cursor: pointer; color: var(--text);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover:not(:disabled) { border-color: var(--text-3); }
.opt:active:not(:disabled) { transform: scale(0.99); }
.opt .key { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--bg-sunken); font-family: var(--mono); }
.opt.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt.sel .key { background: var(--accent); color: var(--on-accent); }
.opt.right { border-color: var(--success); background: var(--success-soft); box-shadow: none; }
.opt.right .key { background: var(--success); color: #fff; }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: none; animation: shake 0.35s; }
.opt.wrong .key { background: var(--danger); color: #fff; }
.opt:disabled { cursor: default; }
.opt.dim { opacity: 0.5; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tf-grid .opt { justify-content: center; font-weight: 560; min-height: 64px; }
.answer-input { height: 56px; font-size: 18px; border-radius: 14px; }
.cloze-line { font-size: 18px; line-height: 2.4; }
.cloze-line input { display: inline-block; width: 150px; height: 40px; margin: 0 4px; padding: 0 10px; border: 0; border-bottom: 2px solid var(--border-strong); border-radius: 8px 8px 0 0; background: var(--bg-sunken); font: inherit; font-size: 16px; color: var(--text); text-align: center; }
.cloze-line input:focus { outline: none; border-color: var(--accent); }
.cloze-line input.ok { border-color: var(--success); background: var(--success-soft); }
.cloze-line input.ko { border-color: var(--danger); background: var(--danger-soft); }
.match { display: grid; gap: 10px; }
.match-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.match-row .l { font-weight: 520; font-size: 14.5px; }
.match-row.ok { border-color: var(--success); background: var(--success-soft); }
.match-row.ko { border-color: var(--danger); background: var(--danger-soft); }
@media (min-width: 640px) { .match-row { grid-template-columns: 1fr 1.2fr; align-items: center; } }
.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); }
.order-item .pos { width: 24px; height: 24px; border-radius: 7px; background: var(--bg-sunken); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); flex: none; }
.order-item .grow { font-size: 15px; }
.order-item.ok { border-color: var(--success); background: var(--success-soft); }
.order-item.ko { border-color: var(--danger); background: var(--danger-soft); }

.feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -12px 32px -12px rgba(0,0,0,.12);
  animation: sheet-up 0.28s var(--ease);
}
.feedback .inner { max-width: 720px; margin: 0 auto; }
.feedback .verdict { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.feedback.ok .verdict { color: var(--success); }
.feedback.ko .verdict { color: var(--danger); }
.feedback .verdict .badge { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.feedback.ok .verdict .badge { background: var(--success); }
.feedback.ko .verdict .badge { background: var(--danger); }
.feedback .expl { margin: 10px 0 16px; font-size: 14.5px; color: var(--text-2); line-height: 1.55; max-height: 30vh; overflow-y: auto; }
.feedback .correct-ans { font-size: 14px; margin-top: 8px; }
.feedback .correct-ans b { font-weight: 600; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.quiz-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 75%, transparent); }
.quiz-actions .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }

.result { max-width: 520px; margin: 0 auto; padding: 32px 16px 64px; text-align: center; animation: page-in 0.4s var(--ease); }
.result .score-ring { position: relative; width: 148px; height: 148px; margin: 8px auto 20px; }
.result .score-ring .v { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.result .score-ring .v b { font-size: 36px; font-weight: 620; letter-spacing: -0.04em; line-height: 1; }
.result .score-ring .v small { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.result h1 { font-size: 26px; letter-spacing: -0.03em; }
.result .rewards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; text-align: left; }
.result .reward { padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.result .reward b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.result .reward small { color: var(--text-3); font-size: 12.5px; }
.result .changes { text-align: left; margin-bottom: 20px; }
.delta-up { color: var(--success); font-weight: 560; }
.pop { animation: pop 0.5s var(--ease); }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.flame-big { width: 72px; height: 72px; margin: 0 auto 8px; color: var(--flame); animation: flame 1.6s ease-in-out infinite; }
.flame-big .icon { width: 72px; height: 72px; fill: var(--flame); stroke: var(--flame); }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.06) rotate(2deg); } }

/* ---------- Flashcards ---------- */
.flash-stage { perspective: 1400px; margin: 8px auto 24px; max-width: 560px; }
.flash {
  position: relative; width: 100%; min-height: 300px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.55s var(--ease);
}
.flash.flipped { transform: rotateY(180deg); }
.flash .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 32px 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 20px; font-weight: 520; letter-spacing: -0.015em; line-height: 1.45;
}
.flash .face.back { transform: rotateY(180deg); background: var(--surface-2); }
.flash .face .tag { position: absolute; top: 16px; left: 18px; }
.flash .face .tap { position: absolute; bottom: 16px; font-size: 12px; color: var(--text-3); font-weight: 450; }
.rate-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 560px; margin: 0 auto; }
.rate-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font: inherit; font-size: 13px; font-weight: 540; transition: transform 0.1s, background 0.15s; }
.rate-grid button small { font-size: 11px; color: var(--text-3); font-weight: 450; }
.rate-grid button:active { transform: scale(0.97); }
.rate-grid .r0 { color: var(--danger); } .rate-grid .r1 { color: var(--warning); } .rate-grid .r2 { color: var(--success); } .rate-grid .r3 { color: var(--accent-text); }

/* ---------- Exercices ---------- */
.exercise { padding: 20px; }
.exercise .solution { margin-top: 16px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- Streak ---------- */
.streak-hero { text-align: center; padding: 28px 20px; }
.streak-hero .n { font-size: 56px; font-weight: 640; letter-spacing: -0.05em; line-height: 1; margin-top: 4px; }
.cal-dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.cal-dots i { aspect-ratio: 1; border-radius: 6px; background: var(--bg-sunken); }
.cal-dots i.done { background: var(--flame); }
.cal-dots i.joker { background: color-mix(in srgb, var(--flame) 35%, var(--bg-sunken)); }
.cal-dots i.today { box-shadow: inset 0 0 0 2px var(--text); }
.milestones { display: flex; gap: 8px; flex-wrap: wrap; }
.milestone { flex: 1; min-width: 56px; padding: 10px 6px; border-radius: 12px; text-align: center; background: var(--bg-sunken); color: var(--text-3); font-size: 12px; }
.milestone b { display: block; font-size: 17px; color: var(--text-2); font-weight: 600; }
.milestone.reached { background: var(--flame-soft); color: var(--flame); }
.milestone.reached b { color: var(--flame); }

/* ---------- Plan ---------- */
.plan-day { padding: 16px 18px; }
.plan-day .head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.plan-day .head b { font-size: 15px; font-weight: 580; }
.plan-day .head small { color: var(--text-3); font-size: 12.5px; }
.plan-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.plan-item:first-of-type { border-top: 0; }
.plan-item .time { font-family: var(--mono); font-size: 12px; color: var(--text-3); width: 42px; flex: none; }
.plan-item .bar { width: 3px; align-self: stretch; border-radius: 2px; flex: none; }
.plan-item .t { font-size: 14px; font-weight: 500; }
.plan-item .s { font-size: 12.5px; color: var(--text-3); }
.plan-item .mins { margin-left: auto; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.plan-scroll { display: grid; gap: 10px; }
@media (min-width: 1100px) { .plan-scroll { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Focus ---------- */
.focus-wrap { max-width: 520px; margin: 0 auto; text-align: center; }
.timer-ring { position: relative; width: min(300px, 78vw); aspect-ratio: 1; margin: 12px auto 28px; }
.timer-ring svg { width: 100%; height: 100%; }
.timer-ring .v { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.timer-ring .v b { font-size: 58px; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; font-family: var(--font); }
.timer-ring .v small { color: var(--text-3); margin-top: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 520; }
.timer-controls { display: flex; justify-content: center; gap: 12px; }
.timer-controls .main-btn { width: 64px; height: 64px; border-radius: 50%; }

/* ---------- Communauté ---------- */
.community { display: grid; gap: 16px; }
@media (min-width: 960px) {
  /* Communauté : la conversation occupe tout l'espace sous la barre du haut,
     à côté de la colonne des salons ; seuls les messages défilent. */
  .main:has(.page-fill) { padding-bottom: 0; max-width: none; }
  .main:has(.page-fill) .topbar { margin-bottom: 16px; }
  .page-fill .chan-group { margin-bottom: 22px; }
  .page-fill { height: calc(100dvh - 80px); display: flex; flex-direction: column; padding: 0 !important; animation: none; }
  .page-fill .community { flex: 1; min-height: 0; grid-template-columns: 250px 1fr; gap: 0; }
  .page-fill .chan-list { overflow-y: auto; padding: 4px 18px 16px 0; border-right: 1px solid var(--border); }
  .chan-head { padding: 0 0 18px 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
  .chan-head h1 { font-size: 22px; letter-spacing: -0.03em; }
  .online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
  .page-fill .chat { min-height: 0; height: 100%; padding: 0 0 16px 28px; }
  .page-fill .chat-head { padding: 4px 0 14px; }
  .page-fill .chat-head h2 { font-size: 18px; }
  .page-fill .chat-msgs { padding: 16px 0 8px; }
  .page-fill .msg { padding: 7px 10px; }
  .page-fill .msg .text { font-size: 15px; }
  .page-fill .chat-input { padding: 6px 0 0; }
  .page-fill .chat-input .textarea { min-height: 48px; height: 48px; padding: 13px 16px; border-radius: 14px; }
  .page-fill .chat-input .btn { height: 48px !important; width: 48px !important; border-radius: 14px; }
  .page-fill .voice-room { margin-left: 28px; }
}
}
.chan-group { margin-bottom: 18px; }
.chan-group h4 { font-size: 11.5px; font-weight: 560; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin: 0 0 6px 8px; }
.chan { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border-radius: 8px; color: var(--text-2); font-size: 14px; cursor: pointer; width: 100%; border: 0; background: none; text-align: left; font: inherit; }
.chan:hover { background: var(--surface-hover); color: var(--text); }
.chan.on { background: var(--surface); color: var(--text); font-weight: 520; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.chan .icon { color: var(--text-3); width: 16px; height: 16px; }
.chan .unread { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.voice-members { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 6px 32px; }
.voice-members .vm { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.voice-members .vm .icon { width: 13px; height: 13px; color: var(--text-3); }
.voice-members .speaking .avatar { box-shadow: 0 0 0 2px var(--success); }

.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 56px - 96px - 120px); }
@media (min-width: 960px) { .chat { min-height: 0; height: 100%; } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.chat-head h2 { font-size: 16px; display: flex; align-items: center; gap: 6px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px 0; display: flex; flex-direction: column; }
.msg { display: flex; gap: 10px; padding: 6px 8px; border-radius: 10px; position: relative; }
.msg:hover { background: var(--surface-hover); }
.msg.cont { padding-top: 1px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg .who { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.msg .who b { font-weight: 580; }
.msg .who small { font-size: 11.5px; color: var(--text-3); }
.msg .text { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .text .mention { color: var(--accent-text); font-weight: 520; background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }
.msg .deleted { font-style: italic; color: var(--text-3); font-size: 13.5px; }
.msg .tools { position: absolute; right: 8px; top: 4px; display: none; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-sm); }
.msg:hover .tools { display: flex; }
.msg .tools .icon-btn { width: 28px; height: 28px; }
.day-sep { text-align: center; font-size: 11.5px; color: var(--text-3); margin: 14px 0 6px; font-weight: 520; }
.chat-input { display: flex; gap: 8px; padding-top: 12px; position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--bg); padding-bottom: 8px; }
@media (min-width: 960px) { .chat-input { position: static; } }
.chat-input .textarea { min-height: 44px; height: 44px; max-height: 140px; resize: none; border-radius: 12px; padding: 11px 14px; }
.typing { font-size: 12px; color: var(--text-3); height: 18px; }

.voice-room { padding: 28px 20px; text-align: center; }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px; margin: 24px 0; }
.voice-grid .p { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; }
.voice-grid .p .avatar { transition: box-shadow 0.15s; }
.voice-grid .p.speaking .avatar { box-shadow: 0 0 0 3px var(--success); }

/* ---------- Duel ---------- */
.duel-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); margin-bottom: 20px; }
.duel-score .p { display: flex; align-items: center; gap: 10px; min-width: 0; }
.duel-score .p.r { flex-direction: row-reverse; text-align: right; }
.duel-score .p b { font-size: 28px; font-weight: 620; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.duel-score .p .nm { font-size: 13px; color: var(--text-2); }
.duel-score .vs { font-size: 12px; color: var(--text-3); font-weight: 600; }
.duel-score .answered { font-size: 11px; color: var(--success); }
.timer-bar { height: 4px; border-radius: 2px; background: var(--bg-sunken); overflow: hidden; margin-bottom: 20px; }
.timer-bar span { display: block; height: 100%; background: var(--accent); transform-origin: left; }

/* ---------- Classement ---------- */
.lb-row { display: grid; grid-template-columns: 32px 32px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.lb-row:first-child { border-top: 0; }
.lb-row.me { background: var(--accent-soft); }
.lb-row .rank { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-3); text-align: center; }
.lb-row .rank.top { color: var(--text); }
.lb-row .score { font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-row .sub { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 10px; margin-bottom: 16px; }
.podium .pl { text-align: center; padding: 16px 8px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.podium .pl.first { padding-top: 24px; }
.podium .pl .avatar { margin: 0 auto 8px; }
.podium .pl .nm { font-size: 13.5px; font-weight: 560; }
.podium .pl .pts { font-size: 12px; color: var(--text-3); }
.podium .medal { font-size: 11px; font-weight: 600; margin-bottom: 8px; color: var(--text-3); }

/* ---------- Profil ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; margin: 8px 0 24px; }
.profile-head h1 { font-size: 24px; letter-spacing: -0.03em; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { padding: 16px; }
.stat .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 12px; background: var(--bg-sunken); color: var(--text-2); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge-item { padding: 16px 14px; text-align: center; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.badge-item .medal-ico { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.badge-item b { display: block; font-size: 13.5px; font-weight: 560; }
.badge-item small { font-size: 12px; color: var(--text-3); }
.badge-item.locked { opacity: 0.5; }
.badge-item.locked .medal-ico { background: var(--bg-sunken); color: var(--text-3); }

/* ---------- Réglages ---------- */
.settings-group { margin-bottom: 28px; }
.settings-group > h2 { font-size: 13px; font-weight: 560; color: var(--text-2); margin: 0 0 10px 4px; }
.setting { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border); }
.setting:first-child { border-top: 0; }
.setting .t { font-size: 14.5px; font-weight: 500; }
.setting .s { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.plan-cards { display: grid; gap: 12px; }
@media (min-width: 640px) { .plan-cards { grid-template-columns: 1fr 1fr; } }
.plan-card { padding: 20px; }
.plan-card ul { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.plan-card li { display: flex; gap: 8px; align-items: flex-start; }
.plan-card li .icon { color: var(--success); width: 16px; height: 16px; margin-top: 2px; }
.plan-card.premium { border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Recouvrements ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(9, 9, 11, 0.38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 0.18s; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .overlay { align-items: flex-start; padding-top: 12vh; } }
.modal { width: 100%; max-width: 560px; max-height: 86dvh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); animation: sheet-up 0.28s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 640px) { .modal { border-radius: 18px; animation: modal-in 0.22s var(--ease); border: 1px solid var(--border); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px 22px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.search-box { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.search-box input { flex: 1; border: 0; background: none; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.search-results { padding: 8px 10px 14px; max-height: 64dvh; overflow-y: auto; }
.search-group h4 { font-size: 11.5px; font-weight: 560; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin: 14px 10px 4px; }
.search-hit { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 14px; cursor: pointer; }
.search-hit:hover, .search-hit.on { background: var(--surface-hover); }
.search-hit .x { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }

.notif-panel { position: fixed; z-index: 85; top: calc(60px + env(safe-area-inset-top)); right: 12px; left: 12px; max-width: 380px; margin-left: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); animation: modal-in 0.2s var(--ease); max-height: 70dvh; overflow-y: auto; }
.notif-panel .head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.notif-panel .head b { font-size: 14px; }
.notif { display: flex; gap: 12px; padding: 11px 16px; font-size: 13.5px; border-top: 1px solid var(--border); cursor: pointer; }
.notif:hover { background: var(--surface-hover); }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--bg-sunken); color: var(--text-2); }
.notif time { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
@media (min-width: 960px) { .toasts { bottom: 28px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in 0.3s var(--ease); }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }

.celebrate { position: fixed; inset: 0; z-index: 120; pointer-events: none; }

.skeleton { background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--surface-hover) 50%, var(--bg-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; min-height: 50vh; color: var(--text-3); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text); font-size: 14px; margin-bottom: 16px; }
.banner .icon { color: var(--accent-text); }
.banner.warn { background: var(--warning-soft); }
.banner.warn .icon { color: var(--warning); }

.phase { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; }
.phase .n { width: 36px; height: 36px; border-radius: 11px; background: var(--bg-sunken); display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.phase.done .n { background: var(--success); color: #fff; }
.phase.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.phase.current .n { background: var(--accent); color: var(--on-accent); }

/* Recherche : icône seule sur mobile, champ complet sur ordinateur. */
@media (min-width: 960px) { .m-only { display: none !important; } }

/* Notions cliquables, surlignage */
.concept-chip { border: 0; cursor: pointer; font: inherit; font-size: 12px; transition: background .15s; }
.concept-chip:hover { background: var(--surface-hover); box-shadow: inset 0 0 0 1px var(--border-strong); }
.prose mark.hl { background: color-mix(in srgb, var(--warning) 28%, transparent); padding: 1px 2px; border-radius: 3px; }
.hl-pop { position: fixed; z-index: 90; transform: translate(-50%, calc(-100% - 10px)); box-shadow: var(--shadow-lg); }

/* Examen blanc : navigation entre questions */
.exam-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.exam-nav button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 560; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.exam-nav button.done { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.exam-nav button.on { border-color: var(--text); color: var(--text); box-shadow: 0 0 0 2px var(--border); }

/* Page matière : préparation, carte des notions, frise */
.ready-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.ready-facts span::before { content: '·'; margin-right: 8px; color: var(--text-3); }
.ready-facts span:first-child::before { content: none; margin: 0; }
.map-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.map-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .map-row { grid-template-columns: 150px 1fr; align-items: start; } }
.map-week { display: flex; gap: 8px; align-items: baseline; min-width: 0; font-size: 13px; padding-top: 6px; }
.map-cells { display: flex; flex-wrap: wrap; gap: 6px; }
.map-cell { border: 0; border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 12.5px; font-weight: 520; cursor: pointer; text-align: left; transition: transform .12s, box-shadow .15s; }
.map-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.map-cell .num { opacity: .7; font-weight: 450; }
.map-cell.s-mastered { background: var(--success-soft); color: var(--success); }
.map-cell.s-fragile { background: var(--warning-soft); color: var(--warning); }
.map-cell.s-weak { background: var(--danger-soft); color: var(--danger); }
.map-cell.s-unseen { background: var(--bg-sunken); color: var(--text-3); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); border-radius: 2px; }
.tl-item { position: relative; margin-bottom: 8px; }
.tl-dot { position: absolute; left: -21px; top: 17px; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 3px var(--bg); }
.tl-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 14px; text-align: left; cursor: pointer; color: var(--text); }
.tl-head:hover { border-color: var(--border-strong); }
.tl-date { font-weight: 620; min-width: 64px; }
.tl-body { padding: 10px 14px 4px; font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.tl-body b { color: var(--text); font-weight: 580; margin-right: 4px; }
