/* =========================================================
   Tempo Naada — mobile-first stylesheet
   Palette sampled from assets/iconic.jpeg so the hero image
   blends straight into the page background.
   ========================================================= */

:root {
  /* backdrop (matches the iconic image) */
  --bg-deep:    #1B0021;
  --bg-base:    #3B0146;
  --bg-mid:     #5A0167;

  /* accents */
  --magenta:    #E5007E;
  --pink:       #FF3D9A;
  --violet:     #8E2BD6;
  --gold:       #F3B13B;
  --cyan:       #2AA7E8;

  /* ink */
  --ink:        #FFFFFF;
  --ink-soft:   rgba(255, 255, 255, .74);
  --ink-mute:   rgba(255, 255, 255, .48);

  /* surfaces */
  --card:       rgba(255, 255, 255, .07);
  --card-hi:    rgba(255, 255, 255, .13);
  --line:       rgba(255, 255, 255, .16);

  --radius:     20px;
  --radius-sm:  14px;

  --font-display: 'Baloo 2', 'Fredoka', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Fredoka', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }

img { max-width: 100%; display: block; }

/* =========================================================
   Background
   ========================================================= */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-mid) 0%, var(--bg-base) 42%, var(--bg-deep) 100%);
}

.blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  will-change: transform;
}

.blob-1 {
  width: 62vw; height: 62vw;
  top: -14vw; left: -18vw;
  background: var(--magenta);
  animation: drift-a 16s ease-in-out infinite;
}

.blob-2 {
  width: 54vw; height: 54vw;
  bottom: -12vw; right: -16vw;
  background: var(--violet);
  animation: drift-b 19s ease-in-out infinite;
}

.blob-3 {
  width: 44vw; height: 44vw;
  top: 42%; left: 46%;
  background: #6A0F8C;
  opacity: .42;
  animation: drift-a 23s ease-in-out infinite reverse;
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(6vw, 5vw, 0) scale(1.12); }
}

@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
  50%      { transform: translate3d(-7vw, -4vw, 0) scale(.94); }
}

/* =========================================================
   Loading screen
   ========================================================= */

.loader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in .3s ease both;
}

.loader-inner {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}

.loader-inner .title { animation: loader-pulse 1.9s ease-in-out infinite; }

@keyframes loader-pulse {
  0%, 100% { transform: scale(1);    opacity: .92; }
  50%      { transform: scale(1.05); opacity: 1; }
}

.loader-bar {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.loader-fill {
  position: relative;
  display: block;
  height: 100%;
  width: 0;
  overflow: hidden;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--pink) 55%, #7BD8FF);
  box-shadow: 0 0 14px rgba(255, 61, 154, .75);
  transition: width .35s cubic-bezier(.25, .9, .35, 1);
}

/* travelling highlight so the bar reads as active even while a
   single large file is still downloading */
.loader-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .45) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: loader-sheen 1.3s linear infinite;
}

@keyframes loader-sheen {
  to { transform: translateX(100%); }
}

.loader-meta {
  margin: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .4px;
  color: var(--ink-soft);
}

.loader-pct { color: var(--ink); }

/* =========================================================
   Layout shell
   ========================================================= */

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 10px) 20px calc(var(--safe-bottom) + 18px);
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  margin-bottom: 4px;
  animation: fade-in .4s ease both;
}

.dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .22);
  transition: all .35s cubic-bezier(.34, 1.4, .5, 1);
}

.dot.done   { background: var(--pink); opacity: .55; }
.dot.active { width: 22px; background: var(--pink); box-shadow: 0 0 12px var(--magenta); }

/* stage holds one screen at a time; scrolls only if the screen
   cannot fit (e.g. the phone keyboard is covering half the viewport) */
.stage {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.stage::-webkit-scrollbar { display: none; }

/* =========================================================
   Screen — everything centred
   ========================================================= */

.screen {
  flex: 1 0 auto;   /* never shrink below its content — .stage scrolls instead */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 8px 0 4px;
  animation: screen-in .45s cubic-bezier(.22, .9, .3, 1) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- hero image (blends into the backdrop) ---------- */

.hero {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
}

.hero::before {
  content: '';
  position: absolute;
  width: 78%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 61, 154, .45), transparent 68%);
  filter: blur(26px);
  animation: pulse-glow 4.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1);    opacity: .85; }
  50%      { transform: scale(1.09); opacity: 1; }
}

.hero img {
  position: relative;
  width: 100%;
  height: auto;
  /* the JPEG has a purple backdrop — lighten + a soft mask melts its
     edges into the page so no rectangle is visible */
  mix-blend-mode: lighten;
  -webkit-mask-image: radial-gradient(ellipse 68% 66% at 50% 50%, #000 52%, rgba(0, 0, 0, .35) 74%, transparent 88%);
          mask-image: radial-gradient(ellipse 68% 66% at 50% 50%, #000 52%, rgba(0, 0, 0, .35) 74%, transparent 88%);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0)     rotate(-.6deg); }
  50%      { transform: translateY(-10px) rotate(.6deg); }
}

.hero-lg img { max-width: 340px; }
.hero-sm img { max-width: 210px; opacity: .95; }

/* ---------- type ---------- */

.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 13vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -.5px;
  text-shadow: 0 4px 22px rgba(0, 0, 0, .45);
}

.title.sm {
  font-size: clamp(1.5rem, 6.6vw, 1.9rem);
  letter-spacing: -.2px;
}

.title .accent {
  background: linear-gradient(100deg, #FFD86B, #FF5FA8 52%, #7BD8FF);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 61, 154, .45));
}

.subtitle {
  margin: 0;
  max-width: 30ch;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* =========================================================
   Buttons
   ========================================================= */

.actions {
  width: 100%;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: 99px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .2px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .16s cubic-bezier(.34, 1.5, .5, 1), box-shadow .2s ease, opacity .2s ease;
}

.btn-block { width: 100%; }

.btn-primary {
  color: #fff;
  background: linear-gradient(100deg, var(--magenta), var(--violet));
  box-shadow: 0 10px 26px -8px rgba(229, 0, 126, .8), inset 0 1px 0 rgba(255, 255, 255, .28);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .35) 50%, transparent 80%);
  transform: translateX(-120%);
  animation: sheen 3.4s ease-in-out infinite;
}

@keyframes sheen {
  0%, 62%  { transform: translateX(-120%); }
  92%, 100% { transform: translateX(120%); }
}

.btn-ghost {
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.btn:active { transform: scale(.96); }

.btn[disabled] {
  opacity: .38;
  box-shadow: none;
  pointer-events: none;
}

/* =========================================================
   Step 2 — form (labels + fields + text all centred)
   ========================================================= */

.form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.field-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.field-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .3px;
  color: var(--ink-soft);
  text-align: center;
}

.field {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  text-align: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .08);
  color: var(--ink);
  font-size: 1.05rem;
  outline: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field::placeholder { color: var(--ink-mute); }

.field:focus {
  border-color: var(--pink);
  background: rgba(255, 255, 255, .12);
  box-shadow: 0 0 0 4px rgba(229, 0, 126, .22);
}

.field-error {
  margin: -2px 0 0;
  height: 1em;
  font-size: .85rem;
  color: #FF9BC2;
  opacity: 0;
  transition: opacity .2s ease;
}

.field-error.show { opacity: 1; }

/* =========================================================
   Step 3 — Tempo packs
   ========================================================= */

.pack-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 4px 0;
}

.pack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform .2s cubic-bezier(.34, 1.4, .5, 1), border-color .25s ease, background .25s ease, box-shadow .25s ease;
}

.pack-glow {
  position: absolute;
  top: -28%;
  left: 50%;
  width: 120%;
  aspect-ratio: 1 / 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--pack), transparent 62%);
  opacity: .22;
  filter: blur(22px);
  transition: opacity .3s ease;
  pointer-events: none;
}

.pack-img {
  position: relative;
  width: 100%;
  max-width: 118px;
  height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .5));
  transition: transform .3s cubic-bezier(.34, 1.4, .5, 1);
}

.pack-name {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.25;
  text-align: center;
}

.pack .check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pack);
  color: #fff;
  transform: scale(0);
  transition: transform .28s cubic-bezier(.34, 1.7, .5, 1);
}

.pack:active { transform: scale(.965); }

.pack.selected {
  border-color: var(--pack);
  background: var(--card-hi);
  box-shadow: 0 0 0 1.5px var(--pack), 0 14px 30px -14px var(--pack);
}

.pack.selected .pack-glow { opacity: .5; }
.pack.selected .pack-img  { transform: translateY(-4px) scale(1.06); }
.pack.selected .check     { transform: scale(1); }

/* =========================================================
   Step 4 — instruments
   ========================================================= */

.inst-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 6px 0;
}

.inst {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform .18s cubic-bezier(.34, 1.4, .5, 1), border-color .25s ease, background .25s ease, box-shadow .25s ease;
  animation: screen-in .45s cubic-bezier(.22, .9, .3, 1) both;
}

.inst:nth-child(1) { animation-delay: .04s; }
.inst:nth-child(2) { animation-delay: .12s; }
.inst:nth-child(3) { animation-delay: .2s; }

.inst-emoji {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  line-height: 1;
  border-radius: 16px;
  background: color-mix(in srgb, var(--inst) 26%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--inst) 45%, transparent);
}

.inst-copy {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.inst-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
}

.inst-desc {
  font-size: .82rem;
  color: var(--ink-mute);
}

.inst-arrow {
  flex: 0 0 auto;
  color: var(--ink-mute);
  transition: transform .2s ease, color .2s ease;
}

.inst:active {
  transform: scale(.975);
  border-color: var(--inst);
  background: var(--card-hi);
  box-shadow: 0 0 0 1.5px var(--inst), 0 14px 30px -16px var(--inst);
}

.inst:active .inst-arrow { transform: translateX(3px); color: var(--ink); }

/* =========================================================
   Step 5 — player + waveform
   ========================================================= */

.screen-play { gap: 18px; }

.player {
  position: relative;
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  margin: 4px 0;
}

.player::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--magenta), var(--violet));
  box-shadow: 0 16px 40px -12px rgba(229, 0, 126, .9), inset 0 2px 0 rgba(255, 255, 255, .25);
}

.player-emoji {
  position: relative;
  font-size: 3.6rem;
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .4));
}

.player.playing .player-emoji { animation: bounce-beat 1.2s ease-in-out infinite; }

@keyframes bounce-beat {
  0%, 100% { transform: translateY(0)    scale(1); }
  25%      { transform: translateY(-7px) scale(1.07); }
  50%      { transform: translateY(0)    scale(.98); }
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 61, 154, .55);
  opacity: 0;
}

.player.playing .ring-1 { animation: ripple 2s ease-out infinite; }
.player.playing .ring-2 { animation: ripple 2s ease-out infinite 1s; }

@keyframes ripple {
  0%   { transform: scale(.82); opacity: .75; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- waveform ---------- */

.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 58px;
  width: 100%;
}

.wave .bar {
  flex: 0 0 auto;
  width: 7px;
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--gold), var(--pink));
  opacity: .35;
  transition: opacity .3s ease, height .3s ease;
}

.wave.playing .bar {
  opacity: 1;
  animation: wave-beat 1s ease-in-out infinite;
}

.wave.playing .bar:nth-child(1) { animation-delay: 0s; }
.wave.playing .bar:nth-child(2) { animation-delay: .09s; }
.wave.playing .bar:nth-child(3) { animation-delay: .18s; }
.wave.playing .bar:nth-child(4) { animation-delay: .27s; }
.wave.playing .bar:nth-child(5) { animation-delay: .36s; }
.wave.playing .bar:nth-child(6) { animation-delay: .27s; }
.wave.playing .bar:nth-child(7) { animation-delay: .18s; }
.wave.playing .bar:nth-child(8) { animation-delay: .09s; }
.wave.playing .bar:nth-child(9) { animation-delay: 0s; }

@keyframes wave-beat {
  0%, 100% { height: 12px; }
  30%      { height: 46px; }
  60%      { height: 22px; }
}

.playing-label {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink-soft);
  letter-spacing: .3px;
}

/* =========================================================
   Step 6 — done
   ========================================================= */

.done-mark {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(140deg, #3FD08A, #159C74);
  box-shadow: 0 16px 36px -12px rgba(63, 208, 138, .8), inset 0 2px 0 rgba(255, 255, 255, .3);
  animation: pop-in .5s cubic-bezier(.2, 1.6, .4, 1) both;
}

@keyframes pop-in {
  from { transform: scale(.3); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* =========================================================
   Responsive tuning
   ========================================================= */

/* small phones */
@media (max-height: 700px) {
  .hero-lg img { max-width: 250px; }
  .hero-sm img { max-width: 160px; }
  .player      { width: 120px; height: 120px; }
  .player-emoji { font-size: 3rem; }
  .pack-img    { height: 96px; }
  .screen      { gap: 11px; }
}

@media (max-height: 600px) {
  .hero-lg img { max-width: 190px; }
  .hero-sm img { max-width: 120px; }
  .wave        { height: 44px; }
  .btn         { min-height: 48px; font-size: 1rem; }
}

/* short + landscape phones */
@media (orientation: landscape) and (max-height: 520px) {
  .app    { max-width: 640px; }
  .screen { gap: 10px; }
  .hero img { max-width: 150px; }
  .inst-list { display: grid; grid-template-columns: repeat(3, 1fr); }
  .inst      { flex-direction: column; text-align: center; }
  .inst-arrow { display: none; }
}

/* tablets / desktop — keep the phone canvas, add breathing room */
@media (min-width: 768px) {
  .app { max-width: 460px; padding-top: 28px; padding-bottom: 28px; }
  .hero-lg img { max-width: 360px; }
}

/* accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* browsers without color-mix() */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .inst-emoji {
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  }
}
