/* ==========================================================================
   MAIN LAYOUT & BASE STYLES
   Mobile-First, sans scroll parasite, safe-area aware
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header & Status Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--state-idle-border);
}

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

.brand-icon {
  font-size: 1.4rem;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Badges d'état (Wake Lock, PWA/Offline) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--state-idle-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-warning);
}

.status-dot.active {
  background-color: var(--status-active);
  box-shadow: 0 0 8px var(--status-active);
}

.status-dot.offline {
  background-color: var(--status-inactive);
}

/* Main Container */
.soundboard-container {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--footer-height) + 24px) 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Footer Fixe - Bouton d'urgence */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) 16px;
  background: linear-gradient(to top, rgba(10, 12, 16, 0.98) 60%, rgba(10, 12, 16, 0));
  pointer-events: none;
}

.app-footer-inner {
  width: 100%;
  max-width: 600px;
  pointer-events: auto;
}
