/* ============================================================================
   Music Studio — "Moises × Apple Music" Pure OLED Dark Mode
   Strict restraint: #000000 canvas, #1C1C1E elevated surfaces, #2C2C2E controls,
   1px rgba(255,255,255,0.08) hairlines, #FFFFFF primary, #FA2D48 active accent.
   Zero gradients, zero neon glows, zero visual clutter.
   ============================================================================ */

:root {
  --bg-canvas: #000000;
  --bg-elevated: #1C1C1E;
  --bg-sidebar: #0D0D0F;
  --bg-control: #2C2C2E;
  --bg-control-hover: #3A3A3C;
  --text-primary: #FFFFFF;
  --text-secondary: #8E8E93;
  --text-muted: #636366;
  --accent: #FA2D48;
  --accent-soft: rgba(250, 45, 72, 0.16);
  --accent-border: rgba(250, 45, 72, 0.42);
  --accent-fg: #FFFFFF;
  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-hairline-strong: rgba(255, 255, 255, 0.14);
  --waveform-played: rgba(255, 255, 255, 0.88);
  --waveform-unplayed: rgba(255, 255, 255, 0.22);
  --primary-btn-bg: #FFFFFF;
  --primary-btn-fg: #000000;
  --backdrop-scrim: rgba(0, 0, 0, 0.64);
  /* Legacy token aliases wired directly to semantic theme tokens */
  --bg: var(--bg-canvas);
  --surface: var(--bg-elevated);
  --sidebar-bg: var(--bg-sidebar);
  --control: var(--bg-control);
  --control-pressed: var(--bg-control-hover);
  --hairline: var(--border-hairline);
  --hairline-strong: var(--border-hairline-strong);
  --text: var(--text-primary);
  --text-tertiary: var(--text-muted);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Roboto", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-secondary);
}

.ui-svg-icon,
.instrument-icon {
  display: block;
  flex-shrink: 0;
}

.ui-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================================
   SCREENS (Max 2 screens: Bibliothèque + Lecteur & Mixeur)
   ============================================================================ */

.app-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
}

/* ============================================================================
   SCREEN 1 — BIBLIOTHÈQUE
   ============================================================================ */

.lib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) 20px 12px;
  flex-shrink: 0;
}

.lib-title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
}

.icon-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.14s ease, transform 0.12s ease;
  flex-shrink: 0;
}

.icon-circle-btn:active {
  background: var(--control);
  transform: scale(0.95);
}

.icon-circle-btn.small {
  width: 36px;
  height: 36px;
  background: var(--control);
  color: var(--text-secondary);
}

.icon-circle-btn.small:active {
  background: var(--control-pressed);
  color: var(--text);
}

.lib-search-wrap {
  padding: 0 20px 12px;
  flex-shrink: 0;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-secondary);
}

.search-field.compact {
  height: 42px;
  background: var(--control);
  margin: 0 20px 12px;
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.search-field input::placeholder {
  color: var(--text-secondary);
}

.search-clear {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--control);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lib-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(96px + var(--safe-bottom));
}

.lib-list {
  display: flex;
  flex-direction: column;
}

.song-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 10px 12px 10px 20px;
  width: 100%;
  text-align: left;
  position: relative;
  transition: background 0.12s ease;
}

.song-row::after {
  content: "";
  position: absolute;
  left: 82px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}

.song-row:last-child::after {
  display: none;
}

.song-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  text-align: left;
}

.song-row:active {
  background: var(--surface);
}

.song-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.song-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.song-info strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-info span {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-more-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.song-more-btn:active {
  background: var(--control);
  color: var(--text);
}

/* Empty State */
.lib-empty {
  height: 100%;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 28px;
  gap: 8px;
}

.lib-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.lib-empty h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.lib-empty p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 260px;
}

/* Primary & Secondary Pill Buttons */
.pill-btn-primary {
  min-height: 50px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.pill-btn-primary:active {
  transform: scale(0.98);
  opacity: 0.88;
}

.pill-btn-primary.full {
  width: 100%;
}

.pill-btn-secondary {
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--control);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, transform 0.12s ease;
}

.pill-btn-secondary:active {
  background: var(--control-pressed);
  transform: scale(0.98);
}

.pill-btn-secondary.full {
  width: 100%;
}

/* Floating + Button (Moises style) */
.fab-add {
  position: fixed;
  right: max(20px, calc(50% - 340px));
  bottom: calc(22px + var(--safe-bottom));
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s ease, opacity 0.14s ease;
  z-index: 20;
}

.fab-add:active {
  transform: scale(0.93);
  opacity: 0.9;
}

/* ============================================================================
   SCREEN 2 — LECTEUR & MIXEUR
   ============================================================================ */

.player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 10px 8px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.player-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1px;
}

.player-heading strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-heading span {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  direction: ltr;
  unicode-bidi: isolate;
}

.player-top-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.player-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Synchronized Chords Strip */
.chords-strip-wrap {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.chords-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chords-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.chords-collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chords-collapse-btn[aria-expanded="false"] svg {
  transform: rotate(180deg);
}

.chords-strip {
  display: flex;
  align-items: baseline;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chords-strip::-webkit-scrollbar {
  display: none;
}

.chord-current {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
}

.chord-upcoming {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.chord-next-item {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 4px 2px;
  transition: color 0.12s ease;
}

.chord-next-item:first-child {
  color: rgba(255, 255, 255, 0.72);
}

.chord-next-item:active {
  color: var(--text);
}

/* Minimal Waveform & Scrubber */
.waveform-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.waveform-stage {
  position: relative;
  height: 58px;
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  touch-action: none;
}

.waveform-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.waveform-canvas-played {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  clip-path: inset(0 100% 0 0);
  will-change: clip-path;
}

.waveform-loop-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent-soft);
  border-left: 1.5px solid var(--accent);
  border-right: 1.5px solid var(--accent);
  pointer-events: none;
}

.waveform-playhead {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  pointer-events: none;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.waveform-scrub-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.waveform-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.time-mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.loop-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loop-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.loop-pill[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.loop-mark {
  height: 28px;
  min-width: 30px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--control);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================================
   MULTITRACK STEM MIXER (The Centerpiece)
   ============================================================================ */

.mixer-section {
  flex: 1;
  min-height: 0;
}

.mixer-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.mixer-subbar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.mixer-subbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mixer-action-pill,
.mixer-reset-pill {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}

.mixer-reset-pill.compact {
  height: 34px;
  padding: 0 12px;
}

.mixer-action-pill:hover,
.mixer-reset-pill:hover {
  background: var(--bg-control);
}

.mixer-action-pill:active,
.mixer-reset-pill:active {
  transform: scale(0.96);
}

.mixer-reset-pill.is-dirty {
  border-color: var(--accent-border);
}

.reset-dirty-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.sheet-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sep-reset-btn {
  font-size: 13px;
  padding: 4px 8px;
}

.stem-row.is-metronome-track {
  border: 1px solid var(--border-hairline);
}

.metronome-bpm-tag {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--control);
  flex-shrink: 0;
  direction: ltr;
  unicode-bidi: isolate;
}

.mixer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stem-row {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 12px 12px 14px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.15s ease;
}

.stem-row.muted-track {
  opacity: 0.45;
}

.stem-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stem-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.stem-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--control);
  color: var(--stem-accent, #8E8E93);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stem-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stem-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ms-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--control);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.ms-btn[aria-pressed="true"].is-mute {
  background: var(--accent);
  color: var(--accent-fg);
}

.ms-btn[aria-pressed="true"].is-solo {
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
}

.stem-fx-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stem-fx-btn.has-fx {
  color: var(--accent);
}

.stem-fx-btn:active {
  background: var(--control);
  color: var(--text);
}

/* Volume slider + subtle VU activity */
.stem-fader-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 26px;
}

.stem-vu-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  bottom: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  pointer-events: none;
}

.stem-vu-fill {
  width: 100%;
  height: 100%;
  background: var(--stem-accent, #8E8E93);
  opacity: 0.65;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.06s linear;
}

.stem-slider,
.apple-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--stem-accent, #FFFFFF) 0%,
    var(--stem-accent, #FFFFFF) var(--fill, 80%),
    var(--control) var(--fill, 80%),
    var(--control) 100%
  );
  outline: none;
  cursor: pointer;
}

.stem-slider::-webkit-slider-thumb,
.apple-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  border: 0;
}

.stem-slider::-moz-range-thumb,
.apple-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  border: 0;
}

.apple-slider {
  --stem-accent: #FFFFFF;
}

.apple-slider.compact {
  flex: 1;
  min-width: 120px;
}

.mixer-empty-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.mixer-empty-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============================================================================
   PLAYER FIXED BOTTOM DOCK (Apple Music Transport + 4-Icon Tool Bar)
   ============================================================================ */

.player-dock {
  flex-shrink: 0;
  background: var(--bg);
  border-top: 1px solid var(--hairline);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transport-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.transport-skip {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, transform 0.12s ease;
}

.transport-skip:active {
  background: var(--surface);
  transform: scale(0.94);
}

.transport-play {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.transport-play:active {
  transform: scale(0.94);
  opacity: 0.9;
}

.tool-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.tool-btn {
  min-height: 48px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.12s ease, background 0.12s ease;
}

.tool-btn:active {
  background: var(--surface);
}

.tool-btn.active,
.tool-btn[aria-pressed="true"] {
  color: var(--accent);
}

/* ============================================================================
   NATIVE-STYLE BOTTOM SHEETS
   ============================================================================ */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop-scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}

.sheet-panel {
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 0 calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--hairline-strong);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.22);
  margin: 0 auto 12px;
  flex-shrink: 0;
}

.sheet-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 14px;
  flex-shrink: 0;
}

.sheet-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-header-text {
  flex: 1;
  min-width: 0;
}

.sheet-header-text.center {
  text-align: center;
}

.sheet-count-pill {
  min-width: 32px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--control);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.text-action-btn {
  min-height: 36px;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}

/* Radio Preset Rows inside Bottom Sheets */
.preset-list {
  margin: 0 16px 12px;
  background: var(--control);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preset-row {
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  position: relative;
  transition: background 0.12s ease;
}

.preset-row::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}

.preset-row:last-child::after {
  display: none;
}

.preset-row:active {
  background: var(--control-pressed);
}

.preset-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.preset-row-text strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.preset-row-text span {
  font-size: 13px;
  color: var(--text-secondary);
}

.preset-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-hairline-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary-btn-fg);
}

.preset-row.selected .preset-check {
  background: var(--primary-btn-bg);
  border-color: var(--primary-btn-bg);
}

/* Drilldown Row ("Personnaliser les pistes ›") */
.drilldown-row {
  margin: 0 16px 14px;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--control);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  color: var(--text-secondary);
}

.drilldown-row:active {
  background: var(--control-pressed);
}

.drilldown-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.drilldown-text strong {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.drilldown-text span {
  font-size: 13px;
}

.sheet-notice {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.35;
}

.sheet-footer {
  padding: 6px 16px 0;
  flex-shrink: 0;
}

/* Custom 38-Instrument List */
.custom-stems-scroll {
  flex: 1;
  min-height: 220px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.custom-cat-title {
  margin: 0 0 6px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.custom-cat-group {
  background: var(--control);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.custom-stem-row {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  position: relative;
}

.custom-stem-row::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}

.custom-stem-row:last-child::after {
  display: none;
}

.custom-stem-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.custom-stem-left .instrument-icon {
  color: var(--text-secondary);
}

.beta-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.custom-stem-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-hairline-strong);
  background: transparent;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.custom-stem-row input[type="checkbox"]:checked {
  background: var(--primary-btn-bg);
  border-color: var(--primary-btn-bg);
}

.custom-stem-row input[type="checkbox"]:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--primary-btn-fg);
  border-bottom: 2px solid var(--primary-btn-fg);
  transform: rotate(-45deg) translate(1px, -1px);
}

#sepCustomView .sheet-footer {
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

/* Calm Processing State inside Séparer Sheet */
.sep-progress-body {
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.progress-ring-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  stroke: var(--control);
}

.progress-ring-fg {
  stroke: var(--text);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.progress-ring-pct {
  position: absolute;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sep-progress-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.sep-progress-file {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

/* Segmented Control (Export) */
.segmented-control {
  margin: 0 16px 14px;
  padding: 3px;
  border-radius: 11px;
  background: var(--control);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.seg-btn {
  min-height: 36px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.14s ease, color 0.14s ease;
}

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* Tempo & Key Steppers */
.stepper-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 28px 18px;
}

.round-step-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--control);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, transform 0.12s ease;
}

.round-step-btn:active {
  background: var(--control-pressed);
  transform: scale(0.94);
}

.stepper-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stepper-readout strong {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.stepper-readout span {
  font-size: 13px;
  color: var(--text-secondary);
}

.sheet-slider-wrap {
  padding: 0 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.sheet-divider {
  height: 1px;
  background: var(--hairline);
  margin: 4px 20px 14px;
}

.sheet-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 22px;
  min-height: 44px;
}

.row-label {
  font-size: 15px;
  color: var(--text);
  min-width: 84px;
}

.fx-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
}

.fx-val {
  min-width: 30px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.toggle-chip {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--control);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.toggle-chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-fg);
}

/* Action Sheet */
.action-sheet {
  padding-left: 16px;
  padding-right: 16px;
  gap: 10px;
}

.action-sheet-title {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 12px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-sheet-list {
  background: var(--control);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.action-sheet-item {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  position: relative;
  text-align: left;
}

.action-sheet-item::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}

.action-sheet-item:last-child::after {
  display: none;
}

.action-sheet-item:active {
  background: var(--control-pressed);
}

.action-sheet-item.danger {
  color: var(--accent);
}

/* Full-Height Studio Overlay */
.studio-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 55;
  display: flex;
  flex-direction: column;
}

.studio-mount-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px calc(24px + var(--safe-bottom));
}

/* Reusable Modals (ui-modals.js) styled in Apple Dark Mode */
.msai-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
}

.msai-modal {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msai-modal h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.msai-modal p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.msai-modal .fieldline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msai-modal .fieldline label {
  font-size: 13px;
  color: var(--text-secondary);
}

.msai-modal .fieldline input {
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--control);
  color: var(--text);
  outline: none;
}

.msai-modal .row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.msai-modal .primary,
.msai-modal .quiet {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.msai-modal .primary {
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
}

.msai-modal .quiet {
  background: var(--control);
  color: var(--text);
}

.msai-modal .quiet.danger {
  background: var(--accent-soft);
  color: var(--accent);
}

.micro {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Minimal Toast (top capsule below topbar — never overlaps Play or header title) */
.toast-pill {
  position: fixed;
  left: 50%;
  top: calc(62px + var(--safe-top));
  transform: translateX(-50%) translateY(-10px);
  background: var(--bg-control);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.toast-pill.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================================
   DESKTOP FRAMELESS TITLEBAR (Windows Electron Only)
   ============================================================================ */

:root {
  --titlebar-h: 0px;
}

body.is-desktop-electron {
  --titlebar-h: 36px;
}

.desktop-titlebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  padding: 0 140px 0 14px;
  -webkit-app-region: drag;
  user-select: none;
  z-index: 120;
}

.desktop-titlebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

/* ============================================================================
   SCREEN 0 — AUTHENTICATION (Apple Music × Moises Pure OLED)
   ============================================================================ */

.auth-screen {
  position: fixed;
  top: var(--titlebar-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(28px + var(--safe-bottom));
  overflow-y: auto;
  z-index: 40;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 4px;
}

.auth-logo-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}

.auth-brand p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-google-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.google-pill-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--primary-btn-bg);
  color: var(--primary-btn-fg);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.google-pill-btn:hover {
  opacity: 0.94;
}

.google-pill-btn:active {
  transform: scale(0.985);
  opacity: 0.88;
}

.google-pill-btn.google-pending {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
}

.auth-google-note {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.auth-field input::placeholder {
  color: var(--text-secondary);
}

.auth-field input:focus {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.auth-password-wrap input {
  padding-right: 48px;
}

.auth-pw-toggle {
  position: absolute;
  right: 4px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-pw-toggle:hover {
  color: var(--text);
}

.auth-error {
  font-size: 13px;
  line-height: 1.35;
  color: #FF7B8E;
  padding: 2px 4px;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-switch-btn {
  color: var(--text);
  font-weight: 600;
  padding: 4px 2px;
}

.auth-switch-btn:hover {
  text-decoration: underline;
}

/* ============================================================================
   ACCOUNT TRIGGER, SHEET & SHELL HELPERS
   ============================================================================ */

.app-shell {
  position: fixed;
  top: var(--titlebar-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
}

.app-shell .app-screen {
  top: var(--titlebar-h);
}

.lib-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  transition: background 0.14s ease, transform 0.12s ease;
}

.account-avatar-btn:active {
  background: var(--control);
  transform: scale(0.95);
}

.account-avatar-btn img,
.account-avatar-badge img,
.account-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-import-wrap,
.sidebar-account-footer,
.desktop-stage-empty {
  display: none;
}

.player-body-inner,
.player-dock-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.player-dock-inner {
  gap: 10px;
}

/* Account Bottom Sheet / Popover */
.account-profile-card {
  margin: 0 16px 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--control);
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.account-profile-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-profile-meta strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-profile-meta span {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-quota-card {
  margin: 0 16px 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--control);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-quota-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.account-quota-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.account-quota-bar {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.account-quota-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: var(--text);
  transition: width 0.25s ease;
}

.account-quota-fill.near-limit {
  background: var(--accent);
}

.pill-btn-danger {
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.pill-btn-danger:hover {
  opacity: 0.88;
}

.pill-btn-danger:active {
  transform: scale(0.98);
}

.pill-btn-danger.full {
  width: 100%;
}

/* Desktop Drag & Drop Overlay */
.drop-overlay {
  position: fixed;
  top: var(--titlebar-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--backdrop-scrim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  pointer-events: none;
}

.drop-overlay-box {
  width: 100%;
  max-width: 420px;
  padding: 40px 28px;
  border-radius: 22px;
  background: var(--surface);
  border: 1.5px dashed var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  color: var(--text);
}

.drop-overlay-box strong {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

.drop-overlay-box span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================================================
   RESPONSIVE APPLE MUSIC DESKTOP LAYOUT (>= 840px)
   Preserves exact mobile Moises layout below 840px; transforms into a crisp
   280px fixed sidebar + spacious OLED stage on Windows Desktop & wide screens.
   ============================================================================ */

@media (min-width: 840px) {
  .app-shell:not(.hidden) {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    overflow: hidden;
  }

  .app-shell:not(.hidden) #screenLibrary,
  .app-shell:not(.hidden) #screenPlayer {
    display: flex !important;
    position: relative;
    inset: auto;
    top: auto;
    max-width: none;
    margin: 0;
    height: 100%;
    min-height: 0;
  }

  /* Left Fixed Apple Music Sidebar */
  #screenLibrary {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--hairline);
  }

  #screenLibrary .lib-header {
    padding: 18px 16px 10px;
  }

  #screenLibrary .lib-title {
    font-size: 22px;
    letter-spacing: -0.02em;
  }

  #librarySearchToggle,
  #settingsBtnMobile,
  #accountBtnMobile,
  #fabImportBtn {
    display: none !important;
  }

  #librarySearchWrap {
    display: block !important;
    padding: 0 14px 10px;
  }

  #librarySearchWrap .search-field {
    height: 38px;
    border-radius: 10px;
    padding: 0 11px;
    background: var(--bg-control);
  }

  #librarySearchWrap .search-field input {
    font-size: 13.5px;
  }

  .sidebar-import-wrap {
    display: block;
    padding: 0 14px 12px;
    flex-shrink: 0;
  }

  .sidebar-import-btn {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    background: var(--primary-btn-bg);
    color: var(--primary-btn-fg);
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: opacity 0.12s ease, transform 0.12s ease;
  }

  .sidebar-import-btn:hover {
    opacity: 0.92;
  }

  .sidebar-import-btn:active {
    transform: scale(0.985);
  }

  #screenLibrary .lib-main {
    padding: 2px 0 12px;
  }

  #screenLibrary .song-row {
    min-height: 58px;
    padding: 7px 6px 7px 10px;
    margin: 2px 10px;
    width: calc(100% - 20px);
    border-radius: 10px;
    gap: 10px;
  }

  #screenLibrary .song-row::after {
    display: none;
  }

  #screenLibrary .song-row:hover {
    background: var(--bg-control);
  }

  #screenLibrary .song-row.active-song {
    background: var(--surface);
  }

  #screenLibrary .song-row.active-song .song-thumb {
    color: var(--accent);
    border-color: var(--accent-border);
  }

  #screenLibrary .song-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  #screenLibrary .song-info strong {
    font-size: 14px;
  }

  #screenLibrary .song-info span {
    font-size: 12px;
  }

  #screenLibrary .song-more-btn {
    width: 34px;
    height: 34px;
  }

  #screenLibrary .lib-empty {
    min-height: 220px;
    padding: 24px 18px;
  }

  #screenLibrary .lib-empty h2 {
    font-size: 16px;
  }

  #screenLibrary .lib-empty p {
    font-size: 13px;
    margin-bottom: 10px;
  }

  #screenLibrary .lib-empty .pill-btn-primary {
    display: none;
  }

  .sidebar-account-footer {
    display: block;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--hairline);
    flex-shrink: 0;
  }

  .sidebar-account-btn {
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    transition: background 0.14s ease;
  }

  .sidebar-account-btn:hover {
    background: var(--bg-control-hover);
  }

  .account-avatar-badge {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--hairline-strong);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }

  .sidebar-account-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
  }

  .sidebar-account-text strong {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-account-text span {
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Right Spacious Main Stage */
  #screenPlayer {
    background: var(--bg);
  }

  #playerBackBtn {
    display: none;
  }

  #screenPlayer.no-song-selected .player-topbar,
  #screenPlayer.no-song-selected .player-body,
  #screenPlayer.no-song-selected .player-dock {
    display: none;
  }

  #screenPlayer.no-song-selected .desktop-stage-empty {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 32px;
    gap: 10px;
  }

  .desktop-stage-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
  }

  .desktop-stage-empty h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .desktop-stage-empty p {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 360px;
  }

  .desktop-shortcuts-hint {
    margin-top: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-tertiary);
  }

  #screenPlayer .player-topbar {
    padding: 14px 28px 12px;
  }

  #screenPlayer .player-heading {
    align-items: flex-start;
    text-align: left;
  }

  #screenPlayer .player-heading strong {
    font-size: 19px;
  }

  #screenPlayer .player-body {
    padding: 20px 32px 28px;
  }

  .player-body-inner {
    max-width: 820px;
    margin: 0 auto;
    gap: 16px;
  }

  .waveform-stage {
    height: 72px;
  }

  .stem-row {
    padding: 13px 16px;
  }

  .player-dock {
    padding: 12px 32px 14px;
  }

  .player-dock-inner {
    max-width: 820px;
    margin: 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .transport-row {
    gap: 18px;
  }

  .transport-play {
    width: 48px;
    height: 48px;
  }

  .tool-bar {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .tool-btn {
    min-width: 82px;
    padding: 6px 12px;
  }

  .tool-btn:hover {
    background: var(--surface);
    color: var(--text);
  }

  /* Desktop Centered Modal Sheets */
  .sheet-backdrop {
    align-items: center;
    padding: 24px;
  }

  .sheet-panel {
    max-width: 460px;
    border-radius: 20px;
    border: 1px solid var(--hairline-strong);
    padding: 18px 0 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
  }

  .sheet-handle {
    display: none;
  }

  .studio-overlay {
    top: var(--titlebar-h);
  }

  .toast-pill {
    top: calc(18px + var(--titlebar-h));
  }
}

/* ============================================================================
   AUTH CORNER QUICK TOOLS (Language & Theme available before login)
   ============================================================================ */

.auth-corner-tools {
  position: absolute;
  top: calc(16px + var(--safe-top));
  inset-inline-end: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

.corner-chip-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.corner-chip-btn.icon-only {
  width: 36px;
  padding: 0;
}

.corner-chip-btn:hover {
  background: var(--bg-control);
}

.sidebar-settings-gear {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================================
   IN-APP LIVE UPDATE BAR (BARRE DE MISE À JOUR)
   ============================================================================ */

.ota-update-bar {
  position: fixed;
  top: calc(64px + var(--titlebar-h) + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 520px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36);
  overflow: hidden;
  z-index: 48;
  animation: otaSlideIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 840px) {
  .ota-update-bar {
    top: calc(16px + var(--titlebar-h));
    left: calc(50% + 140px);
    max-width: min(520px, calc(100vw - 320px));
  }

  [dir="rtl"] .ota-update-bar {
    left: calc(50% - 140px);
  }
}

@keyframes otaSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ota-bar-main {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
}

.ota-bar-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ota-bar-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ota-bar-copy strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ota-bar-copy span {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ota-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ota-bar-cta {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.14s ease, transform 0.12s ease;
}

.ota-bar-cta:hover {
  opacity: 0.92;
}

.ota-bar-cta:active {
  transform: scale(0.96);
}

.ota-bar-dismiss {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ota-bar-dismiss:hover {
  background: var(--bg-control);
  color: var(--text-primary);
}

.ota-bar-progress-track {
  width: 100%;
  height: 4px;
  background: var(--bg-control);
  overflow: hidden;
}

.ota-bar-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.18s ease;
}

/* ============================================================================
   UNIFIED 4-TAB SETTINGS SHEET (Thème · Langue · Mise à jour · Compte)
   ============================================================================ */

.settings-sheet-panel {
  max-height: 90vh;
}

@media (min-width: 840px) {
  .settings-sheet-panel {
    max-width: 500px;
  }
}

.settings-tabs {
  margin: 0 16px 14px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg-control);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  flex-shrink: 0;
}

.settings-tab {
  min-height: 34px;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.14s ease, color 0.14s ease;
}

.settings-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.settings-panels-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 6px;
}

.settings-panel {
  display: flex;
  flex-direction: column;
}

.settings-section-label {
  padding: 2px 20px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.settings-hint {
  margin: 10px 20px 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
}

/* 6 Curated Studio Theme Preset Cards */
.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.theme-preset-card {
  border-radius: 14px;
  padding: 10px;
  background: var(--bg-control);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: start;
  transition: border-color 0.14s ease, transform 0.12s ease;
}

.theme-preset-card:active {
  transform: scale(0.98);
}

.theme-preset-card.selected {
  border-color: var(--accent);
}

.theme-mini-preview {
  width: 100%;
  height: 46px;
  border-radius: 9px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(128, 128, 128, 0.22);
}

.theme-mini-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.theme-mini-pill {
  height: 8px;
  width: 58%;
  border-radius: 99px;
}

.theme-mini-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.theme-mini-wave {
  height: 6px;
  width: 100%;
  border-radius: 99px;
  overflow: hidden;
  display: flex;
}

.theme-mini-wave-fill {
  height: 100%;
  width: 58%;
  border-radius: 99px;
}

.theme-preset-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.theme-preset-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-preset-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Custom Color & Surface Builder */
.custom-theme-card {
  margin: 0 16px 8px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-control);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-theme-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.custom-color-picker-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  cursor: pointer;
}

.custom-color-picker-pill input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.custom-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.35);
  flex-shrink: 0;
}

.custom-color-hex {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.accent-swatches-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  justify-items: center;
}

.accent-swatch-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.14s ease;
}

.accent-swatch-btn:active {
  transform: scale(0.92);
}

.accent-swatch-btn.selected {
  border-color: var(--text-primary);
  transform: scale(1.08);
}

.custom-theme-divider {
  height: 1px;
  background: var(--border-hairline);
}

.surface-pills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.surface-pill-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.surface-pill-btn.selected {
  border-color: var(--accent);
}

.surface-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.4);
  flex-shrink: 0;
}

/* Dedicated 4-Language Selection List (Monogram Badges — Zero Flag Emojis) */
.language-list {
  margin: 0 16px;
  background: var(--bg-control);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.language-row {
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: start;
  position: relative;
  transition: background 0.12s ease;
}

.language-row::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--border-hairline);
}

.language-row:last-child::after {
  display: none;
}

.language-row:active {
  background: var(--bg-control-hover);
}

.language-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lang-monogram {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.language-row.selected .lang-monogram {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.language-row-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.language-row-text strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.language-row-text span {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* OTA Updates Tab */
.ota-settings-card {
  margin: 0 16px 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-control);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ota-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ota-version-pill {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.ota-status-line {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ota-status-line.has-update {
  color: var(--accent);
}

.ota-release-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ota-settings-actions {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================================================
   LIGHT MODE ("Clair · Jour") REFINEMENTS
   ============================================================================ */

[data-theme-mode="light"] .stem-row,
[data-theme-mode="light"] .chords-strip-wrap,
[data-theme-mode="light"] .waveform-stage,
[data-theme-mode="light"] .auth-field input,
[data-theme-mode="light"] .search-field {
  border: 1px solid var(--border-hairline);
}

[data-theme-mode="light"] .apple-slider {
  --stem-accent: var(--text-primary);
}

[data-theme-mode="light"] .stem-slider::-webkit-slider-thumb,
[data-theme-mode="light"] .apple-slider::-webkit-slider-thumb {
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

[data-theme-mode="light"] .chord-next-item:first-child {
  color: rgba(29, 29, 31, 0.72);
}

[data-theme-mode="light"] .sheet-handle {
  background: rgba(0, 0, 0, 0.18);
}

[data-theme-mode="light"] .progress-ring-fg {
  stroke: var(--accent);
}

[data-theme-mode="light"] .account-quota-bar {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme-mode="light"] .account-quota-fill {
  background: var(--text-primary);
}

[data-theme-mode="light"] .account-quota-fill.near-limit {
  background: var(--accent);
}

/* ============================================================================
   ARABIC RTL SUPPORT (Natural RTL text/chrome, LTR audio timelines & sliders)
   ============================================================================ */

[dir="rtl"] .rtl-flip-icon {
  transform: scaleX(-1);
}

[dir="rtl"] .song-row {
  padding: 10px 20px 10px 12px;
  text-align: right;
}

[dir="rtl"] .song-row::after {
  left: 20px;
  right: 82px;
}

[dir="rtl"] .song-row-main,
[dir="rtl"] .preset-row,
[dir="rtl"] .drilldown-row,
[dir="rtl"] .action-sheet-item,
[dir="rtl"] .sidebar-account-btn {
  text-align: right;
}

[dir="rtl"] .fab-add {
  right: auto;
  left: max(20px, calc(50% - 340px));
}

[dir="rtl"] .auth-password-wrap input {
  padding-right: 16px;
  padding-left: 48px;
}

[dir="rtl"] .auth-pw-toggle {
  right: auto;
  left: 4px;
}

[dir="rtl"] .stem-fader-wrap,
[dir="rtl"] .waveform-section,
[dir="rtl"] .transport-row,
[dir="rtl"] input[type="range"] {
  direction: ltr;
}

@media (min-width: 840px) {
  [dir="rtl"] #screenLibrary {
    border-right: 0;
    border-left: 1px solid var(--hairline);
  }

  [dir="rtl"] #screenPlayer .player-heading {
    align-items: flex-end;
    text-align: right;
  }
}

/* ============================================================================
   v2.7.0 — YJ BRAND IDENTITY, LAUNCH OTA MODAL, 3-TIER LOCKS, STORE & ADMIN
   ============================================================================ */

.yj-titlebar-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}

.auth-logo-mark.yj-hero-squircle {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: #0A0909;
  border: 1px solid rgba(200, 82, 50, 0.36);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 224, 210, 0.08);
  padding: 10px;
}

.auth-logo-mark.yj-hero-squircle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lib-brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.lib-brand-wrap .lib-title {
  font-size: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 440px) {
  #screenLibrary .lib-header {
    padding-left: 16px;
    padding-right: 16px;
    gap: 8px;
  }
  #screenLibrary .lib-header-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  #screenLibrary .lib-header-actions .icon-circle-btn {
    width: 34px;
    height: 34px;
  }
  #screenLibrary .lib-header-actions .account-avatar-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  #screenLibrary .credit-pill-btn {
    height: 28px;
    padding: 0 9px;
    font-size: 11.5px;
  }
}

.yj-header-crest {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #0A0909;
  border: 1px solid rgba(200, 82, 50, 0.34);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
}

.yj-header-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.yj-edition-crest {
  margin: 4px 16px 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(200, 82, 50, 0.08);
  border: 1px solid rgba(200, 82, 50, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.yj-edition-crest img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Calm Offline Local Mode Pill */
.offline-local-pill {
  margin: 0 16px 10px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-control);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
}

/* Credit Balance & Tier Pills */
.credit-pill-btn,
.credit-pill-static {
  height: 32px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: transform 0.12s ease, opacity 0.14s ease;
}

.credit-pill-btn:active {
  transform: scale(0.95);
}

.credit-pill-btn.compact {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tier-chip.tier-studio {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.tier-chip.tier-ultra,
.tier-chip.tier-admin {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.sidebar-credit-pill {
  width: 100%;
  margin-bottom: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.sidebar-credit-pill:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-border);
}

.sidebar-credit-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.sidebar-credit-left strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.sidebar-credit-cta {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* Moises-Style Dimmed-Locked Feature States (Opacity + Monochrome Lock SVG + Tier Pill) */
.is-tier-locked {
  opacity: 0.56 !important;
  position: relative;
}

.is-tier-locked:hover {
  opacity: 0.78 !important;
}

.preset-row.is-tier-locked .preset-check {
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  flex-shrink: 0;
}

.tier-lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.tier-lock-pill.ultra {
  border-color: var(--accent-border);
  color: var(--accent);
}

.seg-btn .tier-lock-mini {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-inline-start: 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.85;
}

.tool-btn .tool-lock-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-control);
  border: 1px solid var(--border-hairline-strong);
  color: var(--accent);
  text-transform: uppercase;
}

.tool-btn {
  position: relative;
}

/* Launch Mandatory OTA Update Modal */
.ota-force-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ota-force-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.ota-force-emblem {
  width: 62px;
  height: 62px;
  border-radius: 17px;
  background: #0A0909;
  border: 1px solid rgba(200, 82, 50, 0.36);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.ota-force-emblem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ota-force-card h2 {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.ota-force-version-badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
}

.ota-force-notes {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.ota-force-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ota-force-pct {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ota-force-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

/* Credit Store Bottom Sheet */
.store-sheet-panel {
  max-height: min(90dvh, 760px);
  display: flex;
  flex-direction: column;
}

.store-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.store-scroll {
  overflow-y: auto;
  padding: 0 16px calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.store-packs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.store-pack-card {
  position: relative;
  padding: 13px 10px 12px;
  border-radius: 16px;
  background: var(--bg-control);
  border: 1.5px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
  gap: 4px;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.12s ease;
}

.store-pack-card:active {
  transform: scale(0.98);
}

.store-pack-card.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.store-pack-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-fg);
  margin-bottom: 2px;
}

.store-pack-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.store-pack-credits {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.store-pack-price {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.store-pack-usd {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.store-features-card {
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
}

.store-features-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 9px;
}

.store-features-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.store-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-primary);
}

.store-feature-item .feat-icon {
  color: var(--accent);
  flex-shrink: 0;
  display: inline-flex;
}

.store-feature-item.locked {
  opacity: 0.34;
}

.store-feature-item.locked .feat-icon {
  color: var(--text-secondary);
}

.store-channels-seg {
  margin: 0 !important;
}

.store-channel-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.store-inline-status {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-control);
  color: var(--text-primary);
}

.store-inline-status.ok {
  background: rgba(16, 185, 129, 0.14);
  color: #34D399;
}

.store-inline-status.err {
  background: rgba(250, 45, 72, 0.14);
  color: #FF7B8E;
}

.store-tn-details {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-tn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.store-tn-row-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.store-tn-row-info span {
  font-size: 11px;
  color: var(--text-secondary);
}

.store-tn-row-info strong {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.copy-mini-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.store-tn-note {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.store-tn-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-tn-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.store-history-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.store-history-item {
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--bg-control);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.store-status-pill {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.store-status-pill.pending {
  background: rgba(245, 158, 11, 0.16);
  color: #FBBF24;
}

.store-status-pill.approved {
  background: rgba(16, 185, 129, 0.16);
  color: #34D399;
}

.store-status-pill.rejected {
  background: rgba(250, 45, 72, 0.16);
  color: #FF7B8E;
}

.store-intl-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}

/* Admin Panel Inside Settings Sheet */
.admin-stack {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-card-head strong,
.admin-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-list,
.admin-codes-list,
.admin-form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-row-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px auto;
  gap: 8px;
  align-items: center;
}

.admin-row-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}

.admin-input:focus {
  border-color: var(--accent);
}

.admin-input.mono-upper {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}

.admin-field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.admin-pending-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-pending-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.admin-pending-top strong {
  color: var(--text-primary);
  display: block;
}

.admin-pending-top span {
  color: var(--text-secondary);
  font-size: 11.5px;
  display: block;
}

.admin-pending-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-code-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-primary);
}

.admin-empty-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.compact-btn {
  min-height: 40px !important;
  padding: 0 14px !important;
  font-size: 13.5px !important;
}

@media (min-width: 840px) {
  #creditPillMobile {
    display: none !important;
  }
}

/* ============================================================================
   v2.7.1 — MONTHLY/ANNUAL STORE, CUSTOM CREDITS SLIDER & SERVER HEALTH PROBE
   ============================================================================ */

.store-mode-seg,
.store-cycle-seg {
  margin: 0 !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.store-section-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-pack-subprice {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.store-custom-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline-strong);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-custom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.store-custom-head strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.store-custom-discount {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.store-quick-pills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.quick-credit-pill {
  height: 36px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.quick-credit-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.store-custom-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 10px;
  align-items: center;
}

.store-custom-slider-row .apple-slider {
  --stem-accent: var(--accent);
  --control: rgba(255, 255, 255, 0.16);
}

[data-theme-mode="light"] .store-custom-slider-row .apple-slider {
  --control: rgba(0, 0, 0, 0.14);
}

.admin-card .pill-btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline-strong);
}

.store-qty-input {
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 6px 8px !important;
}

.store-custom-summary {
  padding-top: 10px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.store-custom-unit {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.store-custom-hint {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.store-custom-totals {
  text-align: end;
  flex-shrink: 0;
}

.store-custom-totals strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.store-custom-totals span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.admin-row-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-pair-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.admin-pair-inputs .admin-input {
  padding: 6px 6px;
  font-size: 12px;
  text-align: center;
}

.admin-prices-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 2px;
}

.server-status-badge {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.14);
  color: #34D399;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.server-status-badge.is-backup {
  background: rgba(245, 158, 11, 0.16);
  color: #FBBF24;
}

.admin-health-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.server-health-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.server-health-url {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.server-health-pill {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.server-health-pill.online {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
}

.server-health-pill.offline {
  background: rgba(250, 45, 72, 0.15);
  color: #FF7B8E;
}

/* ============================================================================
   v2.8.0 WEB PWA INSTALL BANNER & iOS SAFARI 2-STEP GUIDE (ZERO EMOJIS)
   ============================================================================ */

.pwa-install-banner {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 440px);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: 16px;
  background: rgba(20, 18, 18, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--accent-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.pwa-install-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
}

.pwa-install-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.pwa-install-copy strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-copy span {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-cta {
  height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.ios-install-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 16px 14px;
}

.ios-step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-control);
  border: 1px solid var(--border-hairline);
}

.ios-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-step-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}
