:root {
  --purple: #5b2bd6; --pink: #ff4d8d; --yellow: #ffd23f; --teal: #22c7a9; --ink: #1c1240;
  --font: "Arial Rounded MT Bold", "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: var(--font); color: var(--ink); background: radial-gradient(circle at 20% 10%, #8f5bff, var(--purple) 60%); overscroll-behavior: none; }
button { font-family: inherit; cursor: pointer; border: 0; }
.hidden { display: none !important; }

.screen { display: none; min-height: 100%; padding: max(16px, env(safe-area-inset-top)) 18px 24px; flex-direction: column; align-items: center; }
.screen.active { display: flex; }

.logo { font-size: 56px; font-weight: 900; color: var(--yellow); text-shadow: 0 5px 0 #2b0f7a; letter-spacing: -1px; margin-top: 8vh; transform: rotate(-3deg); }
.logo span { color: #fff; margin-left: 8px; }
.logo.small { font-size: 28px; margin: 0; text-shadow: 0 3px 0 #2b0f7a; }
.sub { color: #fff; font-size: 20px; opacity: .9; }
.badge { background: rgba(255,255,255,.2); color: #fff; border-radius: 99px; padding: 4px 10px; font-size: 12px; }
.badge:empty { display: none; }

.card { background: #fff; border-radius: 28px; padding: 22px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 0 rgba(0,0,0,.2); margin-top: 20px; }
.card label { font-size: 18px; }
input { font-family: inherit; font-size: 20px; padding: 14px 16px; border-radius: 18px; border: 3px solid #e3dbff; outline: none; width: 100%; }
input:focus { border-color: var(--pink); }
.big { background: var(--pink); color: #fff; font-size: 26px; padding: 16px 26px; border-radius: 99px; box-shadow: 0 6px 0 #b8195a; }
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8195a; }
.err { color: #d3134e; min-height: 1em; margin: 0; }

.top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.mic { margin-top: 3vh; width: min(320px, 80vw, 56vh); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8db8, var(--pink)); color: #fff; font-size: min(110px, 18vh); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 12px 0 #b8195a, 0 0 0 14px rgba(255,255,255,.15); animation: breathe 2.4s ease-in-out infinite; }
.mic span { font-size: 24px; margin-top: 6px; }
.mic:active { transform: translateY(6px) scale(.98); box-shadow: 0 6px 0 #b8195a; }
@keyframes breathe { 50% { box-shadow: 0 12px 0 #b8195a, 0 0 0 28px rgba(255,255,255,.08); } }
.type-row { display: flex; gap: 8px; width: min(520px, 100%); margin-top: 26px; }
.go { background: var(--teal); color: #fff; font-size: 18px; border-radius: 18px; padding: 0 16px; white-space: nowrap; box-shadow: 0 4px 0 #128f78; }

h2 { color: #fff; align-self: flex-start; margin: 28px 0 10px; font-size: 26px; }
h2:empty, .shelf:empty { display: none; }
.shelf { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tile { background: #fff; border-radius: 22px; overflow: hidden; text-align: left; padding: 0; box-shadow: 0 6px 0 rgba(0,0,0,.2); }
.tile img, .tile .noimg { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #c9b8ff; }
.tile .t { padding: 10px 12px; font-size: 18px; }
.tile .n { color: #8a7fb0; font-size: 13px; padding: 0 12px 10px; }

.builder { margin-top: 12vh; font-size: 120px; position: relative; }
.bot { display: inline-block; animation: bob 0.6s ease-in-out infinite alternate; }
.hammer { display: inline-block; transform-origin: 80% 80%; animation: hammer 0.5s ease-in-out infinite alternate; font-size: 80px; }
@keyframes bob { to { transform: translateY(-14px) rotate(-4deg); } }
@keyframes hammer { from { transform: rotate(10deg); } to { transform: rotate(-50deg); } }
.bubble { background: #fff; border-radius: 28px; padding: 18px 22px; font-size: 26px; max-width: min(640px, 92vw); text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.2); margin-top: 24px; }
.bubble:empty { visibility: hidden; }
.stage-text { color: #fff; font-size: 24px; margin-top: 22px; }
.bar { width: min(460px, 86vw); height: 22px; background: rgba(255,255,255,.25); border-radius: 99px; margin-top: 14px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow), var(--pink)); border-radius: 99px; transition: width .5s; }
.big-emoji { font-size: 110px; margin-top: 14vh; }
#s-message .big { margin-top: 26px; }

#s-play { padding: 0; background: #000; }
#player { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.float { position: fixed; z-index: 5; background: rgba(255,255,255,.85); border-radius: 99px; font-size: 26px; min-width: 56px; height: 56px; padding: 0 14px; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.tl { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); }
.tl2 { top: max(10px, env(safe-area-inset-top)); left: calc(max(10px, env(safe-area-inset-left)) + 66px); }
.tr { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
.remix { background: var(--pink); color: #fff; font-size: 22px; animation: wiggle 3s ease-in-out infinite; }
@keyframes wiggle { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-6deg); } 96% { transform: rotate(6deg); } }
.history { position: fixed; z-index: 6; left: 10px; right: 10px; top: 76px; background: rgba(28,18,64,.92); border-radius: 22px; padding: 12px; display: flex; gap: 10px; overflow-x: auto; }
.history .tile { flex: 0 0 160px; }
.history .tile.cur { outline: 5px solid var(--yellow); }
.rotate { display: none; }
@media (orientation: portrait) {
  .rotate { display: flex; position: fixed; z-index: 4; left: 0; right: 0; bottom: 8vh; flex-direction: column; align-items: center; color: #fff; font-size: 44px; pointer-events: none; animation: bob 0.8s infinite alternate; }
  .rotate span { font-size: 20px; }
}

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(28,18,64,.9); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.pulse { font-size: 110px; width: 200px; height: 200px; border-radius: 50%; background: var(--pink); display: flex; align-items: center; justify-content: center; animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,141,.7); } 100% { box-shadow: 0 0 0 40px rgba(255,77,141,0); } }
.heard { color: #fff; font-size: 28px; text-align: center; max-width: 640px; min-height: 2.4em; }
.row { display: flex; gap: 14px; align-items: center; }
.ghost { background: rgba(255,255,255,.2); color: #fff; width: 64px; height: 64px; border-radius: 50%; font-size: 26px; }
#listen-type { margin-top: 4px; }
