/* AIOS Audiollibres: dark, calm, thumb-friendly. No framework, no build step. */
:root {
  --bg: #0b0b12;
  --bg-soft: #14141f;
  --bg-card: #191926;
  --line: #262636;
  --fg: #ecedf5;
  --muted: #9394a8;
  --accent: #6366f1;
  --accent-2: #f59e0b;
  --ok: #22c55e;
  --err: #ef4444;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           calc(env(safe-area-inset-bottom) + 8px) env(safe-area-inset-left);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
.strong { font-weight: 650; }
.error { color: var(--err); font-size: 14px; }
.view { max-width: 1100px; margin: 0 auto; padding: 16px; }
.center { min-height: 86vh; display: flex; flex-direction: column;
          align-items: center; justify-content: center; gap: 18px; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; color: var(--fg); background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px;
  cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 8px; transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: transparent; }
.btn.danger { background: transparent; color: var(--err); border-color: #4a2230; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.tiny { padding: 4px 10px; font-size: 12px; }
.btn.round { width: 58px; height: 58px; padding: 0; justify-content: center;
             border-radius: 50%; font-size: 15px; }
.btn.round.play { width: 74px; height: 74px; font-size: 26px; background: var(--accent);
                  border-color: transparent; }
input[type=password], input[type=text] {
  font: inherit; color: var(--fg); background: var(--bg-soft); width: 100%;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
select.rate {
  font: inherit; color: var(--fg); background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px;
}

/* Login */
.card { background: var(--bg-card); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 28px; width: min(380px, 92vw); }
.card.login { display: flex; flex-direction: column; gap: 14px; text-align: center; }
.card.login form { display: flex; flex-direction: column; gap: 12px; }
.logo { font-size: 26px; font-weight: 750; letter-spacing: -.5px; }

/* Profiles */
.who { font-weight: 650; font-size: 30px; margin: 0; }
.profiles { display: flex; gap: 34px; flex-wrap: wrap; justify-content: center; }
.profile { display: flex; flex-direction: column; align-items: center; gap: 10px;
           background: none; border: 0; color: var(--fg); cursor: pointer; }
.profile .disc {
  width: 124px; height: 124px; border-radius: 22px; display: grid; place-items: center;
  font-size: 48px; font-weight: 750; color: #0b0b12;
  border: 3px solid transparent; transition: border-color .15s, transform .15s;
}
.profile:hover .disc { border-color: var(--fg); transform: translateY(-3px); }
.profile .pname { font-weight: 600; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between;
          gap: 12px; margin-bottom: 14px; }
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 12px; border: 0; cursor: pointer;
          font-weight: 750; color: #0b0b12; font-size: 18px; }

/* Dropzone + banners */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted);
  padding: 18px; text-align: center; margin-bottom: 14px; font-size: 14.5px;
}
.dropzone.hot { border-color: var(--accent); color: var(--fg); background: #1a1a2b; }
.banner { background: var(--bg-card); border: 1px solid var(--line);
          border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14.5px; }
.empty { text-align: center; padding: 30px 0; }

/* Library grid */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { background: none; border: 0; padding: 0; color: var(--fg); cursor: pointer;
        text-align: left; display: flex; flex-direction: column; gap: 8px; }
.cover {
  aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; position: relative;
  display: grid; place-items: end start; padding: 12px; font-weight: 700;
  background: linear-gradient(145deg, #2a2a44, #15151f);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .ctitle { position: relative; font-size: 14px; line-height: 1.25;
                 text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.cover.big { width: 180px; aspect-ratio: 2 / 3; flex: 0 0 auto; }
.tile .tname { font-size: 14px; font-weight: 600; line-height: 1.25; }
.badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700;
         padding: 3px 8px; border-radius: 999px; background: #000a; backdrop-filter: blur(4px); }
.badge.ok { background: #14532daa; color: #bbf7d0; }
.badge.work { background: #3730a3aa; color: #ddd6fe; }
.badge.wait { background: #78350faa; color: #fde68a; }
.badge.err { background: #7f1d1daa; color: #fecaca; }
.pos-bar { height: 4px; border-radius: 999px; background: #ffffff22; overflow: hidden; }
.pos-bar > i { display: block; height: 100%; background: var(--accent-2); }

/* Book detail */
.book-head { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.book-meta { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; }
.book-meta h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badges span { font-size: 12.5px; color: var(--muted); background: var(--bg-soft);
               border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Player */
.player { background: var(--bg-card); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.seek { width: 100%; accent-color: var(--accent); }
.times { display: flex; justify-content: space-between; color: var(--muted);
         font-size: 13px; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 16px;
            margin: 10px 0 14px; }
.offline-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
               border-top: 1px solid var(--line); padding-top: 12px; }

/* Convert box */
.convert-box { background: linear-gradient(160deg, #1d1d3a, #15151f);
               border: 1px solid var(--line); border-radius: var(--radius);
               padding: 18px; margin-bottom: 18px; }
.convert-box h3 { margin: 0 0 8px; }
.prog { height: 8px; border-radius: 999px; background: #ffffff18; overflow: hidden;
        margin: 12px 0 6px; }
.prog > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }

/* Chapters + preview */
.chapters h3 { margin: 0 0 8px; }
.chapters ul { list-style: none; margin: 0; padding: 0; }
.chapters li { border-bottom: 1px solid var(--line); }
.chapters button { width: 100%; text-align: left; background: none; border: 0;
                   color: var(--fg); font: inherit; padding: 12px 4px; cursor: pointer;
                   display: flex; justify-content: space-between; gap: 12px; }
.chapters button:hover { color: var(--accent-2); }
.chapters .cs { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.preview { margin: 18px 0 40px; color: var(--muted); }
.preview summary { cursor: pointer; }
.preview-nav { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.preview pre { white-space: pre-wrap; background: var(--bg-soft); border: 1px solid var(--line);
               border-radius: 12px; padding: 14px; max-height: 50vh; overflow: auto;
               font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg); }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%);
         bottom: calc(18px + env(safe-area-inset-bottom)); background: #000d;
         border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px;
         font-size: 14px; z-index: 50; backdrop-filter: blur(6px); }

@media (max-width: 560px) {
  .cover.big { width: 132px; }
  .book-meta h2 { font-size: 20px; }
  .profile .disc { width: 96px; height: 96px; font-size: 38px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
}
