/* Son Du Quartier — minimal, mobile first. */
:root {
  --bg: #f6f2eb;
  --surface: #fffdf9;
  --ink: #1f1c18;
  --muted: #7d766c;
  --line: #e6dfd4;
  --accent: #d22129;            /* le rouge du logo */
  --accent-ink: #fff;
  --wave: #d9d1c4;
  --wave-played: #d22129;
  --dim: 0.32;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 8px 24px -12px rgba(40, 30, 20, .18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512;
    --surface: #211e1a;
    --ink: #f2ede5;
    --muted: #9c948a;
    --line: #322d27;
    --accent: #ea4a50;
    --wave: #3a342d;
    --wave-played: #ea4a50;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.page { max-width: 640px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }

/* header */
.top { display: flex; align-items: center; gap: 10px; padding: 18px 0 8px; min-height: 64px; }
.top .grow { flex: 1; min-width: 0; }
.brand { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { font-size: 30px; line-height: 1.1; margin: 2px 0 0; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  color: var(--muted); border: 1px solid var(--line); background: var(--surface); flex: none;
}
.icon-btn:hover { color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* song list */
.songs { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.songs li { min-width: 0; }
.song {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.song:active { transform: scale(.985); }
.song .n { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.song .t { flex: 1; min-width: 0; }
.song .title { display: block; font-weight: 650; font-size: 17px; }
.song .meta { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.song .go { color: var(--muted); }
.song .go svg { width: 18px; height: 18px; display: block; }
.foot { margin-top: 36px; text-align: center; color: var(--muted); font-size: 13px; }
.foot button { text-decoration: underline; color: var(--muted); }

/* transport */
.transport { display: flex; align-items: center; gap: 16px; margin: 14px 0 18px; }
.play {
  width: 68px; height: 68px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: var(--shadow); flex: none; transition: transform .12s ease, opacity .2s;
}
.play:active { transform: scale(.95); }
.play[disabled] { opacity: .45; cursor: default; }
.play svg { width: 28px; height: 28px; }
.time { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; letter-spacing: .01em; }
.time .tot { color: var(--muted); font-weight: 400; }
.status { color: var(--muted); font-size: 13px; min-height: 1.2em; }
.restart { margin-left: auto; }

/* tracks */
.tracks { display: grid; gap: 10px; }
.track {
  position: relative; height: 84px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden; user-select: none; -webkit-user-select: none;
  touch-action: pan-y; transition: opacity .2s;
}
.track.off .wave { opacity: var(--dim); }
.track.off .name { color: var(--muted); }
.wave { position: absolute; inset: 0; transition: opacity .2s; }
.wave canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.wave .played { clip-path: inset(0 100% 0 0); }
.cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .55; left: 0; pointer-events: none; }
.track .name {
  position: absolute; left: 12px; top: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; pointer-events: none; text-shadow: 0 0 6px var(--surface), 0 0 2px var(--surface);
}
.track .btns { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; gap: 6px; }
.tbtn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.tbtn svg { width: 19px; height: 19px; }
.tbtn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.note { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent); color: var(--muted); font-size: 14px; white-space: pre-line; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }

/* loading bar */
.loading { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: -8px 0 14px; }
.loading i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }

/* info dialog */
dialog.info { border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 20px 22px; max-width: min(92vw, 380px); box-shadow: var(--shadow); }
dialog.info::backdrop { background: rgba(20, 15, 10, .35); backdrop-filter: blur(2px); }
dialog.info p { margin: 0 0 10px; font-size: 15px; }
dialog.info p:last-of-type { margin-bottom: 0; }
dialog.info b { font-weight: 650; }
dialog.info .k { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); vertical-align: -5px; margin-right: 2px; }
dialog.info .k svg { width: 13px; height: 13px; }
dialog.info form { margin-top: 14px; text-align: right; }
dialog.info form button { color: var(--accent); font-weight: 650; padding: 6px 10px; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: 100%; max-width: 360px; text-align: center; }
.login h1 { font-size: 26px; margin: 8px 0 24px; }
.login input {
  width: 100%; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-align: center; outline: none;
}
.login input:focus { border-color: var(--accent); }
.login .submit { margin-top: 12px; width: 100%; padding: 14px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 17px; }
.login .err { color: var(--accent); font-size: 14px; min-height: 1.4em; margin-top: 10px; }
.login .logo { display: block; width: min(78%, 280px); height: auto; margin: 0 auto 10px; color: var(--ink); }
.login .brand { margin-bottom: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
