/* ─── Design tokens ──────────────────────────────────────────── */
:root {
  --bg:            #08080c;
  --bg-elevated:   #10101a;
  --bg-elevated-2: #1a1a26;
  --border:        #22222e;
  --border-bright: #3a3a4a;

  --text-primary:  #eaeaf0;
  --text-secondary:#9696a8;
  --text-muted:    #5a5a6a;

  --accent:        #ff2ea6;
  --accent-dim:    #d6248c;
  --accent-glow:   rgba(255, 46, 166, 0.55);
  --accent-soft:   rgba(255, 46, 166, 0.12);

  --spotify:       #1db954;
  --soundcloud:    #ff5500;
  --instagram-1:   #e1306c;
  --instagram-2:   #833ab4;

  --success:       #00ff99;
  --danger:        #ff3355;

  --radius:        14px;
  --radius-sm:     8px;

  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset + base ──────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body { position: relative; min-height: 100vh; }

/* ─── Atmosphere ────────────────────────────────────────────── */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 46, 166, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 80% at 50% 100%, rgba(80, 40, 160, 0.12), transparent 60%);
}

.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
}

/* ─── Layout ────────────────────────────────────────────────── */
.gate-container {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.gate-card {
  width: 100%;
  max-width: 460px;
  background: rgba(16, 16, 26, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 30px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

/* ─── Artwork hero ──────────────────────────────────────────── */
.gate-artwork {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 280px;
  margin: 0 auto 24px;
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
  background-color: var(--bg-elevated-2);
  box-shadow:
    0 20px 50px -15px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 50px -10px var(--accent-glow);
  position: relative;
  overflow: hidden;
}
.gate-artwork::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ─── Eyebrow badge ─────────────────────────────────────────── */
.gate-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  margin: 0 auto 22px;
  padding: 7px 16px 7px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 46, 166, 0.45);
  border-radius: 999px;
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 0 24px -6px var(--accent-glow), 0 0 0 1px rgba(255, 46, 166, 0.08) inset;
}

.eyebrow-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ─── Header ────────────────────────────────────────────────── */
.gate-header { text-align: center; margin-bottom: 28px; }

.gate-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  text-shadow: 0 0 30px rgba(255, 46, 166, 0.15);
}

.subtitle {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ─── Tasks ─────────────────────────────────────────────────── */
.gate-tasks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 200ms var(--ease), background 200ms var(--ease), box-shadow 200ms var(--ease);
}

.task:hover:not(.completed) {
  border-color: var(--border-bright);
  background: #1f1f2c;
}

.task.completed {
  border-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 0 24px -8px var(--accent-glow);
}

.task-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 200ms var(--ease), background 200ms var(--ease), box-shadow 250ms var(--ease), transform 300ms var(--ease);
}

.task.completed .task-check {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow), 0 0 22px var(--accent-glow);
  transform: scale(1.08);
}

.task.completed .task-check::after {
  content: "";
  width: 6px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
  animation: check-pop 220ms var(--ease);
}

@keyframes check-pop {
  0%   { opacity: 0; transform: rotate(45deg) scale(0.4); }
  60%  { opacity: 1; transform: rotate(45deg) scale(1.15); }
  100% { opacity: 1; transform: rotate(45deg) scale(1) translate(-1px, -1px); }
}

.task-content { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 2px; }
.task-description { font-size: 0.82rem; color: var(--text-muted); }
.task-action {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.task-action .btn-task { text-align: center; }

/* Two-step tasks (SoundCloud follow/comment): buttons go full-width below the text */
.task--actions-below { flex-wrap: wrap; }
.task--actions-below .task-action {
  flex-basis: 100%;
  margin-left: 0;
  margin-top: 12px;
  flex-direction: row;
}
.task--actions-below .task-action .btn-task { flex: 1; }

/* ─── Inputs ────────────────────────────────────────────────── */
.task-input {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.task-input::placeholder { color: var(--text-muted); }
.task-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 16px -4px var(--accent-glow);
}
.task-input.valid { border-color: var(--success); }
.task-input:disabled { opacity: 0.5; cursor: not-allowed; }

.task-error {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #ff6b8a;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  transition: transform 120ms var(--ease), box-shadow 200ms var(--ease), background 150ms var(--ease), opacity 150ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-task {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
}

.btn-spotify {
  background: var(--spotify);
  box-shadow: 0 0 0 1px rgba(29, 185, 84, 0.2), 0 6px 14px -6px rgba(29, 185, 84, 0.6);
}
.btn-spotify:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(29, 185, 84, 0.4), 0 10px 20px -6px rgba(29, 185, 84, 0.8), 0 0 20px -4px rgba(29, 185, 84, 0.5);
}

.btn-soundcloud {
  background: var(--soundcloud);
  box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.2), 0 6px 14px -6px rgba(255, 85, 0, 0.6);
}
.btn-soundcloud:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.4), 0 10px 20px -6px rgba(255, 85, 0, 0.8), 0 0 20px -4px rgba(255, 85, 0, 0.5);
}

.btn-instagram {
  background: linear-gradient(135deg, var(--instagram-2), var(--instagram-1));
  box-shadow: 0 0 0 1px rgba(225, 48, 108, 0.2), 0 6px 14px -6px rgba(225, 48, 108, 0.6);
}
.btn-instagram:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(225, 48, 108, 0.4), 0 10px 20px -6px rgba(225, 48, 108, 0.8), 0 0 20px -4px rgba(225, 48, 108, 0.5);
}

/* ─── Instagram profile buttons ─────────────────────────────── */
.ig-profiles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.ig-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(131, 58, 180, 0.14), rgba(225, 48, 108, 0.14));
  border: 1px solid rgba(225, 48, 108, 0.4);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms var(--ease), box-shadow 200ms var(--ease), background 150ms var(--ease);
}

.ig-profile::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='2' width='20' height='20' rx='5'/><path d='M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z'/><line x1='17.5' y1='6.5' x2='17.5' y2='6.5'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}

.ig-profile .ig-handle { flex: 1; text-align: left; }

.ig-profile::after {
  content: "Open ↗";
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.ig-profile:hover {
  background: linear-gradient(135deg, rgba(131, 58, 180, 0.28), rgba(225, 48, 108, 0.28));
  border-color: var(--instagram-1);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(225, 48, 108, 0.6), 0 0 18px -4px rgba(225, 48, 108, 0.5);
}

.ig-profile:active { transform: translateY(0); }

.ig-profile.opened {
  background: linear-gradient(135deg, rgba(131, 58, 180, 0.4), rgba(225, 48, 108, 0.4));
  border-color: var(--instagram-1);
  box-shadow: 0 0 0 1px var(--instagram-1), 0 0 18px -4px rgba(225, 48, 108, 0.5);
}

.ig-profile.opened::after {
  content: "Opened ✓";
  color: #fff;
}

/* ─── Download CTA ──────────────────────────────────────────── */
.gate-download { margin-top: 8px; }

.btn-download {
  width: 100%;
  padding: 16px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  text-transform: uppercase;
}

.btn-download:disabled { opacity: 0.8; }

.btn-download:not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-color: transparent;
  box-shadow:
    0 0 0 1px var(--accent-glow),
    0 10px 30px -6px var(--accent-glow),
    0 0 40px -10px var(--accent-glow);
  animation: glow-pulse 2.4s ease-in-out infinite;
}

.btn-download:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px var(--accent),
    0 16px 40px -8px var(--accent-glow),
    0 0 60px -10px var(--accent-glow);
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent-glow), 0 10px 30px -6px var(--accent-glow), 0 0 40px -10px var(--accent-glow); }
  50%      { box-shadow: 0 0 0 1px var(--accent),      0 12px 36px -6px var(--accent-glow), 0 0 55px -10px var(--accent-glow); }
}

/* ─── Error state ──────────────────────────────────────────── */
.error {
  padding: 16px;
  background: rgba(255, 51, 85, 0.08);
  border: 1px solid rgba(255, 51, 85, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  text-align: center;
  font-size: 0.9rem;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .gate-card { padding: 28px 22px; }
  .gate-header h1 { font-size: 1.5rem; }
  .task { padding: 14px; gap: 12px; }
  .task-title { font-size: 0.9rem; }
}

/* ─── In-app browser escape banner (Instagram/Facebook webview) ─ */
.inapp-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--instagram-2), var(--instagram-1));
  color: #fff;
  font-size: 13.5px;
  line-height: 1.35;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.inapp-banner .inapp-text { flex: 1; }
.inapp-banner .inapp-text strong { font-weight: 700; }
.inapp-banner .inapp-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 9px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #14141c;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform 0.1s var(--ease);
}
.inapp-banner .inapp-btn:active { transform: scale(0.96); }

/* ─── Embedded SoundCloud / Spotify player ──────────────────── */
.gate-embed {
  margin: 2px 0 22px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
}
.gate-embed .sc-player { display: block; width: 100%; border: 0; }
.gate-embed .spotify-player { display: block; width: 100%; border: 0; }
/* When both players stack, separate them. */
.gate-embed .sc-player + .spotify-player { margin-top: 10px; }
