/* Kit CESRC 2027 — thème « carnet de lectures » : papier crème, bleu cobalt, magenta, souci, émeraude, terre cuite */
@font-face { font-family: "Playfair Display"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/playfair-display-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 700; font-style: italic; font-display: swap; src: url(/fonts/playfair-display-latin-700-italic.woff2) format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/lora-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 400; font-style: italic; font-display: swap; src: url(/fonts/lora-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 600 800; font-style: normal; font-display: swap; src: url(/fonts/lora-latin-600-normal.woff2) format("woff2"); }

:root {
  --paper: #fbf5ea; --paper2: #f4ead8; --card: #fffdf8; --ink: #2b211b; --muted: #7a6656; --line: #eadcc4;
  --cobalt: #2147a3; --cobalt-d: #16306f; --magenta: #c2185b; --souci: #e8a317; --emeraude: #17845a; --terre: #c4532b; --bougain: #8e2f8f; --sarcelle: #0f7d85;
  --lu: #2147a3; --revise: #e8a317; --maitrise: #17845a; --radius: 14px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif; --text: "Lora", Georgia, serif; --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 16px/1.55 var(--text);
  background: var(--paper) radial-gradient(circle at 1px 1px, rgba(122,102,86,.09) 1px, transparent 1.4px) 0 0 / 18px 18px; }
a { color: inherit; }
button, input, select { font: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: .005em; }

/* en-tête : bleu cobalt + guirlande de papier découpé */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; background: var(--cobalt); color: #fff;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 30px; pointer-events: none;
  background: url(/img/picado.svg) 0 -4px / 252px 32px repeat-x; filter: drop-shadow(0 2px 2px rgba(43,33,27,.12)); }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; }
.brand b { display: block; font: 700 17px/1.1 var(--serif); } .brand small { display: block; color: #ffd98a; font: 12px var(--ui); letter-spacing: .02em; }
.logo { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; background: url(/icon-192.png) center / cover; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.gear { text-decoration: none; font-size: 22px; padding: 4px 6px; }
.syncdot { width: 11px; height: 11px; border-radius: 50%; background: #9aa6c7; box-shadow: 0 0 0 2px rgba(255,255,255,.3); }
.syncdot.ok { background: #4ade80; } .syncdot.wait { background: var(--souci); } .syncdot.err { background: #ff6b6b; }
.view { max-width: 980px; margin: 0 auto; padding: 40px 14px 100px; outline: none; }

/* barre d'onglets */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(43,33,27,.06); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; text-decoration: none; color: var(--muted); font: 600 11.5px var(--ui); position: relative; }
.tabbar a i { font-style: normal; font-size: 20px; line-height: 1.1; }
.tabbar a[aria-current="page"] { color: var(--magenta); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--magenta); }
@media (min-width: 900px) {
  .tabbar { position: sticky; top: 58px; z-index: 9; border: 0; border-bottom: 1px solid var(--line); justify-content: center; gap: 6px; box-shadow: none; padding-top: 24px; background: var(--paper); }
  .tabbar a { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 10px 16px; font-size: 14px; }
  .tabbar a[aria-current="page"]::before { top: auto; bottom: -1px; left: 12px; right: 12px; border-radius: 3px 3px 0 0; }
  .view { padding-top: 22px; padding-bottom: 40px; }
}

h1 { font-size: 1.7rem; margin: 6px 0 4px; color: var(--cobalt-d); }
h2 { font-size: 1.28rem; margin: 26px 0 10px; color: var(--cobalt-d); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2::before { content: ""; width: 20px; height: 20px; flex: 0 0 auto; background: url(/img/fleur.svg) center / contain no-repeat; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: .95rem; }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 6px rgba(43,33,27,.05); margin-bottom: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

/* bandeau d'accueil */
.hero { position: relative; overflow: hidden; color: #fff; border-radius: 20px; padding: 22px 20px 18px; margin-bottom: 16px;
  background: radial-gradient(120% 140% at 100% 0%, #3a62c4 0%, var(--cobalt) 45%, var(--cobalt-d) 100%); box-shadow: 0 6px 18px rgba(22,48,111,.25); }
.hero::after { content: ""; position: absolute; right: -26px; top: -18px; width: 190px; height: 130px; background: url(/img/fleurs.svg) center / contain no-repeat; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hello { font: italic 700 1.75rem/1.15 var(--serif); margin: 0 0 6px; padding-right: 140px; }
.quote { font: italic 1rem/1.45 var(--text); color: #ffe7ad; margin: 0 0 16px; padding-right: 120px; max-width: 640px; }
@media (max-width: 520px) { .hero::after { width: 130px; height: 90px; right: -22px; top: -10px; } .hello { padding-right: 90px; font-size: 1.5rem; } .quote { padding-right: 0; } }
.hero .big { font: 700 2.8rem/1 var(--serif); color: #ffd98a; } .hero small { color: #dbe4ff; font-family: var(--ui); }
.hero .row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.hero .pct { font: 700 1.7rem var(--serif); }
.bar { height: 10px; background: var(--paper2); border-radius: 99px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.hero .bar { background: rgba(255,255,255,.18); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font: 12.5px var(--ui); color: var(--muted); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: var(--c); }

/* étagère : un livre par sous-module */
.shelf { display: flex; align-items: flex-end; gap: 4px; padding: 16px 12px 0; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(#fffdf8, #f3e7d2); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.shelfwood { height: 12px; margin: 0 0 6px; border-radius: 0 0 8px 8px; background: linear-gradient(#a3734b, #6e4527); box-shadow: 0 3px 6px rgba(43,33,27,.2); }
.book { flex: 0 0 auto; position: relative; width: 36px; border-radius: 3px 3px 0 0; text-decoration: none; color: #fff; display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; background: var(--c); box-shadow: inset -4px 0 0 rgba(0,0,0,.15), inset 3px 0 0 rgba(255,255,255,.16); transition: transform .15s; }
.book:hover, .book:focus-visible { transform: translateY(-6px); }
.book b { font: 700 12px var(--ui); } .book span { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 10.5px/1 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-height: calc(100% - 26px); flex: 1; padding: 8px 0 4px; }
.book::before, .book::after { content: ""; position: absolute; left: 3px; right: 4px; height: 2px; background: rgba(255,255,255,.45); }
.book::before { top: 24px; } .book::after { bottom: 8px; }
.book .rib { position: absolute; top: -3px; right: 6px; width: 8px; height: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.book .rib.lu { height: 16px; background: #a9c1ff; } .book .rib.revise { height: 22px; background: #ffd25e; } .book .rib.maitrise { height: 30px; background: #7cf0b4; }
.shelfnote { font: 12.5px var(--ui); color: var(--muted); margin: 0 0 14px; }

.ep { display: block; text-decoration: none; border-left: 6px solid var(--c); }
.ep .t { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ep b { font: 700 1.05rem var(--serif); } .ep .meta { color: var(--muted); font: 12.5px var(--ui); white-space: nowrap; }
.ep .bar { margin-top: 10px; }
.pill { display: inline-block; font: 700 11.5px var(--ui); color: #fff; border-radius: 99px; padding: 2px 9px; background: var(--c, #6b5b4e); vertical-align: 1px; }
.mod { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.mod .num { flex: 0 0 auto; width: 40px; height: 50px; border-radius: 4px 8px 8px 4px; display: grid; place-items: center; font: 700 15px var(--ui); color: #fff; background: var(--c);
  box-shadow: inset 5px 0 0 rgba(0,0,0,.16), 2px 2px 0 var(--paper2); }
.mod .body { flex: 1; min-width: 0; } .mod .body b { display: block; font: 700 1.02rem var(--serif); }
.mod .st { font: 12.5px var(--ui); color: var(--muted); }
.mod > span:last-child { color: var(--magenta); font-size: 22px; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.dots i.lu { background: var(--lu); } .dots i.revise { background: var(--revise); } .dots i.maitrise { background: var(--maitrise); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 11px; padding: 10px 15px; font: 700 14.5px var(--ui);
  text-decoration: none; cursor: pointer; background: var(--magenta); color: #fff; box-shadow: 0 2px 0 #8d1042; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.alt { background: var(--paper2); color: var(--ink); box-shadow: 0 2px 0 var(--line); } .btn.ghost { background: transparent; color: var(--cobalt); border: 1.5px solid #b9c7ea; box-shadow: none; }
.btn.small { padding: 7px 12px; font-size: 13px; }
details summary { cursor: pointer; }
.seclist a { display: block; padding: 9px 2px; border-bottom: 1px dashed var(--line); text-decoration: none; font-size: .95rem; }
.seclist a:last-child { border: 0; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.tasks li:last-child { border: 0; }
.tasks input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--emeraude); flex: 0 0 auto; }
.tasks li.done .txt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--magenta); }
.tasks .txt a { color: var(--magenta); font: 700 13px var(--ui); text-decoration: none; margin-left: 4px; white-space: nowrap; }
.week { border-left: 5px solid var(--line); } .week.now { border-left-color: var(--magenta); box-shadow: 0 0 0 2px #f5bfd3; }
.week .wh { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.week .wh b { font: 700 1.08rem var(--serif); } .week .wh small { color: var(--muted); font-family: var(--ui); }
.q { margin-bottom: 12px; } .q p { margin: 0 0 10px; font-weight: 600; }
.opts { display: grid; gap: 7px; }
.opts button { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: .97rem; font-family: var(--text); color: var(--ink); }
.opts button:hover { border-color: #b9c7ea; }
.opts button.ok { border-color: var(--emeraude); background: #e8f6ee; } .opts button.ko { border-color: var(--magenta); background: #fdecf2; }
.expl { margin-top: 9px; font-size: .93rem; background: #fff6df; border-left: 4px solid var(--souci); border-radius: 6px; padding: 9px 11px; }
.expl a { color: var(--cobalt); }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.filters button { flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 6px 13px; font: 600 13px var(--ui); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--cobalt); color: #fff; border-color: var(--cobalt); }
.search { width: 100%; font: 17px var(--text); padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.search:focus, .login input:focus { outline: 3px solid #f5bfd3; border-color: var(--magenta); }
.res { display: block; text-decoration: none; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.res .rt { font: 700 1rem var(--serif); color: var(--cobalt-d); } .res .rs { color: var(--muted); font: 12.5px var(--ui); } .res .rx { font-size: .92rem; margin-top: 3px; }
mark { background: #ffe08a; border-radius: 3px; padding: 0 1px; color: inherit; }
.empty { color: var(--muted); text-align: center; padding: 26px 8px; font-style: italic; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.kv:last-child { border: 0; }
input[type=date] { padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.score { font-weight: 700; font-family: var(--ui); color: var(--emeraude); }
.note { font-size: .9rem; color: var(--muted); }
.colophon { text-align: center; margin: 30px 0 0; color: var(--muted); font: italic .92rem var(--text); }
.colophon::before { content: ""; display: block; height: 26px; margin-bottom: 6px; background: url(/img/fleur.svg) center / 26px no-repeat; }

/* écran de connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 70px 20px 20px; position: relative;
  background: radial-gradient(120% 120% at 50% 0%, #3a62c4 0%, var(--cobalt) 45%, var(--cobalt-d) 100%); }
.login::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 46px; background: url(/img/picado.svg) 0 0 / 336px 42px repeat-x; }
.login .card { width: 100%; max-width: 390px; text-align: center; padding: 26px 22px 24px; border: 0; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login .card::before { content: ""; display: block; width: 150px; height: 100px; margin: -4px auto 4px; background: url(/img/fleurs.svg) center / contain no-repeat; }
.login h1 { font-size: 1.9rem; margin: 4px 0 2px; } .login h1 em { color: var(--magenta); }
.login input { width: 100%; font-size: 18px; padding: 13px; border: 1.5px solid var(--line); border-radius: 12px; margin: 16px 0 10px; text-align: center; background: #fff; }
.login .btn { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }
.login .err { color: var(--magenta); min-height: 1.4em; font-size: .92rem; }
