/* ============================================================
   TRACK_05 LA RADIO, site v1 (novembre 2026)
   Un bureau d'ordinateur des années 90 dans la grammaire v4 :
   bleu électrique, papier, encre, Archivo 900 et Plex Mono.
   Les pixels viennent des icônes, du LCD et des ombres dures.
   ============================================================ */

@font-face { font-family: "Arch"; src: url("assets/fonts/archivo.ttf"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Mono"; src: url("assets/fonts/plexmono.ttf"); font-display: swap; }

:root {
  --blue:  #0019FF;
  --blue-d:#0012B8;
  --black: #0A0A0A;
  --paper: #ECEBE5;
  --paper-d:#CFCDC4;
  --ink:   #111111;
  --red:   #FF2D2D;
  --flash: #FF8A1F;
  --white: #FFFFFF;
  --lcd:   #FF8A1F;
  --shadow: 4px 4px 0 var(--black);
  --mono: "Mono", ui-monospace, monospace;
  --pixel: "Silkscreen", "Mono", monospace;
  --bar-h: 30px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  background-color: var(--blue);
  /* trame de bureau : points d'un pixel */
  background-image: radial-gradient(rgba(0, 0, 0, .22) 1px, transparent 1.4px);
  background-size: 4px 4px;
  color: var(--ink);
  font-family: var(--mono);
  isolation: isolate;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  /* fond d'écran choisi dans Fond.cpl (app.js), le tunnel du Baladeur par défaut */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--wall,
    radial-gradient(rgba(0, 0, 0, .28) 1px, transparent 1.4px) 0 0 / 4px 4px,
    linear-gradient(rgba(0, 25, 255, .42), rgba(0, 25, 255, .42)),
    url("assets/tunnel.jpg") center 62% / cover no-repeat);
}
/* fonds clairs : les étiquettes des icônes passent à l'encre */
.wall-light .icon { color: var(--ink); }
.wall-photo .icon-label { background: var(--black); }
.wall-light .icon:hover .icon-label, .wall-light .icon:focus-visible .icon-label { color: var(--white); }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* curseurs pixel nets : 1 pixel du dessin = 1 px CSS, soit 2 pixels d'écran sur Retina */
@media (pointer: fine) {
  body {
    cursor: url("assets/cursors/arrow.png") 0 0, auto;
    cursor: -webkit-image-set(url("assets/cursors/arrow.png") 1x, url("assets/cursors/arrow@2x.png") 2x) 0 0, auto;
    cursor: image-set(url("assets/cursors/arrow.png") 1x, url("assets/cursors/arrow@2x.png") 2x) 0 0, auto;
  }
  a, button, label, select, input[type="range"], input[type="file"], [role="radio"], [role="menuitem"] {
    cursor: url("assets/cursors/hand.png") 7 0, pointer;
    cursor: -webkit-image-set(url("assets/cursors/hand.png") 1x, url("assets/cursors/hand@2x.png") 2x) 7 0, pointer;
    cursor: image-set(url("assets/cursors/hand.png") 1x, url("assets/cursors/hand@2x.png") 2x) 7 0, pointer;
  }
  input[type="text"], textarea { cursor: text; }
  button:disabled { cursor: not-allowed; }
}

.mono-s { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.muted { opacity: .55; }
.display { font-family: "Arch", sans-serif; font-weight: 900; text-transform: uppercase; line-height: .85; letter-spacing: -.01em; }

/* ---------- écran de démarrage ---------- */
.boot {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center;
  background: var(--black); color: var(--paper);
  transition: opacity .25s steps(4);
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-inner { display: grid; justify-items: center; gap: 14px; }
.boot-logo { width: 220px; filter: invert(1); }
.win.opening { animation: winopen .2s steps(4); }
@keyframes winopen { from { clip-path: inset(40% 30% 40% 30%); } to { clip-path: inset(0); } }

.boot-name { font-family: var(--pixel); font-size: 14px; letter-spacing: .1em; }
.boot-bar { width: 180px; height: 12px; border: 2px solid var(--paper); padding: 2px; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--paper); animation: boot 1.1s steps(12) forwards; }
.boot-log { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; opacity: .6; min-height: 1.4em; }
@keyframes boot { to { width: 100%; } }

/* ---------- barre de menus ---------- */
.menubar {
  position: sticky; top: 0; z-index: 1200; /* toujours devant les fenêtres, menus déroulants compris */
  display: flex; align-items: center; gap: 14px;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: var(--paper);
  border-bottom: 2px solid var(--black);
  font-size: 12px;
}
.menubar-logo { display: flex; align-items: center; height: 100%; padding: 0 6px; margin-left: -6px; }
.menubar-logo img { height: 14px; width: auto; display: block; }
.menubar-logo:hover, .menubar-logo:focus-visible { background: var(--black); outline: 0; }
.menubar-logo:hover img, .menubar-logo:focus-visible img { filter: invert(1); }
/* menus déroulants façon Mac OS 9 */
.menubar-nav { display: flex; gap: 2px; height: 100%; }
.menu { position: relative; display: flex; align-items: center; }
.menu-btn { padding: 3px 9px; }
.menu-btn:hover, .menu-btn:focus-visible, .menu-btn[aria-expanded="true"] { background: var(--blue); color: var(--white); outline: 0; }
.menu-pop {
  position: absolute; left: 0; top: calc(100% + 2px); z-index: 1100; min-width: 200px; padding: 4px 0;
  background: var(--paper); border: 2px solid var(--black); box-shadow: var(--shadow);
}
.menu-pop button { display: block; width: 100%; text-align: left; padding: 6px 14px; font-size: 12px; white-space: nowrap; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--blue); color: var(--white); outline: 0; }
.menubar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.onair { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .08em; opacity: .4; }
.onair i { width: 8px; height: 8px; background: var(--ink); }
.onair.live { opacity: 1; }
.onair.live i { background: var(--red); animation: blink 1s steps(2) infinite; }
/* réseaux sociaux : petites icônes de la barre de menus, comme une zone de notification */
.tray { display: flex; align-items: center; gap: 2px; padding-right: 10px; margin-right: -4px; border-right: 1px dotted rgba(0, 0, 0, .35); }
.tray-ico { display: grid; place-items: center; width: 24px; height: 22px; }
.tray-ico .px { width: 16px; height: 16px; }
.tray-ico:hover, .tray-ico:focus-visible { background: var(--black); outline: 0; }
.tray-ico:hover svg, .tray-ico:focus-visible svg { filter: invert(1); }
.sound { display: flex; align-items: center; gap: 5px; font-family: var(--pixel); font-size: 10px; padding: 2px 4px; }
.sound .px { width: 16px; height: 16px; }
.sound[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.sound:hover { background: var(--black); color: var(--paper); }
.sound:hover .px svg { filter: invert(1); }
.clock { font-variant-numeric: tabular-nums; }
.install { padding: 2px 8px; background: var(--black); color: var(--paper); font-size: 11px; letter-spacing: .04em; }
.install:hover { background: var(--blue); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- bureau ---------- */
.desktop {
  isolation: isolate; /* les z-index des fenêtres grimpent à chaque clic : on les garde sous la barre de menus */
  position: relative;
  display: grid;
  grid-template-columns: 92px 400px minmax(380px, 540px) 340px;
  grid-template-areas: "icons c1 c2 c3";
  align-items: start;
  gap: 28px;
  padding: 28px 24px 48px;
  min-height: calc(100dvh - var(--bar-h));
}
.icons { grid-area: icons; list-style: none; display: grid; gap: 14px; justify-items: center; }
/* grille fixe, comme un vrai bureau : chaque icône occupe la même case, le nom ne peut pas l'élargir */
.icon {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; gap: 6px;
  width: 100px; padding: 6px 0; color: var(--white); text-decoration: none;
}
.icon .px { width: 40px; height: 40px; }
.icon-label {
  max-width: 100%; font-family: var(--pixel); font-size: 10px; letter-spacing: .02em; padding: 1px 4px; line-height: 1.3; text-align: center;
  overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.icon:hover .icon-label, .icon:focus-visible .icon-label { background: var(--black); outline: 0; }
.icon:focus-visible { outline: 0; }
.icon:active .px { filter: invert(1); }
.px svg { width: 100%; height: 100%; display: block; }

/* ---------- fenêtres ---------- */
.win {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--black);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-width: 0;
}
.win.floating { position: absolute; z-index: 20; }
.win.front { z-index: 30; }
.col { display: grid; gap: 28px; align-content: start; min-width: 0; }
.col-1 { grid-area: c1; }
.col-2 { grid-area: c2; }
.col-3 { grid-area: c3; }
.win-about { position: absolute; z-index: 40; left: 50%; top: 80px; width: min(440px, calc(100vw - 32px)); transform: translateX(-50%); }
.win-about.floating { transform: none; }

.win-bar {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: 24px; border-bottom: 2px solid var(--black);
  /* rayures de barre de titre */
  background: repeating-linear-gradient(to bottom, var(--paper) 0 2px, var(--black) 2px 3px);
  background-clip: content-box; padding: 4px 4px;
  user-select: none; touch-action: none;
}
.win-title {
  font-family: var(--pixel); font-weight: 400; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--paper); padding: 0 10px; line-height: 16px;
}
@media (min-width: 821px) {
  .win:not(.front) .win-bar { background: var(--paper); }
}
.win-close {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border: 2px solid var(--black); background: var(--paper);
  box-shadow: 0 0 0 2px var(--paper);
}
.win-close:hover { background: var(--black); }
.win-close:active { background: var(--blue); }
.win-body { padding: 14px; }
.win-status {
  display: flex; justify-content: space-between; gap: 10px;
  border-top: 2px solid var(--black); padding: 4px 10px;
  font-family: var(--pixel); font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; background: var(--paper); text-decoration: none;
  border: 2px solid var(--black); box-shadow: 2px 2px 0 var(--black);
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
}
.btn:hover { background: var(--white); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- radio ---------- */
.lcd {
  background: var(--black); color: var(--lcd);
  border: 2px solid var(--black);
  box-shadow: inset 0 0 0 2px #1d1d1d;
  padding: 10px 12px;
  font-family: var(--pixel); font-size: 11px; letter-spacing: .06em;
  position: relative; overflow: hidden;
}
.lcd::after {
  /* lignes de balayage */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px);
}
.lcd-top, .lcd-bottom { display: flex; justify-content: space-between; gap: 10px; text-transform: uppercase; }
.lcd-top { opacity: .7; }
.lcd-main { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; margin: 10px 0; align-items: center; }
.cover {
  width: 96px; height: 96px; image-rendering: pixelated;
  background: #1a1a1a; border: 2px solid #2a2a2a;
}
.lcd-text { min-width: 0; display: grid; gap: 4px; }
.marquee { overflow: hidden; white-space: nowrap; text-transform: uppercase; }
.marquee span { display: inline-block; }
.marquee.scroll span { animation: marquee var(--dur, 10s) steps(var(--steps, 80)) infinite; padding-right: 3em; }
#npArtist { color: var(--paper); font-size: 13px; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.eq { display: flex; align-items: end; gap: 2px; height: 22px; margin-top: 4px; }
.eq i { width: 6px; height: 2px; background: var(--lcd); transition: height .12s steps(3); }
.lcd-bottom { color: var(--paper); }
.lcd-bottom #progName { color: var(--lcd); }

.controls { display: flex; align-items: stretch; gap: 12px; margin-top: 14px; }
.btn-play {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 64px; background: var(--blue); color: var(--white);
  border: 2px solid var(--black); box-shadow: var(--shadow);
  font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 125%; font-size: 22px; letter-spacing: -.01em;
}
.btn-play:hover { background: var(--blue-d); }
.btn-play:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-play:focus-visible { outline: 2px dashed var(--black); outline-offset: 4px; }
.glyph { width: 18px; height: 20px; background: var(--white); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.btn-play.playing .glyph { clip-path: none; width: 16px; height: 16px; }
.btn-play.loading .glyph { animation: blink .6s steps(2) infinite; }
.btn-play.playing { background: var(--black); }

/* cœur des favoris, discret, dans l'écran du lecteur */
.lcd-fav {
  position: relative; z-index: 1; align-self: start;
  width: 26px; height: 26px; display: grid; place-items: center;
  opacity: .6;
}
.lcd-fav .px { width: 20px; height: 20px; }
.lcd-fav:hover, .lcd-fav:focus-visible, .lcd-fav[aria-pressed="true"] { opacity: 1; outline: 0; }
.lcd-fav:focus-visible { box-shadow: 0 0 0 1px var(--lcd); }
.lcd-fav.pop .px { animation: pop .3s steps(3); }
@keyframes pop { 50% { transform: scale(1.35); } }
.ios .volume { display: none; }
.volume {
  display: grid; align-content: center; gap: 6px; width: 110px;
  border: 2px solid var(--black); padding: 8px 10px; background: var(--paper);
}
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: repeating-linear-gradient(to right, var(--black) 0 2px, transparent 2px 4px); border: 0; }
input[type="range"]::-moz-range-track { height: 6px; background: repeating-linear-gradient(to right, var(--black) 0 2px, transparent 2px 4px); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 16px; margin-top: -5px; background: var(--blue); border: 2px solid var(--black); border-radius: 0; }
input[type="range"]::-moz-range-thumb { width: 8px; height: 14px; background: var(--blue); border: 2px solid var(--black); border-radius: 0; }
input[type="range"]:focus-visible { outline: 2px dashed var(--black); outline-offset: 2px; }

.block { margin-top: 16px; }
.block-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 2px solid var(--black); padding-bottom: 4px;
}
.block-head span:first-child { font-family: var(--pixel); font-size: 11px; }
.history { list-style: none; counter-reset: h; }
.history li {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: baseline;
  padding: 6px 0; border-bottom: 1px dashed rgba(0, 0, 0, .25);
  counter-increment: h;
}
.history li::before { content: counter(h, decimal-leading-zero); color: var(--red); font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 15px; }
.history li.muted::before { content: none; }
.history .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .t b { font-weight: 600; text-transform: uppercase; }
.history time { font-size: 10px; opacity: .6; }

/* ---------- playlists ---------- */
.pl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 14px; }
.pl {
  display: grid; gap: 8px; text-align: left; padding: 4px;
}
.pl-cover {
  position: relative; aspect-ratio: 1; background: var(--black); border: 2px solid var(--black);
  box-shadow: 3px 3px 0 var(--black); overflow: hidden;
}
.pl-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-cover .ph {
  position: absolute; inset: 0; display: grid; place-items: end start; padding: 8px;
  color: var(--white); font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 26px; line-height: .85; text-transform: uppercase;
}
.pl-name { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; line-height: 1.3; padding: 1px 3px; justify-self: start; }
.pl-meta { font-size: 10px; opacity: .6; text-transform: uppercase; letter-spacing: .06em; padding: 0 3px; }
.pl:hover .pl-name, .pl:focus-visible .pl-name { background: var(--blue); color: var(--white); }
.pl:focus-visible { outline: 0; }
.pl:active .pl-cover { transform: translate(3px, 3px); box-shadow: none; }
.pl-view-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pl-embed iframe { display: block; width: 100%; height: 452px; border: 2px solid var(--black); background: var(--black); }

/* ---------- grille ---------- */
.days { display: flex; border: 2px solid var(--black); margin-bottom: 12px; }
.days button {
  flex: 1; padding: 6px 0; font-size: 11px; letter-spacing: .06em;
  border-right: 2px solid var(--black);
}
.days button:last-child { border-right: 0; }
.days button[aria-selected="true"] { background: var(--black); color: var(--paper); }
.days button.today:not([aria-selected="true"]) { color: var(--blue); font-weight: 600; }
.slots { list-style: none; }
.slots li {
  display: grid; grid-template-columns: 104px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 8px; border-bottom: 1px dashed rgba(0, 0, 0, .25);
}
.slots .h { font-variant-numeric: tabular-nums; font-size: 12px; }
.slots .n { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 72%; font-size: 19px; text-transform: uppercase; line-height: 1; }
.slots .now-tag { font-size: 10px; letter-spacing: .08em; }
.slots li.now { background: var(--blue); color: var(--white); border-bottom-color: transparent; }

/* ---------- visualiseur ---------- */
.visu { display: block; width: 100%; aspect-ratio: 96 / 56; image-rendering: pixelated; background: var(--black); border: 2px solid var(--black); }
.visu-modes { display: flex; gap: 8px; margin-top: 12px; }
.visu-modes .btn { flex: 1; justify-content: center; padding: 5px 4px; font-family: var(--pixel); font-size: 10px; }
.visu-modes .btn[aria-pressed="true"] { background: var(--black); color: var(--paper); box-shadow: none; transform: translate(2px, 2px); }

/* ---------- envoi ---------- */
.envoi { display: grid; gap: 12px; }
.envoi h3 { font-size: 44px; font-stretch: 72%; }
.envoi p { font-size: 13px; line-height: 1.5; }
.stats { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--black); }
.stats div { padding: 8px 10px; }
.stats div + div { border-left: 2px solid var(--black); }
.stats dt { font-family: var(--pixel); font-size: 9px; text-transform: uppercase; opacity: .6; }
.stats dd { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 30px; line-height: 1; color: var(--red); }
.xp { height: 12px; border: 2px solid var(--black); padding: 2px; background: var(--paper); }
.xp span { display: block; height: 100%; background: repeating-linear-gradient(to right, var(--blue) 0 6px, transparent 6px 8px); }
.btn-blue { justify-content: center; padding: 10px 12px; background: var(--blue); color: var(--white); font-family: var(--pixel); font-size: 12px; }
.btn-blue:hover { background: var(--blue-d); }

/* ---------- actions sous le lecteur ---------- */
.radio-actions { display: flex; gap: 8px; margin-top: 12px; }
.radio-actions .btn { flex: 1; justify-content: center; }
#sleepBtn.on { background: var(--black); color: var(--paper); }
.history li { grid-template-columns: 22px 1fr auto 24px; }
/* cœur vide toujours visible, pour qu'on comprenne qu'on peut liker (surtout sur mobile) */
.h-fav { width: 22px; height: 22px; display: grid; place-items: center; align-self: center; opacity: .5; }
.h-fav:hover, .h-fav:focus-visible, .h-fav[aria-pressed="true"], .history li:hover .h-fav { opacity: 1; }
.h-fav .px { width: 16px; height: 16px; }

/* ---------- journal d'antenne ---------- */
.journal { display: grid; gap: 10px; align-content: start; }
.jr-search { width: 100%; padding: 8px 10px; border: 2px solid var(--black); background: var(--white); font-family: var(--mono); font-size: 12px; }
.jr-search:focus { outline: 2px dashed var(--blue); outline-offset: 2px; }
.jr-list { list-style: none; }
.jr-prog {
  position: sticky; top: -14px; z-index: 1; margin-top: 8px; padding: 5px 8px;
  background: var(--black); color: var(--lcd); font-family: var(--pixel); font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
}
.jr-list > .jr-prog:first-child { margin-top: 0; }
.jr-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed rgba(0, 0, 0, .25); }
.jr-row time { font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }
.jr-row .t b, .jr-row .t span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-row .t b { font-weight: 600; font-size: 12px; text-transform: uppercase; }
.jr-row .t span { font-size: 12px; }
.jr-row .links { display: flex; gap: 4px; align-items: center; }
.jr-row .links a { font-family: var(--pixel); font-size: 9px; padding: 3px 5px; border: 2px solid var(--black); text-decoration: none; background: var(--paper); }
.jr-row .links a:hover { background: var(--blue); color: var(--white); }
.jr-empty, .jr-note { font-size: 12px; line-height: 1.5; opacity: .7; }

/* ---------- favoris ---------- */
.favoris { display: grid; gap: 12px; }
.favs { list-style: none; counter-reset: f; }
.favs li {
  display: grid; grid-template-columns: 22px 40px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed rgba(0, 0, 0, .25); counter-increment: f;
}
.favs li::before { content: counter(f, decimal-leading-zero); color: var(--red); font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 15px; }
.favs img, .favs .nocover { width: 40px; height: 40px; border: 2px solid var(--black); image-rendering: pixelated; object-fit: cover; background: var(--black); display: block; }
.favs .t { min-width: 0; }
.favs .t b, .favs .t span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favs .t b { font-weight: 600; text-transform: uppercase; font-size: 12px; }
.favs .t span { font-size: 12px; }
.favs .t small { display: block; font-size: 10px; opacity: .55; margin-top: 2px; }
.favs .links { display: flex; gap: 4px; align-items: center; }
.favs .links a, .favs .links button { font-family: var(--pixel); font-size: 9px; padding: 3px 5px; border: 2px solid var(--black); text-decoration: none; background: var(--paper); }
.favs .links a:hover { background: var(--blue); color: var(--white); }
.favs .links button:hover { background: var(--red); color: var(--white); }
.favs-empty { font-size: 13px; line-height: 1.5; }
.favs-actions { display: flex; gap: 8px; }
.favs-actions .btn { flex: 1; justify-content: center; }

/* ---------- notes ---------- */
.notes { display: grid; gap: 10px; }
.notes-tools { display: flex; gap: 8px; }
.notes-paper {
  width: 100%; min-height: 220px; resize: vertical;
  padding: 2px 10px; border: 2px solid var(--black);
  font-family: var(--mono); font-size: 13px; line-height: 24px; color: var(--ink);
  background: repeating-linear-gradient(to bottom, var(--white) 0 23px, rgba(0, 25, 255, .2) 23px 24px) 0 2px / 100% 24px local;
}
.notes-paper:focus, .notes-name:focus { outline: 2px dashed var(--blue); outline-offset: 2px; }
.notes-name { width: 100%; padding: 8px 10px; border: 2px solid var(--black); background: var(--white); font-family: var(--mono); font-size: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.notes-send { padding: 11px 12px; font-size: 12px; }
.notes-send:disabled { opacity: .5; }
.send-bar { height: 14px; border: 2px solid var(--black); padding: 2px; }
.send-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(to right, var(--blue) 0 8px, transparent 8px 10px); animation: installbar 1.4s steps(12) infinite; }
.notes-msg { font-family: var(--pixel); font-size: 11px; text-transform: uppercase; min-height: 1em; }
.notes-msg.ok { color: var(--blue); }
.notes-msg.err { color: var(--red); }

/* ---------- blind test ---------- */
.blind { display: grid; }
.bt-screen { display: grid; gap: 12px; }
.bt-hero { display: grid; gap: 8px; padding: 14px; background: var(--black); color: var(--paper); }
.bt-title { font-size: 56px; font-stretch: 72%; line-height: .85; }
.bt-hero .bt-title { color: var(--lcd); }
.bt-sub { font-size: 12px; line-height: 1.5; }
.bt-label { font-family: var(--pixel); font-size: 10px; text-transform: uppercase; margin-bottom: -4px; }
.bt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-chips button { padding: 5px 9px; border: 2px solid var(--black); background: var(--paper); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.bt-chips button:hover { background: var(--white); }
.bt-chips button[aria-checked="true"] { background: var(--black); color: var(--paper); }
.bt-go { justify-content: center; padding: 12px; font-size: 13px; }
.bt-msg { font-family: var(--pixel); font-size: 10px; color: var(--red); min-height: 1em; text-transform: uppercase; }
.bt-hi { display: flex; justify-content: space-between; font-family: var(--pixel); font-size: 10px; text-transform: uppercase; border-top: 2px solid var(--black); padding-top: 6px; }
.bt-hi b { font-weight: 400; color: var(--red); }
.bt-hud { display: grid; gap: 6px; }
.bt-score { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 44px; line-height: 1; color: var(--paper); font-variant-numeric: tabular-nums; }
.bt-eq { height: 18px; margin: 0; }
.bt-timer { height: 8px; background: #1d1d1d; }
.bt-timer span { display: block; height: 100%; width: 100%; background: repeating-linear-gradient(to right, var(--lcd) 0 6px, transparent 6px 8px); }
.bt-timer.low span { background: repeating-linear-gradient(to right, var(--red) 0 6px, transparent 6px 8px); }
.bt-q { font-family: var(--pixel); font-size: 11px; text-transform: uppercase; }
.bt-choices { list-style: none; display: grid; gap: 8px; counter-reset: c; }
.bt-choices button {
  width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; text-align: left;
  padding: 10px 12px; border: 2px solid var(--black); background: var(--white); box-shadow: 3px 3px 0 var(--black);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.bt-choices button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-choices button:hover:not(:disabled) { background: var(--paper); }
.bt-choices button:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.bt-choices .k { font-family: var(--pixel); font-size: 11px; font-weight: 400; display: grid; place-items: center; width: 24px; height: 24px; background: var(--black); color: var(--paper); }
.bt-choices button.good { background: var(--blue); color: var(--white); }
.bt-choices button.bad { background: var(--red); color: var(--white); }
.bt-choices button:disabled:not(.good):not(.bad) { opacity: .45; }
.bt-reveal { display: grid; gap: 10px; border-top: 2px solid var(--black); padding-top: 10px; }
.bt-verdict { font-family: var(--pixel); font-size: 12px; text-transform: uppercase; }
.bt-verdict.ok { color: var(--blue); }
.bt-verdict.ko { color: var(--red); }
.bt-track b, .bt-track span, .bt-track small { display: block; }
.bt-track b { font-weight: 600; text-transform: uppercase; }
.bt-track small { font-size: 10px; opacity: .6; margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; }
.bt-actions { display: flex; gap: 8px; }
.bt-actions .btn { flex: 1; justify-content: center; }
.bt-final { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 72px; line-height: 1; color: var(--red); font-variant-numeric: tabular-nums; }
.bt-rank { font-family: var(--pixel); font-size: 13px; text-transform: uppercase; }
.bt-record { font-family: var(--pixel); font-size: 11px; color: var(--blue); animation: blink 1s steps(2) infinite; }

/* pendant une partie, les autres fenêtres sont masquées : pas de triche avec le lecteur ou l'historique */
.bt-playing .win:not(.win-blind):not(.win-install)::after {
  content: "BLIND TEST EN COURS\A PAS DE TRICHE"; white-space: pre;
  position: absolute; left: 0; right: 0; top: 24px; bottom: 0; z-index: 5;
  display: grid; place-items: center; text-align: center;
  font-family: var(--pixel); font-size: 12px; line-height: 2; letter-spacing: .12em; color: var(--lcd);
  background: radial-gradient(rgba(255, 138, 31, .2) 1px, transparent 1.4px) 0 0 / 4px 4px, var(--black);
  cursor: not-allowed;
}

/* ---------- fond d'écran ---------- */
.fond { display: grid; gap: 12px; }
.monitor { justify-self: center; display: grid; justify-items: center; }
.monitor-screen {
  position: relative; width: 236px; height: 148px; overflow: hidden;
  border: 10px solid var(--paper-d); outline: 2px solid var(--black);
  box-shadow: inset 0 0 0 2px var(--black);
  background: var(--prev);
}
.mini-win { position: absolute; background: var(--paper); border: 1px solid var(--black); box-shadow: 2px 2px 0 var(--black); }
.mini-win::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; border-bottom: 1px solid var(--black); background: repeating-linear-gradient(to bottom, var(--paper) 0 1px, var(--black) 1px 2px); }
.mini-win:nth-child(1) { left: 20px; top: 16px; width: 62px; height: 70px; }
.mini-win:nth-child(2) { left: 96px; top: 26px; width: 84px; height: 56px; }
.monitor-foot { width: 92px; height: 12px; margin-top: 2px; background: var(--paper-d); border: 2px solid var(--black); }
.monitor-foot::before { content: ""; display: block; width: 40px; height: 8px; margin: -12px auto 0; background: var(--paper-d); border: 2px solid var(--black); border-bottom: 0; }
.fond-name { display: flex; justify-content: space-between; gap: 10px; font-family: var(--pixel); font-size: 11px; text-transform: uppercase; border-bottom: 2px solid var(--black); padding-bottom: 4px; }
.fond-name #wallNote { opacity: .6; }
.walls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wall {
  aspect-ratio: 16 / 10; border: 2px solid var(--black); position: relative;
  background-clip: padding-box;
}
.wall[aria-checked="true"] { outline: 2px dashed var(--black); outline-offset: 3px; }
.wall[aria-checked="true"]::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; background: var(--red); border: 1px solid var(--black); }
.wall:focus-visible { outline: 2px dashed var(--blue); outline-offset: 3px; }
.wall-add { display: grid; place-items: center; background: var(--paper); font-family: var(--pixel); font-size: 18px; }
.fond-import { justify-content: center; }
.fond-actions { display: flex; gap: 10px; }
.fond-actions .btn { flex: 1; justify-content: center; padding: 8px 10px; }

/* ---------- écran de veille ---------- */
.saver-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.saver { position: fixed; inset: 0; z-index: 2500; background: #000; cursor: none; }
.saver canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
/* le logo reste vectoriel et net : un calque teinté par masque, déplacé au-dessus des étoiles pixel */
.saver-logo {
  position: absolute; left: 0; top: 0; aspect-ratio: 2000 / 409; background: #FFFFFF; will-change: transform;
  -webkit-mask: url("assets/logo-track05.svg") center / contain no-repeat; mask: url("assets/logo-track05.svg") center / contain no-repeat;
}
.saver-np {
  position: absolute; left: 0; right: 0; bottom: 28px; text-align: center;
  font-family: var(--pixel); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--lcd);
}

/* ---------- notifications ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1800; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; width: 300px; padding: 10px 14px;
  background: var(--black); color: var(--paper); border: 2px solid var(--paper); box-shadow: var(--shadow);
  animation: toastin .3s steps(4);
}
.toast .px { flex: none; width: 32px; height: 32px; }
.toast b { display: block; font-family: var(--pixel); font-size: 11px; font-weight: 400; text-transform: uppercase; color: var(--lcd); }
.toast small { display: block; font-size: 12px; line-height: 1.4; margin-top: 2px; }
.toast.out { opacity: 0; transition: opacity .3s steps(3); }
@keyframes toastin { from { transform: translateY(20px); opacity: 0; } }

/* ---------- mode nuit ---------- */
html.night body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: rgba(0, 0, 12, .55); }
.night-badge { font-family: var(--pixel); font-size: 10px; letter-spacing: .06em; }
html.phosphore body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .25) 0 2px, transparent 2px 4px), rgba(0, 60, 20, .35); mix-blend-mode: multiply; }

/* ---------- terminal ---------- */
.term { background: #050505; color: var(--lcd); font-family: var(--mono); font-size: 13px; line-height: 1.5; padding: 10px 12px; cursor: text; min-height: 200px; }
.term-out div { white-space: pre-wrap; word-break: break-word; }
.term-out .cmd { color: var(--paper); }
.term-out .dim { opacity: .6; }
.term-out .err { color: var(--red); }
.term-line { display: flex; gap: 8px; }
.term-ps { flex: none; color: var(--paper); }
.term-line input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--lcd); font: inherit; caret-color: var(--lcd); }

/* ---------- corbeille ---------- */
.trash { display: grid; gap: 10px; }
.trash-list { list-style: none; }
.trash-list button { width: 100%; display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 6px 4px; text-align: left; font-size: 12px; }
.trash-list .px { width: 20px; height: 20px; }
.trash-list .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-list .ts { font-size: 10px; opacity: .6; }
.trash-list button:hover, .trash-list button.sel { background: var(--blue); color: var(--white); }
.trash-msg { background: var(--black); color: var(--lcd); padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.trash-icon { display: none; }

/* ---------- succès ---------- */
.ach { display: grid; gap: 12px; }
.ach-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.ach-lvl { display: grid; place-items: center; aspect-ratio: 1; background: var(--black); color: var(--lcd); font-family: var(--pixel); font-size: 10px; }
.ach-lvl b { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 52px; line-height: .9; }
.ach-who { display: grid; gap: 4px; }
.ach-who b { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 72%; font-size: 26px; text-transform: uppercase; line-height: 1; }
.ach-who small { font-family: var(--pixel); font-size: 10px; opacity: .7; }
.ach-grid li small.rw { margin-top: 3px; opacity: 1; color: var(--blue); font-family: var(--pixel); font-size: 9px; text-transform: uppercase; }
.ach-grid li:not(.on) small.rw { color: var(--ink); opacity: .55; }
.lvl-chip { padding: 2px 6px; background: var(--black); color: var(--lcd); font-family: var(--pixel); font-size: 10px; letter-spacing: .04em; }
.lvl-chip:hover { background: var(--blue); color: var(--white); }
.ach-grid { list-style: none; display: grid; gap: 6px; }
.ach-grid li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border: 2px solid var(--black); background: var(--paper-d); }
.ach-grid li .px { width: 32px; height: 32px; filter: grayscale(1); opacity: .35; }
.ach-grid li b { display: block; font-family: var(--pixel); font-size: 11px; font-weight: 400; text-transform: uppercase; }
.ach-grid li small { display: block; font-size: 11px; line-height: 1.4; opacity: .7; }
.ach-grid li time { font-size: 10px; opacity: .6; }
.ach-grid li.on { background: var(--white); box-shadow: 3px 3px 0 var(--black); }
.ach-grid li.on .px { filter: none; opacity: 1; }
.ach-grid li.on b { color: var(--blue); }

/* ---------- story ---------- */
.story { display: grid; gap: 12px; justify-items: center; }
.story-wrap { width: 100%; max-width: 270px; border: 2px solid var(--black); box-shadow: var(--shadow); }
.story-wrap canvas { display: block; width: 100%; height: auto; }
.story-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.story-actions .btn { flex: 1; justify-content: center; }
.radio-actions { flex-wrap: wrap; }

/* ---------- platine ---------- */
.platine { display: grid; gap: 10px; }
.plat-cv { width: 100%; aspect-ratio: 340 / 260; display: block; border: 2px solid var(--black); touch-action: none; cursor: grab; }
.plat-cv:active { cursor: grabbing; }
.plat-actions { display: flex; gap: 8px; }
.plat-actions .btn { flex: 1; justify-content: center; }
.plat-hint { font-size: 11px; opacity: .65; }

/* ---------- boîte à rythmes ---------- */
.beatbox { display: grid; gap: 12px; }
.beat-grid { display: grid; gap: 6px; }
.beat-row { display: grid; grid-template-columns: 46px repeat(16, minmax(0, 1fr)); gap: 3px; align-items: center; }
.beat-name { font-family: var(--pixel); font-size: 9px; text-transform: uppercase; }
.beat-step { aspect-ratio: 1; border: 2px solid var(--black); background: var(--white); }
.beat-step.bar { background: var(--paper-d); }
.beat-step.on { background: var(--blue); }
.beat-step.now { outline: 2px solid var(--lcd); outline-offset: 1px; }
.beat-step.on.now { background: var(--lcd); }
.beat-ctrl { display: flex; gap: 10px; align-items: center; }
.beat-bpm { flex: 1; display: grid; gap: 4px; font-family: var(--pixel); font-size: 10px; }
.beat-bpm b { font-weight: 400; color: var(--red); }

/* ---------- pochette ---------- */
.pochette { display: grid; gap: 10px; }
.poch-wrap { width: 100%; max-width: 320px; justify-self: center; aspect-ratio: 1; border: 2px solid var(--black); box-shadow: var(--shadow);
  background: linear-gradient(rgba(0,0,0,.08) 1px, transparent 1px) 0 0 / 3.125% 3.125%, linear-gradient(90deg, rgba(0,0,0,.08) 1px, transparent 1px) 0 0 / 3.125% 3.125%; position: relative; }
.poch-wrap canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; cursor: crosshair; mix-blend-mode: multiply; }
.poch-pal { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.poch-pal button { aspect-ratio: 1; border: 2px solid var(--black); }
.poch-pal button[aria-pressed="true"] { outline: 2px dashed var(--black); outline-offset: 2px; }

/* ---------- sauvegarde ---------- */
.save { display: grid; gap: 12px; }
.save-screen { text-align: center; padding: 16px 12px; }
.save-label { font-size: 10px; opacity: .7; letter-spacing: .14em; }
.save-code { font-family: var(--pixel); font-size: 22px; letter-spacing: .08em; color: var(--lcd); margin-top: 6px; }
.save-txt { font-size: 12px; line-height: 1.5; }
#saveOff, #saveOn { display: grid; gap: 10px; }
#saveOff[hidden], #saveOn[hidden] { display: none; }
.save-wide { justify-content: center; }
.save-or { font-family: var(--pixel); font-size: 10px; text-transform: uppercase; text-align: center; opacity: .6; }
.save-row { display: flex; gap: 8px; }
.save-row input { text-transform: uppercase; letter-spacing: .1em; }

/* ---------- menu du clic droit ---------- */
.ctx {
  position: fixed; z-index: 1400; min-width: 230px; padding: 4px 0;
  background: var(--paper); border: 2px solid var(--black); box-shadow: var(--shadow);
}
.ctx button { display: block; width: 100%; text-align: left; padding: 6px 14px; font-size: 12px; }
.ctx button:hover, .ctx button:focus-visible { background: var(--blue); color: var(--white); outline: 0; }
.ctx hr { border: 0; border-top: 1px dashed rgba(0, 0, 0, .35); margin: 4px 0; }

/* ---------- guide d'installation ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 1500;
  display: grid; place-items: center; padding: 16px;
  background: radial-gradient(rgba(0, 0, 0, .55) 1px, transparent 1.4px) 0 0 / 3px 3px, rgba(0, 0, 0, .35);
}
.sheet .win-install { display: flex; position: relative; left: auto; top: auto; z-index: auto !important; width: min(420px, 100%); max-height: calc(100dvh - 32px); }
.sheet .win-install .win-close { display: block; }
.install-body { display: grid; gap: 14px; overflow: auto; }
.install-body h3 { font-size: 40px; font-stretch: 72%; }
.install-lead { font-size: 13px; line-height: 1.5; }
.install-now { padding: 12px; font-size: 13px; }
.steps { list-style: none; display: grid; border: 2px solid var(--black); }
.steps li { display: grid; grid-template-columns: 30px 34px 1fr; gap: 10px; align-items: center; padding: 10px 12px; }
.steps li + li { border-top: 1px dashed rgba(0, 0, 0, .3); }
.steps .num { font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 26px; line-height: 1; color: var(--red); }
.steps .px { width: 32px; height: 32px; }
.steps b { display: block; font-size: 13px; font-weight: 600; }
.steps small { display: block; font-size: 11px; line-height: 1.4; opacity: .65; margin-top: 2px; }
.install-bar { height: 14px; border: 2px solid var(--black); padding: 2px; }
.install-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(to right, var(--blue) 0 8px, transparent 8px 10px); animation: installbar 3.2s steps(16) infinite; }
@keyframes installbar { 70%, 100% { width: 100%; } }
.install-actions { display: flex; gap: 10px; }
.install-actions .btn { flex: 1; justify-content: center; padding: 9px 10px; }
.install-open { margin-top: 4px; justify-self: start; }

/* ---------- à propos ---------- */
.about { display: grid; gap: 12px; }
.about-logo { width: 100%; max-width: 320px; display: block; }
.about p { font-size: 13px; line-height: 1.55; }
.about-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.about .about-lead { font-size: 30px; font-stretch: 72%; line-height: .95; }
.about-lead em { font-style: normal; color: var(--red); }
.about-sec { display: grid; gap: 10px; justify-items: start; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--black); }
.about-sec h4 { display: flex; align-items: baseline; gap: 8px; font-family: "Arch", sans-serif; font-weight: 900; font-stretch: 72%; font-size: 22px; line-height: 1; text-transform: uppercase; }
.about-sec h4 span { color: var(--red); }
.about-list, .about-swatches, .about-levels { list-style: none; width: 100%; }
.about-list li { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--paper-d); font-size: 13px; line-height: 1.5; }
.about-list li:first-child { border-top: 0; padding-top: 0; }
.about-list li:last-child { padding-bottom: 0; }
.about-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; font-size: 10px; line-height: 1.25; }
.about-swatches i { display: block; height: 34px; margin-bottom: 5px; border: 1px solid var(--black); box-shadow: 2px 2px 0 var(--black); }
.about-levels li { display: grid; grid-template-columns: 52px 1fr; padding: 5px 0; border-top: 1px solid var(--paper-d); font-size: 13px; }
.about-levels li:first-child { border-top: 0; }
.about-levels span { font-family: var(--pixel); font-size: 11px; }
.tip { background: var(--paper-d); padding: 8px 10px; line-height: 1.5; }

/* ---------- tailles intermédiaires ---------- */
@media (max-width: 1399px) {
  .desktop {
    grid-template-columns: 92px minmax(0, 400px) minmax(0, 560px);
    grid-template-areas: "icons c1 c2" "icons c3 c2";
    grid-template-rows: auto 1fr;
  }
}
@media (max-width: 1120px) {
  .pl-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- mobile : une app à onglets ---------- */
.tabbar, .miniplayer { display: none; }
.win-grip { display: none; }

@media (max-width: 820px) {
  :root {
    --bar-h: 42px; /* contenu du header remonté, la marge du flou iOS (--top-safe) ne bouge pas */
    /* marge haute généreuse : le flou « verre » d'iOS ne doit jamais passer sur le logo */
    --top-safe: max(env(safe-area-inset-top), 14px);
    /* barre d'onglets : boutons centrés, la marge de la barre d'accueil est partagée entre le haut et le bas */
    --tab-h: 50px;
    --tab-pad: max(calc(env(safe-area-inset-bottom) / 2), 6px);
    --bottom-safe: calc(var(--tab-pad) * 2);
  }
  html, body { overscroll-behavior-y: none; }
  html { background: var(--paper); }
  /* header fixé en haut et au-dessus de tout : il ne glisse plus sous les fenêtres
     ni ne se décolle quand on tire la page */
  .menubar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    gap: 10px;
    height: calc(var(--bar-h) + var(--top-safe));
    padding: var(--top-safe) 16px 0;
  }
  .menubar-logo img { height: 19px; }
  .menubar-nav, .onair, .install { display: none; }
  .sound span:last-child { display: none; }
  .clock { font-size: 13px; }

  .desktop {
    display: block;
    padding: calc(var(--bar-h) + var(--top-safe) + 18px) 16px calc(var(--tab-h) + var(--bottom-safe) + 4px);
    min-height: calc(100dvh - var(--bar-h) - var(--top-safe));
  }
  .icons, .trash-icon { display: none !important; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tab-h) + var(--bottom-safe) + 66px); justify-items: stretch; }
  .toast { width: auto; }
  /* place du mini-lecteur seulement quand il est affiché */
  body.mini-on .desktop { padding-bottom: calc(var(--tab-h) + var(--bottom-safe) + 66px); }
  /* 16 px minimum dans les champs : sinon iOS zoome au focus */
  input, textarea, select { font-size: 16px !important; }
  .beat-row { grid-template-columns: 30px repeat(16, minmax(0, 1fr)); gap: 2px; }
  .beat-name { font-size: 8px; }
  .beat-step { border-width: 1px; }
  .col { display: contents; }
  /* un onglet = une section ; les autres fenêtres sont masquées */
  .win { display: none; z-index: auto !important; }
  .win.tab-on { display: flex; margin-bottom: 22px; }
  .win-close { display: none; }
  .win-about {
    position: relative; left: auto; top: auto; transform: none; width: auto; z-index: auto;
  }
  .pl-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
  .pl-embed iframe { height: 380px; }
  .slots li { grid-template-columns: 92px 1fr auto; }

  /* barre d'onglets */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    display: grid; grid-template-columns: repeat(6, 1fr);
    height: calc(var(--tab-h) + var(--bottom-safe));
    padding: var(--tab-pad) 6px;
    background: var(--paper); border-top: 2px solid var(--black);
  }
  .tabbar button {
    display: grid; justify-items: center; align-content: center; gap: 5px;
    font-family: var(--pixel); font-size: 9px; letter-spacing: .02em; text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar .px { width: 28px; height: 28px; }
  .tabbar button span:last-child { padding: 1px 4px; }
  .tabbar button[aria-current="page"] span:last-child { background: var(--black); color: var(--paper); }
  .tabbar button:not([aria-current="page"]) .px { opacity: .55; filter: grayscale(1); }
  .tabbar button:active .px { transform: translateY(1px); }

  /* mini-lecteur : la radio reste à portée quand on change d'onglet */
  .sheet { place-items: end center; padding-bottom: calc(var(--tab-h) + var(--bottom-safe) + 12px); }
  .sheet .win-install { max-height: calc(100dvh - var(--bar-h) - var(--top-safe) - var(--tab-h) - var(--bottom-safe) - 36px); }
  .miniplayer:not([hidden]) {
    position: fixed; left: 12px; right: 12px; z-index: 999;
    bottom: calc(var(--tab-h) + var(--bottom-safe) + 10px);
    display: flex; align-items: stretch; height: 46px;
    background: var(--black); color: var(--lcd);
    border: 2px solid var(--black); box-shadow: var(--shadow);
  }
  .mini-info { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 12px; text-align: left; }
  .mini-dot { flex: none; width: 8px; height: 8px; background: var(--red); animation: blink 1s steps(2) infinite; }
  .mini-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--pixel); font-size: 11px; text-transform: uppercase; }
  .mini-stop { flex: none; width: 50px; display: grid; place-items: center; background: var(--blue); border-left: 2px solid var(--black); }
  .mini-stop span { width: 14px; height: 14px; background: var(--white); }
}

/* ---------- téléphone en paysage ---------- */
.rotate { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate {
    position: fixed; inset: 0; z-index: 3000;
    display: grid; place-content: center; justify-items: center; gap: 14px;
    padding: 24px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left));
    text-align: center; color: var(--white);
    background:
      radial-gradient(rgba(0, 0, 0, .28) 1px, transparent 1.4px) 0 0 / 4px 4px,
      var(--blue);
  }
  .rotate .display { font-size: 44px; font-stretch: 72%; }
  .rotate .mono-s { max-width: 34ch; line-height: 1.5; opacity: .85; }
  .rotate-icon { width: 64px; height: 64px; animation: turn 2.4s steps(1) infinite; }
  .rotate-icon .px { display: block; width: 100%; height: 100%; }
  body { overflow: hidden; }
}
@keyframes turn { 0%, 45% { transform: rotate(-90deg); } 50%, 100% { transform: rotate(0); } }

@media (prefers-reduced-motion: reduce) {
  .rotate-icon { animation: none; }
  .marquee.scroll span, .onair.live i, .boot-bar span { animation: none; }
  .boot-bar span { width: 100%; }
}

/* ---------- bureau fixe sur ordinateur ----------
   Comme un vrai écran : pas de scroll de page, les fenêtres sont posées
   en absolu (placées par app.js), se chevauchent et défilent à l'intérieur. */
@media (min-width: 821px) {
  html, body { height: 100%; overflow: hidden; }
  .desktop {
    display: block; position: relative; padding: 0;
    height: calc(100dvh - var(--bar-h)); min-height: 0; overflow: hidden;
  }
  .col { display: contents; }
  .icons {
    position: absolute; left: 12px; top: 20px; bottom: 20px;
    grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 84px);
    grid-auto-columns: 100px; gap: 0 4px; align-content: start; justify-items: stretch; align-items: start;
  }
  .win { position: absolute; left: 0; top: 0; max-height: calc(100% - 28px); }
  .win-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
  /* fenêtre agrandie : le contenu reste en haut à sa taille, l'espace en trop reste vide */
  .win-body, .bt-screen { align-content: start; }
  .win-radio { width: 400px; }
  .win-playlists { width: 540px; }
  .win-grille { width: 460px; }
  .win-visu, .win-envoi { width: 340px; }
  .win-fond { width: 340px; }
  .win-notes { width: 380px; }
  .win-favoris { width: 440px; }
  .win-blind { width: 400px; }
  .win-journal { width: 460px; height: 560px; }
  .win-term { width: 540px; height: 340px; }
  .win-trash { width: 380px; }
  .win-ach { width: 420px; height: 600px; }
  .win-story { width: 340px; }
  .win-platine { width: 380px; }
  .win-beat { width: 520px; }
  .win-pochette { width: 380px; }
  .win-save { width: 360px; }
  .trash-icon { display: grid; position: absolute; right: 16px; bottom: 16px; }
  .win-about { width: 480px; height: 640px; transform: none; }
  .pl-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }

  /* poignée de redimensionnement façon « size box » des vieux Mac */
  .win-grip {
    display: block; position: absolute; right: 0; bottom: 0; z-index: 6; width: 18px; height: 18px; cursor: nwse-resize;
    border-left: 2px solid var(--black); border-top: 2px solid var(--black); background: var(--paper) center / 10px 10px no-repeat
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'%3E%3Cpath d='M9 1L1 9M9 5L5 9' stroke='%230A0A0A' stroke-width='1.4'/%3E%3C/svg%3E");
    touch-action: none;
  }
  .win-grip:hover { background-color: var(--white); }
  .win-status { padding-right: 26px; }
  .win.resizing { user-select: none; }
  .win.resizing iframe { pointer-events: none; }
  /* le contenu suit la fenêtre */
  .win-body.notes { display: flex; flex-direction: column; }
  .notes-paper { flex: 1 1 220px; min-height: 120px; }
  .win-body.pl-wrap, .pl-view { display: flex; flex-direction: column; }

  /* barres de défilement façon vieux Mac */
  .win-body::-webkit-scrollbar { width: 16px; }
  .win-body::-webkit-scrollbar-track {
    border-left: 2px solid var(--black);
    background: repeating-conic-gradient(var(--paper-d) 0 25%, var(--paper) 0 50%) 0 0 / 4px 4px;
  }
  .win-body::-webkit-scrollbar-thumb { background: var(--paper); border: 2px solid var(--black); border-right: 0; }
  .win-body::-webkit-scrollbar-thumb:hover { background: var(--white); }
}
/* Firefox : pas de pseudo-éléments, on garde au moins les couleurs */
@supports not selector(::-webkit-scrollbar) {
  .win-body { scrollbar-color: var(--black) var(--paper-d); }
}
