:root {
  --bg: #1a0a2e;
  --bg2: #2a0b3d;
  --pink: #ff4fd8;
  --cyan: #33e1ff;
  --yellow: #ffd23f;
  --green: #7cff6b;
  --red: #ff5b6e;
  --text: #fff;
  --muted: #c3b2da;
  --card: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.13);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; overflow-x: hidden; }
body {
  font-family: 'Baloo 2', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 10% 0%, #4a1470 0%, transparent 60%), linear-gradient(170deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 16px;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h3 { margin: 18px 0 8px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.35; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 2px 8px; }

.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.logo b { background: linear-gradient(90deg, var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo.big { font-size: 30px; text-align: center; margin-bottom: 12px; }

#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 70%, transparent); }
.top .me { margin-left: auto; font-size: 14px; color: var(--muted); text-align: right; line-height: 1.2; }
.live-pill { border: 0; border-radius: 99px; background: var(--red); font-size: 12px; font-weight: 800; padding: 2px 10px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }

.tab { display: none; }
.tab.show { display: block; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(20, 8, 36, 0.96); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; backdrop-filter: blur(8px); }
.tabs button { background: none; border: 0; padding: 8px 0 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; position: relative; }
.tabs button span { font-size: 22px; line-height: 1.2; }
.tabs button.on { color: var(--text); }
.tabs button.on span { transform: scale(1.12); }
.tabs i { position: absolute; top: 4px; left: 56%; font-style: normal; background: var(--pink); color: #1a0630; font-weight: 800; font-size: 11px; border-radius: 99px; padding: 0 6px; }
.tabs i:empty { display: none; }

.now-bar { background: linear-gradient(120deg, rgba(255, 79, 216, 0.25), rgba(51, 225, 255, 0.15)); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 12px; }
.now-bar .t { font-weight: 800; line-height: 1.2; }
.now-bar .s { font-size: 13px; color: var(--muted); }
.now-bar .ctl { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.now-bar .ctl button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: 14px; }
.bar { height: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--pink)); transition: width 2s linear; }

.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; font-size: 16px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); }
.search button { border: 0; border-radius: 12px; padding: 0 14px; background: var(--pink); color: #1a0630; font-weight: 800; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: 14px; white-space: nowrap; }
.chips button.on { background: var(--text); color: #1a0630; font-weight: 700; }

.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.item { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.item img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; background: #000; }
.item .txt { flex: 1; min-width: 0; }
.item .txt b, .item .txt small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .txt small { color: var(--muted); font-size: 13px; }
.item .pos { width: 26px; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.item.mine { border-color: var(--pink); }
.add { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--pink); color: #1a0630; font-size: 24px; font-weight: 800; line-height: 1; }
.icon-btn { flex: none; border: 1px solid var(--line); background: none; border-radius: 10px; padding: 6px 9px; font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 12px; }
.panel h3 { margin-top: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slider { display: block; margin-top: 12px; font-weight: 700; }
.slider input { display: block; width: 100%; margin-top: 4px; accent-color: var(--pink); height: 28px; }
.toggle { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-weight: 700; }
.toggle input { width: 22px; height: 22px; accent-color: var(--pink); margin-top: 2px; flex: none; }
.toggle small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.btn { display: block; width: 100%; margin-top: 12px; border: 0; border-radius: 14px; padding: 12px; font-weight: 800; background: linear-gradient(90deg, var(--yellow), var(--pink)); color: #1a0630; font-size: 16px; }
.btn.big { font-size: 20px; padding: 14px; }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--text); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { border: 1px solid var(--line); background: none; border-radius: 12px; padding: 10px; font-weight: 700; }
.seg button.on { background: var(--text); color: #1a0630; }

.mic-hero { text-align: center; padding: 12px 0 4px; }
.mic-btn { width: 170px; height: 170px; border-radius: 50%; border: 0; background: radial-gradient(circle at 30% 30%, #5a2a86, #2a0b3d); box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08), 0 10px 40px rgba(0, 0, 0, 0.4); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; transition: box-shadow 0.1s; }
.mic-btn .ico { font-size: 56px; line-height: 1; }
.mic-btn.on { background: radial-gradient(circle at 30% 30%, #ff7be4, #b3168f); }
.vu { position: relative; height: 18px; background: rgba(0, 0, 0, 0.35); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.vu i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #3a7bd5, var(--cyan)); }
.vu i.open { background: linear-gradient(90deg, var(--green), var(--yellow)); }
.vu span { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #fff; box-shadow: 0 0 6px #fff; }

.sheet { position: fixed; inset: 0; background: rgba(10, 3, 20, 0.88); backdrop-filter: blur(6px); z-index: 20; display: none; align-items: center; justify-content: center; padding: 16px; }
.sheet.show { display: flex; }
.sheet-card { width: 100%; max-width: 440px; background: linear-gradient(170deg, #2e1150, #1a0a2e); border: 1px solid var(--line); border-radius: 22px; padding: 22px 18px; max-height: 92vh; overflow: auto; }
.sheet-card label { display: block; font-weight: 700; margin-bottom: 12px; }
.sheet-card input:not([type]), .sheet-card input[type=text] { display: block; width: 100%; margin-top: 4px; font-size: 18px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); }
#codeIn { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 800; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-grid button { font-size: 24px; background: none; border: 2px solid transparent; border-radius: 10px; padding: 2px 0; }
.emoji-grid button.on { border-color: var(--pink); background: rgba(255, 79, 216, 0.15); }
.err { color: var(--red); font-weight: 700; min-height: 1em; text-align: center; }

.tut-art { font-size: 72px; text-align: center; line-height: 1.1; margin: 8px 0; }
.tut-art .flip { display: inline-block; transform: rotate(180deg); }
.tut h2 { text-align: center; margin: 6px 0; font-size: 24px; line-height: 1.15; }
.tut p { text-align: center; color: var(--muted); font-size: 16px; line-height: 1.4; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--pink); }
.big-count { font-size: 64px; font-weight: 800; text-align: center; color: var(--yellow); line-height: 1; }
.stars { display: flex; justify-content: center; gap: 4px; margin: 14px 0; }
.stars button { font-size: 38px; padding: 0 2px; background: none; border: 0; filter: grayscale(1) opacity(0.5); transition: transform 0.1s; }
.stars button.on { filter: none; transform: scale(1.1); }

.sing { position: fixed; inset: 0; z-index: 15; display: none; background: radial-gradient(circle at 50% 40%, #3b0f5c, #12051f 70%); }
.sing.show { display: block; }
.sing-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; transition: transform 0.4s; }
.sing.flip .sing-inner { transform: rotate(180deg); }
.sing-song { font-size: 20px; font-weight: 800; line-height: 1.2; }
.sing-song small { display: block; color: var(--muted); font-weight: 500; font-size: 15px; }
.ring { width: 200px; height: 200px; border-radius: 50%; display: grid; place-items: center; font-size: 80px; background: radial-gradient(circle, #ff7be4, #8a1270); box-shadow: 0 0 0 calc(var(--l, 0) * 40px) rgba(255, 79, 216, 0.35); transition: box-shadow 0.08s; }
.ring.closed { background: radial-gradient(circle, #5a3a7a, #2a1540); }
.sing-status { color: var(--muted); font-size: 15px; min-height: 2.6em; }
.sing .progress { width: 80%; height: 5px; background: rgba(255, 255, 255, 0.12); border-radius: 99px; overflow: hidden; }
.sing .progress i { display: block; height: 100%; width: 0; background: var(--pink); transition: width 2s linear; }
.sing-actions { display: flex; gap: 10px; }
.sing-actions button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 10px 18px; font-size: 18px; font-weight: 700; }
.sing-actions .danger { background: var(--red); border: 0; color: #fff; }

.result-card { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.result-card .n { font-size: 56px; font-weight: 800; color: var(--yellow); line-height: 1; }
.banner { position: fixed; top: 0; left: 50%; transform: translate(-50%, -120%); background: var(--yellow); color: #1a0630; font-weight: 800; padding: 6px 16px; border-radius: 0 0 12px 12px; transition: transform 0.3s; z-index: 30; }
.banner.show { transform: translate(-50%, 0); }
#toast { pointer-events: none; position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateY(200%); text-align: center; background: rgba(20, 8, 36, 0.97); border: 1px solid var(--pink); padding: 10px 14px; border-radius: 14px; font-weight: 700; transition: transform 0.3s; z-index: 40; }
#toast.show { transform: none; }

.phone-screen { position: fixed; inset: 0; z-index: 12; display: none; flex-direction: column; background: #12051f; transition: transform 0.3s; }
.phone-screen.show { display: flex; }
.phone-screen.min { transform: translateY(110%); pointer-events: none; }
.phone-screen iframe { flex: 1; width: 100%; border: 0; }
.scr-bar { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(20, 8, 36, 0.97); border-top: 1px solid var(--line); }
.scr-bar button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 6px; font-weight: 700; font-size: 14px; }
.scr-pill { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 7; border: 0; border-radius: 99px; padding: 10px 16px; font-weight: 800; background: linear-gradient(90deg, var(--yellow), var(--pink)); color: #1a0630; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
#where .btn small { display: block; font-weight: 500; font-size: 13px; }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); margin-top: 6px; }
