/* Adaptations aux tailles d’écran : à garder en dernier */
@media (pointer: coarse), (max-width: 760px) {
  .touch { display: flex; }
  .keys { display: none; }
}
@media (min-width: 761px) and (pointer: fine) {
  .app[data-playing] .top, .app[data-playing] .foot { display: none; }
  .foot { flex-direction: row; justify-content: space-between; }
  .foot p { width: auto; border: 0; padding: 0; }
}
@media (max-height: 760px) {
  .foot { flex-direction: row; justify-content: space-between; }
  .foot p { width: auto; border: 0; padding: 0; }
}
/* Téléphone en paysage : la scène prend tout, les boutons flottent dessus */
@media (orientation: landscape) and (max-height: 540px) and (pointer: coarse) {
  .app { padding-block: 4px; position: relative; }
  .top, .foot { display: none; }
  .app:not([data-playing]) .touch { display: none; }
  .touch { position: absolute; z-index: 2; left: max(24px, env(safe-area-inset-left, 0px)); right: max(24px, env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
  .touch button { pointer-events: auto; background: rgba(20, 28, 34, .6); height: 56px; }
  .touch .actions { flex-basis: 260px; }
}

@container stage (max-height: 520px) {
  .title-inner { gap: 6px; }
  .title .tags { display: none; }
}

@container stage (max-width: 700px) {
  .hud { grid-template-columns: 1fr auto; gap: 6px 10px; padding: 8px 12px; }
  .hud-logo, .hud-name, .hud-sound, .dodge-label { display: none; }
  .hud-left { grid-column: 1; grid-row: 1; }
  .hud-right { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; gap: 10px; }
  .hud-mid { grid-column: 1 / -1; grid-row: 2; }
  .pips { gap: 6px; padding-top: 3px; }
  .pips i { width: 12px; }
  .dodge { width: 102px; margin: 7px 0 0; height: 4px; }
  .meta { padding: 0; font-size: 11px; }
  .meta .sep { margin: 0 .35em; }
  .ammo { font-size: 11px; }
  .hud-btns button { height: 32px; min-width: 36px; padding: 0 8px; }
  .act { font-size: 10.5px; padding: 0; }
  .act .sep { margin: 0 .5em; }
  .bar { height: 7px; margin: 5px 0; }
  .objective { font-size: 11.5px; }
  .keys { display: none; }
  .title { background: linear-gradient(90deg, rgba(10, 15, 24, .76) 0%, rgba(10, 15, 24, .5) 62%, rgba(10, 15, 24, .08) 100%); }
}
@container stage (max-width: 400px) {
  .meta { display: flex; flex-direction: column; text-align: right; }
  .meta .sep { display: none; }
  .ammo { text-align: right; }
  .status { margin-inline: 12px; font-size: 10.5px; }
}
@container stage (max-height: 440px) {
  .hud-logo, .hud-name, .dodge-label { display: none; }
  .hud { padding-block: 5px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; }
  .hud-left { grid-area: 1 / 1; }
  .hud-mid { grid-area: 1 / 2; }
  .hud-right { grid-area: 1 / 3; }
  .meta { display: flex; flex-direction: column; text-align: right; }
  .meta .sep { display: none; }
  .dodge { width: 110px; }
  .act, .meta { padding-top: 0; font-size: 11px; }
  .bar { height: 6px; margin: 4px 0; }
  .objective { font-size: 11px; }
  .dodge { margin: 7px 0 0; }
  .toast { font-size: 12px; padding: 6px 12px; top: 6px; }
  .hud-right { flex-direction: row; align-items: center; }
  .hud-btns button { height: 28px; min-width: 36px; padding: 0 8px; }
  .keys { padding-block: 5px; font-size: 11px; }
  .kicker, .tags, .divider { display: none; }
}
/* Écran étroit ET bas : le bandeau garde ses deux rangées au lieu d'écraser l'objectif */
@container stage (max-width: 560px) and (max-height: 440px) {
  .hud { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding-inline: 10px; }
  .hud-left { grid-area: 1 / 1; }
  .hud-right { grid-area: 1 / 2; gap: 8px; }
  .hud-mid { grid-area: 2 / 1 / 3 / -1; }
  .dodge { width: 90px; }
}
@media (max-width: 400px) {
  .rules { font-size: 13px; white-space: nowrap; }
  .foot p { font-size: 9.5px; letter-spacing: .08em; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
