:root {
  --bg: #0e1020;
  --panel: #181b33;
  --text: #eef1ff;
  --muted: #9aa0c7;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #1c2150, var(--bg));
  color: var(--text);
  overflow-x: hidden;
}

/* Стартовый оверлей */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 9, 20, 0.85); z-index: 10;
}
.overlay.hidden { display: none; }
.start-card {
  text-align: center; padding: 36px; max-width: 380px;
  background: var(--panel); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.start-card h1 { font-size: 40px; margin: 0 0 8px; }
.start-card p { color: var(--muted); }
.start-card small { display: block; margin-top: 14px; color: #6a6f96; }
.big-btn {
  margin-top: 10px; padding: 14px 30px; font-size: 20px; font-weight: 700;
  border: none; border-radius: 14px; cursor: pointer; color: #0e1020;
  background: linear-gradient(135deg, #6df, #9d7bff);
}
.big-btn:active { transform: scale(.97); }

#app { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* Навигация Студия/Каталог */
.nav { display: flex; gap: 8px; margin-bottom: 14px; }
.nav-btn {
  flex: 1; padding: 12px; font-size: 16px; font-weight: 700; cursor: pointer;
  color: var(--muted); background: var(--panel); border: 1px solid #2c3160; border-radius: 12px;
}
.nav-btn.active { color: #0e1020; background: linear-gradient(135deg, #6df, #9d7bff); border-color: transparent; }
.view-hidden { display: none; }

/* HUD: Ноты + уровень */
.hud { display: flex; align-items: center; gap: 10px; margin-left: auto; padding-left: 8px; }
.hud-notes, .hud-lvl {
  font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid #2c3160; white-space: nowrap;
}
.hud-notes { color: #ffd24d; }
.hud-lvl { color: #6df; }

/* Задание дня */
.daily-card {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: linear-gradient(135deg, #1b2348, #181b33);
  border: 1px solid #2c3160; border-radius: 12px;
}
.daily-text { font-size: 14px; }
.daily-text b { color: #ffd24d; }
.daily-actions { margin-left: auto; }
.daily-actions button {
  padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer; color: #0e1020;
  background: linear-gradient(135deg, #ffd24d, #ffb14e); border: none; border-radius: 9px;
}
.daily-done { font-size: 13px; color: #5cffa6; font-weight: 700; }

/* Заблокированный мир */
.tab.locked { color: #6a6f96; border-style: dashed; }

/* Кнопка магазина в навигации */
.nav-shop {
  flex: 0 0 auto; padding: 12px 16px; font-size: 18px; cursor: pointer;
  color: var(--text); background: var(--panel); border: 1px solid #2c3160; border-radius: 12px;
}
.nav-shop:active { transform: scale(.96); }

/* Онбординг */
.onb-card {
  width: min(380px, 92vw); padding: 30px 26px; text-align: center;
  background: var(--panel); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.onb-emoji { font-size: 72px; line-height: 1; }
.onb-card h2 { margin: 14px 0 8px; font-size: 24px; }
.onb-card p { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 0; }
.onb-dots { display: flex; gap: 8px; justify-content: center; margin: 20px 0 16px; }
.onb-dot { width: 9px; height: 9px; border-radius: 50%; background: #2c3160; }
.onb-dot.on { background: #6df; transform: scale(1.2); }
.onb-next {
  display: block; width: 100%; padding: 14px; font-size: 18px; font-weight: 700; cursor: pointer;
  color: #0e1020; background: linear-gradient(135deg, #6df, #9d7bff); border: none; border-radius: 12px;
}
.onb-skip {
  display: block; margin: 10px auto 0; padding: 6px 12px; font-size: 13px; cursor: pointer;
  color: var(--muted); background: none; border: none;
}

/* Диалог подтверждения */
.confirm-card { text-align: center; }
.confirm-text { font-size: 17px; margin: 0 0 18px; line-height: 1.4; }

/* Магазин */
.shop-card { text-align: left; }
.shop-card h2 { text-align: center; }
.shop-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid #2c3160;
}
.si-emoji { font-size: 24px; }
.si-title { flex: 1; font-weight: 600; }
.si-buy {
  padding: 9px 16px; font-size: 14px; font-weight: 700; cursor: pointer; color: #0e1020;
  background: linear-gradient(135deg, #5cffa6, #6df); border: none; border-radius: 9px; white-space: nowrap;
}
.si-buy:disabled { background: #2c3160; color: #6a6f96; cursor: default; }
.shop-card > button:last-child {
  display: block; margin: 16px auto 0; padding: 9px 20px; cursor: pointer;
  color: var(--text); background: #20254a; border: 1px solid #2c3160; border-radius: 10px;
}

/* Каталог */
.cat-title { font-size: 22px; margin: 0 0 12px; }
.feed-tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.feed-tab {
  padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: var(--panel); border: 1px solid #2c3160; border-radius: 999px;
}
.feed-tab.active { color: #0e1020; background: #6df; border-color: transparent; }
.cat-filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cat-filter select, .cat-filter button {
  padding: 9px 12px; font-size: 14px; cursor: pointer;
  color: var(--text); background: var(--panel); border: 1px solid #2c3160; border-radius: 10px;
}
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-empty { color: #5b6092; font-size: 15px; padding: 24px 0; text-align: center; }
.cat-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--panel); border: 1px solid #2c3160; border-radius: 12px;
}
.ci-emoji { font-size: 28px; }
.ci-main { flex: 1; min-width: 0; }
.ci-name { font-weight: 700; font-size: 16px; }
.ci-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ci-btns { display: flex; gap: 5px; }
.ci-btns .mini { width: 34px; height: 34px; font-size: 15px; }

/* Вкладки миров */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: var(--panel); border: 1px solid #2c3160; border-radius: 999px;
}
.tab:active { transform: scale(.96); }
.tab.active { color: #0e1020; background: linear-gradient(135deg, #6df, #9d7bff); border-color: transparent; }

/* Заголовок */
.header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.header h1 { margin: 0; font-size: 24px; }
.bpm { font-size: 13px; color: var(--muted); padding: 4px 10px; border: 1px solid #2c3160; border-radius: 20px; }
.controls { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.controls button {
  padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--text); background: var(--panel); border: 1px solid #2c3160; border-radius: 10px;
}
.controls button:active { transform: scale(.96); }

/* Сцена */
.stage-wrap {
  background: linear-gradient(180deg, #11142b, #0c0e1c);
  border: 1px solid #242a52; border-radius: 18px; padding: 18px; margin-bottom: 16px;
}
.stage {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; justify-content: center;
  min-height: 120px;
}
.stage-empty { color: #5b6092; font-size: 15px; align-self: center; text-align: center; }

/* Пати-режим (трансформация) — диско-перелив цветов */
@keyframes partyhue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
.stage-wrap.party { animation: partyhue 3s linear infinite; box-shadow: inset 0 0 60px rgba(157,123,255,.25); }

/* Подсказка о секретах */
.secrets-hint { text-align: center; font-size: 12px; color: #b388ff; margin-top: 10px; min-height: 14px; }

/* Празднование находки секрета */
.celebrate {
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.celebrate-emoji { font-size: 90px; animation: celebpop .5s cubic-bezier(.2,1.4,.4,1); }
.celebrate-text {
  margin-top: 12px; font-size: 20px; font-weight: 800; text-align: center; line-height: 1.4;
  background: #222a55; color: #fff; padding: 12px 22px; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
@keyframes celebpop { from { transform: scale(0) rotate(-25deg); } to { transform: scale(1) rotate(0); } }
.char { width: 78px; text-align: center; cursor: pointer; animation: pop-in .25s ease; }
.char-body {
  width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  background: radial-gradient(circle at 35% 30%, #ffffff22, transparent 60%),
              color-mix(in srgb, var(--accent) 35%, #1c2143);
  border: 3px solid var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
  will-change: transform;
}
.char-name { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.char.silent .char-body { opacity: .35; filter: grayscale(.6); }
@keyframes pop-in { from { transform: scale(0); } to { transform: scale(1); } }

/* Контролы персонажа (mute / solo / убрать) */
.char-ctrls { display: flex; gap: 4px; justify-content: center; }
.mini {
  width: 26px; height: 26px; padding: 0; font-size: 13px; cursor: pointer;
  color: var(--text); background: #20254a; border: 1px solid #2c3160; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mini:active { transform: scale(.9); }
.mini.on { background: var(--accent, #6df); color: #0e1020; border-color: transparent; }

/* Индикатор битов */
.dots { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #2c3160; transition: transform .05s, background .05s; }
.dot.on { background: #6df; transform: scale(1.6); box-shadow: 0 0 12px #6df; }

/* Студийная панель: сцены + дорожка */
.studio-panel {
  background: var(--panel); border: 1px solid #242a52; border-radius: 14px;
  padding: 12px 14px; margin-bottom: 16px;
}
.scene-row, .arr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scene-row { margin-bottom: 10px; }
.row-label { font-size: 13px; color: var(--muted); min-width: 64px; }
.scene-btns { display: flex; gap: 8px; }
.scene-btn {
  position: relative; min-width: 44px; padding: 8px 12px; font-size: 16px; font-weight: 800;
  cursor: pointer; color: var(--text); background: #20254a;
  border: 2px solid #2c3160; border-radius: 10px;
}
.scene-btn.active { border-color: var(--sc); color: var(--sc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc) 35%, transparent); }
.scene-count {
  position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  color: #0e1020; background: var(--sc); border-radius: 9px;
}
.arr-blocks { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.arr-block {
  position: relative; width: 40px; height: 40px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--sc) 22%, #20254a);
  border: 2px solid var(--sc); border-radius: 9px; font-weight: 800;
}
.arr-block.playing { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 55%, transparent); transform: translateY(-2px); }
.ab-x {
  position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; padding: 0;
  font-size: 10px; line-height: 1; cursor: pointer; color: #fff;
  background: #444; border: none; border-radius: 50%;
}
.arr-add {
  width: 40px; height: 40px; font-size: 20px; cursor: pointer; color: var(--muted);
  background: #20254a; border: 2px dashed #2c3160; border-radius: 9px;
}
.track-btn {
  padding: 10px 18px; font-size: 15px; font-weight: 700; cursor: pointer; color: #0e1020;
  background: linear-gradient(135deg, #6df, #9d7bff); border: none; border-radius: 10px;
}
.track-btn.playing { background: linear-gradient(135deg, #ff7a7a, #ff5c7a); color: #fff; }

/* Доска категорий */
.board { display: flex; gap: 12px; flex-wrap: wrap; }
.col {
  flex: 1 1 160px; min-width: 150px; background: var(--panel);
  border-radius: 16px; padding: 12px; border-top: 3px solid var(--accent, #555);
}
.col-h { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--accent); }
.card {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 8px; padding: 12px;
  text-align: left; font-size: 15px; font-weight: 600; cursor: pointer;
  color: var(--text); background: #20254a; border: 2px solid transparent; border-radius: 12px;
  transition: transform .06s, box-shadow .15s, background .15s;
}
.card-emoji { font-size: 20px; }
.card:active { transform: scale(.97); }
.card.active {
  background: color-mix(in srgb, var(--accent) 28%, #20254a);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent),
              0 6px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Код трека */
.codewrap { margin-top: 18px; }
.codewrap label { font-size: 13px; color: var(--muted); }
.codewrap textarea {
  width: 100%; margin-top: 6px; padding: 10px; resize: vertical;
  background: #0c0e1c; color: #8be9c0; border: 1px solid #2c3160; border-radius: 10px;
  font-family: monospace; font-size: 12px;
}

/* Мои треки */
.mytracks { margin-top: 22px; }
.mt-head { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.mt-empty { color: #5b6092; font-size: 14px; }
.track-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--panel); border: 1px solid #2c3160; border-radius: 12px;
}
.ti-emoji { font-size: 22px; }
.ti-name { font-weight: 600; }
.ti-world { font-size: 12px; color: var(--muted); margin-left: auto; }
.track-item .mini { width: 30px; height: 30px; font-size: 14px; }

/* Диалог сохранения */
.save-card {
  width: min(420px, 92vw); padding: 24px; text-align: center;
  background: var(--panel); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.save-card h2 { margin: 0 0 14px; font-size: 22px; }
.gen-name {
  font-size: 24px; font-weight: 800; padding: 14px; margin-bottom: 12px;
  background: #0c0e1c; border-radius: 12px;
}
.emoji-grid {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin: 12px 0 18px;
}
.emoji-pick {
  aspect-ratio: 1; font-size: 18px; cursor: pointer;
  background: #20254a; border: 2px solid transparent; border-radius: 9px;
}
.emoji-pick.on { border-color: #6df; background: #2a3470; }
.save-actions { display: flex; gap: 10px; justify-content: center; }
.save-actions button {
  padding: 10px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
  color: var(--text); background: #20254a; border: 1px solid #2c3160; border-radius: 10px;
}
.save-card > button {
  padding: 8px 14px; font-size: 14px; cursor: pointer;
  color: var(--text); background: #20254a; border: 1px solid #2c3160; border-radius: 10px;
}

/* Всплывашка */
.flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #222a55; color: #fff; padding: 10px 18px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 20; font-size: 14px;
}
