/* Mini App: токены, экраны, шапка, кнопка музыки. */
:root {
  --night: #1c2233; --night-2: #151a28; --night-3: #10141f; --card: #242b3f; --card-2: #2b3350; --line: #343c55;
  --parch: #e8d9b5; --parch-dim: #b9ab8a; --ochre: #cd9640; --candle: #ffcf6b;
  --wine: #7a2e2e; --wine-2: #a8483f; --moss: #4f6b3a; --ink: #1a1410;
  --tabbar: 50px; --appbar: 52px;
  --danger: #ff9d8a; --danger-soft: #ffb3a6; --heal: #a8cb3d; --heal-deep: #4a5f10; --info: #cfe3ff; --hot: #ff8a3d;
  --side-pc: #5b9be0; --side-ally: #5fb57c; --side-npc: #d1ab4e; --side-foe: #e05a5a; --wood-ink: #2a1d10;
  --shadow: #05070d; --white-ish: #f7f2e8;   /* тени: rgb(5 7 13 / α) того же почти-чёрного */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;   /* скругления: чипы и мелкие кнопки, карточки и поля, большие панели; круг 50%, пилюля 999px */
  --safe-t: env(safe-area-inset-top); --safe-b: max(4px, calc(env(safe-area-inset-bottom) - 14px));   /* вкладки ближе к краю */
  /* z-шкала: лента 1 · липкие панели 10 · док 20 · вкладки 30 · тост 40 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100dvh; background: var(--night-2); color: var(--parch); font: 15px/1.45 "PT Sans", system-ui, sans-serif; }
body { background: radial-gradient(120% 60% at 50% 0%, #2c2638 0%, var(--night) 45%, var(--night-2) 100%) fixed; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, textarea:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible, label:has(> input:focus-visible) { outline: 2px solid var(--candle); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2 { text-wrap: balance; } p, .text { text-wrap: pretty; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- экраны ---------- */
.view { position: fixed; inset: 0 0 calc(var(--tabbar) + var(--safe-b)) 0; display: none; flex-direction: column; }
.view.on { display: flex; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; position: relative; }
.pad { max-width: 640px; margin: 0 auto; padding: 12px 14px 20px; }

/* ---------- шапка экрана: всегда видно, где ты ---------- */
.appbar { flex: none; display: flex; align-items: center; gap: 10px; min-height: calc(var(--appbar) + var(--safe-t)); padding: var(--safe-t) 14px 0;
  background: var(--night-3); border-bottom: 1px solid var(--line); z-index: 10; }
.appbar .ava { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--ochre); flex: none; background: var(--card); }
.appbar .ttl { flex: 1; min-width: 0; }
.appbar h1 { margin: 0; font: 700 20px/1.1 "Cormorant SC", Georgia, serif; color: var(--candle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .st { font-size: 12px; color: var(--parch-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: #6b7a55; flex: none; }
.conn.on { background: #7fd08a; } .conn.off { background: #d06a5c; }
/* переключатель кампании: только у тех, кто играет в двух группах */
.camp { flex: none; max-width: 45%; min-height: 44px; padding: 4px 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); color: var(--parch); font: 13px/1.2 "PT Sans", sans-serif; text-overflow: ellipsis; }
.camp[hidden] { display: none; }
/* музыка сцены: включает сам игрок, по умолчанию тишина */
.mus { flex: none; width: 44px; height: 44px; margin: 0 -8px; display: grid; place-items: center; border-radius: 50%; color: var(--parch-dim); }
.mus .i { width: 22px; height: 22px; } .mus .w, .mus .x { transition: opacity .3s; } .mus .w { opacity: 0; }
.mus-pop { position: fixed; z-index: 60; width: 240px; padding: 6px 14px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); box-shadow: 0 10px 30px #0008; color: var(--parch); }
.mus-row { display: flex; align-items: center; gap: 12px; min-height: 44px; font: 14px/1.2 "PT Sans", sans-serif; }
.mus-row > span { flex: 1; color: var(--parch-dim); }
.mus-sw { min-width: 64px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--night-2); color: var(--parch-dim); font: 600 13px "PT Sans", sans-serif; }
.mus-sw[aria-pressed=true] { background: var(--candle); border-color: var(--candle); color: var(--night); }
.mus-pick { display: grid; gap: 6px; padding: 8px 0 10px; border-top: 1px solid var(--line); font: 14px/1.2 "PT Sans", sans-serif; }
.mus-pick > span { color: var(--parch-dim); }
.mus-pick small { color: var(--parch); font-size: 13px; line-height: 1.35; }
.mus-chips { display: grid; gap: 6px; }
.mus-chip { min-height: 36px; padding: 0 12px; text-align: left; border-radius: 10px; border: 1px solid var(--line); background: var(--night-2); color: var(--parch); font: 13px "PT Sans", sans-serif; }
.mus-chip[aria-pressed=true] { border-color: var(--candle); color: var(--candle); }
.mus-vol { flex: 1.4; min-height: 44px; accent-color: var(--candle); }
.mus[aria-pressed=true] { color: var(--candle); } .mus[aria-pressed=true] .w { opacity: 1; } .mus[aria-pressed=true] .x { opacity: 0; }

