:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1b1b1b;
  --muted: #5a5a5a;
  --accent: #1f3b4d;
  --accent-2: #2f6f8f;
  --ok: #2e7d32;
  --line: #ddd6cc;
  --radius: 18px;
  font-size: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.35;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.view { max-width: 640px; margin: 0 auto; padding: 0 18px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.top h1 { font-size: 1.5rem; margin: 0; color: var(--accent); }
.badge { background: #8a5a00; color: #fff; border-radius: 999px; padding: 4px 12px; font-size: .75rem; }

/* Reprendre */
.resume-label { margin: 8px 0 8px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.resume-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
  padding: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.15);
}
.resume-card img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: #ffffff22; flex: none; }
.resume-text { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.resume-text strong { font-size: 1.1rem; }
.resume-text span { opacity: .9; font-size: .85rem; }
.resume-play { flex: none; width: 64px; height: 64px; border-radius: 50%; background: #fff; color: var(--accent);
  display: grid; place-items: center; font-size: 1.6rem; padding-left: 4px; }

/* Liste */
.list-title { font-size: 1.05rem; margin: 28px 0 10px; color: var(--muted); }
.book-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.book {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.cover-ph, .book img {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 1.3rem;
}
.book-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.book-info strong { font-size: 1rem; }
.book-info .author { color: var(--muted); font-size: .85rem; }
.book-info .state { color: var(--accent-2); font-size: .8rem; font-weight: 600; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent-2); }
.empty { color: var(--muted); text-align: center; margin-top: 40px; }
.install { margin-top: 28px; width: 100%; padding: 16px; border-radius: var(--radius); border: 2px dashed var(--accent-2); background: transparent; color: var(--accent-2); font-weight: 600; }

/* Lecteur */
.back { background: none; border: 0; color: var(--accent); font-size: 1.05rem; font-weight: 600; padding: 12px 4px; }
.player-body { display: flex; flex-direction: column; align-items: center; text-align: center; }
.p-cover { width: min(70vw, 300px); aspect-ratio: 1; object-fit: cover; border-radius: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.18); background: var(--accent-2); }
.p-title { font-size: 1.35rem; margin: 18px 0 4px; }
.p-author { margin: 0; color: var(--muted); }
.p-part { margin: 10px 0 14px; font-weight: 600; color: var(--accent-2); }

.seek { width: 100%; height: 36px; accent-color: var(--accent); }
.times { width: 100%; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }

.controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 10px; }
.ctl {
  width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,.12); display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 1.5rem; line-height: 1;
}
.ctl small { font-size: .65rem; margin-top: 2px; color: var(--muted); }
.ctl.small { width: 56px; height: 56px; font-size: 1.15rem; }
.ctl.play { width: 96px; height: 96px; background: var(--accent); color: #fff; font-size: 2.2rem; }
.ctl:active { transform: scale(.96); }

.speed { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.speed > span { color: var(--muted); font-size: .9rem; }
.speed-buttons { display: flex; gap: 8px; }
.speed-buttons button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: .85rem; }
.speed-buttons button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.dl-status { color: var(--muted); font-size: .8rem; min-height: 1.2em; }
.dl-status.ok { color: var(--ok); }

.parts { width: 100%; margin-top: 14px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.parts summary { padding: 16px; font-weight: 600; color: var(--accent); }
.parts ol { list-style: none; margin: 0; padding: 0 8px 8px; max-height: 50vh; overflow: auto; }
.parts li button { width: 100%; text-align: left; border: 0; background: none; padding: 12px 10px; border-radius: 10px; display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.parts li button.current { background: #e8eef2; font-weight: 700; }
.parts li .meta { color: var(--muted); white-space: nowrap; }

/* Connexion */
body.login main { max-width: 420px; margin: 0 auto; padding: 60px 24px; text-align: center; }
body.login h1 { color: var(--accent); }
body.login form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
body.login input { font-size: 1.2rem; padding: 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
body.login button { font-size: 1.1rem; padding: 16px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; }
body.login .error { color: #b00020; font-weight: 600; }
