/* =========================================================
   CSO Sound Board — thème "piste de concours"
   © 2026 BS CONCEPT 61. Tous droits réservés.
   ========================================================= */
:root {
  --bg: #08111c;
  --bg2: #0c1826;
  --panel: #102033;
  --panel2: #15293f;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .13);
  --text: #eef3f8;
  --muted: #8ea1b7;
  --dim: #5a6d84;
  --gold: #d8b04a;
  --gold2: #f0d37f;
  --red: #e5484d;
  --green: #2fb36f;
  --radius: 18px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  background:
    radial-gradient(1100px 520px at 50% -240px, rgba(37, 84, 140, .55), transparent 70%),
    radial-gradient(900px 400px at 100% 120%, rgba(216, 176, 74, .08), transparent 70%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2 { margin: 0; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 750; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.ic { width: 20px; height: 20px; flex: none; display: block; }

/* ---------- Barre du haut ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(10px + var(--sat)) calc(18px + var(--sar)) 10px calc(18px + var(--sal));
  background: linear-gradient(180deg, rgba(6, 13, 22, .96), rgba(8, 17, 28, .82));
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 0; }
.logo { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .4)); }
.brand-text { min-width: 0; }
.brand-title {
  font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold2);
}
.brand-event {
  font-size: 17px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status { display: flex; flex-direction: column; align-items: center; flex: none; }
.clock { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
.onair {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 3px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.onair .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.onair.live { color: #ff9a9d; }
.onair.live .dot { background: var(--red); animation: pulse 1.3s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .7); }
  70% { box-shadow: 0 0 0 9px rgba(229, 72, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); }
}

.controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex: 1 1 0; }
.wake {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(216, 176, 74, .12); color: var(--gold2);
}
.wake[hidden] { display: none; }
.wake .ic { width: 18px; height: 18px; }
.wake.warn { background: rgba(245, 158, 11, .18); color: #fbbf24; animation: blink .9s infinite alternate; }

/* statut de la mise en veille + alerte */
.wake-status, .banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45;
  border: 1px solid var(--line2); background: rgba(255, 255, 255, .04); color: var(--muted);
}
.wake-status .ic, .banner > .ic { width: 22px; height: 22px; margin-top: 1px; }
.wake-status div, .banner div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.wake-status b, .banner b { color: var(--text); font-size: 14.5px; }
.wake-status span b, .banner span b { font-size: inherit; }
.wake-status.ok { border-color: rgba(47, 179, 111, .45); background: rgba(47, 179, 111, .1); }
.wake-status.ok > .ic { color: #4ade80; }
.wake-status.warn, .banner.warn { border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .1); }
.wake-status.warn > .ic, .banner.warn > .ic { color: #fbbf24; }
.banner { margin-bottom: 14px; align-items: center; }
.banner[hidden] { display: none; }
.banner .btn { flex: none; }
.master {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 12px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 999px;
  color: var(--muted);
}
.master input { width: 130px; }
.master-val { width: 28px; text-align: right; font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stopall {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 92px; padding: 8px 18px; line-height: 1.05;
  border: 0; border-radius: 14px;
  color: #fff; font-weight: 900; font-size: 18px; letter-spacing: .1em;
  background: linear-gradient(180deg, #f0565b, #b8232b);
  box-shadow: 0 8px 22px rgba(229, 72, 77, .35), inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -2px 0 rgba(0, 0, 0, .2);
  transition: transform .08s;
}
.stopall small { white-space: nowrap; font-size: 10px; font-weight: 650; letter-spacing: .08em; opacity: .85; margin-top: 2px; text-transform: uppercase; }
.stopall:active { transform: scale(.95); }

/* ---------- Zones principales ---------- */
main { flex: 1; min-height: 0; position: relative; }
.view {
  display: none;
  position: absolute; inset: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px calc(18px + var(--sar)) 28px calc(18px + var(--sal));
}
.view.active { display: block; }
.page { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 6px 0 4px; }
.page-head p { margin: 6px 0 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.toolbar-actions { display: flex; gap: 8px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--panel);
  font-size: 13.5px; font-weight: 650; color: var(--text);
}
.chip .ic { width: 16px; height: 16px; }
.chip.on { background: rgba(216, 176, 74, .16); border-color: rgba(216, 176, 74, .55); color: var(--gold2); }

/* ---------- Grille de pads ---------- */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}
.pad {
  --c: #3b82f6;
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 4px;
  min-height: clamp(128px, 19vh, 190px);
  padding: 24px 16px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: linear-gradient(165deg, var(--panel2), var(--panel) 70%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .05);
  text-align: left; color: var(--text);
  overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .09s ease, box-shadow .25s, border-color .25s;
}
/* barre d'obstacle rayée */
.pad::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 11px;
  background: repeating-linear-gradient(-45deg, var(--c) 0 17px, #f3f5f8 17px 34px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.pad:active { transform: scale(.965); }
.pad-fill {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--c-soft), var(--c-glow));
  transform-origin: left center;
  transform: scaleX(0);
}
.pad-top { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.pad-num {
  font-size: 11px; font-weight: 800; color: var(--muted);
  border: 1px solid var(--line2); border-radius: 6px; padding: 0 6px; line-height: 18px;
}
.pad-num:empty { display: none; }
.pad-state { font-size: 10.5px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; color: #fff; }
.pad-flags { margin-left: auto; display: flex; gap: 6px; color: var(--muted); }
.pad-flags .ic { width: 15px; height: 15px; }
.pad-label { font-size: clamp(17px, 2.1vw, 23px); font-weight: 800; line-height: 1.15; letter-spacing: -.005em; margin-top: 4px; overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; }
.pad-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-bottom { margin-top: auto; padding-top: 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.pad-time { font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pad-fades { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pad-fades .ic { width: 13px; height: 13px; }
.pad-edit {
  position: absolute; right: 10px; bottom: 10px;
  width: 34px; height: 34px; border-radius: 10px;
  display: none; place-items: center;
  background: rgba(216, 176, 74, .18); color: var(--gold2);
}
.pad-edit .ic { width: 17px; height: 17px; }

.pad.playing {
  border-color: var(--c);
  box-shadow: 0 0 0 2px var(--c), 0 14px 44px var(--c-glow);
}
.pad.playing .pad-meta, .pad.playing .pad-fades, .pad.playing .pad-flags { color: rgba(255, 255, 255, .8); }
.pad.stopping { border-color: var(--c); }
.pad.stopping .pad-fill { opacity: .55; }
.pad.stopping .pad-state { animation: blink .7s infinite alternate; }
@keyframes blink { to { opacity: .35; } }
/* Musique de fond mise en pause (ou baissée) pendant un autre son */
.pad.paused { border-color: var(--c); border-style: dashed; box-shadow: 0 0 0 1px var(--c); }
.pad.paused .pad-fill { opacity: .35; }
.pad.paused .pad-state { color: var(--gold2); }

.pad.empty { border-style: dashed; background: rgba(16, 32, 51, .55); box-shadow: none; }
.pad.empty::before { opacity: .3; }
.pad.empty .pad-label { color: var(--muted); }

.grid.editing .pad { border-color: rgba(216, 176, 74, .5); }
.grid.editing .pad-edit { display: grid; }
.grid.editing .pad-fades { visibility: hidden; }

.credit {
  margin: 22px 0 4px; text-align: center;
  font-size: 12px; letter-spacing: .04em; color: var(--dim);
}
.credit b { color: var(--muted); letter-spacing: .08em; }
.about b { color: var(--gold2); }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted);
  border: 1px dashed var(--line2); border-radius: var(--radius);
}
.empty-state .btn { margin-top: 14px; }

/* ---------- Boutons génériques ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line2); background: var(--panel2);
  font-size: 15px; font-weight: 650; color: var(--text); white-space: nowrap;
  transition: filter .15s, transform .08s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1d1606; border-color: transparent; box-shadow: 0 6px 18px rgba(216, 176, 74, .25); }
.btn.danger { background: transparent; color: #ff8f93; border-color: rgba(229, 72, 77, .45); }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.playing { background: rgba(216, 176, 74, .18); border-color: var(--gold); color: var(--gold2); }
.icon-btn {
  width: 40px; height: 40px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 11px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font-size: 13px; font-weight: 700;
}
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn.danger { color: #ff8f93; }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row > input[type=range], .row > select { flex: 1; min-width: 0; }

/* ---------- Cartes / formulaires ---------- */
.card {
  background: linear-gradient(180deg, rgba(21, 41, 63, .75), rgba(16, 32, 51, .75));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.card p { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Licence */
.lic-badge { flex: none; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; background: rgba(255, 255, 255, .08); color: var(--muted); }
.lic-badge.ok { background: rgba(74, 222, 128, .16); color: #4ade80; }
.lic-badge.warn { background: rgba(216, 176, 74, .18); color: var(--gold2); }
.lic-badge.bad { background: rgba(229, 72, 77, .16); color: #ff8f93; }
.lic-form { display: flex; gap: 10px; }
.lic-form input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.lic-transfer { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(216, 176, 74, .45); background: rgba(216, 176, 74, .08); }
.banner.demo { background: rgba(216, 176, 74, .12); border-color: rgba(216, 176, 74, .45); color: var(--text); }
.banner.demo button { margin-left: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label:first-child {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.field output { font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text); font-variant-numeric: tabular-nums; }
.field .hint-inline { font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--dim); }
input[type=text], input:not([type]), select {
  width: 100%; padding: 11px 13px; font-size: 16px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; color: var(--text);
  outline: none;
}
input[type=text]:focus, input:not([type]):focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 176, 74, .18); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea1b7' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}

/* curseurs */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: transparent; --fill: 50%; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--gold) var(--fill), rgba(255, 255, 255, .13) var(--fill));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 4px solid var(--gold); box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .13); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--gold); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--gold); }
.master input[type=range] { height: 26px; }
.master input[type=range]::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -6px; border-width: 3px; }

/* interrupteurs */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 4px 0; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  position: relative; width: 48px; height: 28px; border-radius: 14px;
  background: rgba(255, 255, 255, .15); transition: background .2s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .2s;
}
.switch input:checked { background: var(--gold); }
.switch input:checked::after { transform: translateX(20px); }
.switch span { display: flex; flex-direction: column; }
.switch b { font-weight: 650; font-size: 15px; }
.switch small { color: var(--muted); font-size: 12.5px; }

/* ---------- Bibliothèque ---------- */
.dropzone {
  display: none; padding: 28px; text-align: center; border-radius: var(--radius);
  border: 2px dashed var(--gold); background: rgba(216, 176, 74, .08); color: var(--gold2); font-weight: 700;
}
.dropzone.show { display: block; }
.sound-list, .pad-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sound {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.sound.playing { border-color: var(--gold); background: rgba(216, 176, 74, .08); }
.sound-main { flex: 1; min-width: 0; }
.sound-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sound-sub { font-size: 12.5px; color: var(--muted); }
.mini-wave { width: 160px; height: 34px; flex: none; color: rgba(255, 255, 255, .28); }
.sound.playing .mini-wave { color: var(--gold); }
.play-btn { border-radius: 50%; background: rgba(216, 176, 74, .15); border-color: rgba(216, 176, 74, .4); color: var(--gold2); }
.sound.playing .play-btn { background: var(--gold); color: #1d1606; }
.lib-empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--radius); }
#libMine, #libCatalog { display: flex; flex-direction: column; gap: 12px; }
#libMine[hidden], #libCatalog[hidden] { display: none; }
.lib-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lib-bar input[type=search] { flex: 1; min-width: 200px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line2); }
.seg button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 10px;
  font-weight: 700; font-size: 14.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px;
}
.seg button.on { background: var(--panel2); color: var(--gold2); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.seg small, .chip small { font-size: 12px; font-weight: 700; opacity: .7; }
input[type=search] {
  width: 100%; padding: 11px 13px 11px 40px; font-size: 16px; outline: none;
  background: var(--bg2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea1b7' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 13px center / 18px;
  border: 1px solid var(--line2); border-radius: 12px; color: var(--text);
}
input[type=search]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 176, 74, .18); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { flex: none; }
.cat-item .btn { flex: none; }
.owned { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--green); font-weight: 700; font-size: 14px; padding: 0 6px; }
.owned .ic { width: 18px; height: 18px; }

/* ---------- Liste des boutons (réglages) ---------- */
.pad-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 0; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); overflow: hidden;
}
.pad-row .stripe { width: 10px; align-self: stretch; background: repeating-linear-gradient(-45deg, var(--c) 0 8px, #f3f5f8 8px 16px); flex: none; }
.pad-row .info { flex: 1; min-width: 0; }
.pad-row b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-row small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-row .acts { display: flex; gap: 6px; }

.help ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.help b { color: var(--text); }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  display: flex; justify-content: center; gap: 6px;
  padding: 7px calc(12px + var(--sar)) calc(7px + var(--sab)) calc(12px + var(--sal));
  border-top: 1px solid var(--line);
  background: rgba(6, 13, 22, .94);
  z-index: 5;
}
.tab {
  flex: 0 1 150px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 8px; border: 0; border-radius: 12px; background: none;
  color: var(--muted); font-size: 11.5px; font-weight: 650;
}
.tab .ic { width: 23px; height: 23px; }
.tab.active { color: var(--gold2); background: rgba(216, 176, 74, .1); }

/* ---------- Éditeur (dialog) ---------- */
dialog {
  padding: 0; border: 0; background: transparent; color: var(--text);
  width: min(680px, calc(100vw - 24px));
  max-width: none; max-height: calc(100dvh - 24px);
  overflow: visible;
}
dialog::backdrop { background: rgba(2, 7, 13, .72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.sheet {
  position: relative;
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 24px);
  background: linear-gradient(180deg, #15293f, #0f1e30);
  border: 1px solid var(--line2); border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.sheet-stripe { height: 12px; flex: none; background: repeating-linear-gradient(-45deg, var(--c) 0 20px, #f3f5f8 20px 40px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 6px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold2); }
.sheet-head h2 { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { padding: 12px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.sheet-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px calc(14px + var(--sab)); border-top: 1px solid var(--line); background: rgba(6, 13, 22, .4); flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; padding: 0;
  border: 3px solid transparent; background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15);
}
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px var(--c); }
.wave {
  position: relative; height: 92px; border-radius: 12px; overflow: hidden; cursor: crosshair;
  background: var(--bg2); border: 1px solid var(--line2); touch-action: none;
}
.wave svg { width: 100%; height: 100%; display: block; }
.seg-info { font-size: 13px; color: var(--muted); }
.seg-info b { color: var(--text); font-variant-numeric: tabular-nums; }
.marks { display: flex; gap: 8px; flex-wrap: wrap; }
.notice {
  padding: 16px; border-radius: 14px; color: var(--muted);
  background: rgba(216, 176, 74, .07); border: 1px dashed rgba(216, 176, 74, .35);
}
.toggles { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--sab));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px);
  padding: 11px 18px; border-radius: 12px;
  background: #f3f5f8; color: #0b1622; font-weight: 650; font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Annonce (baisse de la musique) ---------- */
.duck {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px 0 12px;
  border: 1px solid var(--line2); border-radius: 999px; background: var(--panel);
  color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  transition: background .15s, color .15s, border-color .15s;
}
.duck .ic { width: 19px; height: 19px; }
.duck.listening { color: var(--text); }
.duck.listening .ic { color: #4ade80; }
.duck.on { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1d1606; border-color: transparent; box-shadow: 0 0 0 3px rgba(216, 176, 74, .25), 0 6px 18px rgba(216, 176, 74, .35); }
.duck.on .ic { color: #1d1606; }
.duck.on.auto { animation: blink .8s infinite alternate; }

/* ---------- Bas de console : MICRO et mixage ---------- */
.dock { flex: none; position: relative; z-index: 6; background: rgba(6, 13, 22, .94); border-top: 1px solid var(--line); }
body:not([data-view="console"]) .dock { display: none; }
body[data-view="console"] #duckBtn { display: none; }
body.locked .dock { padding-bottom: var(--sab); }
.dock-row { display: flex; gap: 10px; padding: 10px calc(14px + var(--sar)) 10px calc(14px + var(--sal)); max-width: 1100px; margin: 0 auto; }
.micro {
  flex: 1; min-width: 0; min-height: 62px;
  display: flex; align-items: center; gap: 14px; padding: 8px 18px 8px 10px;
  border: 2px solid rgba(216, 176, 74, .55); border-radius: 18px;
  background: linear-gradient(180deg, #1b3350, #132740);
  color: var(--text); text-align: left;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.micro:active { transform: scale(.985); }
.micro-ic { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(216, 176, 74, .16); color: var(--gold2); }
.micro-ic .ic { width: 26px; height: 26px; }
.micro-txt { display: flex; flex-direction: column; min-width: 0; }
.micro-txt b { font-size: 21px; font-weight: 900; letter-spacing: .14em; line-height: 1.1; }
.micro-txt small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.micro.listening .micro-ic { color: #4ade80; }
.micro.on { background: linear-gradient(180deg, var(--gold2), var(--gold)); border-color: transparent; color: #1d1606; box-shadow: 0 0 0 4px rgba(216, 176, 74, .25), 0 8px 26px rgba(216, 176, 74, .4); }
.micro.on .micro-ic { background: #1d1606; color: var(--gold2); animation: blink .8s infinite alternate; }
.micro.on .micro-txt small { color: rgba(29, 22, 6, .8); }
.micro-lvl { display: block; height: 5px; margin-top: 4px; border-radius: 3px; background: rgba(29, 22, 6, .2); overflow: hidden; max-width: 220px; }
.micro-lvl i { display: block; height: 100%; width: 0; background: #1d1606; transition: width .06s linear; }
#micLiveBox .meter { margin: 8px 0 12px; }
.mixbtn {
  flex: none; width: 92px; min-height: 62px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line2); border-radius: 18px; background: var(--panel); color: var(--text);
  font-size: 12.5px; font-weight: 750;
}
.mixbtn .ic { width: 24px; height: 24px; }
.mixbtn.on { background: rgba(216, 176, 74, .16); border-color: rgba(216, 176, 74, .55); color: var(--gold2); }
.mixer { border-bottom: 1px solid var(--line); max-width: 1100px; margin: 0 auto; padding: 10px calc(14px + var(--sar)) 4px calc(14px + var(--sal)); }
.mixer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mixer-head b { display: block; font-size: 15px; }
.mixer-head small { color: var(--muted); font-size: 12px; }
.mixer-head .icon-btn { width: 36px; height: 36px; }
.mixer-list { max-height: min(42vh, 360px); overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 2px 18px; padding-bottom: 6px; }
.mix-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border-radius: 12px; border-left: 4px solid var(--c); background: rgba(255, 255, 255, .02); }
.mix-row.live { background: rgba(216, 176, 74, .1); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, transparent), rgba(255, 255, 255, .02)); }
.mix-name { flex: 0 1 34%; min-width: 0; display: flex; flex-direction: column; }
.mix-name b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix-state { font-size: 11px; font-weight: 750; color: var(--gold2); min-height: 14px; font-variant-numeric: tabular-nums; }
.mix-ctl { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.mix-ctl input[type=range] { flex: 1; min-width: 60px; height: 36px; }
.mix-step { width: 34px; height: 34px; font-size: 20px; font-weight: 600; line-height: 1; }
.mix-val { flex: none; width: 62px; text-align: right; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mix-empty { margin: 6px 0 10px; }
body[data-view="console"] .toast { bottom: calc(160px + var(--sab)); }

/* ---------- Profil, verrouillage ---------- */
.profile-box {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 260px;
  padding: 0 4px 0 12px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel);
  color: var(--gold2);
}
.profile-box .ic { width: 17px; height: 17px; }
.profile-box select {
  border: 0; background-color: transparent; box-shadow: none !important; padding: 7px 30px 7px 0;
  font-size: 14.5px; font-weight: 700; color: var(--text); min-width: 0; background-position: right 8px center;
}
.profile-box select:disabled { opacity: 1; background-image: none; padding-right: 10px; }
.profile-box.single { opacity: .75; }
.lock-chip { position: relative; overflow: hidden; isolation: isolate; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.lock-chip::after {
  content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(216, 176, 74, .35);
  transform-origin: left center; transform: scaleX(0);
}
.lock-chip.holding::after { transform: scaleX(1); transition: transform 2s linear; }
body.locked .edit-only, body.locked .tabbar, body.locked .pad-edit { display: none !important; }
body.locked .toolbar { justify-content: space-between; }
body.locked .hint { display: none; }

/* ---------- Pages de boutons ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; }
.pager[hidden] { display: none; }
.page-dots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.page-dot {
  position: relative; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--muted); font-weight: 800; font-size: 15px;
}
.page-dot.on { background: rgba(216, 176, 74, .16); border-color: rgba(216, 176, 74, .6); color: var(--gold2); }
.page-dot.live::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); animation: pulse 1.3s infinite;
}
.grid.slide-l { animation: slideL .22s ease-out; }
.grid.slide-r { animation: slideR .22s ease-out; }
@keyframes slideL { from { opacity: .3; transform: translateX(40px); } }
@keyframes slideR { from { opacity: .3; transform: translateX(-40px); } }
.page-head-row { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold2); padding: 6px 2px 0; }
.profile-row .stripe { background: var(--line2); }
.profile-row.on { border-color: rgba(216, 176, 74, .5); }
.profile-row.on .stripe { background: var(--gold); }
.profile-row b em { font-style: normal; font-weight: 600; color: var(--gold2); font-size: 13px; }
.profile-row .acts { align-items: center; }

/* ---------- Divers réglages ---------- */
.field[hidden] { display: none; }
.field > label.switch:first-child {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  font-size: inherit; font-weight: inherit; letter-spacing: 0; text-transform: none; color: var(--text);
}
.field-note { color: var(--dim); font-size: 12.5px; }
.field.dim > label, .field.dim select { opacity: .5; }
.meter { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: #4ade80; transition: width .06s linear; }
.meter.hot span { background: var(--gold); }
#pasteShare { font-size: 15px; }
.share-ways { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.share-ways b { color: var(--text); }

/* ---------- Fenêtre d'information (partage) ---------- */
.modal { width: min(460px, calc(100vw - 24px)); }
.modal-sheet { padding: 22px 20px 20px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-body h2 { font-size: 20px; padding-right: 44px; overflow-wrap: anywhere; }
.modal-body p { margin: 0; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.qr-wrap { display: flex; justify-content: center; }
.qr-wrap canvas { border-radius: 12px; image-rendering: pixelated; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
#shareLink { font-size: 13px; color: var(--muted); }
.notice.small { font-size: 13px; padding: 12px; }

/* ---------- Adaptation écrans ---------- */
@media (max-width: 1180px) {
  .hint { display: none; }
}
@media (max-width: 820px) {
  .master input { width: 90px; }
  .duck span { display: none; }
  .duck { padding: 0; width: 42px; justify-content: center; }
}
@media (max-width: 640px) {
  .toolbar-actions .chip span { display: none; }
  .toolbar-actions .chip { padding: 8px 10px; }
  .toolbar-actions .chip.lock-chip.on span { display: inline; }
  .profile-box { flex: 1 1 auto; }
  .duck { width: 38px; height: 38px; }
}
@media (max-width: 420px) {
  .brand-text { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding-left: calc(12px + var(--sal)); padding-right: calc(12px + var(--sar)); }
  .status { display: none; }
  .brand-title { display: none; }
  .brand-event { font-size: 15px; }
  .logo { width: 36px; height: 36px; }
  .master { padding: 4px 10px; }
  .master input { width: 70px; }
  .master-val, #masterIcon { display: none; }
  .stopall { min-width: 76px; padding: 7px 12px; font-size: 16px; }
  .view { padding: 12px calc(12px + var(--sar)) 24px calc(12px + var(--sal)); }
  .grid { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pad { padding: 22px 12px 12px; min-height: 122px; }
  .pad-label { font-size: 17px; }
  .pad-time { font-size: 18px; }
  .form-grid, .two { grid-template-columns: 1fr; }
  .mini-wave { display: none; }
  .seg { width: 100%; }
  .seg button { flex: 1; justify-content: center; }
  .lib-bar input[type=search] { min-width: 0; flex-basis: 100%; }
  .cat-item .btn span, .owned span { display: none; }
  h1 { font-size: 22px; }
  dialog { width: 100vw; max-height: calc(100dvh - var(--sat) - 10px); margin: auto 0 0; }
  .sheet { border-radius: 22px 22px 0 0; max-height: calc(100dvh - var(--sat) - 10px); }
}
@media (max-width: 640px) {
  .dock-row { padding: 8px calc(10px + var(--sar)) 8px calc(10px + var(--sal)); gap: 8px; }
  .micro { min-height: 58px; gap: 10px; padding: 6px 12px 6px 8px; }
  .micro-ic { width: 42px; height: 42px; }
  .micro-txt b { font-size: 19px; }
  .micro-txt small { font-size: 11.5px; }
  .mixbtn { width: 70px; min-height: 58px; }
  .mixer { padding: 8px calc(10px + var(--sar)) 2px calc(10px + var(--sal)); }
  .mixer-list { grid-template-columns: 1fr; max-height: 38vh; }
  .mix-row { gap: 8px; padding: 6px 6px 6px 10px; }
  .mix-name { flex-basis: 30%; }
  .mix-val { width: 54px; font-size: 12px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .micro, .mixbtn { min-height: 48px; }
  .micro-ic { width: 36px; height: 36px; }
  .mixer-list { max-height: 34vh; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { padding-top: calc(6px + var(--sat)); padding-bottom: 6px; }
  .status { display: flex; }
  .pad { min-height: 104px; }
}
