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

:root {
  --bg-dark: #0a0a0a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --text-primary: #f5f5f5;
  --text-secondary: rgba(245, 245, 245, 0.55);
  --text-muted: rgba(245, 245, 245, 0.35);
  --accent: #e8ff47;
  --accent-dim: rgba(232, 255, 71, 0.15);
  --accent-glow: rgba(232, 255, 71, 0.3);
  --success: #4ade80;
  --warning: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ─── Background: Event Poster Blur ─────────────────────────────────────── */
.bg-poster {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(40px) brightness(0.25) saturate(1.4);
  transform: scale(1.1);
  z-index: 0;
  transition: background-image 0.8s ease;
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(232, 255, 71, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.6) 100%);
  z-index: 1;
}

/* ─── Main Card ─────────────────────────────────────────────────────────── */
.card {
  position: relative;
  z-index: 10;
  width: min(480px, calc(100vw - 32px));
  background: rgba(12, 12, 12, 0.85);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 32px 64px rgba(0,0,0,0.6),
    0 0 80px rgba(232, 255, 71, 0.03);
}

/* ─── Logo & Event Header ───────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 32px;
  height: 32px;
  opacity: 0.9;
}

.brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.event-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.event-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* ─── Status Section ────────────────────────────────────────────────────── */
.status-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.status-badge.pre-queue {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--warning);
}

.status-badge.waiting {
  background: var(--accent-dim);
  border: 1px solid rgba(232, 255, 71, 0.25);
  color: var(--accent);
}

.status-badge.granted {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--success);
}

.status-badge .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

.status-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Position Display ──────────────────────────────────────────────────── */
.position-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.position-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
  font-family: var(--font-mono);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.position-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Progress Ring ─────────────────────────────────────────────────────── */
.progress-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.progress-ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.progress-ring {
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
}

.progress-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.progress-ring-fill.granted {
  stroke: var(--success);
  filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.5));
}

.progress-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wait-time {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}

.wait-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Sale Countdown ────────────────────────────────────────────────────── */
.sale-countdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.countdown-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

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

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

.countdown-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  line-height: 1;
  min-width: 2ch;
  text-align: center;
}

.countdown-sep {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  animation: blink 1s step-end infinite;
}

.countdown-unit-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ─── Granted State ─────────────────────────────────────────────────────── */
.granted-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
  padding: 8px 0;
}

.granted-icon {
  font-size: 48px;
  animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.granted-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
}

.granted-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.granted-countdown {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  animation: countdownPulse 1s ease-in-out infinite;
}

.btn-enter {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
}

.btn-enter:hover {
  background: #f0ff70;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(232, 255, 71, 0.3);
}

.btn-enter:active {
  transform: translateY(0);
}

/* ─── Divider ───────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
}

/* ─── Info Row ──────────────────────────────────────────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ─── Turnstile ─────────────────────────────────────────────────────────── */
.turnstile-wrap {
  display: flex;
  justify-content: center;
  min-height: 65px;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text-primary);
}

/* ─── Error State ───────────────────────────────────────────────────────── */
.error-banner {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #fca5a5;
  display: none;
}

.error-banner.visible {
  display: block;
}

/* ─── Loading State ─────────────────────────────────────────────────────── */
.loading-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 12px 0;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* ─── Particle Background ───────────────────────────────────────────────── */
#particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes countdownPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes loadingDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.card {
  animation: fadeInUp 0.5s ease both;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card {
    padding: 24px 20px;
    gap: 20px;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
  }

  .app {
    justify-content: flex-end;
  }

  .position-number {
    font-size: 36px;
  }

  .countdown-value {
    font-size: 26px;
  }
}
