:root {
  --bg: #0a0a0c;
  --surface: #151519;
  --surface-2: #1c1c22;
  --text: #f4f4f5;
  --text-dim: #9a9aa2;
  --accent: #6c63ff;
  --accent-2: #84e91f;
  --border: rgba(255, 255, 255, 0.08);
  font-family: -apple-system, "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 140px;
}

main { padding: 28px 20px 20px; max-width: 720px; margin: 0 auto; }

.view { display: none; animation: fadein .25s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity:0; transform: translateY(6px);} to {opacity:1; transform:none;} }

h1.page-title {
  font-size: 26px;
  font-weight: 800;
  margin: 8px 0 4px;
}
.page-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 20px; }

.section-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin: 24px 0 10px;
}

.pl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.pl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
}
.pl-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.18); }

.pl-cover {
  aspect-ratio: 1;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  font-size: 22px;
}

.pl-tag {
  font-size: 9px;
  letter-spacing: 0.06em;
  color: #0a0a0c;
  background: var(--accent-2);
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  align-self: flex-start;
}

.pl-name { font-weight: 700; font-size: 14px; margin: 0 0 2px; }
.pl-count { font-size: 12px; color: var(--text-dim); }

.track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.track-row:hover { background: var(--surface); }
.track-row.playing { background: var(--surface-2); border-color: var(--accent-2); }

.track-swatch {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.track-info { flex: 1; min-width: 0; }
.track-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-sub { font-size: 12px; color: var(--text-dim); }
.track-play-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); flex-shrink: 0;
}

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim); cursor: pointer; background: transparent;
}
.chip.active { background: var(--accent-2); border-color: var(--accent-2); color: #08140a; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.stat-num { font-size: 20px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; cursor: pointer; position: relative;
  background-size: cover; background-position: center;
  border: none; padding: 0; overflow: hidden;
}
.avatar-edit-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}

.verse-card {
  background: linear-gradient(135deg, rgba(108,99,255,0.12), rgba(132,233,31,0.06));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin: 20px 0;
}
.verse-text { font-size: 15px; font-style: italic; line-height: 1.5; margin: 0 0 8px; }
.verse-ref { font-size: 12px; color: var(--text-dim); }

.explain-box {
  background: var(--surface);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 26px;
}
.explain-box b { color: var(--text); }

.footer-links { margin-top: 22px; text-align: center; }
.footer-link {
  background: #000; border: 1px solid var(--border); color: var(--text);
  font-size: 12px; text-decoration: none; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
}
.footer-link:hover { border-color: rgba(255,255,255,0.25); }
.legal-text { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }
.legal-text p { margin: 0 0 14px; }
.legal-text b { color: var(--text); }

/* ---------- Dynamic home ---------- */
.home-view > * {
  animation: homeIn .45s ease both;
}
.home-view > *:nth-child(1) { animation-delay: .02s; }
.home-view > *:nth-child(2) { animation-delay: .08s; }
.home-view > *:nth-child(3) { animation-delay: .14s; }
.home-view > *:nth-child(4) { animation-delay: .20s; }
.home-view > *:nth-child(5) { animation-delay: .26s; }
.home-view > *:nth-child(6) { animation-delay: .32s; }
.home-view > *:nth-child(7) { animation-delay: .38s; }
@keyframes homeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.greeting-eyebrow { font-size: 13px; font-weight: 700; color: var(--accent-2); letter-spacing: .02em; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}
.stat-pill-num { display: block; font-size: 22px; font-weight: 800; color: var(--accent-2); }
.stat-pill-label { display: block; font-size: 10.5px; color: var(--text-dim); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

.hero-resume {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--hero-color) 22%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--hero-color) 45%, var(--border));
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 22px;
  cursor: pointer;
  overflow: hidden;
}
.hero-resume-glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--hero-color);
  opacity: 0.18;
  filter: blur(30px);
  animation: heroPulse 3.2s ease-in-out infinite;
}
@keyframes heroPulse { 0%, 100% { opacity: 0.14; transform: scale(1); } 50% { opacity: 0.26; transform: scale(1.15); } }
.hero-resume-info { flex: 1; min-width: 0; position: relative; }
.hero-resume-label { font-size: 11px; font-weight: 700; color: var(--hero-color); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.hero-resume-title { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-resume-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.hero-resume-btn {
  position: relative;
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--hero-color);
  border: none;
  color: #08140a;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.pl-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.pl-carousel .pl-card { flex: 0 0 148px; scroll-snap-align: start; }

/* Bottom mini-player */
.player-bar {
  position: fixed; left: 0; right: 0; bottom: 56px;
  background: var(--surface-2); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; max-width: 720px; margin: 0 auto;
}
.player-bar { border-radius: 12px 12px 0 0; }
.player-swatch { width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; }
.player-info { flex: 1; min-width: 0; }
.player-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-sub { font-size: 11px; color: var(--text-dim); }
.player-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--accent-2);
  border: none; color: #08140a; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.progress-track { position: absolute; top: 0; left: 16px; right: 16px; height: 2px; background: var(--border); }
.progress-fill { height: 100%; background: var(--accent-2); width: 0%; }

/* Bottom nav */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: var(--bg); border-top: 1px solid var(--border);
  padding: 8px 0 10px; max-width: 720px; margin: 0 auto;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-dim); font-size: 10px; background: none; border: none; cursor: pointer;
}
.tab.active { color: var(--accent-2); }
.tab svg { width: 20px; height: 20px; }

@media (min-width: 500px) {
  .pl-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Gate hides the app shell until unlocked */
.app-shell { display: none; }
body.unlocked .app-shell { display: block; }
body.unlocked .tabbar.app-shell { display: flex; }

/* Fake email gate */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 20%, rgba(132,233,31,0.08), transparent 60%), var(--bg);
  transition: opacity .35s ease;
  overflow-y: auto;
}
.auth-gate.hidden { opacity: 0; pointer-events: none; }

.auth-gate-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Install-as-web-app instructions banner */
.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(132,233,31,0.14), rgba(132,233,31,0.04));
  border-bottom: 1px solid rgba(132,233,31,0.35);
  padding: 12px 20px;
  font-size: 12.5px;
  color: var(--text);
  border-radius: 12px;
  margin: 0 0 18px;
  border: 1px solid rgba(132,233,31,0.3);
  transition: max-height .3s ease, opacity .3s ease, padding .3s ease, margin .3s ease;
  overflow: hidden;
  max-height: 80px;
}
.auth-gate > .install-banner {
  border-radius: 0;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(132,233,31,0.35);
  padding: 12px 24px;
}
.install-banner-icon { font-size: 16px; flex-shrink: 0; }
.install-banner-text { flex: 1; line-height: 1.4; }
.install-banner-text strong { color: var(--accent-2); }
.install-banner-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px 6px;
}
.install-banner-close:hover { color: var(--text); }
.install-banner.dismissed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  opacity: 0;
  border-width: 0;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.auth-logo-icon { width: 44px; height: 44px; object-fit: contain; }
.auth-logo .accent { color: var(--accent-2); }

.auth-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.auth-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 22px; }

.auth-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  outline: none;
}
.auth-input:focus { border-color: var(--accent-2); }
.auth-input::placeholder { color: var(--text-dim); }

.auth-btn {
  width: 100%;
  background: var(--accent-2);
  color: #08140a;
  font-weight: 800;
  font-size: 15px;
  border: none;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.auth-btn:disabled { opacity: 0.7; cursor: default; }

.auth-success {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  animation: fadein .3s ease;
}
.auth-success.show { display: flex; }
.auth-check {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-2);
  color: #08140a;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Welcome pop-up shown right after unlock */
.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 4, 0.78);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .3s ease;
}
.welcome-modal.show { display: flex; opacity: 1; }

.welcome-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 26px 26px;
  text-align: center;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6);
}

.welcome-icon { width: 48px; height: 48px; object-fit: contain; margin-bottom: 16px; }
.welcome-title { font-size: 19px; font-weight: 800; color: var(--accent-2); margin-bottom: 14px; }
.welcome-text { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0 0 24px; }

.welcome-btn {
  width: 100%;
  background: var(--accent-2);
  color: #08140a;
  font-weight: 800;
  font-size: 15px;
  border: none;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
}
