/* SlamTrack — 90s Memphis-pop design system */
:root {
  --ink: #14112b;
  --paper: #fff8e7;
  --grape: #5a1fd1;
  --pink: #ff3ea5;
  --teal: #00d1c1;
  --sun: #ffd400;
  --lime: #c6ff3d;
  --tang: #ff8a00;
  --blue: #2d5bff;
  --red: #ff1f3d;
  --red-d: #b8001c;
  --line: 3px solid var(--ink);
  --display: "Bungee", "Arial Black", Impact, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden], .hidden { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font: 700 15px/1.3 var(--mono);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cpath d='M18 44q10-16 20 0t20 0t20 0' fill='none' stroke='%23ffd400' stroke-width='6' stroke-linecap='round'/%3E%3Cpolygon points='170,22 202,76 138,76' fill='none' stroke='%2300d1c1' stroke-width='6' stroke-linejoin='round'/%3E%3Ccircle cx='62' cy='168' r='15' fill='%23ff3ea5'/%3E%3Cpath d='M136 176l13-13l13 13l13-13l13 13' fill='none' stroke='%23c6ff3d' stroke-width='6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cg fill='%23fff' opacity='.45'%3E%3Ccircle cx='112' cy='112' r='3'/%3E%3Ccircle cx='126' cy='112' r='3'/%3E%3Ccircle cx='112' cy='126' r='3'/%3E%3Ccircle cx='126' cy='126' r='3'/%3E%3C/g%3E%3Crect x='22' y='208' width='30' height='11' fill='%23ff8a00' transform='rotate(-22 37 213)'/%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 120%, var(--pink) 0, transparent 55%),
    var(--grape);
}

.app {
  height: 100dvh;
  max-width: 440px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
}

.view { display: none; width: 100%; flex-direction: column; gap: 16px; }
.view.active { display: flex; animation: pop .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.card {
  background: var(--paper);
  border: var(--line);
  border-radius: 22px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 26px 20px 24px;
  position: relative;
}

/* ---------- LOGO ---------- */
.logo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 34px 0 8px;
  transform: rotate(-4deg);
}
.slam-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateX(-3px); /* optical center for 7px right drop shadow */
}
.burst {
  position: absolute;
  width: 112px;
  height: 112px;
  top: 35%;
  margin-top: -56px;
  right: -46px; /* centers star squarely on the last vertical stroke of "M" */
  fill: var(--sun);
  stroke: var(--ink);
  stroke-width: 3;
  animation: spin 18s linear infinite;
  z-index: 0;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logo-slam {
  position: relative;
  z-index: 1;
  font: 400 4.3rem/0.9 var(--display);
  color: var(--pink);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--teal), 7px 7px 0 var(--ink);
  letter-spacing: -0.02em;
}
.logo-track {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  padding: 4px 10px 2px 10px;
  font: 400 1.6rem/1.15 var(--display);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--lime);
  background: var(--ink);
  transform: rotate(3deg);
  box-shadow: 4px 4px 0 var(--blue);
}
.logo-sm {
  padding: 18px 0 4px;
}
.logo-sm .logo-slam { font-size: 2.7rem; }
.logo-sm .logo-track { font-size: 1.05rem; padding: 3px 8px 1px; margin-top: 4px; }
.logo-sm .burst { width: 74px; height: 74px; margin-top: -37px; right: -30px; }

.tagline { text-align: center; font-size: 1rem; }

/* ---------- UPLOAD ---------- */
.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 78px;
  padding: 12px 40px;
  border: 3px dashed var(--ink);
  border-radius: 16px;
  background:
    repeating-linear-gradient(45deg, rgba(20, 17, 43, .06) 0 8px, transparent 8px 16px),
    var(--teal);
  font: 400 1rem var(--display);
  text-align: center;
  cursor: pointer;
  transition: transform .12s, background-color .12s;
}
.drop:hover, .drop.over { transform: rotate(-1deg) scale(1.02); background-color: var(--sun); }
.drop.shake { animation: shake .32s ease; border-color: var(--red); background-color: #ffe3e7; }
@keyframes shake {
  20% { transform: translateX(-6px); }
  45% { transform: translateX(6px); }
  70% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}
.upload-hint {
  margin-top: -8px;
  text-align: center;
  font-size: .8rem;
  color: var(--red-d);
}
.x {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--paper);
  font: 900 1.1rem/1 sans-serif; cursor: pointer;
}

/* ---------- SLAM BUTTON ---------- */
.slam {
  width: 100%;
  padding: 18px 12px 16px;
  font: 400 2.1rem/1 var(--display);
  letter-spacing: .04em;
  color: #fff;
  background: var(--red);
  border: var(--line);
  border-radius: 18px;
  text-shadow: 3px 3px 0 var(--ink);
  box-shadow: 0 8px 0 var(--red-d), 6px 12px 0 var(--ink);
  cursor: pointer;
  transition: transform .07s, box-shadow .07s;
  flex-shrink: 0;
}
.slam:hover { filter: saturate(1.2) brightness(1.05); }
.slam:active { transform: translateY(7px); box-shadow: 0 1px 0 var(--red-d), 3px 4px 0 var(--ink); }

/* ---------- SHARED SMALL UI ---------- */
.icon-btn {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  padding: 0;
  border: var(--line); border-radius: 12px;
  background: var(--sun); box-shadow: 3px 3px 0 var(--ink);
  font: 900 1.2rem/1 sans-serif; color: var(--ink); cursor: pointer;
}
.home-btn svg { display: block; width: 24px; height: 24px; }
.icon-btn.ghost { visibility: hidden; }
.icon-btn:active, .share:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.mini-logo { font: 400 1.4rem var(--display); color: var(--pink); text-align: center; }
.mini-logo b { font-weight: 400; color: var(--ink); }

/* ---------- BUILD ---------- */
#buildCv { width: 100%; height: auto; border: var(--line); border-radius: 14px; background: var(--ink); }
.build-text { text-align: center; font: 400 1.05rem var(--display); }
.bar { height: 16px; border: var(--line); border-radius: 99px; overflow: hidden; background: #fff; }
.bar i, .prog i { display: block; height: 100%; width: 0; }
.bar i {
  background: repeating-linear-gradient(-45deg, var(--pink) 0 10px, var(--sun) 10px 20px, var(--teal) 20px 30px);
  transition: width .2s linear;
}

/* ---------- RESULT ---------- */
.result { height: 100%; gap: 12px; }
.res-head { display: flex; align-items: center; gap: 10px; }
.tags { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tag {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 2px solid var(--ink); border-radius: 99px;
  background: var(--paper);
  font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 2px 2px 0 var(--ink);
}
.tag b {
  font: 400 .66rem/1 var(--display);
  padding: 4px 7px 3px; border-radius: 99px; color: var(--paper); background: var(--ink);
}
.tag span { overflow: hidden; text-overflow: ellipsis; }
.tag-genre { background: var(--sun); }
.tag-motif { background: var(--teal); }
.share {
  flex-shrink: 0; height: 42px; padding: 0 16px;
  border: var(--line); border-radius: 12px;
  background: var(--pink); color: #fff;
  font: 400 1.15rem/1 var(--display); text-shadow: 2px 2px 0 var(--ink);
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
}

/* 9:16 stage that always fits remaining height */
.stage-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; }
.stage {
  position: relative;
  height: min(100cqh, 100cqw * 16 / 9);
  aspect-ratio: 9 / 16;
  border: var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
}
#vidCv { width: 100%; height: 100%; display: block; }
.play-ov {
  position: absolute; inset: 0; margin: auto;
  width: 66px; height: 66px; display: grid; place-items: center;
  border: var(--line); border-radius: 50%;
  background: var(--red); color: #fff; font-size: 1.6rem;
  box-shadow: 4px 4px 0 var(--ink);
  transition: opacity .15s, transform .15s;
}
.stage.playing .play-ov { opacity: 0; transform: scale(.6); }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255, 255, 255, .25); }
.prog i { background: linear-gradient(90deg, var(--pink), var(--sun), var(--teal)); }
.result .slam { padding: 15px 12px 13px; font-size: 1.9rem; }

/* ---------- RE-SLAM PICKER ---------- */
.pick-head { display: flex; align-items: center; justify-content: space-between; }
.pick-head h2 {
  font: 400 1.9rem var(--display); color: var(--red);
  -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-3deg);
}
h3 { font: 400 .95rem var(--display); margin-bottom: -6px; }
h3 small { font: 700 .72rem var(--mono); opacity: .55; margin-left: 6px; text-transform: lowercase; }
.bubbles { display: flex; flex-wrap: wrap; gap: 6px; }
.bubble {
  padding: 5px 10px;
  border: 2px solid var(--ink); border-radius: 99px;
  background: #fff; color: var(--ink);
  font: 700 .76rem var(--mono);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, background-color .1s;
}
.bubble.on {
  background: var(--c);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -2px) rotate(-2deg);
}
.bubble.on::before { content: "\2605  "; }

@media (max-height: 640px) {
  .card { padding: 18px 16px; gap: 12px; }
  .logo-slam { font-size: 3.4rem; }
  .slam { font-size: 1.7rem; padding: 14px 10px 12px; }
}

/* ---------- SHARE MODAL ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  padding: 16px;
  background: rgba(20, 17, 43, .78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal { width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 14px; animation: pop .2s ease; }
.share-title { font-size: 2.3rem !important; }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sh-btn {
  position: relative;
  overflow: hidden;
  padding: 13px 10px;
  border: var(--line);
  border-radius: 14px;
  background: var(--c, var(--sun));
  color: var(--fg, var(--ink));
  font: 400 .95rem var(--display);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, opacity .15s;
}
.sh-btn:disabled { opacity: .42; cursor: wait; }
.sh-btn.loader-btn:disabled { opacity: 1; background: #e8e2d0; color: var(--ink); }
.sh-btn .sh-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--lime));
  transition: width .16s linear;
  z-index: 0;
}
.sh-btn .sh-label { position: relative; z-index: 1; }
.sh-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.sh-btn.wide { grid-column: 1 / -1; }
.share-note { text-align: center; font-size: .78rem; color: var(--grape); }

