/* ─── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg:         #03030a;
  --card:       rgba(255,255,255,.028);
  --card-hov:   rgba(255,255,255,.052);
  --border:     rgba(255,255,255,.07);
  --border-hov: rgba(255,255,255,.14);

  --purple:    #7c3aed;
  --purple-lt: #a78bfa;
  --pink:      #ec4899;
  --pink-lt:   #f472b6;
  --amber:     #f59e0b;
  --green:     #10b981;
  --red:       #ef4444;
  --orange:    #f97316;

  --grad: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);

  --text:  #f4f4fc;
  --text2: rgba(244,244,252,.58);
  --text3: rgba(244,244,252,.32);

  --r-md:   14px;
  --r-lg:   18px;
  --r-full: 999px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100dvh;
  overflow-x: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease-out;
}

/* ─── Shared header ─────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  padding: max(1rem, env(safe-area-inset-top, 1rem)) 1.25rem .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(3,3,10,.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
}
.header-brand:hover .header-title { opacity: .8; }

.header-logo-svg {
  width: 22px;
  height: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(167,139,250,.65));
}

.header-brand-text { display: flex; flex-direction: column; gap: 1px; }

.header-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  background: linear-gradient(120deg, #e9e4ff 0%, var(--purple-lt) 45%, var(--pink-lt) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity .2s;
}

.header-tagline {
  font-size: .6rem;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header-live-pill {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.22);
  border-radius: var(--r-full);
  padding: .28rem .75rem;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--red);
  text-transform: uppercase;
}
.header-live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse-dot 1s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════════════════════
   LANDING SCREEN
══════════════════════════════════════════════════════════════════════════════ */
#landing-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.landing-hdr { position: relative; background: transparent; border-bottom: none; }
.landing-hdr::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3,3,10,.6) 0%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}

/* ─── Blobs animés ──────────────────────────────────────────────────────────── */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(124,58,237,.22) 0%, transparent 68%);
  top: -160px; right: -140px;
  animation: blob-drift 14s ease-in-out infinite alternate;
}
.blob-2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(236,72,153,.16) 0%, transparent 68%);
  bottom: -120px; left: -120px;
  animation: blob-drift 11s ease-in-out infinite alternate-reverse;
}
.blob-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(167,139,250,.12) 0%, transparent 70%);
  top: 45%; left: 50%;
  transform: translate(-50%, -50%);
  animation: blob-pulse 8s ease-in-out infinite;
}
@keyframes blob-drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, -40px) scale(1.1); }
}
@keyframes blob-pulse {
  0%,100% { opacity: .5; transform: translate(-50%,-50%) scale(1); }
  50%      { opacity: 1;  transform: translate(-50%,-50%) scale(1.15); }
}

/* ─── Hero ──────────────────────────────────────────────────────────────────── */
.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 1.75rem 3rem;
  gap: 1.35rem;
  position: relative;
  z-index: 1;
}

.landing-mark {
  width: 64px; height: auto;
  filter: drop-shadow(0 0 28px rgba(167,139,250,.7)) drop-shadow(0 0 8px rgba(244,114,182,.4));
  animation: mark-float 6s ease-in-out infinite;
}
.landing-mark svg { width: 64px; height: auto; }
@keyframes mark-float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}

.landing-headline {
  font-size: clamp(2rem, 9vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -.05em;
  line-height: 1.05;
  max-width: 500px;
  color: var(--text);
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-sub {
  font-size: clamp(.875rem, 3vw, 1rem);
  color: var(--text2);
  max-width: 360px;
  line-height: 1.65;
}

/* ─── CTA ───────────────────────────────────────────────────────────────────── */
.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: 1.05rem 2rem;
  border: none;
  border-radius: var(--r-full);
  background: var(--grad);
  color: #fff;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(124,58,237,.42), 0 2px 8px rgba(0,0,0,.3);
  transition: transform .12s, box-shadow .2s;
}
.landing-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.15) 0%, transparent 60%);
  pointer-events: none;
}
.landing-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 52px rgba(124,58,237,.58), 0 4px 12px rgba(0,0,0,.3);
}
.landing-cta:active { transform: scale(.97); }
.landing-cta svg { flex-shrink: 0; transition: transform .15s; }
.landing-cta:hover svg { transform: translateX(3px); }

/* ─── Pills ─────────────────────────────────────────────────────────────────── */
.landing-pills {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.lpill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: rgba(255,255,255,.04);
  font-size: .72rem;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════════
   EVENTS SCREEN
══════════════════════════════════════════════════════════════════════════════ */
#events-screen {
  min-height: 100dvh;
  display: none;
  flex-direction: column;
  align-items: center;
  padding-bottom: 3rem;
}

/* ─── Hero ──────────────────────────────────────────────────────────────────── */
.events-hero {
  position: relative;
  width: 100%;
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 500px; height: 360px;
  background: radial-gradient(ellipse at center, rgba(124,58,237,.2) 0%, rgba(236,72,153,.07) 45%, transparent 72%);
  filter: blur(24px);
  pointer-events: none;
}
.events-eyebrow {
  display: inline-block;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--purple-lt);
  margin-bottom: .7rem;
  position: relative;
}
.events-heading {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -.042em;
  line-height: 1.06;
  margin-bottom: .55rem;
  position: relative;
}
.events-sub {
  font-size: .875rem;
  color: var(--text2);
  line-height: 1.55;
  position: relative;
}

/* ─── Search ────────────────────────────────────────────────────────────────── */
.search-section {
  width: 100%;
  max-width: 540px;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.search-bar { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute; left: .95rem;
  width: 16px; height: 16px;
  color: var(--text3); pointer-events: none;
}
.search-input {
  width: 100%; height: 50px;
  padding: 0 2.8rem 0 2.9rem;
  background: rgba(255,255,255,.038);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.search-input::placeholder { color: var(--text3); }
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus {
  border-color: rgba(124,58,237,.45);
  background: rgba(255,255,255,.055);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.search-clear-btn {
  position: absolute; right: .75rem;
  background: rgba(255,255,255,.08);
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer;
  transition: background .15s;
}
.search-clear-btn:hover { background: rgba(255,255,255,.14); }

/* ─── Filter Chips ──────────────────────────────────────────────────────────── */
.filter-chips {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  height: 30px; padding: 0 .85rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: rgba(255,255,255,.035);
  color: var(--text2);
  font-family: var(--font); font-size: .7rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--grad); border-color: transparent; color: #fff; }
.chip:not(.active):hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: var(--text); }

/* ─── Events count ──────────────────────────────────────────────────────────── */
.events-count {
  width: 100%; max-width: 540px;
  padding: .6rem 1.5rem 0;
  font-size: .7rem; font-weight: 500; color: var(--text3);
}

/* ─── Events List ───────────────────────────────────────────────────────────── */
.events-list {
  width: 100%; max-width: 540px;
  padding: .8rem 1.25rem;
  display: flex; flex-direction: column; gap: .6rem;
}
.events-loading {
  display: flex; align-items: center; justify-content: center;
  gap: .75rem; padding: 4rem 0;
  color: var(--text2); font-size: .875rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.08);
  border-top-color: var(--purple-lt);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.events-empty { text-align: center; padding: 3.5rem 1rem; }
.empty-icon { font-size: 2rem; display: block; margin-bottom: .75rem; }
.events-empty p { font-size: .875rem; color: var(--text3); line-height: 1.65; }

/* ─── Event Card ────────────────────────────────────────────────────────────── */
.event-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem 1rem 1.35rem;
  cursor: pointer;
  display: flex; align-items: center; gap: 1rem;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .25s;
  overflow: hidden;
}
.event-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.02) 0%, transparent 65%);
  pointer-events: none; border-radius: inherit;
}
.event-card:hover {
  background: var(--card-hov);
  border-color: var(--border-hov);
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.25);
}
.event-card:active { transform: scale(.98); box-shadow: none; }

.event-card-accent {
  position: absolute; left: 0; top: .85rem; bottom: .85rem;
  width: 3px; border-radius: 0 3px 3px 0;
}
.event-card-body { flex: 1; min-width: 0; }
.event-card-artist {
  font-size: .98rem; font-weight: 700; letter-spacing: -.022em;
  margin-bottom: .22rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-card-venue {
  font-size: .77rem; color: var(--text2); margin-bottom: .3rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-card-date { font-size: .72rem; color: var(--text3); font-weight: 500; }
.event-card-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: .45rem; flex-shrink: 0;
}
.event-status-badge {
  display: inline-flex; align-items: center; gap: .28rem;
  padding: .22rem .62rem;
  border-radius: var(--r-full);
  font-size: .6rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; white-space: nowrap;
}
.event-status-badge.idle  { background: rgba(255,255,255,.055); color: var(--text3); border: 1px solid rgba(255,255,255,.07); }
.event-status-badge.armed { background: rgba(245,158,11,.1);    color: var(--amber); border: 1px solid rgba(245,158,11,.2); }
.event-status-badge.live  { background: rgba(239,68,68,.1);     color: var(--red);   border: 1px solid rgba(239,68,68,.22); }
.event-status-badge.ended { background: rgba(255,255,255,.04);  color: var(--text3); border: 1px solid rgba(255,255,255,.05); }
.event-status-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.event-status-badge.live .event-status-dot { animation: pulse-dot 1s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.2} }
.event-card-chevron { color: var(--text3); }

.events-footer {
  width: 100%; max-width: 540px;
  padding: .25rem 1.5rem 3rem;
  text-align: center; font-size: .72rem; color: var(--text3); line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SPLASH SCREEN
══════════════════════════════════════════════════════════════════════════════ */
#splash-screen {
  min-height: 100dvh;
  display: none;
  flex-direction: column;
  align-items: center;
  padding-bottom: 2.5rem;
}
#splash-screen[aria-hidden="false"],
#splash-screen.active { display: flex; }

.splash-nav {
  width: 100%;
  padding: max(1rem, env(safe-area-inset-top, 1rem)) 1.25rem .5rem;
}
.back-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: none;
  color: var(--text2); font-family: var(--font);
  font-size: .82rem; font-weight: 500;
  cursor: pointer; padding: .4rem .2rem;
  transition: color .2s; letter-spacing: -.01em;
}
.back-btn:hover { color: var(--text); }

.event-hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: .5rem;
  padding: 1.5rem 2rem 1.25rem;
  flex: 1; justify-content: center; width: 100%;
}
.event-cover-ring {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  margin-bottom: .5rem;
}
.event-cover-dot {
  width: 76px; height: 76px; border-radius: 50%;
  transition: background .35s, box-shadow .35s;
}
.event-artist-name {
  font-size: 1.85rem; font-weight: 900;
  letter-spacing: -.045em; line-height: 1.1; max-width: 310px;
}
.event-venue-info { font-size: .875rem; color: var(--text2); max-width: 290px; }
.event-date-info  { font-size: .8rem; font-weight: 600; color: var(--text3); }

/* ─── Status ────────────────────────────────────────────────────────────────── */
.status-container {
  width: 100%; max-width: 310px; text-align: center;
  display: flex; flex-direction: column; gap: .65rem;
  padding: .25rem 1.5rem;
}
.status-message {
  font-size: .875rem; font-weight: 500; color: var(--text2);
  min-height: 1.4em; transition: color .3s;
}
.status-message.syncing { color: var(--amber); }
.status-message.success { color: var(--green); }
.status-message.error   { color: var(--red); }
.status-message.warning { color: var(--orange); }
#sync-progress {
  height: 2px; background: rgba(255,255,255,.08);
  border-radius: 2px; overflow: hidden;
  opacity: 0; transition: opacity .3s;
}
#sync-progress.visible { opacity: 1; }
#sync-progress-bar {
  height: 100%; width: 0%;
  background: var(--grad);
  border-radius: 2px; transition: width .3s ease;
}

/* ─── Join Button ───────────────────────────────────────────────────────────── */
.join-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: calc(100% - 3rem); max-width: 310px;
  padding: 1.05rem 1.75rem;
  border: none; border-radius: var(--r-full);
  background: var(--grad); color: #fff;
  font-family: var(--font); font-size: 1rem; font-weight: 700;
  letter-spacing: -.015em; cursor: pointer;
  margin-top: .35rem; position: relative; overflow: hidden;
  box-shadow: 0 8px 32px rgba(124,58,237,.38), 0 2px 8px rgba(0,0,0,.3);
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.join-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, transparent 60%);
  pointer-events: none;
}
.join-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 44px rgba(124,58,237,.52), 0 4px 0 rgba(124,58,237,.25); }
.join-btn:active { transform: scale(.97); box-shadow: 0 4px 16px rgba(124,58,237,.3); }
.join-btn:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: 0 4px 16px rgba(124,58,237,.2); }
.join-btn-icon { flex-shrink: 0; }

.join-hint {
  font-size: .72rem; color: var(--text3); text-align: center;
  max-width: 250px; line-height: 1.55; padding: 0 1.5rem;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SHOW SCREEN
══════════════════════════════════════════════════════════════════════════════ */
#show-screen {
  min-height: 100dvh;
  display: none;
  background: #000;
  align-items: center;
  justify-content: center;
}
#show-screen[aria-hidden="false"],
#show-screen.active {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 100;
}
.live-badge {
  position: absolute;
  top: max(1.2rem, env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: .4rem;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--r-full);
  padding: .35rem .9rem;
  font-size: .68rem; font-weight: 800;
  letter-spacing: .12em; color: var(--red); text-transform: uppercase;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  animation: pulse-dot 1s ease-in-out infinite;
}
.show-label {
  color: rgba(255,255,255,.35);
  font-size: .78rem; font-weight: 600; letter-spacing: .06em;
  position: absolute;
  bottom: max(2rem, env(safe-area-inset-bottom));
  text-align: center;
}
.audio-btn {
  position: absolute;
  bottom: max(1.75rem, env(safe-area-inset-bottom));
  right: 1.5rem;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.65); cursor: pointer;
  transition: background .2s, color .2s;
}
.audio-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ─── Wake Lock & Debug ─────────────────────────────────────────────────────── */
#wakelock-indicator {
  position: fixed;
  top: max(.6rem, env(safe-area-inset-top));
  right: .8rem;
  display: flex; align-items: center; gap: .3rem;
  font-size: .6rem; color: var(--text3);
  opacity: 0; transition: opacity .4s;
  z-index: 200; pointer-events: none;
}
#wakelock-indicator.active { opacity: 1; }
#debug-panel {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.75);
  padding: .3rem .75rem;
  font-family: monospace; font-size: .62rem;
  color: rgba(167,139,250,.8);
  z-index: 999; text-align: center;
}
#debug-panel.visible { display: block; }
