/* HUSHTOON v3 — lecteur + adaptation téléphone */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --tabbar: 62px; }

/* ================= LECTEUR ================= */
body.reading { background: #000; }
body.reading #header, body.reading #footer, body.reading .tabbar, body.reading .cookie { display: none !important; }

.rd-top { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; gap: 8px;
  height: calc(54px + var(--sat)); padding: var(--sat) 8px 0; background: rgba(11,9,16,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.rd-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: var(--text); }
.rd-ico:hover { background: var(--bg-3); }
.rd-ico svg { width: 20px; height: 20px; }
.rd-title { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.rd-title b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title span { font-size: 12px; color: var(--muted); }
.rd-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.rd-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .1s linear; }

.reader { max-width: 720px; margin: 0 auto; padding-top: calc(54px + var(--sat)); background: #000; }
.reader img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }
.rd-ph { position: relative; aspect-ratio: 720 / 1100; }
.rd-note { color: var(--muted); text-align: center; padding: 18px; font-size: 13px; background: var(--bg-2); }

.rd-bottom { position: fixed; left: 50%; bottom: calc(14px + var(--sab)); z-index: 60; transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; width: min(480px, calc(100% - 24px)); padding: 6px;
  background: rgba(20,17,27,.95); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .28s; }
.rd-bottom button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 22px; font-weight: 700; font-size: 13.5px; }
.rd-bottom button:hover:not(:disabled) { background: var(--bg-3); }
.rd-bottom button:disabled { opacity: .3; cursor: default; }
.rd-bottom button:last-child { background: var(--accent); color: #fff; }
.rd-bottom button:last-child:disabled { background: none; color: var(--text); }
.rd-bottom svg { width: 18px; height: 18px; flex-shrink: 0; }

body.rd-hide .rd-top { transform: translateY(-100%); }
body.rd-hide .rd-bottom { transform: translate(-50%, calc(100% + 30px)); opacity: 0; }

.rd-after { max-width: 720px; margin: 0 auto; padding: 32px 16px calc(110px + var(--sab)); background: var(--bg); }
.rd-after > h3 { font-family: var(--font-display); font-size: 22px; text-align: center; }
.rd-rate { text-align: center; margin: 14px 0 22px; color: var(--muted); }
.stars { display: inline-flex; gap: 4px; margin-top: 8px; }
.stars button { font-size: 30px; line-height: 1; color: #3a3446; transition: transform .1s, color .15s; padding: 2px; }
.stars button.on { color: var(--accent-2); }
.stars button:active { transform: scale(1.2); }
.next-card { width: 100%; display: grid; grid-template-columns: 96px 1fr 40px; gap: 14px; align-items: center; padding: 10px; border-radius: 16px;
  background: linear-gradient(110deg, rgba(194,54,122,.22), rgba(20,17,27,.9)); border: 1px solid rgba(194,54,122,.5); text-align: left; transition: transform .15s; }
.next-card:hover { transform: translateY(-2px); }
.next-card .thumb { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; }
.nc-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.nc-txt small { color: var(--accent-2); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.nc-txt b { font-size: 16px; }
.nc-txt .price-col { align-items: flex-start; }
.nc-go { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.nc-go svg { width: 18px; height: 18px; }
.rd-theend { text-align: center; color: var(--muted); margin-bottom: 14px; }
.rd-vip { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.rd-vip span:nth-child(2) { flex: 1; }
.rd-vip .pct { background: var(--accent); color: #fff; font-weight: 800; padding: 4px 9px; border-radius: 16px; font-size: 13px; }
.rd-after .section { padding-top: 30px; }

/* panneau liste des chapitres */
.rd-sheet-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .25s; }
.rd-sheet-scrim.open { opacity: 1; pointer-events: auto; }
.rd-sheet { position: fixed; z-index: 71; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw; background: var(--bg-2); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.rd-sheet.open { transform: none; }
.sh-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + var(--sat)) 12px 10px 18px; border-bottom: 1px solid var(--line); }
.sh-list { overflow-y: auto; flex: 1; padding: 6px 8px calc(16px + var(--sab)); overscroll-behavior: contain; }
.sh-ep { width: 100%; display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; text-align: left; }
.sh-ep:hover { background: var(--bg-3); }
.sh-ep.cur { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.sh-ep .thumb { position: relative; aspect-ratio: 16/10; border-radius: 6px; overflow: hidden; }
.sh-t { font-weight: 600; font-size: 13.5px; }
.sh-ep .state, .sh-ep .price-col { font-size: 11px; }
.sh-ep .state { padding: 4px 9px; border-radius: 14px; font-weight: 700; }
.sh-ep .state.free { background: var(--accent-soft); color: #ff8cc0; }
.sh-ep .state.lock { background: var(--bg-3); color: var(--muted); display: flex; align-items: center; gap: 4px; }
.sh-ep .state.open { background: rgba(80,200,140,.14); color: #6fdca5; }
.sh-ep .state.vip { background: rgba(240,180,92,.14); color: var(--accent-2); }
.next-card .state { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 14px; }
.next-card .state.free { background: var(--accent-soft); color: #ff8cc0; }
.next-card .state.lock { background: var(--bg-3); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.next-card .state.open { background: rgba(80,200,140,.14); color: #6fdca5; }
.next-card .state.vip { background: rgba(240,180,92,.14); color: var(--accent-2); }

/* ================= BARRE D'ONGLETS ================= */
.tabbar { display: none; }
.avatar.mini { width: 24px; height: 24px; font-size: 11px; }

/* ================= TÉLÉPHONE ================= */
@media (max-width: 680px) {
  body { padding-bottom: calc(var(--tabbar) + var(--sab)); font-size: 14.5px; }
  body.reading { padding-bottom: 0; }
  .wrap { padding: 0 14px; }

  /* en-tête compact */
  .header-top { height: 54px; gap: 6px; }
  .logo { font-size: 19px; gap: 6px; }
  .logo-mark { width: 22px; height: 22px; }
  .header-actions { gap: 2px; }
  .header-actions > a.icon-btn, .header-actions > .avatar { display: none; }
  .lang-mini { padding: 0 6px; }
  .coin-chip { padding: 0 10px; height: 32px; }
  .nav { display: none; }

  /* onglets du bas */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: calc(var(--tabbar) + var(--sab)); padding-bottom: var(--sab); background: rgba(14,11,19,.97); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; min-width: 0; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar span:not(.avatar) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar .on { color: var(--text); }
  .tabbar .on svg { color: var(--accent); }

  /* fenêtres = panneaux qui montent du bas */
  .overlay { align-items: flex-end; padding: 0; }
  .overlay .modal { max-width: none; width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: var(--sab); animation: sheetUp .32s cubic-bezier(.2,.8,.2,1); }
  .age-gate .modal, .confirm .modal, .settings .modal, .checkout .modal, .join .modal { padding-bottom: calc(22px + var(--sab)); }
  .overlay .modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #4a425a; margin: 8px auto 0; }
  .auth .modal::before, .shop .modal::before, .promo-modal .modal::before { position: absolute; left: 50%; transform: translateX(-50%); top: 0; z-index: 3; }
  .cookie { bottom: calc(var(--tabbar) + var(--sab) + 10px); left: 10px; right: 10px; }
  .toast { bottom: calc(var(--tabbar) + var(--sab) + 14px); max-width: calc(100% - 32px); text-align: center; }
  body.reading .toast { bottom: calc(80px + var(--sab)); }
  .drawer { width: 100%; max-width: 360px; padding-bottom: calc(22px + var(--sab)); }

  /* accueil */
  .hero { padding-top: 12px; }
  .hero-track { height: 440px; }
  .hero-info h2 { font-size: 26px; }
  .section { padding-top: 22px; }
  .section-head h3 { font-size: 18px; }
  .promo { margin-top: 20px; }
  .to-top { margin: 28px auto 34px; }

  /* fiche série */
  .series-hero { padding: 20px 0 18px; }
  .series-hero .wrap { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: start; }
  .series-hero .wrap > .cover { max-width: none; grid-column: 1; grid-row: 1 / span 2; }
  .series-hero .wrap > div:last-child { display: contents; }
  .series-hero .tags { grid-column: 2; grid-row: 1; margin-top: 0; align-self: end; }
  .series-hero h1 { grid-column: 2; grid-row: 2; margin-top: 0 !important; font-size: 24px; align-self: start; }
  .series-hero .by, .series-hero .syn, .series-hero .stats, .series-cta { grid-column: 1 / -1; }
  .series-hero .by { margin-top: 0; font-size: 12.5px; }
  .series-hero .syn { margin-top: 2px; font-size: 14px; }
  .stats { margin-top: 4px; gap: 16px; }
  .series-cta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 6px; }
  .series-cta .btn { justify-content: center; padding: 13px 16px; min-width: 0; }
  .series-cta .btn-accent { grid-column: 1 / -1; font-size: 16px; }
  .series-cta .btn-outline { font-size: 12.5px; white-space: normal; line-height: 1.25; text-align: center; padding: 10px 14px; }
  .series-cta .btn-outline svg { flex-shrink: 0; }
  #favBtn span { display: none; }
  .ep { grid-template-columns: 76px 1fr auto; gap: 12px; padding: 10px 2px; }
  .ep h5 { font-size: 13.5px; }
  .price-col { font-size: 11px; }
  .price-col b { font-size: 12.5px; }

  /* VIP */
  .vip { padding-top: 30px; }
  .vip-head p { font-size: 12px; }
  .vip-plans { margin-top: 26px; gap: 14px; }
  .vplan { padding: 20px 18px; }
  .vplan.best { order: -1; }
  .save-pill.ghost { display: none; }
  .vplan h3 { font-size: 26px; margin-top: 12px; }
  .vplan .old { margin-top: 14px; }
  .vplan .price { font-size: 40px; }
  .vplan ul { margin: 16px 0 18px; }
  .coins { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* lecteur */
  .rd-bottom { width: calc(100% - 20px); bottom: calc(10px + var(--sab)); }
  .rd-bottom button { padding: 0 10px; font-size: 12.5px; }
  .rd-bottom button[data-sheet] span { display: none; }
  .rd-sheet { top: auto; left: 0; right: 0; width: 100%; max-width: none; height: 78vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .rd-sheet .sh-head { padding-top: 12px; }
  .next-card { grid-template-columns: 84px 1fr 36px; }

  /* divers */
  .footer { padding-bottom: 24px; }
  .footer-brand p { font-size: 11.5px; }
  .page-title { font-size: 25px; margin-top: 20px; }
  .chips { margin: 16px 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button, .chips a { flex-shrink: 0; }
  .day-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; }
  .day-tabs::-webkit-scrollbar { display: none; }
  .day-tabs button { flex-shrink: 0; }
  .search-results { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (max-width: 380px) {
  .logo { font-size: 17px; }
  .lang-mini { display: none; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
/* tablette : 3 colonnes au lieu de 2 */
@media (min-width: 481px) and (max-width: 680px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .row-scroller { grid-auto-columns: 28%; }
}
