:root {
  --bg: #121218;
  --surface: #1C1C25;
  --surface-2: #26262F;
  --line: #2A2A35;
  --line-strong: #34343F;
  --text: #EDEDF2;
  --text-2: #D4D4DE;
  --muted: #A3A3B5;
  --accent: #E6CF9F;
  --accent-ink: #2A2110;
  --accent-soft: #2E2A22;
  --accent-light: #F2E3C2;
  --danger: #FF9A85;
  --ok: #7EE2B4;
  --radius: 16px;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
}
a { color: var(--accent); }
a:hover { color: var(--accent-light); }
h1, h2 { margin: 0; font-weight: 400; }
h1 { font-family: var(--serif); font-size: 32px; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Mise en page ---------- */
.app { min-height: 100vh; }
.sidebar { display: none; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  background: rgba(18, 18, 24, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.content {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.logo { font-family: var(--serif); font-size: 28px; color: var(--text); text-decoration: none; letter-spacing: .2px; }
.logo span { color: var(--accent); }
.logo:hover { color: var(--text); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: #17171F;
  border-top: 1px solid var(--line);
  padding: 8px 4px calc(10px + env(safe-area-inset-bottom));
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500;
  min-height: 44px;
}
.bottomnav__ico { display: flex; align-items: center; justify-content: center; width: 64px; height: 32px; border-radius: 16px; }
.bottomnav a.is-active { color: var(--text); font-weight: 600; }
.bottomnav a.is-active .bottomnav__ico { background: var(--accent-soft); color: var(--accent); }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 28px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 28px 16px;
    border-right: 1px solid var(--line);
  }
  .sidebar > .logo { padding: 0 12px; font-size: 32px; }
  .topbar, .bottomnav { display: none; }
  .content { padding: 36px 32px 64px; }
}

.sidenav { display: flex; flex-direction: column; gap: 4px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 14px; border-radius: 22px;
  color: var(--text-2); text-decoration: none; font-size: 15px;
}
.sidenav a:hover { background: var(--surface); color: var(--text); }
.sidenav a.is-active { background: var(--accent-soft); color: var(--accent-light); font-weight: 600; }
.legend { display: flex; flex-direction: column; gap: 2px; }
.legend__title { padding: 0 14px 6px; font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.legend a { display: flex; align-items: center; padding: 8px 14px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14px; }
.legend a:hover { background: var(--surface); color: var(--text); }
.sidebar__me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--muted); font-size: 14px; }

/* Pages hors connexion */
.bare { max-width: 440px; margin: 0 auto; padding: 48px 16px; display: flex; flex-direction: column; gap: 20px; }
.bare__logo { text-align: center; }
.bare__logo .logo { font-size: 40px; }

/* ---------- Éléments ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; }
.card--form { display: flex; flex-direction: column; gap: 14px; }
.card--form h1 { font-size: 28px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head--row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; min-height: 32px; }
.backlink:hover { color: var(--text); }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 22px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font: 600 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #4A4A58; color: var(--text); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-light); border-color: var(--accent-light); color: var(--accent-ink); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--wide { width: 100%; }
.btn--icon { min-width: 44px; padding: 0 10px; }
.btn--play { width: 60px; height: 60px; border-radius: 30px; padding: 0; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--play:hover { background: var(--accent-light); color: var(--accent-ink); }

.badge { display: inline-block; padding: 4px 11px; border-radius: 13px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.status--ok { color: var(--ok); }
.status--wait { color: var(--accent); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 14px; font-weight: 600;
}
.avatar--sm { width: 30px; height: 30px; font-size: 12px; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; }

.flash { padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-light); border: 1px solid #4A4231; }
.flash--error { background: #3A201C; color: #FFC2B5; border-color: #5A3028; }
.flash[hidden] { display: none; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.form--inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
input, textarea, select {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: #15151C; color: var(--text);
  font: 400 15px var(--sans);
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
input:disabled { color: var(--muted); }
input.num { width: 72px; min-height: 36px; padding: 6px 10px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
fieldset { border: 0; margin: 0; }
legend { padding: 0; margin-bottom: 4px; font-size: 17px; font-weight: 600; float: left; width: 100%; }
legend + * { clear: both; }

/* ---------- Fil ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; flex: none;
  min-height: 38px; padding: 0 14px; border-radius: 19px;
  border: 1px solid var(--line-strong); color: var(--text-2);
  text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: #4A4A58; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip__n { margin-left: 8px; font-size: 12px; opacity: .7; }
.feed { display: flex; flex-direction: column; gap: 12px; }
.trackcard { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; transition: background .15s; }
.trackcard:hover { background: #22222C; color: inherit; }
.trackcard__head { display: flex; align-items: center; gap: 12px; }
.trackcard__author { font-size: 14px; font-weight: 500; }
.trackcard__head .grow > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 960px) { .chips { flex-wrap: wrap; overflow: visible; } }
.trackcard__title { font-family: var(--serif); font-size: 22px; line-height: 1.2; }
.trackcard__meta { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.miniwave { display: flex; align-items: center; gap: 2px; height: 36px; }
.miniwave span { flex: 1; min-width: 2px; border-radius: 2px; background: #4A4A58; }
.trackcard:hover .miniwave span { background: #5C5C6C; }
.miniwave--empty { background: repeating-linear-gradient(90deg, #2E2E38 0 3px, transparent 3px 5px); height: 6px; margin: 15px 0; border-radius: 3px; }

/* ---------- Page morceau ---------- */
.trackpage { display: flex; flex-direction: column; gap: 16px; }
.trackpage__head { display: flex; flex-direction: column; gap: 10px; }
.trackpage__head h1 { font-size: 34px; }
.trackpage__by { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.versions { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.versions::-webkit-scrollbar { display: none; }
.versions a {
  display: inline-flex; align-items: center; flex: none;
  min-height: 40px; padding: 0 14px; border-radius: 20px;
  border: 1px solid var(--line-strong); color: var(--text-2); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.versions a.is-active { background: var(--accent-soft); border-color: #4A4231; color: var(--accent-light); font-weight: 600; }
.player { display: flex; flex-direction: column; gap: 14px; }
.wave { display: block; width: 100%; height: 96px; cursor: pointer; touch-action: none; }
.wave--preview { height: 72px; cursor: default; }
.wave[hidden] { display: none; }
.player__bar { display: flex; align-items: center; justify-content: center; gap: 14px; }
.player__time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 92px; }
.player__time [data-time] { color: var(--accent-light); }
.trackpage__about { color: var(--text-2); }

.comments { display: flex; flex-direction: column; gap: 12px; }
.commentform { display: flex; flex-direction: column; gap: 10px; }
.commentform textarea { background: #15151C; }
.commentform__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--text-2); }
.commentform__foot [data-at-label] { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.comment { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 14px; padding: 12px 14px; }
.comment__head { font-size: 14px; }
.comment__body { color: var(--text-2); overflow-wrap: anywhere; }
.stamp {
  flex: none; min-width: 54px; min-height: 30px; padding: 0 8px; border-radius: 15px;
  border: 0; background: var(--accent-soft); color: var(--accent);
  font: 600 13px var(--sans); font-variant-numeric: tabular-nums; cursor: pointer;
}
.stamp:hover { background: #3A3428; }
.stamp--none { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--muted); cursor: default; }
.manage { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Publication ---------- */
.dropzone {
  position: relative; display: flex !important; align-items: center; justify-content: center;
  min-height: 120px; padding: 20px; text-align: center;
  border: 1.5px dashed #4A4A58; border-radius: 14px; cursor: pointer;
  font-weight: 400 !important;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.aicats { display: flex; flex-direction: column; gap: 10px; }
.aicat { flex-direction: row !important; }
.aicat input { position: absolute; opacity: 0; }
.aicat__box {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-strong); cursor: pointer; font-weight: 400;
}
.aicat input:checked + .aicat__box { border-color: var(--c); background: #20202A; }
.aicat input:focus-visible + .aicat__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress[hidden] { display: none; }
.progress__bar { width: 0; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- Listes (invitations, administration) ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list h2 { margin: 8px 0 4px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 12px 14px; }
.row--wrap { flex-wrap: wrap; }
.row.is-off { opacity: .6; }
.row form { display: flex; align-items: center; gap: 8px; }
.row form.inline label { flex-direction: row; align-items: center; gap: 8px; display: flex; }
.copyline { display: flex; gap: 8px; flex-wrap: wrap; }
.copyline input { flex: 1 1 240px; font-size: 14px; }
.invite-done { border: 1px solid #4A4231; display: flex; flex-direction: column; gap: 10px; }
.profile { display: flex; align-items: center; gap: 16px; }
.profile__name { font-family: var(--serif); font-size: 24px; }
