/* Maqamify — poppy neo-brutalist candy */

:root {
  --ink: #191510;
  --paper: #FFF6EA;
  --card: #FFFDF8;
  --pink: #FF2E88;
  --orange: #FF9F1C;
  --purple: #7048E8;
  --teal: #00C2A8;
  --sand: #FFF1DC;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px 16px;
  overflow-x: hidden;
}

/* floating gradient blobs behind everything */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  z-index: -1;
  pointer-events: none;
}
.blob-1 {
  width: 45vw; height: 45vw; min-width: 340px; min-height: 340px;
  left: -10vw; top: -12vh;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  animation: drift 16s ease-in-out infinite alternate;
}
.blob-2 {
  width: 40vw; height: 40vw; min-width: 300px; min-height: 300px;
  right: -12vw; bottom: -15vh;
  background: linear-gradient(135deg, var(--purple), var(--teal));
  animation: drift 19s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(4vw, 3vh) scale(1.15); }
}

/* the card */
.card {
  width: min(660px, 100%);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 12px 12px 0 var(--ink);
  padding: 40px 36px 28px;
}

header { text-align: center; margin-bottom: 26px; }

h1 {
  font-size: clamp(46px, 9vw, 74px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(92deg, var(--pink) 10%, var(--orange) 60%, var(--purple) 105%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: none;
}

.tagline {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 500;
  color: #4c4438;
  line-height: 1.5;
}
.tagline b { color: var(--ink); }

/* drop zone */
.dropzone {
  border: 3px dashed var(--ink);
  border-radius: 20px;
  background: var(--sand);
  padding: 46px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  outline-offset: 4px;
}
.dropzone:hover, .dropzone:focus-visible {
  transform: rotate(-1deg) scale(1.015);
  background: #FFE8C6;
}
.dropzone.dragover {
  transform: scale(1.03);
  background: #FFDFF0;
  border-style: solid;
  border-color: var(--pink);
}
.dz-emoji {
  font-size: 46px;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-8px) rotate(4deg); }
}
.dz-text { margin-top: 10px; font-size: 17px; line-height: 1.6; }
.dz-text span { font-size: 14px; color: #6d6355; font-weight: 600; }

/* panels */
.panel { display: flex; flex-direction: column; gap: 18px; }
.hidden { display: none !important; }

.track-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.track-name {
  font-weight: 800;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-block {
  background: var(--sand);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 16px;
}
.key-label {
  font-size: 13px; font-weight: 900; letter-spacing: .12em;
  margin-bottom: 10px;
}
.detected { font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--purple); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font: inherit; font-size: 13px; font-weight: 800;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
}
.pill:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.pill.selected {
  background: var(--purple); color: #fff;
  transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink);
}
.bend-info { margin-top: 12px; font-size: 14px; font-weight: 700; color: #4c4438; min-height: 1em; }

/* buttons */
.big-btn {
  font: inherit; font-size: 22px; font-weight: 900;
  width: 100%;
  padding: 16px;
  background: var(--pink); color: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.big-btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.big-btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.big-btn:disabled { opacity: .55; cursor: wait; }
.big-btn.alt { background: var(--teal); }

.mini-btn {
  font: inherit; font-size: 14px; font-weight: 900;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  padding: 6px 10px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s ease, box-shadow .1s ease;
  flex-shrink: 0;
}
.mini-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.mini-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.mini-btn.tall { font-size: 18px; padding: 10px 14px; border-radius: 14px; }

.ghost-row { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.ghost-btn {
  font: inherit; font-size: 14px; font-weight: 800;
  background: none; border: none;
  color: #6d6355;
  cursor: pointer;
  text-decoration: underline 2px;
  text-underline-offset: 3px;
}
.ghost-btn:hover { color: var(--pink); }

/* progress — camel crossing the dunes */
.camel-track {
  position: relative;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  margin-top: 34px;
}
.progress-fill {
  position: absolute; inset: 0; right: auto;
  width: 0%;
  border-radius: inherit;
  background: repeating-linear-gradient(45deg, var(--orange) 0 12px, var(--pink) 12px 24px);
  transition: width .25s ease;
}
.camel {
  position: absolute;
  top: -36px; left: 0%;
  font-size: 32px;
  transform: translateX(-50%) scaleX(-1);
  transition: left .25s ease;
}
.progress-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 800; font-size: 15px;
}
#progress-pct { font-variant-numeric: tabular-nums; font-size: 18px; }

/* result */
.waveform {
  display: block;
  width: 100%;
  height: 110px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--sand);
  cursor: crosshair;
}
.ab-row { display: flex; gap: 12px; }
.ab-btn {
  font: inherit; font-size: 17px; font-weight: 900;
  flex: 1;
  padding: 13px 8px;
  background: #fff; color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.ab-btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.ab-btn.active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.ab-btn.active { background: #E9E2D5; }
.ab-btn.hot.active { background: linear-gradient(92deg, var(--pink), var(--orange)); color: #fff; }
.ab-hint { text-align: center; font-size: 13px; font-weight: 600; color: #6d6355; margin-top: -6px; }

/* footer */
footer {
  margin-top: 30px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #6d6355;
  line-height: 1.6;
}
.nerd { margin-top: 8px; font-size: 11.5px; font-weight: 500; opacity: .8; }

/* toast */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 140%);
  background: var(--ink); color: #fff;
  font-weight: 800; font-size: 15px;
  padding: 14px 22px;
  border-radius: 16px;
  box-shadow: 6px 6px 0 rgba(0,0,0,.25);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* confetti */
.confetti {
  position: fixed;
  top: -44px;
  z-index: 99;
  pointer-events: none;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes fall {
  to { transform: translateY(115vh) rotate(560deg); opacity: .85; }
}

@media (max-width: 480px) {
  .card { padding: 26px 18px 20px; box-shadow: 8px 8px 0 var(--ink); }
  .ab-row { flex-wrap: wrap; }
  .ab-btn { min-width: 40%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
