@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Raleway:wght@600;700;800&display=swap');
/* Mixeurs : habillage commun (carte, ambiances alignées, fenêtre des presets, boîte d'enregistrement).
   Chargé APRÈS styles.css / mobile.css / compact.css : il ne touche ni aux sons ni aux scripts. */

body {
  --av-surface: #17171d;
  --av-line: rgba(255, 255, 255, .13);
  --av-field: rgba(255, 255, 255, .07);
  --av-btn: rgba(255, 255, 255, .3); --av-btn-hover: rgba(255, 255, 255, .4); --av-btn-line: rgba(255, 255, 255, .42); --lilac: #8f78f0; --av-btn-text: #fff;
  --av-field-hover: rgba(255, 255, 255, .12);
  --av-accent: #8b5cf6;
  --av-accent-2: #c026d3;
  --av-danger: #f87171;
  --av-muted: rgba(226, 226, 226, .62);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body.light {
  --av-surface: #ffffff;
  --av-line: rgba(24, 24, 27, .13);
  --av-field: rgba(24, 24, 27, .05);
  --av-btn-text: #262629; --av-btn: #ffffff; --av-btn-hover: #f1edff; --av-btn-line: rgba(24, 24, 27, .16);
  --av-field-hover: rgba(24, 24, 27, .09);
  --av-accent: #7c3aed;
  --av-danger: #dc2626;
  --av-muted: rgba(38, 38, 41, .62);
}
button, select, input, label, .hz, .menubox, #menu { font-family: inherit; }

/* ---------- carte ---------- */
.main-container { padding: 25px 12px; }
.equalizer {
  width: 100%; max-width: 400px;
  padding: 20px 18px 18px !important;
  border-radius: 20px !important;
  border: 1px solid var(--av-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.equalizer > p {
  font-family: 'Raleway', 'Inter', sans-serif;
  font-size: 1.5rem; font-weight: 700; letter-spacing: .01em;
  padding: 2px 44px 14px !important;
}
.hz { font-size: 10px; font-weight: 500; color: var(--av-muted); opacity: 1; }

/* ---------- lecture ---------- */
.pp {
  width: 100%; margin: 0 !important; min-height: 46px;
  display: flex !important; align-items: center; justify-content: center;
  font-size: 15px !important; font-weight: 700; letter-spacing: .02em;
  border: 0 !important; border-radius: 12px !important;
  background: var(--lilac) !important; color: #fff !important;
  box-shadow: none !important;
}
.pp:hover { filter: brightness(1.08); }
.pp:active { transform: scale(.985); }
.mod { width: 100%; gap: 12px !important; }

/* ---------- ambiances : colonnes égales, texte centré, dernière ligne centrée ---------- */
.button-container {
  display: flex !important; flex-wrap: wrap !important; justify-content: center !important; align-items: stretch !important;
  width: 100% !important; max-width: none !important; gap: 8px !important;
}
.button-container .preset {
  flex: 0 0 calc((100% - 16px) / 3) !important; width: calc((100% - 16px) / 3) !important; min-width: 0;
  min-height: 40px !important; margin: 0 !important; padding: 8px 6px !important;
  display: flex !important; align-items: center; justify-content: center; text-align: center;
  font: 600 13px/1.25 'Inter', sans-serif !important; letter-spacing: 0; overflow-wrap: anywhere;
  border: 1px solid var(--av-btn-line) !important; border-radius: 10px !important;
  background: var(--av-btn) !important; color: var(--av-btn-text, var(--text-color));
}
.button-container .preset:hover { background: var(--av-btn-hover) !important; box-shadow: none; }
.button-container .preset.clicked { border-color: var(--lilac) !important; background: var(--lilac) !important; color: #fff !important; }
@media (max-width: 330px) {
  .button-container .preset { flex-basis: calc((100% - 8px) / 2) !important; width: calc((100% - 8px) / 2) !important; }
}

/* enregistrer / mes presets : une rangée à part, deux boutons égaux */
.av-presetbar { display: flex; gap: 8px; width: 100%; }
.av-presetbar .preset {
  flex: 1 1 0 !important; width: auto !important; min-width: 0; margin: 0 !important;
  min-height: 38px !important; padding: 7px 10px !important;
  display: flex !important; align-items: center; justify-content: center; gap: 7px; text-align: center;
  font: 600 13px/1.2 'Inter', sans-serif !important;
  border: 1px solid var(--av-btn-line) !important; border-radius: 10px !important;
  background: var(--av-btn) !important; color: var(--av-btn-text, var(--text-color));
}
.av-presetbar .preset:hover { background: var(--av-btn-hover) !important; box-shadow: none; }

/* ---------- volume ---------- */
.volume-general {
  width: 100% !important; margin: 0 !important;
  display: flex !important; align-items: center; gap: 10px;
}
.volume-general label { margin: 0 !important; font-size: 13px !important; font-weight: 500; color: var(--av-muted); white-space: nowrap; display: inline !important; }
.volume-general .volume { flex: 1 1 auto; width: auto !important; min-width: 0; margin: 0 !important; height: 20px !important; accent-color: var(--av-accent); }

/* ---------- menu (jour / nuit) ---------- */
.menubox { font-family: 'Inter', sans-serif !important; font-weight: 600; letter-spacing: .04em; }

/* ---------- fenêtre « Mes presets » ---------- */
.popup {
  background: rgba(8, 8, 12, .62) !important;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.popup[style*="display: block"] { display: flex !important; }
.popup-content {
  position: relative; box-sizing: border-box;
  width: min(92%, 420px) !important; max-width: 420px !important; max-height: min(80dvh, 560px);
  margin: 0 !important; padding: 22px 20px 18px !important; overflow-y: auto;
  text-align: left !important;
  background: var(--av-surface) !important; color: var(--text-color);
  border: 1px solid var(--av-line); border-radius: 20px !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45) !important;
  backdrop-filter: none !important;
}
.popup-content h2 { margin: 0 36px 14px 0 !important; font: 700 1.2rem/1.2 'Raleway', 'Inter', sans-serif !important; }
.popup .close {
  position: absolute !important; top: 14px !important; right: 14px !important;
  width: 32px; height: 32px; padding: 0 !important;
  display: block; font-size: 0 !important; line-height: 0; color: var(--av-muted) !important;
  border-radius: 50%; background: var(--av-field); cursor: pointer;
}
.popup .close::before, .popup .close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; border-radius: 1px; background: currentColor; transform: rotate(45deg); }
.popup .close::after { transform: rotate(-45deg); }
.popup .close:hover { background: var(--av-field-hover); color: var(--text-color) !important; }
#savedPresetsList { list-style: none; margin: 0 !important; padding: 0 !important; display: flex; flex-direction: column; gap: 8px; }
#savedPresetsList li {
  display: flex !important; align-items: center; gap: 6px; flex-wrap: nowrap !important;
  padding: 4px 4px 4px 4px !important; border: 1px solid var(--av-line) !important; border-radius: 12px; background: var(--av-field);
  font-size: 14px; color: var(--av-muted);
}
#savedPresetsList li:not(:has(button)) { justify-content: center; padding: 18px 10px !important; border-style: dashed !important; background: transparent; }
#savedPresetsList li button, .popup-content #savedPresetsList button {
  margin: 0 !important; min-height: 38px !important; padding: 0 12px !important;
  font: 600 13px/1 'Inter', sans-serif !important; border: 0 !important; border-radius: 9px !important; box-shadow: none !important; transform: none !important;
  backdrop-filter: none !important;
}
#savedPresetsList .apply-btn {
  flex: 1 1 auto !important; min-width: 0; text-align: left !important; background: transparent !important; color: var(--text-color) !important;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px !important;
}
#savedPresetsList .apply-btn:hover { background: rgba(139, 92, 246, .16) !important; }
#savedPresetsList .delete-btn { flex: none; background: transparent !important; color: var(--av-danger) !important; }
#savedPresetsList .delete-btn:hover, #savedPresetsList .delete-btn.armed { background: rgba(248, 113, 113, .16) !important; }

/* ---------- boîte d'enregistrement + message ---------- */
.av-modal {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 8, 12, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.av-modal[hidden] { display: none !important; }
.av-box {
  width: min(100%, 380px); box-sizing: border-box; padding: 22px 20px 18px; margin: 0;
  background: var(--av-surface); color: var(--text-color); border: 1px solid var(--av-line); border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45); font-family: 'Inter', sans-serif;
}
.av-box h2 { margin: 0 0 4px; font: 700 1.2rem/1.2 'Raleway', 'Inter', sans-serif; }
.av-box .av-sub { margin: 0 0 14px; padding: 0; font: 400 13px/1.4 'Inter', sans-serif; text-align: left; color: var(--av-muted); }
.av-box input {
  width: 100%; box-sizing: border-box; height: 44px; padding: 0 14px; margin: 0;
  font: 500 15px 'Inter', sans-serif; color: var(--text-color);
  background: var(--av-field); border: 1px solid var(--av-line); border-radius: 12px; outline: none;
}
.av-box input:focus { border-color: var(--av-accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.av-box .av-err { margin: 8px 2px 0; padding: 0; font: 500 12px/1.3 'Inter', sans-serif; text-align: left; color: var(--av-danger); }
.av-box .av-row { display: flex; gap: 8px; margin-top: 16px; }
.av-box .av-row button {
  flex: 1 1 0; height: 42px; margin: 0; padding: 0 12px; font: 600 14px 'Inter', sans-serif; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--av-line); background: transparent; color: var(--text-color);
}
.av-box .av-row button:hover { background: var(--av-field); }
.av-box .av-row .av-ok { border: 0; color: #fff; background: var(--lilac); }
.av-box .av-row .av-ok:hover { filter: brightness(1.1); }
.av-toast {
  position: fixed; left: 50%; bottom: 18px; z-index: 2100; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px;
  font: 500 13px/1.3 'Inter', sans-serif; color: var(--text-color);
  background: var(--av-surface); border: 1px solid var(--av-line); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.av-toast[hidden] { display: none; }

@media (max-width: 700px) and (max-height: 560px) {
  #menu { top: 4px !important; right: 8px !important; padding: 0 6px !important; transform: scale(.72); transform-origin: top right; }
}

/* ---------- petite fenêtre (console) : même alignement, plus serré ---------- */
@media (max-height: 560px) {
  .main-container { padding: 6px 8px !important; }
  .equalizer { padding: 8px 10px !important; max-width: none; }
  .equalizer > p { font-size: 1.05rem !important; padding: 0 44px 6px !important; }
  .pp { min-height: 34px !important; font-size: 14px !important; }
  .mod { gap: 6px !important; }
  .button-container { gap: 5px !important; }
  .button-container .preset { flex-basis: calc((100% - 10px) / 3) !important; width: calc((100% - 10px) / 3) !important; min-height: 28px !important; padding: 3px 4px !important; font-size: 11.5px !important; border-radius: 8px !important; }
  .av-presetbar { gap: 5px; }
  .av-presetbar .preset { min-height: 28px !important; padding: 3px 6px !important; font-size: 11.5px !important; border-radius: 8px !important; }
  .volume-general label { font-size: 12px !important; }
}
