:root {
  --stage: #180a2c;
  --pink: #ff3d9a;
  --pink-deep: #e0187a;
  --violet: #8b3dff;
  --gold: #ffd84d;
  --cream: #fff4f9;
  --ink: #2a0f3d;
  --ink-soft: #7a5c8e;
  --card: #ffffff;
  --card-2: #fff1f7;
  --line: #f6cce0;
  --display: "Fredoka", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--stage); color: var(--cream);
  font-family: var(--body); font-size: 18px; line-height: 1.4; font-weight: 700;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; user-select: none; -webkit-user-select: none;
  background-image:
    radial-gradient(60% 45% at 15% 0%, rgba(255, 61, 154, .38), transparent 60%),
    radial-gradient(50% 40% at 90% 5%, rgba(139, 61, 255, .38), transparent 60%),
    radial-gradient(70% 50% at 50% 100%, rgba(255, 216, 77, .10), transparent 60%);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
#stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

.app { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 18px 22px 60px; min-height: 100vh; }
.screen { display: none; flex-direction: column; gap: 22px; animation: pop .25s ease-out; }
.screen.on { display: flex; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* top bar */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; min-height: 64px; }
.bar > :last-child { justify-self: end; }
.bar h1 { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 4vw, 38px); margin: 0; text-align: center; text-wrap: balance; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; font-size: 26px; }
.logo .dot { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--pink), var(--violet)); display: grid; place-items: center; box-shadow: 0 8px 22px rgba(255, 61, 154, .45); }
.logo .dot svg { width: 26px; height: 26px; }
.back { width: 64px; height: 64px; border-radius: 22px; background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .16); display: grid; place-items: center; justify-self: start; }
.back svg { width: 30px; height: 30px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.back:hover, .small-btn:hover { background: rgba(255, 255, 255, .18); }
.small-btn { border-radius: 999px; padding: 10px 18px; background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .16); font-size: 15px; font-weight: 800; letter-spacing: .02em; min-height: 48px; }

/* home */
.hero-btn {
  display: flex; align-items: center; justify-content: center; gap: 22px; width: 100%; min-height: 160px; padding: 26px 30px;
  border-radius: 40px; background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff;
  box-shadow: 0 22px 50px rgba(224, 24, 122, .45), inset 0 -4px 0 rgba(0, 0, 0, .12);
  font-family: var(--display); font-weight: 700; font-size: clamp(30px, 5vw, 46px); transition: transform .12s;
}
.hero-btn:hover { transform: translateY(-3px); }
.hero-btn:active { transform: translateY(1px) scale(.99); }
.hero-btn svg { width: 76px; height: 76px; stroke: #fff; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 24px; margin: 6px 0 0; color: #f6dcf0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px 16px; border-radius: 28px;
  background: var(--card); color: var(--ink); text-align: center; box-shadow: 0 4px 0 var(--line), 0 14px 30px rgba(0, 0, 0, .25); transition: transform .12s;
}
.tile:hover { transform: translateY(-4px); }
.tile .sticker { font-size: 64px; line-height: 1; width: 96px; height: 96px; display: grid; place-items: center; border-radius: 28px; background: var(--card-2); }
.tile .name { font-family: var(--display); font-weight: 600; font-size: 19px; line-height: 1.15; text-wrap: balance; overflow-wrap: anywhere; }
.tile .meta { font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.empty { color: #d9b8d4; font-size: 20px; text-align: center; padding: 30px 10px; margin: 0; }
.empty b { color: var(--gold); }

/* beats */
.beats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .beats { grid-template-columns: repeat(2, 1fr); } }
.beat {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 12px 18px; border-radius: 30px; min-height: 150px;
  background: var(--card); color: var(--ink); border: 5px solid transparent; box-shadow: 0 4px 0 var(--line), 0 14px 30px rgba(0, 0, 0, .25);
  font-family: var(--display); font-weight: 600; font-size: 24px; transition: transform .12s;
}
.beat span { font-size: 56px; line-height: 1; }
.beat:hover { transform: translateY(-4px); }
.beat.on { border-color: var(--gold); background: #fff6d6; box-shadow: 0 0 0 6px rgba(255, 216, 77, .25), 0 14px 30px rgba(0, 0, 0, .25); }
.beat .eq { display: none; align-items: flex-end; gap: 3px; height: 18px; }
.beat.on .eq { display: flex; }
.eq i { width: 4px; background: var(--pink-deep); border-radius: 2px; animation: eq .6s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: .15s; } .eq i:nth-child(3) { animation-delay: .3s; } .eq i:nth-child(4) { animation-delay: .1s; }
@keyframes eq { from { height: 5px; } to { height: 18px; } }

.big-next {
  align-self: center; min-width: 280px; min-height: 84px; padding: 18px 40px; border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; font-family: var(--display); font-weight: 700; font-size: 28px;
  box-shadow: 0 14px 34px rgba(224, 24, 122, .4); transition: transform .12s;
}
.big-next:hover { transform: translateY(-3px); }
.big-next:disabled { opacity: .45; cursor: default; transform: none; }
.big-next.gold { background: linear-gradient(135deg, #ffd84d, #ff9a3d); color: #3d1a00; box-shadow: 0 14px 34px rgba(255, 170, 60, .4); }

/* record */
.rec-area { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 6px; }
.beat-pill { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .16); font-size: 18px; }
.beat-pill span { font-size: 24px; }
.wave-wrap { position: relative; width: min(420px, 90vw); height: min(420px, 90vw); display: grid; place-items: center; }
#wave { position: absolute; inset: 0; width: 100%; height: 100%; }
.mic-big {
  position: relative; width: 60%; height: 60%; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff;
  display: grid; place-items: center; box-shadow: 0 20px 50px rgba(224, 24, 122, .5); transition: transform .12s, background .3s;
}
.mic-big:hover { transform: scale(1.03); }
.mic-big svg { width: 45%; height: 45%; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mic-big .stop-ic { display: none; width: 38%; height: 38%; border-radius: 18%; background: #fff; }
.mic-big.rec { background: linear-gradient(135deg, #ff4d6d, #e0187a); }
.mic-big.rec .mic-ic { display: none; } .mic-big.rec .stop-ic { display: block; }
.mic-big.wait { pointer-events: none; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: clamp(90px, 20vw, 150px); font-weight: 700; color: #fff; pointer-events: none; text-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.timer { font-family: var(--display); font-size: 40px; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 48px; }
.rec-hint { margin: 0; color: #e9cfe6; font-size: 20px; text-align: center; min-height: 28px; text-wrap: balance; }

/* sparkle */
.fx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .fx-grid { grid-template-columns: repeat(2, 1fr); } }
.fx {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px 14px; border-radius: 26px; min-height: 136px;
  background: var(--card); color: var(--ink); border: 5px solid transparent; box-shadow: 0 4px 0 var(--line), 0 14px 30px rgba(0, 0, 0, .25);
  font-family: var(--display); font-weight: 600; font-size: 22px; transition: transform .12s;
}
.fx span { font-size: 48px; line-height: 1; }
.fx small { font-family: var(--body); font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.fx:hover { transform: translateY(-4px); }
.fx.on { border-color: var(--violet); background: #f1e6ff; box-shadow: 0 0 0 6px rgba(139, 61, 255, .3), 0 14px 30px rgba(0, 0, 0, .25); }
.row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.stickers { display: flex; gap: 10px; flex-wrap: wrap; }
.stk { width: 68px; height: 68px; border-radius: 20px; background: var(--card); border: 4px solid transparent; font-size: 36px; display: grid; place-items: center; box-shadow: 0 3px 0 var(--line); transition: transform .12s; }
.stk:hover { transform: translateY(-3px); }
.stk.on { border-color: var(--gold); background: #fff6d6; }
.namebox { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 22px; padding: 6px 8px 6px 18px; color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.namebox label { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 800; white-space: nowrap; }
.namebox input { flex: 1; min-width: 0; font: inherit; font-family: var(--display); font-weight: 600; font-size: 24px; border: 0; background: none; color: var(--ink); padding: 10px 6px; user-select: text; -webkit-user-select: text; }
.namebox input:focus { outline: none; }
.shuffle { width: 52px; height: 52px; border-radius: 16px; background: var(--card-2); font-size: 24px; display: grid; place-items: center; }
.preview-bar { display: flex; align-items: center; justify-content: center; gap: 14px; color: #e9cfe6; font-size: 17px; }
.preview-bar .pp { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .18); display: grid; place-items: center; }
.preview-bar .pp svg { width: 24px; height: 24px; fill: #fff; }
.progress { flex: 1; max-width: 360px; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--pink)); border-radius: 999px; transition: width .1s linear; }

/* song */
.song-hero { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-top: 10px; }
.big-cover { width: 200px; height: 200px; border-radius: 48px; background: linear-gradient(135deg, var(--gold), var(--pink)); display: grid; place-items: center; font-size: 110px; line-height: 1; box-shadow: 0 24px 60px rgba(255, 61, 154, .4); }
.play-wrap { position: relative; width: 190px; height: 190px; display: grid; place-items: center; }
.play-wrap svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.play-wrap svg.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.play-wrap svg.ring .track { stroke: rgba(255, 255, 255, .14); }
.play-wrap svg.ring .bar-p { stroke: var(--gold); stroke-dasharray: 534; stroke-dashoffset: 534; transition: stroke-dashoffset .1s linear; }
.play-big { width: 150px; height: 150px; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; display: grid; place-items: center; box-shadow: 0 18px 44px rgba(224, 24, 122, .45); transition: transform .12s; }
.play-big:hover { transform: scale(1.04); }
.play-big svg { width: 64px; height: 64px; fill: #fff; }
.play-big .pause-ic { display: none; } .play-big.playing .play-ic { display: none; } .play-big.playing .pause-ic { display: block; }
.song-meta { color: #e9cfe6; font-size: 17px; text-align: center; }
.song-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.trash { position: relative; overflow: hidden; z-index: 0; }
.trash i { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(255, 77, 109, .6); z-index: -1; }
.trash.hold i { width: 100%; transition: width 1.5s linear; }

/* modal + toast + confetti */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(10, 4, 20, .7); backdrop-filter: blur(6px); }
.modal[hidden] { display: none; }
.sheet { width: min(560px, 100%); background: var(--card); color: var(--ink); border-radius: 30px; padding: 28px 28px 24px; font-weight: 600; font-size: 17px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
.sheet h2 { font-family: var(--display); font-weight: 700; font-size: 28px; margin: 0 0 12px; }
.sheet p { margin: 0 0 12px; }
.sheet .close { display: block; margin: 12px auto 0; min-height: 56px; padding: 12px 36px; border-radius: 999px; background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; font-family: var(--display); font-weight: 700; font-size: 20px; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); z-index: 30; background: #fff; color: var(--ink); font-weight: 800; font-size: 17px; padding: 14px 22px; border-radius: 999px; opacity: 0; transition: .3s; pointer-events: none; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  #stars, #confetti { display: none; }
}

.logo{white-space:nowrap}
@media (max-width:420px){.hero-btn span{white-space:nowrap}}
