/**
 * Swedish Trainer V4 - Styles de l'application.
 *
 * Fichier : assets/styles.css
 * Rôle : thème sombre, sidebar, cartes, profils, révision, graphe
 * et adaptations responsive.
 */

:root{
  --bg:#0d1117;
  --panel:#111827;
  --panel-2:#151e2e;
  --panel-3:#0f1724;
  --text:#e5eefb;
  --muted:#94a3b8;
  --border:rgba(148,163,184,.18);
  --accent:#38bdf8;
  --accent-2:#a78bfa;
  --ok:#34d399;
  --warn:#fbbf24;
  --danger:#fb7185;
  --shadow:0 24px 70px rgba(0,0,0,.32);
  --radius:18px;
  --sidebar:360px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(56,189,248,.22), transparent 34%),
    radial-gradient(circle at 94% 4%, rgba(167,139,250,.2), transparent 32%),
    linear-gradient(135deg,#08111f 0%,#0d1117 42%,#111827 100%);
  overflow:hidden;
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
*{
  scrollbar-width:thin;
  scrollbar-color:rgba(56,189,248,.55) rgba(15,23,36,.42);
}
*::-webkit-scrollbar{width:10px; height:10px;}
*::-webkit-scrollbar-track{background:rgba(15,23,36,.42); border-radius:999px;}
*::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,rgba(56,189,248,.72),rgba(167,139,250,.68));
  border:2px solid rgba(15,23,36,.9);
  border-radius:999px;
}
*::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,rgba(125,211,252,.9),rgba(196,181,253,.86));}
*::-webkit-scrollbar-corner{background:transparent;}
.app{display:grid; grid-template-columns:var(--sidebar) 1fr; min-height:100vh;}
.sidebar{
  height:100vh; overflow:auto; padding:22px 18px;
  background:rgba(10,16,28,.86); backdrop-filter: blur(16px);
  border-right:1px solid var(--border);
}
.brand{display:flex; gap:13px; align-items:center; margin-bottom:18px;}
.logo{width:46px; height:46px; border-radius:16px; display:grid; place-items:center; background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#05111f; font-size:24px; box-shadow:0 16px 35px rgba(56,189,248,.25);}
.brand h1{font-size:18px; line-height:1.05; margin:0;}
.brand p{margin:4px 0 0; color:var(--muted); font-size:12px;}
.section-label{font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:#6b7c95; margin:18px 10px 8px;}
.nav{display:flex; flex-direction:column; gap:8px;}
.nav button{
  width:100%; border:1px solid transparent; background:transparent; color:var(--text);
  border-radius:15px; padding:12px 12px; display:flex; align-items:center; justify-content:space-between; gap:10px; text-align:left;
  transition:.16s ease;
}
.nav button:hover{background:rgba(148,163,184,.09); border-color:rgba(148,163,184,.12); transform:translateX(2px)}
.nav button.active{background:linear-gradient(135deg,rgba(56,189,248,.2),rgba(167,139,250,.16)); border-color:rgba(56,189,248,.38); box-shadow:0 12px 30px rgba(0,0,0,.14);}
.nav-main{display:flex; align-items:center; gap:10px; min-width:0; flex:1;}
.nav-ico{width:34px; height:34px; border-radius:12px; display:grid; place-items:center; background:rgba(255,255,255,.06); flex:0 0 auto;}
.nav-title{font-weight:760; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.nav-sub{display:block; margin-top:2px; font-size:11px; color:var(--muted); font-weight:500;}
.pill{font-size:11px; padding:4px 7px; border-radius:999px; color:#b7c8dd; border:1px solid rgba(148,163,184,.18); background:rgba(148,163,184,.08); flex:0 0 auto; white-space:nowrap;}
.mini-panel{margin-top:16px; border:1px solid var(--border); background:rgba(17,24,39,.72); border-radius:var(--radius); padding:14px;}
.mini-panel strong{font-size:13px; display:block; margin-bottom:7px;}
.mini-panel p{margin:0; color:var(--muted); font-size:12px; line-height:1.45;}
.main{height:100vh; overflow:auto; padding:26px 30px 54px;}
.mobile-top{display:none; position:sticky; top:0; z-index:9; margin:-26px -30px 18px; padding:13px 16px; background:rgba(13,17,23,.92); backdrop-filter:blur(16px); border-bottom:1px solid var(--border);}
.mobile-top button{border:1px solid var(--border); background:rgba(255,255,255,.06); color:var(--text); border-radius:12px; padding:10px 12px;}
.hero{display:grid; grid-template-columns:1fr auto; align-items:start; gap:18px; margin-bottom:20px;}
.hero h2{font-size:34px; margin:0 0 6px; letter-spacing:-.04em;}
.hero p{margin:0; color:var(--muted); line-height:1.5; max-width:860px;}
.hero-card{min-width:220px; border:1px solid var(--border); background:rgba(17,24,39,.72); padding:14px; border-radius:var(--radius); box-shadow:var(--shadow);}
.hero-card .big{font-size:30px; font-weight:850; letter-spacing:-.04em;}
.hero-card .small{color:var(--muted); font-size:12px;}
.toolbar{display:grid; grid-template-columns:minmax(240px,1fr) auto auto; gap:12px; margin:18px 0; align-items:center;}
.searchbox,.field,textarea{
  width:100%; border:1px solid var(--border); background:rgba(15,23,36,.84); color:var(--text); border-radius:16px; padding:13px 14px; outline:none; transition:.16s ease;
}
.searchbox:focus,.field:focus,textarea:focus{border-color:rgba(56,189,248,.55); box-shadow:0 0 0 4px rgba(56,189,248,.1)}
.btn{border:1px solid var(--border); background:rgba(255,255,255,.07); color:var(--text); border-radius:14px; padding:12px 14px; display:inline-flex; align-items:center; gap:8px; justify-content:center; transition:.16s ease; text-decoration:none;}
.btn:hover{background:rgba(255,255,255,.11); transform:translateY(-1px)}
.btn.primary{background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#06111f; border-color:transparent; font-weight:800;}
.btn.good{background:rgba(52,211,153,.14); border-color:rgba(52,211,153,.25); color:#bbf7d0;}
.btn.danger{background:rgba(251,113,133,.12); border-color:rgba(251,113,133,.26); color:#fecdd3;}
.btn.small{padding:8px 10px; border-radius:12px; font-size:12px;}
.chips{display:flex; flex-wrap:wrap; gap:8px; margin:12px 0 20px;}
.chip{border:1px solid var(--border); color:#c8d7ec; background:rgba(148,163,184,.08); border-radius:999px; padding:8px 11px; font-size:12px; transition:.16s ease;}
.chip.active{border-color:rgba(56,189,248,.5); background:rgba(56,189,248,.16); color:#e0f7ff;}
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:12px; align-items:start;}
.card{border:1px solid var(--border); border-radius:var(--radius); background:linear-gradient(180deg,rgba(17,24,39,.86),rgba(15,23,36,.82)); padding:15px; box-shadow:0 16px 38px rgba(0,0,0,.16); display:flex; flex-direction:column;}
.card.phrase-card{min-height:auto;}
.card.phrase-card .card-top{display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start;}
.card.phrase-card .actions{margin-top:14px;}
.card.understood{border-color:rgba(52,211,153,.34); background:linear-gradient(180deg,rgba(18,45,42,.72),rgba(15,35,34,.72));}
.card.understood .sv::after{content:"  ✅"; font-size:15px; opacity:.9;}
.card-top{display:flex; justify-content:space-between; gap:12px; align-items:flex-start;}
.sv{font-size:20px; font-weight:850; letter-spacing:-.02em; line-height:1.22; word-break:break-word;}
.fr{margin-top:7px; color:#cbd5e1; line-height:1.4; word-break:break-word;}
.meta{display:flex; flex-wrap:wrap; gap:6px; margin-top:11px;}
.tag{font-size:11px; color:#b9c7da; background:rgba(148,163,184,.1); border:1px solid rgba(148,163,184,.15); padding:5px 7px; border-radius:999px;}
.tag.personal{color:#bfdbfe; border-color:rgba(59,130,246,.3); background:rgba(59,130,246,.12)}
.actions{display:flex; gap:7px; flex-wrap:wrap; margin-top:13px;}
.empty{border:1px dashed rgba(148,163,184,.32); border-radius:var(--radius); padding:28px; text-align:center; color:var(--muted); background:rgba(15,23,36,.48);}
.panel{border:1px solid var(--border); background:rgba(17,24,39,.74); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); margin-bottom:16px;}
.panel h3{margin:0 0 10px; font-size:20px; letter-spacing:-.02em;}
.panel p{color:var(--muted); line-height:1.5; margin:0 0 14px;}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
.form-grid.full{grid-template-columns:1fr;}
label{display:block; font-size:12px; color:#b3c2d5; margin:0 0 7px;}
textarea{min-height:110px; resize:vertical; line-height:1.45;}
.translate-layout{display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start;}
.hint{font-size:12px; color:var(--muted); margin-top:7px; line-height:1.4;}
.suggestions{display:grid; gap:9px; margin-top:12px;}
.suggestion{border:1px solid var(--border); border-radius:15px; padding:12px; background:rgba(15,23,36,.7); display:grid; gap:6px;}
.suggestion strong{font-size:15px;}
.warnbox{border:1px solid rgba(251,191,36,.28); background:rgba(251,191,36,.1); color:#fde68a; border-radius:16px; padding:13px; line-height:1.45; margin:12px 0;}
.okbox{border:1px solid rgba(52,211,153,.28); background:rgba(52,211,153,.1); color:#bbf7d0; border-radius:16px; padding:13px; line-height:1.45; margin:12px 0;}
.split-actions{display:flex; flex-wrap:wrap; gap:9px; align-items:center;}
.toast{position:fixed; right:20px; bottom:20px; background:#0b1220; border:1px solid var(--border); color:var(--text); padding:13px 15px; border-radius:15px; box-shadow:var(--shadow); opacity:0; transform:translateY(10px); pointer-events:none; transition:.2s ease; z-index:99; max-width:min(420px, calc(100vw - 40px));}
.toast.show{opacity:1; transform:translateY(0)}
.kbd{font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; background:rgba(255,255,255,.08); border:1px solid var(--border); border-radius:7px; padding:2px 6px; color:#dbeafe;}
.library-row{display:grid; grid-template-columns:1fr auto; gap:12px; align-items:center;}
.footer-note{color:var(--muted); font-size:12px; margin-top:16px;}
.stats-grid{display:grid; grid-template-columns:repeat(4,minmax(160px,1fr)); gap:12px; margin:16px 0;}
.stat-card{border:1px solid var(--border); background:linear-gradient(180deg,rgba(17,24,39,.82),rgba(15,23,36,.76)); border-radius:var(--radius); padding:16px; box-shadow:0 16px 38px rgba(0,0,0,.14);}
.stat-card .num{font-size:28px; font-weight:900; letter-spacing:-.04em;}
.stat-card .label{font-size:12px; color:var(--muted); margin-top:4px; line-height:1.35;}
.progress-list{display:grid; gap:10px; margin-top:12px;}
.progress-row{border:1px solid var(--border); background:rgba(15,23,36,.62); border-radius:15px; padding:12px; display:grid; gap:8px;}
.progress-head{display:flex; justify-content:space-between; gap:10px; align-items:center; color:#dbeafe; font-size:13px;}
.bar{height:9px; border-radius:999px; background:rgba(148,163,184,.14); overflow:hidden; border:1px solid rgba(148,163,184,.12);}
.bar span{display:block; height:100%; width:0%; background:linear-gradient(90deg,var(--ok),var(--accent)); border-radius:inherit;}
.home-grid{display:grid; grid-template-columns:minmax(0,1.4fr) minmax(320px,.8fr); gap:14px; align-items:start;}
.profile-box{display:grid; gap:10px;}
.toggle-line{display:flex; align-items:center; gap:10px; color:#cbd5e1; font-size:13px;}
.toggle-line input{width:18px; height:18px; accent-color:#38bdf8;}
.status-dot{width:10px; height:10px; border-radius:999px; display:inline-block; background:#94a3b8; box-shadow:0 0 18px rgba(148,163,184,.35);}
.status-dot.online{background:var(--ok); box-shadow:0 0 18px rgba(52,211,153,.45);}
.status-dot.warn{background:var(--warn); box-shadow:0 0 18px rgba(251,191,36,.45);}
.status-dot.offline{background:var(--danger); box-shadow:0 0 18px rgba(251,113,133,.45);}
.recent-list{display:grid; gap:8px; margin-top:10px;}
.recent-item{border:1px solid var(--border); background:rgba(15,23,36,.6); border-radius:13px; padding:10px; font-size:13px;}
.recent-item strong{display:block; color:#e0f2fe; margin-bottom:3px;}

.profile-gate{position:fixed; inset:0; z-index:120; display:grid; place-items:center; padding:22px; background:
  radial-gradient(circle at 16% 10%, rgba(56,189,248,.22), transparent 32%),
  radial-gradient(circle at 88% 12%, rgba(167,139,250,.22), transparent 30%),
  rgba(8,13,23,.94); backdrop-filter:blur(18px);}
.profile-gate.hidden{display:none;}
.profile-modal{width:min(980px,100%); border:1px solid var(--border); background:linear-gradient(180deg,rgba(17,24,39,.94),rgba(10,16,28,.92)); border-radius:28px; padding:26px; box-shadow:0 35px 110px rgba(0,0,0,.48);}
.login-brand{text-align:center; margin-bottom:20px;}
.login-brand .login-logo{width:72px; height:72px; margin:0 auto 12px; border-radius:25px; display:grid; place-items:center; font-size:36px; background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#06111f; box-shadow:0 20px 48px rgba(56,189,248,.24);}
.login-brand h2{margin:0; font-size:32px; letter-spacing:-.04em;}
.login-brand p{margin:7px auto 0; max-width:720px; color:var(--muted); line-height:1.45;}
.profile-list{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin:20px 0;}
.profile-card{border:1px solid var(--border); background:rgba(15,23,36,.72); color:var(--text); border-radius:22px; padding:18px 14px; display:grid; place-items:center; gap:10px; min-height:160px; transition:.16s ease;}
.profile-card:hover{transform:translateY(-3px); border-color:rgba(56,189,248,.46); background:rgba(30,41,59,.72);}
.profile-avatar{width:74px; height:74px; border-radius:24px; display:grid; place-items:center; font-size:36px; background:linear-gradient(135deg,rgba(56,189,248,.24),rgba(167,139,250,.22)); border:1px solid rgba(255,255,255,.08);}
.profile-name{font-weight:850; font-size:16px; text-align:center;}
.profile-foot{display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; margin-top:14px; color:var(--muted); font-size:12px;}
.admin-profile-row{display:grid; grid-template-columns:90px 1fr 90px auto auto; gap:10px; align-items:end; padding:12px; border:1px solid var(--border); background:rgba(15,23,36,.62); border-radius:16px; margin-top:10px;}
.admin-profile-row .id{font-weight:850; color:#dbeafe; padding-bottom:13px; word-break:break-word;}
@media(max-width:720px){.admin-profile-row{grid-template-columns:1fr}.admin-profile-row .id{padding-bottom:0}}
.profile-current{display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:999px; background:rgba(56,189,248,.1); border:1px solid rgba(56,189,248,.22); color:#dff7ff;}

@media (max-width: 940px){
  body{overflow:auto}.app{display:block}.sidebar{position:fixed; z-index:20; left:0; top:0; bottom:0; width:min(88vw,var(--sidebar)); transform:translateX(-105%); transition:.2s ease; box-shadow:var(--shadow)}
  .sidebar.open{transform:translateX(0)}.main{height:auto; min-height:100vh}.mobile-top{display:flex; justify-content:space-between; align-items:center}.hero{grid-template-columns:1fr}.toolbar{grid-template-columns:1fr}.translate-layout,.form-grid,.home-grid{grid-template-columns:1fr}.grid,.stats-grid{grid-template-columns:1fr}.hero h2{font-size:28px}
}
  
.review-config{display:grid; grid-template-columns:repeat(4,minmax(170px,1fr)); gap:14px; margin-top:14px;}
.review-question{max-width:920px; margin:0 auto; border:1px solid rgba(56,189,248,.24); background:linear-gradient(135deg,rgba(15,23,36,.92),rgba(17,24,39,.78)); border-radius:26px; padding:24px; box-shadow:var(--shadow);}
.review-progress{display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--muted); margin-bottom:18px;}
.review-prompt{font-size:32px; font-weight:850; letter-spacing:-.03em; margin:10px 0 8px; line-height:1.12;}
.review-sub{color:var(--muted); font-size:14px; margin-bottom:16px;}
.answer-grid{display:grid; grid-template-columns:repeat(2,minmax(180px,1fr)); gap:12px; margin-top:18px;}
.answer-choice{border:1px solid var(--border); background:rgba(255,255,255,.055); color:var(--text); border-radius:16px; padding:14px; text-align:left; line-height:1.35; transition:.14s ease;}
.answer-choice:hover{border-color:rgba(56,189,248,.42); transform:translateY(-1px);}
.answer-choice.good{border-color:rgba(52,211,153,.58); background:rgba(52,211,153,.15);}
.answer-choice.bad{border-color:rgba(251,113,133,.58); background:rgba(251,113,133,.13);}
.correction-box{margin-top:16px; border:1px solid var(--border); background:rgba(255,255,255,.055); border-radius:18px; padding:16px; line-height:1.55;}
.correction-box.good{border-color:rgba(52,211,153,.45); background:rgba(52,211,153,.11);}
.correction-box.mid{border-color:rgba(251,191,36,.45); background:rgba(251,191,36,.10);}
.correction-box.bad{border-color:rgba(251,113,133,.45); background:rgba(251,113,133,.10);}
.score-badge{font-weight:850; font-size:18px; display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border-radius:999px; border:1px solid var(--border); background:rgba(255,255,255,.07);}
.leaderboard{display:flex; flex-direction:column; gap:9px;}
.leader-row{display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; border:1px solid var(--border); background:rgba(255,255,255,.045); border-radius:14px; padding:10px 12px;}
.leader-name{font-weight:760;}
.leader-score{font-weight:850; color:#bae6fd;}
.chart-wrap{border:1px solid var(--border); background:rgba(15,23,36,.58); border-radius:16px; padding:12px; overflow:hidden;}
.chart-canvas{display:block; width:100%; height:300px;}
.chart-legend{display:flex; flex-wrap:wrap; gap:8px; margin-top:10px;}
.legend-item{display:inline-flex; align-items:center; gap:7px; color:#cbd5e1; font-size:12px;}
.legend-dot{width:10px; height:10px; border-radius:999px; display:inline-block;}
.mistake-list{display:flex; flex-direction:column; gap:9px;}
.mistake-item{border:1px solid var(--border); background:rgba(255,255,255,.045); border-radius:14px; padding:10px 12px;}
.mistake-item strong{display:block; margin-bottom:3px;}
.muted{color:var(--muted); font-size:13px;}
@media(max-width:1100px){.review-config{grid-template-columns:repeat(2,minmax(170px,1fr));}.answer-grid{grid-template-columns:1fr;}.review-prompt{font-size:26px;}}

/* -------------------------------------------------------------------------
   V4.1 - Interface mobile propre
   ------------------------------------------------------------------------- */
:root{
  --bottom-nav-height:76px;
  --safe-bottom:env(safe-area-inset-bottom, 0px);
}
button,.btn,.chip,.answer-choice,.profile-card{touch-action:manipulation;-webkit-tap-highlight-color:transparent;}
button:focus-visible,.btn:focus-visible,.chip:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:2px solid rgba(125,211,252,.86);
  outline-offset:3px;
}
.mobile-backdrop{display:none;}
.bottom-nav{display:none;}

@media (hover:none){
  .btn:hover,.chip:hover,.nav button:hover,.answer-choice:hover,.profile-card:hover{transform:none;}
}

@media (max-width: 940px){
  :root{--radius:20px;}
  html,body{min-height:100%;height:auto;}
  body{
    overflow:auto;
    background:
      radial-gradient(circle at 12% -8%, rgba(56,189,248,.24), transparent 36%),
      radial-gradient(circle at 100% 0%, rgba(167,139,250,.22), transparent 34%),
      linear-gradient(180deg,#08111f 0%,#0d1117 52%,#111827 100%);
  }
  body.drawer-open{overflow:hidden;}
  .app{display:block;min-height:100svh;}
  .main{
    height:auto;
    min-height:100svh;
    overflow:visible;
    padding:18px 14px calc(var(--bottom-nav-height) + var(--safe-bottom) + 24px);
  }
  .mobile-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    position:sticky;
    top:0;
    z-index:18;
    margin:-18px -14px 16px;
    padding:calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
    background:linear-gradient(180deg,rgba(8,13,23,.96),rgba(13,17,23,.86));
    backdrop-filter:blur(18px);
    border-bottom:1px solid rgba(148,163,184,.16);
  }
  .mobile-top button{
    min-height:44px;
    border-radius:999px;
    padding:10px 14px;
    font-weight:800;
    background:linear-gradient(135deg,rgba(56,189,248,.18),rgba(167,139,250,.14));
  }
  .mobile-top .pill{font-size:12px;padding:7px 10px;}
  .sidebar{
    position:fixed;
    z-index:40;
    left:0;
    top:0;
    bottom:0;
    width:min(86vw, 360px);
    height:100dvh;
    padding:calc(18px + env(safe-area-inset-top, 0px)) 16px calc(22px + var(--safe-bottom));
    transform:translateX(-108%);
    transition:transform .22s ease;
    box-shadow:0 32px 90px rgba(0,0,0,.52);
    border-right:1px solid rgba(148,163,184,.2);
  }
  .sidebar.open{transform:translateX(0);}
  .mobile-backdrop{
    display:block;
    position:fixed;
    inset:0;
    z-index:35;
    opacity:0;
    pointer-events:none;
    background:rgba(2,6,23,.58);
    backdrop-filter:blur(6px);
    transition:opacity .18s ease;
  }
  .mobile-backdrop.show{opacity:1;pointer-events:auto;}
  .brand{position:sticky;top:0;z-index:2;margin:-6px -4px 14px;padding:6px 4px 12px;background:linear-gradient(180deg,rgba(10,16,28,.96),rgba(10,16,28,.78));backdrop-filter:blur(12px);}
  .section-label{margin:16px 8px 8px;}
  .nav button{min-height:54px;border-radius:18px;padding:11px 12px;}
  .nav-ico{width:38px;height:38px;border-radius:14px;font-size:18px;}
  .nav-title{font-size:15px;}
  .mini-panel{border-radius:20px;background:rgba(15,23,36,.76);}

  .bottom-nav{
    position:fixed;
    left:10px;
    right:10px;
    bottom:calc(8px + var(--safe-bottom));
    z-index:30;
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:6px;
    padding:8px;
    min-height:var(--bottom-nav-height);
    border:1px solid rgba(148,163,184,.22);
    border-radius:26px;
    background:linear-gradient(180deg,rgba(15,23,36,.92),rgba(8,13,23,.92));
    box-shadow:0 18px 55px rgba(0,0,0,.48);
    backdrop-filter:blur(18px);
  }
  .bottom-nav button{
    appearance:none;
    border:1px solid transparent;
    border-radius:20px;
    background:transparent;
    color:#b8c6da;
    min-width:0;
    padding:8px 4px;
    display:grid;
    place-items:center;
    gap:3px;
    font-size:11px;
    line-height:1.05;
  }
  .bottom-nav .bn-ico{font-size:20px;line-height:1;}
  .bottom-nav .bn-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
  .bottom-nav button.active{
    color:#06111f;
    border-color:transparent;
    background:linear-gradient(135deg,var(--accent),var(--accent-2));
    box-shadow:0 10px 26px rgba(56,189,248,.22);
    font-weight:900;
  }
  .bottom-nav button.menu-active{
    border-color:rgba(125,211,252,.34);
    background:rgba(56,189,248,.12);
    color:#e0f7ff;
  }

  .hero{display:block;margin-bottom:14px;}
  .hero h2{font-size:clamp(25px,8vw,32px);line-height:1.03;margin-bottom:8px;}
  .hero p{font-size:14px;line-height:1.5;}
  .hero-card{margin-top:12px;min-width:0;width:100%;border-radius:22px;padding:14px;background:linear-gradient(135deg,rgba(56,189,248,.13),rgba(167,139,250,.1));}
  .hero-card .big{font-size:28px;}
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0;}
  .stat-card{padding:13px;border-radius:20px;min-height:96px;}
  .stat-card .num{font-size:24px;}
  .stat-card .label{font-size:11.5px;}
  .home-grid{grid-template-columns:1fr;gap:12px;}
  .panel{padding:15px;border-radius:22px;margin-bottom:12px;box-shadow:0 16px 40px rgba(0,0,0,.2);}
  .panel h3{font-size:19px;}
  .panel p{font-size:13.5px;}
  .progress-row{border-radius:17px;padding:11px;}
  .progress-head{font-size:12px;align-items:flex-start;}
  .progress-head span:last-child{text-align:right;}

  .toolbar{grid-template-columns:1fr;gap:10px;margin:14px 0;}
  .searchbox,.field,textarea{min-height:46px;border-radius:18px;padding:13px 14px;font-size:16px;}
  textarea{min-height:122px;}
  .chips{gap:8px;margin:10px 0 16px;overflow-x:auto;flex-wrap:nowrap;padding-bottom:3px;scroll-snap-type:x mandatory;}
  .chip{flex:0 0 auto;min-height:40px;padding:9px 12px;scroll-snap-align:start;}
  .grid{grid-template-columns:1fr;gap:11px;}
  .card{border-radius:22px;padding:14px;}
  .card.phrase-card .card-top{grid-template-columns:1fr;gap:10px;}
  .card-top{display:grid;grid-template-columns:1fr;gap:10px;}
  .sv{font-size:19px;}
  .fr{font-size:14px;}
  .actions,.split-actions{gap:8px;}
  .actions .btn,.split-actions .btn{min-height:42px;}
  .library-row{grid-template-columns:1fr;}
  .translate-layout,.form-grid{grid-template-columns:1fr;gap:12px;}
  .suggestion{border-radius:18px;}
  .toast{left:14px;right:14px;bottom:calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);max-width:none;text-align:center;border-radius:18px;}

  .profile-gate{padding:16px;background:linear-gradient(180deg,rgba(8,13,23,.98),rgba(13,17,23,.96));}
  .profile-modal{width:100%;max-height:calc(100dvh - 32px);overflow:auto;border-radius:28px;padding:20px 16px;}
  .login-brand .login-logo{width:66px;height:66px;border-radius:24px;font-size:34px;}
  .login-brand h2{font-size:clamp(26px,8vw,34px);line-height:1.02;}
  .profile-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0;}
  .profile-card{min-height:142px;border-radius:24px;padding:14px 10px;}
  .profile-avatar{width:64px;height:64px;border-radius:22px;font-size:32px;}

  .review-config{grid-template-columns:1fr;gap:10px;}
  .review-question{border-radius:24px;padding:17px;margin:0;}
  .review-prompt{font-size:clamp(24px,8vw,34px);line-height:1.08;}
  .answer-grid{grid-template-columns:1fr;gap:10px;}
  .answer-choice{min-height:52px;border-radius:18px;padding:14px;}
  .chart-canvas{height:240px;}
}

@media (max-width: 430px){
  .main{padding-left:10px;padding-right:10px;}
  .mobile-top{margin-left:-10px;margin-right:-10px;padding-left:10px;padding-right:10px;}
  .stats-grid{grid-template-columns:1fr 1fr;gap:8px;}
  .stat-card{padding:12px;min-height:90px;}
  .stat-card .num{font-size:22px;}
  .hero-card .big{font-size:26px;}
  .profile-list{grid-template-columns:1fr 1fr;}
  .bottom-nav{left:6px;right:6px;border-radius:24px;gap:4px;padding:7px;}
  .bottom-nav button{font-size:10.5px;border-radius:18px;padding-inline:2px;}
  .bottom-nav .bn-ico{font-size:19px;}
}

@media (max-width: 350px){
  .profile-list,.stats-grid{grid-template-columns:1fr;}
  .bottom-nav .bn-title{display:none;}
  .bottom-nav button{gap:0;}
}


/* -------------------------------------------------------------------------
   V4.2 - Fix accueil mobile : carte progression + bottom bar
   ------------------------------------------------------------------------- */
html,
body{
  max-width:100%;
  overflow-x:hidden;
}
.app,
.main,
#appView,
.hero,
.home-grid,
.stats-grid,
.panel,
.stat-card,
.hero-card,
.progress-list,
.progress-row{
  max-width:100%;
  min-width:0;
}

@media (max-width: 940px){
  .main{
    width:100%;
    max-width:100dvw;
    overflow-x:hidden;
  }

  #appView{
    width:100%;
    overflow-x:hidden;
  }

  .hero{
    width:100%;
    max-width:100%;
    overflow:hidden;
  }

  .hero-card.home-progress-card{
    width:min(214px, 100%);
    max-width:100%;
    min-width:0;
    margin-top:12px;
    padding:12px 14px;
    border-radius:20px;
    justify-self:start;
    box-shadow:0 12px 30px rgba(0,0,0,.18);
  }

  .hero-card.home-progress-card .big{
    font-size:25px;
    line-height:1;
  }

  .hero-card.home-progress-card .small{
    font-size:11.5px;
    line-height:1.25;
    white-space:normal;
    overflow-wrap:anywhere;
  }

  .stats-grid,
  .home-grid{
    width:100%;
    max-width:100%;
    min-width:0;
  }

  .panel,
  .stat-card{
    min-width:0;
    overflow:hidden;
  }

  .progress-head,
  .stat-card .label,
  .recent-item,
  .panel p{
    min-width:0;
    overflow-wrap:anywhere;
  }

  .bottom-nav{
    left:max(8px, env(safe-area-inset-left, 0px));
    right:auto;
    bottom:calc(8px + var(--safe-bottom));
    width:calc(100dvw - max(8px, env(safe-area-inset-left, 0px)) - max(8px, env(safe-area-inset-right, 0px)));
    max-width:calc(100dvw - 16px);
    box-sizing:border-box;
    overflow:hidden;
  }

  .bottom-nav button{
    min-width:0;
    max-width:100%;
  }
}

@media (max-width: 430px){
  .hero-card.home-progress-card{
    width:min(190px, 100%);
    padding:11px 13px;
  }

  .bottom-nav{
    left:max(6px, env(safe-area-inset-left, 0px));
    width:calc(100dvw - max(6px, env(safe-area-inset-left, 0px)) - max(6px, env(safe-area-inset-right, 0px)));
    max-width:calc(100dvw - 12px);
  }
}

/* -------------------------------------------------------------------------
   V4.4 - Header mobile transparent
   ------------------------------------------------------------------------- */
@media (max-width: 940px){
  .mobile-top{
    background:transparent !important;
    border-bottom:0 !important;
    box-shadow:none !important;
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
    padding-top:calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom:8px;
    margin-bottom:8px;
    pointer-events:none;
  }

  .mobile-top button,
  .mobile-top .pill{
    pointer-events:auto;
    border:1px solid rgba(148,163,184,.28);
    background:rgba(15,23,36,.56);
    box-shadow:0 10px 28px rgba(0,0,0,.20);
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
  }

  .mobile-top button{
    background:linear-gradient(135deg,rgba(56,189,248,.18),rgba(167,139,250,.14)), rgba(15,23,36,.48);
  }

  .mobile-top .pill{
    color:#d5e4f7;
  }
}

@media (max-width: 430px){
  .mobile-top{
    padding-bottom:6px;
    margin-bottom:6px;
  }
}

/* -------------------------------------------------------------------------
   V4.4 - Header mobile : espace sous menu + bottom nav traduction
   ------------------------------------------------------------------------- */
@media (max-width: 940px){
  .mobile-top{
    min-height:56px;
    margin:0 -14px 20px !important;
    padding-top:calc(8px + env(safe-area-inset-top, 0px));
    padding-bottom:10px;
    align-items:flex-start;
  }

  .mobile-top button,
  .mobile-top .pill{
    min-height:42px;
  }

  #appView > .hero:first-child{
    padding-top:2px;
  }

  #appView > .hero:first-child h2{
    margin-top:0;
  }

  .bottom-nav{
    grid-template-columns:repeat(5,minmax(0,1fr));
  }
}

@media (max-width: 430px){
  .mobile-top{
    min-height:58px;
    margin:0 -10px 18px !important;
    padding-top:calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom:10px;
  }

  #appView > .hero:first-child{
    padding-top:4px;
  }
}

@media (max-width: 370px){
  .bottom-nav .bn-title{
    font-size:10px;
  }
}


/* -------------------------------------------------------------------------
   V4.5 - Finitions mobile : badge centré, hero-card sans ombre, focus search propre
   ------------------------------------------------------------------------- */
@media (max-width: 940px){
  .mobile-top{
    align-items:center;
  }

  .mobile-top .pill{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
    padding:0 14px;
    line-height:1;
    text-align:center;
    white-space:nowrap;
    border-radius:999px;
  }

  .hero-card{
    box-shadow:none;
  }

  .searchbox,
  .field,
  textarea{
    max-width:100%;
  }

  .searchbox:focus,
  .field:focus,
  textarea:focus,
  .searchbox:focus-visible,
  .field:focus-visible,
  textarea:focus-visible{
    outline:none;
    outline-offset:0;
    border-color:rgba(56,189,248,.72);
    box-shadow:inset 0 0 0 1px rgba(125,211,252,.55), 0 0 0 2px rgba(56,189,248,.18);
  }
}

@media (max-width: 430px){
  .mobile-top .pill{
    min-height:40px;
    padding:0 12px;
    font-size:12px;
  }

  .hero-card{
    box-shadow:none;
  }

  .searchbox:focus,
  .field:focus,
  textarea:focus,
  .searchbox:focus-visible,
  .field:focus-visible,
  textarea:focus-visible{
    box-shadow:inset 0 0 0 1px rgba(125,211,252,.55), 0 0 0 1px rgba(56,189,248,.14);
  }
}
