:root {
  --bg: var(--tg-theme-bg-color, #14121f);
  --bg2: var(--tg-theme-secondary-bg-color, #1e1b2e);
  --text: var(--tg-theme-text-color, #f2f0fa);
  --hint: var(--tg-theme-hint-color, #9a95b3);
  --accent: #ff6b5e;
  --accent2: #ffb347;
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --r: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.screen { display: none; flex-direction: column; min-height: calc(100vh - 40px); }
.screen.active { display: flex; animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; color: transparent; }
h2 { font-size: 22px; margin: 4px 0 6px; }
h3 { margin: 0 0 4px; font-size: 17px; }
.hero { margin-bottom: 8px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.label { display: block; font-weight: 600; margin: 18px 0 8px; }
.label .muted { font-weight: 400; }
.spacer { flex: 1; min-height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  padding: 8px 14px; border-radius: 999px; font-size: 15px; cursor: pointer; }
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg2)); }
.chips.small .chip { padding: 6px 12px; font-size: 14px; }

.input { width: 100%; border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: var(--r); padding: 12px 14px; font: inherit; outline: none; resize: vertical; }
.input:focus { border-color: var(--accent); }
textarea.lyrics { font-size: 15px; line-height: 1.5; min-height: 300px; margin-top: 8px; }
.input.title { font-weight: 600; margin-top: 8px; }
.stress { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }

.btn { border: 0; border-radius: var(--r); padding: 14px 18px; font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1; cursor: pointer;
  color: var(--text); background: var(--bg2); }
.btn.primary { color: #fff; background: linear-gradient(90deg, var(--accent), #ff8a4c); }
.btn.ghost { border: 1px solid var(--line); background: transparent; }
.btn:disabled { opacity: .45; }
.btn.sticky { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); width: 100%;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 30%, transparent); }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.row { display: flex; gap: 10px; margin-top: 12px; }
.grow { flex: 1; }
#new-song { margin-top: 16px; }

.hints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hint { font-size: 13px; color: var(--hint); border: 1px dashed var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.style-row { display: flex; justify-content: space-between; align-items: center; margin-top: 20px;
  padding: 12px 14px; background: var(--bg2); border-radius: var(--r); }

.card { background: var(--bg2); border-radius: var(--r); padding: 16px; margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.variant { background: var(--bg2); border-radius: var(--r); padding: 14px; margin-top: 10px; border: 2px solid transparent; }
.variant.chosen { border-color: var(--accent); }
.variant .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
audio { width: 100%; height: 40px; }
.pkg { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.pkg.on { border-color: var(--accent); }
.pkg .badge { font-size: 12px; background: var(--accent); color: #fff; border-radius: 6px; padding: 2px 6px; margin-left: 6px; }

.center-screen { justify-content: center; align-items: center; text-align: center; }
.pulse { display: flex; gap: 6px; height: 48px; align-items: center; margin-bottom: 16px; }
.pulse span { width: 7px; height: 100%; border-radius: 4px; background: linear-gradient(var(--accent), var(--accent2));
  animation: eq 1s ease-in-out infinite; }
.pulse span:nth-child(2) { animation-delay: .15s } .pulse span:nth-child(3) { animation-delay: .3s }
.pulse span:nth-child(4) { animation-delay: .45s } .pulse span:nth-child(5) { animation-delay: .6s }
@keyframes eq { 0%,100% { transform: scaleY(.3) } 50% { transform: scaleY(1) } }
@media (prefers-reduced-motion: reduce) { .pulse span, .screen.active { animation: none; } }

.my { margin-top: 28px; }
.song-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  background: var(--bg2); border-radius: var(--r); margin-top: 8px; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #000c; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90%; }
.toast.show { opacity: 1; }

#packages { display: flex; flex-direction: column; gap: 8px; }
