/* ============================================================
   ENHANCER LIVE — PWA concert
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --bg-2: #141414;
  --fg: #f5f5f5;
  --muted: #8a8a8a;
  --accent: #ef4444;
  --accent-2: #f97316;
  --border: rgba(255, 255, 255, 0.08);
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overscroll-behavior: none;
  overflow: hidden;            /* PAS de scroll body — l'app tient dans la viewport */
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  height: 100dvh;              /* dynamic vh sur iOS (gère la barre Safari) */
  display: flex;
  flex-direction: column;
}
/* fallback ancien iOS */
@supports not (height: 100dvh) {
  body { height: 100vh; }
}

/* Page admin/régie : contenu long → autoriser le scroll */
html.allow-scroll,
html.allow-scroll body {
  overflow: auto;
  height: auto;
  min-height: 100dvh;
}
html.allow-scroll body { display: block; }
html.allow-scroll .page { overflow: visible; height: auto; }

a { color: var(--fg); text-decoration: none; }

/* ---- Typo titres ---- */
.title {
  font-family: "Helvetica Neue", "Arial Black", sans-serif;
  font-weight: 900;
  font-stretch: condensed;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  line-height: 0.9;
}

h1.title { font-size: clamp(2.5rem, 12vw, 4.5rem); }
h2.title { font-size: clamp(1.5rem, 6vw, 2.25rem); }
h3.title { font-size: 1.25rem; }

.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* ---- Layout ---- */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 24px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;               /* permet aux enfants flex:1 de scroller correctement */
}

/* Container interne scrollable (ex: liste de morceaux) */
.scroll-y {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }

/* ---- Header ---- */
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.brand-name {
  font-family: "Helvetica Neue", "Arial Black", sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-name::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 26px;
  background: url('/logo.svg') center/contain no-repeat;
  flex-shrink: 0;
}
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

/* ---- Card / buttons ---- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 64px;
  padding: 16px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--fg);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  justify-content: center;
  text-align: center;
}
.btn-primary:active { background: #dc2626; }
.btn-ghost { background: transparent; }
.btn-icon { font-size: 1.5rem; }

.btn-feature {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;     /* centre verticalement quand le bouton s'allonge */
  min-height: 84px;
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
}
.btn-feature .btn-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.btn-feature .btn-title {
  font-family: "Helvetica Neue", "Arial Black", sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 1rem;
  line-height: 1.1;
}
.btn-feature .btn-sub {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.25;
}
.btn-feature.live::before {
  content: "LIVE";
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 4px;
}

/* Animation d'appui — bounce + halo rouge */
@keyframes btn-press {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0   rgba(239, 68, 68, 0); }
  40%  { transform: scale(0.94); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.12); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(239, 68, 68, 0); }
}
.btn-feature.pressing {
  animation: btn-press 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Form ---- */
input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }

label { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- Setlist song row ---- */
.song {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.song:active { background: #1c1c1c; }
.song.top3 { border-color: var(--accent); }
.song.top3 .song-rank { color: var(--accent); }
.song-rank {
  font-family: "Helvetica Neue", "Arial Black", sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
  color: var(--muted);
}
.song-info { flex: 1; min-width: 0; }
.song-title {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-album { font-size: 0.8rem; color: var(--muted); }
.song-heart {
  font-size: 1.5rem;
  filter: grayscale(1) brightness(0.6);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.song.liked .song-heart {
  filter: none;
  transform: scale(1.15);
}
.song-count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}
.song.liked .song-count { color: var(--accent); }

/* ---- Vote bars ---- */
.vote-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  overflow: hidden;
  min-height: 72px;
}
.vote-option .vote-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.1));
  width: 0%;
  transition: width 0.4s ease;
  z-index: 0;
}
.vote-option .vote-content { position: relative; z-index: 1; display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 12px; }
.vote-option .vote-title { font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; font-size: 1.1rem; }
.vote-option .vote-count { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.vote-option.voted { border-color: var(--accent); }
.vote-option.voted .vote-count { color: var(--accent); }
.vote-option.winner { border-color: var(--accent-2); }
.vote-option.winner .vote-bar { background: linear-gradient(90deg, rgba(249, 115, 22, 0.4), rgba(239, 68, 68, 0.2)); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-200%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.3s ease;
  z-index: 100;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Light show fullscreen ---- */
.lightshow-screen {
  position: fixed;
  inset: 0;
  background: #000;
  transition: background 0.05s linear;
  z-index: 1;
}
.lightshow-ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 20px);
  pointer-events: none;
}
.lightshow-ui > * { pointer-events: auto; }
.lightshow-top, .lightshow-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lightshow-status {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lightshow-msg {
  text-align: center;
  font-family: "Helvetica Neue", "Arial Black", sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 7vw, 2.5rem);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  padding: 0 20px;
}
.exit-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Zone picker ---- */
.zone-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
}
.zone-btn {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-weight: 700;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.zone-btn.active {
  border-color: var(--accent);
  background: rgba(239, 68, 68, 0.1);
}
.zone-emoji { font-size: 2rem; margin-bottom: 4px; }

/* ---- Admin grid ---- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.admin-pattern {
  padding: 16px 12px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  text-align: center;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.admin-pattern.active { border-color: var(--accent); background: rgba(239, 68, 68, 0.1); }

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
}
.swatch.active { border-color: #fff; transform: scale(1.1); }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-value { font-weight: 800; font-size: 1.1rem; }

/* ---- Section heading ---- */
.section {
  margin-top: 28px;
}
.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 700;
}

/* ---- Big circle button (vote primaire) ---- */
.big-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--accent);
  color: #fff;
  padding: 22px 32px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
}

/* Vibrate animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.shake { animation: shake 0.4s ease; }

/* Strobe screen burst */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.05s linear;
}
