* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; padding: 16px; max-width: 640px; margin-inline: auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px; color: #1a1a1a; background: #fafafa;
}
h1 { font-size: 26px; margin: 8px 0 16px; }
h1 small { font-size: 15px; color: #666; font-weight: normal; }
h2 { font-size: 22px; margin: 8px 0 12px; }
header { display: flex; justify-content: space-between; align-items: center; }

label { display: block; margin: 0 0 14px; font-weight: 600; }
input, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  font-size: 18px; border: 1px solid #bbb; border-radius: 8px; background: #fff;
}
textarea { font-family: inherit; }
#search { margin: 12px 0 16px; }

.btn {
  min-height: 54px; padding: 12px 18px; font-size: 18px; font-weight: 600;
  border: 1px solid #bbb; border-radius: 10px; background: #fff; color: #1a1a1a;
  cursor: pointer; flex: 1;
}
.btn.primary { background: #1565c0; border-color: #1565c0; color: #fff; }
.btn.danger { background: #fff; border-color: #c62828; color: #c62828; }
.btn.link, .link { background: none; border: none; color: #1565c0; font-size: 16px; cursor: pointer; }
.row { display: flex; gap: 10px; margin: 8px 0; }
.row input { margin-top: 0; }
.msg { color: #c62828; min-height: 1.4em; margin: 8px 0; }

.overlay {
  position: fixed; inset: 0; overflow: auto; padding: 16px;
  background: #fafafa; z-index: 10; max-width: 640px; margin-inline: auto;
}
.overlay.center { display: flex; align-items: center; justify-content: center; font-size: 22px; }
#reader { width: 100%; background: #000; border-radius: 10px; overflow: hidden; }

/* Liste de la collection */
.group { margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 2px solid #1565c0; font-size: 20px; font-weight: 700; }
.group small { color: #666; font-weight: normal; font-size: 15px; }
.album {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 8px; margin: 6px 0; background: #fff; border: 1px solid #ddd; border-radius: 10px; cursor: pointer;
  font: inherit; color: inherit;
}
.album .title { font-weight: 600; }
.album .year { color: #666; font-size: 15px; }
.empty { color: #666; text-align: center; margin: 40px 0; }

/* Pochettes */
.cover {
  position: relative; flex: none; display: flex; align-items: center; justify-content: center;
  background: #e0e0e0; border-radius: 6px; overflow: hidden; font-size: 28px;
}
.cover.small { width: 56px; height: 56px; }
.cover.big { width: 220px; height: 220px; margin: 0 auto 12px; font-size: 80px; border-radius: 10px; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Fiche d'un album */
.card { text-align: center; }
.card .artist { font-size: 19px; margin: 0 0 4px; }
.card .small { color: #666; font-size: 14px; margin: 0 0 12px; }
.tracks { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; }
.tracks li { display: flex; gap: 10px; padding: 8px 6px; border-bottom: 1px solid #e5e5e5; }
.tracks .n { color: #666; min-width: 2.2em; text-align: right; }
.tracks .t { flex: 1; }
.tracks .dur { color: #666; }

/* Emplacement (case du rangement) */
.loc label { flex: 1; }
select {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  font-size: 18px; border: 1px solid #bbb; border-radius: 8px; background: #fff;
}
.badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px;
  background: #1565c0; color: #fff; font-size: 14px; font-weight: 700;
}

/* Onglets Résumé / Ma liste */
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab {
  flex: 1; min-height: 48px; font-size: 18px; font-weight: 600; cursor: pointer;
  background: #fff; color: #1565c0; border: 2px solid #1565c0; border-radius: 10px;
}
.tab.active { background: #1565c0; color: #fff; }

/* Résumé */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.tile { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 14px; text-align: center; color: #666; }
.tile b { display: block; font-size: 32px; color: #1565c0; }
#resume h3 { font-size: 18px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #1565c0; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-row .lbl { flex: none; width: 110px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar { flex: 1; height: 18px; background: #e0e0e0; border-radius: 4px; overflow: hidden; }
.bar-row .bar div { height: 100%; background: #1565c0; }
.bar-row .val { flex: none; width: 36px; text-align: right; font-weight: 600; }
.facts { padding-left: 20px; }
.facts li { margin: 8px 0; }

/* En-tête d'artiste dans la liste */
.group { background: #e3ecf7; padding: 8px 10px; border-radius: 8px; border-bottom: none; }
.loc label { min-width: 0; }

/* Boutons d'écoute (liens vers les applis de musique) */
.listen a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* Mise à jour depuis internet */
#detail-refresh { width: 100%; margin: 8px 0; }
#refresh-all { width: 100%; }
.progress { color: #1565c0; min-height: 1.4em; margin: 8px 0; }
