:root {
  color-scheme: dark;
  --bg: #070a0f;
  --panel: #0d121a;
  --card: #111823;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e7edf7;
  --muted: #8ca0b8;
  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --ok: #34d399;
  --error: #f87171;
  --lane-gutter: 232px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 700px at 12% -10%, #15263d 0%, transparent 55%),
    radial-gradient(900px 600px at 95% 0%, #1c1636 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
svg { display: block; }
::selection { background: rgba(34, 211, 238, 0.28); color: #f2fbff; }

* { scrollbar-width: thin; scrollbar-color: #24313f transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #24313f; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---------- Barre du haut ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.6);
  backdrop-filter: blur(12px);
  z-index: 30;
  flex: none;
}

.brand { display: flex; align-items: center; gap: 12px; flex: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #031019;
  background: linear-gradient(135deg, #22d3ee, #8b5cf6);
  box-shadow: 0 6px 22px rgba(34, 211, 238, 0.28);
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }

.topbar-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: #8296ad;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.perf-hud {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 10px;
  margin: 0;
  font-size: 10.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  color: #8296ad;
  pointer-events: none;
  user-select: none;
}
.topbar .perf-hud {
  flex: none;
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
}
.perf-hud dt { font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; color: var(--muted); }
.perf-hud dd { margin: 0; font-weight: 600; text-align: right; color: #cfe0f2; transition: color 0.3s ease; }
.perf-hud dd.is-medium { color: #fbbf24; }
.perf-hud dd.is-high { color: var(--error); }

.local-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  margin-left: 10px;
  padding: 6px 11px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.08);
  color: #8ee6c0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.local-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

/* ---------- Menus ---------- */

.menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.55);
  backdrop-filter: blur(12px);
  z-index: 25;
  flex: none;
  position: relative;
}

.menu { position: relative; }

.menu-trigger {
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b9c9dd;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.menu-trigger:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.menu.open .menu-trigger {
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.14);
}

.menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(10, 15, 22, 0.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.55);
  z-index: 40;
}
.menu.open .menu-panel { display: block; }
.menu-panel-wide { width: 320px; }

.menu-title {
  margin: 6px 9px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cfe0f2;
  font-size: 13px;
  text-align: left;
}
.menu-item:hover { background: rgba(34, 211, 238, 0.12); color: #eaf9ff; }
.menu-item .menu-kbd { margin-left: auto; font-size: 9.5px; color: #a9bbd0; white-space: nowrap; }
.menu-item[disabled] { opacity: 0.4; pointer-events: none; }

.menu-sep { height: 1px; margin: 6px 8px; background: var(--line); }

/* ---------- Ossature ---------- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(248px, 0.26fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px 16px 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
}
.card h2 {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #151d29;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.btn:hover { background: #1b2534; border-color: #2d3d52; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #0891b2, #7c3aed);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.22);
}
.btn.primary:hover { background: linear-gradient(135deg, #06a3c7, #8b5cf6); }
.btn.small { padding: 6px 10px; font-size: 11.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn.danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.32); background: transparent; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.12); }
.btn.rec.recording { color: #fecaca; border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.14); }
.btn.rec.recording::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.icon-mini {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.icon-mini:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }

/* ---------- Barre d’outils ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(9, 14, 21, 0.86);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  flex: none;
}

.transport { display: flex; align-items: center; gap: 3px; }

.transport-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.transport-btn svg { width: 15px; height: 15px; }
.transport-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.transport-btn.is-on {
  color: var(--accent);
  background: rgba(34, 211, 238, 0.14);
  border-color: rgba(34, 211, 238, 0.35);
}

.play-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 4px;
  border: 0;
  border-radius: 50%;
  color: #06121a;
  background: linear-gradient(135deg, #22d3ee, #8b5cf6);
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.25);
  transition: filter 0.15s ease, transform 0.12s ease;
}
.play-btn svg { width: 16px; height: 16px; }
.play-btn:hover { filter: brightness(1.08); }
.play-btn:active { transform: translateY(1px); }

.time-display { display: flex; flex-direction: column; gap: 1px; min-width: 132px; }
.time-main {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #eef8ff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.time-sub { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.toolbar-sep { width: 1px; height: 26px; background: var(--line); flex: none; }
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar-group.zoom { margin-left: auto; }
.btn.primary.small, .toolbar .btn.primary { width: auto; }

.zoom-label {
  min-width: 58px;
  text-align: center;
  font-size: 10.5px;
  color: #a9bbd0;
  font-variant-numeric: tabular-nums;
}

/* ---------- Barre d’état ---------- */

.statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
  min-height: 16px;
}
.statusbar .status-spacer { margin-left: auto; }
.status-meter { display: inline-flex; align-items: center; gap: 8px; }
.meter {
  display: inline-block;
  width: 86px;
  height: 5px;
  border-radius: 999px;
  background: #1b2735;
  overflow: hidden;
}
.meter > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #0891b2, #22d3ee); transition: width 0.08s linear; }
.meter > i.is-hot { background: linear-gradient(90deg, #fbbf24, #f87171); }
