/* ikhouvanpik.nl — one song, one screen. Mobile first. */

:root {
  --bg: #0f0710;
  --pink: #ff2d7a;
  --pink-soft: #ff6aa9;
  --violet: #7b2cff;
  --peach: #ff9d5c;

  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.38);

  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.11);
  --control: rgba(255, 255, 255, 0.09);
  --control-hover: rgba(255, 255, 255, 0.14);

  --radius: 30px;
  --radius-sm: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-display: "Unbounded", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

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

html {
  color-scheme: dark;
  background: var(--bg);
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- ambient background ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 110%, rgba(123, 44, 255, 0.28), transparent 60%),
    var(--bg);
}
.bg::before, .bg::after {
  content: "";
  position: absolute;
  width: 78vmax; height: 78vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.6;
  will-change: transform;
}
.bg::before {
  top: -32vmax; left: -28vmax;
  background: radial-gradient(circle at 40% 40%, var(--pink) 0%, rgba(255, 45, 122, 0.35) 35%, transparent 65%);
  animation: drift-a 22s ease-in-out infinite alternate;
}
.bg::after {
  bottom: -40vmax; right: -30vmax;
  background: radial-gradient(circle at 60% 60%, var(--violet) 0%, rgba(123, 44, 255, 0.35) 35%, transparent 65%);
  animation: drift-b 26s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(14vmax, 10vmax) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-12vmax, -14vmax) scale(1.1); } }

/* ---------- app shell ---------- */

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  box-sizing: border-box;
  padding:
    calc(var(--safe-top) + 12px)
    calc(var(--safe-right) + 16px)
    calc(var(--safe-bottom) + 14px)
    calc(var(--safe-left) + 16px);
  gap: 14px;
}

.top {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.2s;
}
.brand:active { background: var(--control); }
.brand-heart { width: 18px; height: 18px; color: var(--pink); }

.foot {
  flex: none;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.04em;
  padding-top: 4px;
}

/* ---------- card ---------- */

.card {
  flex: none;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 20px 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow:
    0 40px 90px -40px rgba(255, 45, 122, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  backdrop-filter: blur(28px) saturate(140%);
  animation: card-in 0.6s var(--ease) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ---------- cover ---------- */

.cover {
  position: relative;
  width: min(100%, 280px);
  /* shrink on short viewports so the whole screen fits without scrolling */
  width: min(100%, clamp(140px, calc(100dvh - 545px), 280px));
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 26px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: conic-gradient(from 200deg at 50% 50%, var(--pink), var(--pink-soft), var(--violet), var(--peach), var(--pink));
  box-shadow:
    0 30px 60px -22px rgba(255, 45, 122, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.5), transparent 42%),
    linear-gradient(180deg, transparent 45%, rgba(20, 0, 20, 0.35));
}
.cover::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 255, 255, 0.18) 80%, transparent 90%);
  opacity: 0;
  transition: opacity 0.6s;
}
.playing .cover { transform: scale(1.02); box-shadow: 0 36px 70px -20px rgba(255, 45, 122, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.18) inset; }
.playing .cover::after { opacity: 1; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.cover .heart {
  position: relative;
  width: 46%;
  height: 46%;
  color: #fff;
  filter: drop-shadow(0 14px 28px rgba(60, 0, 40, 0.45));
  transform-origin: 50% 55%;
}
.playing .cover .heart { animation: beat 0.95s ease-in-out infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  28%      { transform: scale(1.14); }
  44%      { transform: scale(1.03); }
  60%      { transform: scale(1.1); }
}

.cover--empty {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  color: var(--pink-soft);
}
.cover--empty::before { background: radial-gradient(circle at 50% 50%, rgba(255, 45, 122, 0.22), transparent 60%); }
.cover--empty .heart { filter: drop-shadow(0 0 24px rgba(255, 45, 122, 0.45)); animation: float 3.6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ---------- meta ---------- */

.meta { text-align: center; }
.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(26px, 7.8vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  text-wrap: balance;
}

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

.wave-wrap { display: flex; flex-direction: column; gap: 6px; }

.wave {
  position: relative;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  touch-action: pan-y;
}
.wave.loading::before {
  content: "";
  position: absolute;
  inset: 26px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.seek { display: none; }
.no-wave .wave { display: none; }
.no-wave .seek {
  display: block;
  width: 100%;
  height: 28px;
  margin: 22px 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.no-wave .seek::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--pink) var(--p, 0%), rgba(255,255,255,0.18) var(--p, 0%)); }
.no-wave .seek::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.18); }
.no-wave .seek::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--pink); }
.no-wave .seek::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.no-wave .seek::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.4); }

.times {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
}

/* ---------- controls ---------- */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 2px 0;
}

.icon-btn {
  position: relative;
  width: 54px; height: 54px;
  border: 0;
  border-radius: 50%;
  background: var(--control);
  color: var(--text);
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.18s var(--spring), background 0.2s;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { background: var(--control-hover); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 3px; }
.skip-n {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 3px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.play {
  width: 82px; height: 82px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--violet) 100%);
  box-shadow:
    0 18px 40px -10px rgba(255, 45, 122, 0.75),
    0 1px 0 rgba(255, 255, 255, 0.25) inset;
}
.play:hover { background: linear-gradient(135deg, var(--pink) 0%, var(--violet) 100%); filter: brightness(1.06); }
.play svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 34px; height: 34px;
  transition: opacity 0.16s, transform 0.28s var(--spring);
}
.play .ic-play { transform: translateX(2px); }
.play .ic-pause { opacity: 0; transform: scale(0.5); }
.playing .play .ic-play { opacity: 0; transform: translateX(2px) scale(0.5); }
.playing .play .ic-pause { opacity: 1; transform: scale(1); }
.playing .play { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 18px 40px -10px rgba(255, 45, 122, 0.75), 0 1px 0 rgba(255, 255, 255, 0.25) inset; }
  50%      { box-shadow: 0 22px 54px -8px rgba(255, 45, 122, 1), 0 1px 0 rgba(255, 255, 255, 0.25) inset; }
}

/* ---------- download ---------- */

.download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--control);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.18s var(--spring), background 0.2s;
}
.download svg { width: 20px; height: 20px; }
.download small { color: var(--muted); font-weight: 500; font-size: 13px; }
.download:hover { background: var(--control-hover); }
.download:active { transform: scale(0.98); }
.download:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 3px; }

#audio { display: none; width: 100%; }
.native #audio { display: block; }
.native .controls, .native .wave-wrap { display: none; }

/* ---------- upload ---------- */

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 22px 16px 16px;
  border-radius: 22px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease);
}
.dropzone.dragover {
  border-color: var(--pink);
  background: rgba(255, 45, 122, 0.1);
  transform: scale(1.015);
}
.dropzone.uploading { border-style: solid; border-color: rgba(255, 255, 255, 0.12); }
.dropzone.done { border-color: var(--pink); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--control);
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.18s var(--spring), opacity 0.2s, filter 0.2s;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .dropzone:has(#file:focus-visible) .pick { outline: 2px solid var(--pink-soft); outline-offset: 3px; }
.btn.primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--violet) 100%);
  box-shadow: 0 14px 34px -12px rgba(255, 45, 122, 0.8);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.38; box-shadow: none; filter: saturate(0.6); cursor: not-allowed; transform: none; }

.pick { width: 100%; }
.submit { width: 100%; }
.uploading .pick, .uploading .hint { opacity: 0.4; pointer-events: none; }

.hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--faint);
  text-align: center;
}

.fileinfo {
  width: 100%;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  word-break: break-word;
}
.fileinfo strong { color: var(--text); font-weight: 600; }
.fileinfo:empty::before { content: "Nog geen bestand gekozen"; color: var(--faint); }

/* progress fills the submit button itself */
.submit { position: relative; overflow: hidden; }
.submit .label { position: relative; }
.submit .progress {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.25s;
}
.submit .bar {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.2s linear;
}
.uploading .progress, .done .progress { opacity: 1; }
.uploading .submit:disabled, .done .submit:disabled {
  opacity: 1;
  filter: none;
  cursor: progress;
  box-shadow: 0 14px 34px -12px rgba(255, 45, 122, 0.8);
}
.done .submit .bar { background: rgba(255, 255, 255, 0.45); }

.msg {
  margin: -4px 0 0;
  min-height: 20px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}
.msg.error { color: #ff9ac0; font-weight: 500; }

/* ---------- larger screens ---------- */

@media (min-width: 640px) {
  .app { padding-top: 24px; padding-bottom: 24px; gap: 18px; }
  .card { padding: 28px 28px 26px; gap: 20px; }
  .cover { width: min(100%, 300px); }
  .title { font-size: 34px; }
  .controls { gap: 30px; }
}

@media (min-height: 900px) {
  .cover { width: min(100%, 320px); }
}

/* typical phone viewports (browser toolbars eat space): tighter spacing, fluid cover */
@media (max-height: 800px) {
  .app { gap: 8px; }
  .top { height: 36px; }
  .card { gap: 14px; padding: 18px 18px 16px; }
  .cover { width: min(100%, clamp(110px, calc(100dvh - 470px), 280px)); border-radius: 22px; }
  .title { font-size: clamp(24px, 7vw, 30px); }
  .subtitle { margin-top: 4px; font-size: 14px; }
  .wave { height: 60px; }
  .controls { gap: 22px; }
  .icon-btn { width: 48px; height: 48px; }
  .play { width: 72px; height: 72px; }
  .play svg { width: 30px; height: 30px; }
  .dropzone { padding: 16px 14px 12px; gap: 10px; }
  .foot { display: none; }
}

/* very short viewports (landscape phones): compact "now playing" row */
@media (max-height: 560px) {
  .card {
    display: grid;
    grid-template-columns: 84px 1fr;
    align-items: center;
    column-gap: 16px;
    row-gap: 12px;
  }
  .cover { width: 84px; border-radius: 18px; margin: 0; }
  .cover .heart { width: 50%; height: 50%; }
  .meta { text-align: left; }
  .title { font-size: 22px; }
  .wave-wrap, .controls, .download, .dropzone, #audio { grid-column: 1 / -1; }
  .wave { height: 52px; }
}

/* ---------- motion ---------- */

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