:root {
  color-scheme: dark;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color: #f7f3ff;
  background: #100d16;
  --muted: #c2b8cc;
  --line: #393143;
  --accent: #e4c8ff;
  --panel: #1e1828;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, a, textarea, select, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a { color: var(--accent); }
[hidden] { display: none !important; }
.shell { max-width: 640px; min-height: 100dvh; margin: auto; }
.header {
  padding: calc(20px + max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px))) 20px 12px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 700; }
.mark {
  display: grid; place-items: center; width: 35px; height: 35px; border-radius: 12px;
  color: #1b0b2a; background: #e4c8ff;
}
.wallet { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
#balance { font-size: 14px; color: var(--muted); }
main { padding: 8px 20px calc(90px + var(--safe-bottom)); }
h1 { margin: 14px 0 18px; font-size: clamp(26px, 7vw, 37px); line-height: 1.1; letter-spacing: -.04em; }
h2 { font-size: 17px; margin: 0 0 10px; overflow-wrap: anywhere; }
p { margin: 0 0 12px; }
.card, .section, .option {
  width: 100%; padding: 17px; border: 1px solid var(--line); border-radius: 19px;
  color: inherit; background: var(--panel); text-align: left; margin: 0 0 10px;
}
.card { display: grid; gap: 9px; min-height: 120px; }
.card.primary { background: linear-gradient(135deg, #423056 0%, #281c38 80%); border-color: #69527f; }
.card strong { font-size: 19px; line-height: 1.2; }
.card small, .muted { color: var(--muted); }
.card small { font-size: 14px; }
.icon { font-size: 24px; line-height: 1; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 11px 0 18px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.control {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 8px 13px; color: var(--accent); border: 1px solid var(--line);
  border-radius: 12px; background: #21182b; text-decoration: none; font-size: 14px;
}
.control.primary { background: var(--accent); color: #1b0b2a; border-color: transparent; font-weight: 700; }
.control.full { width: 100%; }
.field { display: grid; gap: 8px; margin: 0 0 14px; }
.inline { display: flex; align-items: center; gap: 8px; margin: 6px 0 15px; }
select, textarea {
  width: 100%; min-height: 44px; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #21182b; color: inherit;
}
textarea { min-height: 125px; resize: vertical; }
.error { margin: 10px 0; color: #ffc3cb; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
audio { display: block; width: 100%; margin: 8px 0; }
.track { padding-top: 13px; overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--muted); overflow-wrap: anywhere; }
details > p { margin: 10px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.idea { overflow-wrap: anywhere; white-space: pre-wrap; }
.nav {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed;
  inset: auto 0 0; max-width: 640px; margin: auto; padding: 4px 5px var(--safe-bottom);
  background: #18121f; border-top: 1px solid var(--line);
}
.nav button { min-height: 58px; background: transparent; color: var(--muted); border: 0; font-size: 11px; }
.nav button[aria-current="page"] { color: var(--accent); }
.nav span { display: block; font-size: 18px; margin-bottom: 3px; }
.profile { display: flex; gap: 12px; align-items: center; margin: 0 0 14px; }
.avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.payment-frame { display: block; width: 100%; height: clamp(480px, 72dvh, 760px); margin: 0 0 10px; border: 0; border-radius: 12px; background: white; }
.option { min-height: 44px; }
footer { color: var(--muted); padding-top: 12px; text-align: center; font-size: 12px; }
@media (max-width: 350px) {
  .header { padding-left: 14px; padding-right: 14px; }
  main { padding-left: 14px; padding-right: 14px; }
  .card, .section, .option { padding: 13px; }
}

.create-song { min-height: 96px; font-size: clamp(20px, 5.5vw, 28px); letter-spacing: .02em; border-radius: 22px; box-shadow: 0 12px 35px #0003; }
.settings-link { display: flex; margin: 12px auto 24px; border-color: transparent; background: transparent; color: var(--muted); }

.preference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 24px; }
.preference-choice { min-height: 48px; width: 100%; color: var(--muted); }
.preference-grid > .preference-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
.preference-choice.selected { color: #1b0b2a; background: var(--accent); border-color: var(--accent); font-weight: 700; }

.setting-section { padding: 16px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.setting-section h2 { margin-bottom: 0; }
.setting-section .preference-grid { margin-bottom: 0; }
