/* Песочница: полноэкранное приложение. Холст всегда тёмный, панели — по теме сайта. */
.sandbox {
  --pan: rgba(16, 16, 20, .9);
  --pan-2: #1a1a20;
  --pan-3: #24242b;
  --pan-line: rgba(255, 255, 255, .07);
  --ink: #ececf1;
  --ink-2: #a3a3ad;
  --chip: rgba(10, 10, 13, .72);
  --blue: #3fa7ff;
  overflow: hidden; background: #0b0b0e; color: var(--ink); overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
:root[data-theme="light"] .sandbox {
  --pan: rgba(255, 255, 255, .92); --pan-2: #f1f1f5; --pan-3: #e4e4ea; --pan-line: rgba(0, 0, 0, .08);
  --ink: #17171b; --ink-2: #63636d; background: #e9e9ee;
}
.sandbox .hidden { display: none !important; }
.sandbox svg { width: 20px; height: 20px; flex: none; }
.sandbox svg[fill="none"] { fill: none; }

#app {
  position: fixed; inset: 0; display: grid;
  grid-template: "tb tb" auto "tools stage" 1fr "dock dock" auto / auto 1fr;
}

/* ---------- Верхняя панель ---------- */
.tb {
  grid-area: tb; display: flex; align-items: center; gap: 10px; padding: 8px 12px; z-index: 5;
  background: var(--pan); border-bottom: 1px solid var(--pan-line); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; margin-right: 6px; }
.brand b { font: 900 16px/1 var(--font); letter-spacing: .02em; text-transform: uppercase; }
.brand-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #ff6a3d, #e0283c 55%, #7a0f1c); box-shadow: 0 4px 18px -4px rgba(224, 40, 60, .7); }
.brand-ico svg { width: 18px; height: 18px; color: #fff; }
.grp { display: flex; align-items: center; gap: 4px; }
.sp { flex: 1; }

.ib {
  position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 0;
  background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, transform .12s;
}
.ib:hover { background: var(--pan-3); color: var(--ink); }
.ib:active { transform: scale(.92); }
.ib:disabled { opacity: .35; pointer-events: none; }
.ib.on, .ib[aria-pressed="true"] { background: rgba(224, 40, 60, .16); color: #ff5468; }
.ib.big-play { background: var(--accent); color: #fff; box-shadow: 0 6px 20px -8px rgba(224, 40, 60, .8); }
.ib.big-play:hover { background: var(--accent-hover); }
.ib.big-play.paused { background: #2fbf71; box-shadow: 0 6px 20px -8px rgba(47, 191, 113, .8); }
.ib .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 9px; background: var(--accent); }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 13px; background: var(--pan-2); border: 1px solid var(--pan-line); }
.seg button {
  min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 10px; background: none; color: var(--ink-2);
  font: 800 13px/1 var(--font); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); background: var(--pan-3); }
.seg button.on { background: var(--ink); color: var(--pan-2); }
.seg button.tog[aria-pressed="true"] { color: #ffc531; }
.views button.on[data-view="1"] { background: linear-gradient(135deg, #3b0a5c, #d4321c 55%, #ffd447); color: #fff; }
.views button.on[data-view="2"] { background: linear-gradient(135deg, #2f6bff, #ff4d4d); color: #fff; }
.views button.on[data-view="3"] { background: linear-gradient(135deg, #22d3ee, #a855f7, #f97316); color: #fff; }

.cta {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 12px; border: 0; border-radius: 99px; cursor: pointer;
  background: var(--accent); color: #fff; font: 800 13px/1 var(--font); letter-spacing: .02em; text-transform: uppercase;
  box-shadow: 0 8px 26px -10px rgba(224, 40, 60, .9), inset 0 1px 0 rgba(255, 255, 255, .2); transition: transform .15s, background .15s;
}
.cta:hover { background: var(--accent-hover); transform: translateY(-1px); }
.cta.inroom { background: var(--pan-3); color: var(--ink); box-shadow: none; }
.cta.inroom b { font-family: ui-monospace, monospace; letter-spacing: .12em; color: #ff5468; }
.cta-ico { display: grid; }
.peers { display: flex; margin-right: 4px; }
.peer { width: 30px; height: 30px; border-radius: 99px; margin-left: -8px; border: 2px solid var(--pan-2); display: grid; place-items: center; font: 800 12px/1 var(--font); color: #fff; position: relative; }
.peer.off { opacity: .35; }
.peer.lagging::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 9px; background: #ffb020; border: 2px solid var(--pan-2); }

/* ---------- Инструменты ---------- */
.tools {
  grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; z-index: 4;
  background: var(--pan); border-right: 1px solid var(--pan-line); overflow-y: auto; scrollbar-width: none;
}
.tools .sep { width: 26px; height: 1px; background: var(--pan-line); margin: 4px 0; flex: none; }
.tools .ib { width: 52px; height: 44px; flex: none; }
.tools .ib.tl { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tools .ib.tl svg { width: 19px; height: 19px; }
.tools .ib.tl span { font: 700 9.5px/1 var(--font); letter-spacing: -.01em; }
.tools .ib.on { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(224, 40, 60, .9); }

/* ---------- Холст ---------- */
.stage { grid-area: stage; position: relative; overflow: hidden; background: #0b0b0e; cursor: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.panning { cursor: grabbing; }
.hud-l, .hud-r {
  position: absolute; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 12px;
  background: var(--chip); color: #e6e6ea; font: 600 12px/1.2 var(--font); backdrop-filter: blur(10px); pointer-events: none;
  border: 1px solid rgba(255, 255, 255, .06); font-variant-numeric: tabular-nums;
}
.hud-l { left: 12px; min-height: 34px; }
.hud-l:empty { display: none; }
.hud-l img { width: 20px; height: 20px; border-radius: 6px; }
.hud-l b { font-weight: 800; }
.hud-l .t { color: #ffb36b; }
.hud-l .t.cold { color: #7cc8ff; }
.hud-l .m { color: #8d8d97; }
.hud-r { right: 12px; color: #8d8d97; gap: 12px; }
.hud-r b { color: #e6e6ea; font-weight: 700; }
.paused-badge {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 99px; pointer-events: none;
  background: rgba(47, 191, 113, .14); color: #59e39a; font: 800 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; border: 1px solid rgba(47, 191, 113, .35);
}
.sync { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgba(8, 8, 10, .55); backdrop-filter: blur(3px); font: 700 14px/1 var(--font); color: #fff; }
.sync i { width: 34px; height: 34px; border-radius: 99px; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.selbar {
  position: absolute; display: flex; gap: 2px; padding: 4px; border-radius: 13px; background: var(--pan); border: 1px solid var(--pan-line);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .6); backdrop-filter: blur(12px); z-index: 3; cursor: default;
}
.selbar .ib { width: 34px; height: 34px; }
.selbar .sep { width: 1px; background: var(--pan-line); margin: 4px 2px; }

/* ---------- Док с веществами ---------- */
.dock {
  grid-area: dock; display: flex; gap: 12px; align-items: stretch; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); z-index: 4;
  background: var(--pan); border-top: 1px solid var(--pan-line); backdrop-filter: blur(14px); min-width: 0;
}
.cats { display: grid; grid-template-rows: repeat(4, 24px); grid-auto-flow: column; gap: 2px 2px; align-content: center; flex: none; }
.cat {
  display: flex; align-items: center; gap: 6px; padding: 0 9px 0 6px; border: 0; border-radius: 9px; background: none; color: var(--ink-2);
  font: 700 12px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.cat svg { width: 16px; height: 16px; }
.cat:hover { background: var(--pan-3); color: var(--ink); }
.cat.on { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(224, 40, 60, .9); }
.els { flex: 1; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden; min-width: 0; padding: 4px 3px 6px; scrollbar-width: thin; }
.el {
  --c: 160,160,170;
  position: relative; width: 70px; height: 84px; padding: 6px 4px 0; border: 0; border-radius: 14px; cursor: pointer; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: radial-gradient(120% 90% at 50% 20%, rgba(var(--c), .2), rgba(var(--c), .03) 70%), var(--pan-2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); color: var(--ink);
  transition: transform .16s cubic-bezier(.3, 1.6, .5, 1), box-shadow .15s, background .2s;
  animation: elIn .35s backwards cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes elIn { from { opacity: 0; transform: translateY(8px) scale(.9); } }
.el .ico { width: 44px; height: 44px; display: block; flex: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.el .ico.er, .sw .ico.er { display: grid; place-items: center; color: var(--ink-2); }
.el .ico.er svg { width: 26px; height: 26px; }
.el .nm { font: 700 10.5px/1.15 var(--font); text-align: center; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; letter-spacing: -.01em; }
.el:hover { transform: translateY(-3px); background: radial-gradient(120% 90% at 50% 20%, rgba(var(--c), .34), rgba(var(--c), .05) 70%), var(--pan-3); z-index: 1; }
.el:hover .ico { transform: scale(1.12) rotate(-4deg); }
.el:hover .nm { color: var(--ink); }
.el.l { box-shadow: inset 0 0 0 2px var(--accent), 0 8px 22px -8px rgba(224, 40, 60, .8); }
.el.l .nm { color: var(--ink); }
.el.r { box-shadow: inset 0 0 0 2px var(--blue); }
.el.l.r { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 2px var(--blue); }
.el.l::after, .el.r::before { content: ''; position: absolute; top: 6px; width: 8px; height: 8px; border-radius: 9px; box-shadow: 0 0 8px currentColor; }
.el.l::after { right: 6px; background: var(--accent); color: var(--accent); }
.el.r::before { left: 6px; background: var(--blue); color: var(--blue); }
.search { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 12px; border-radius: 12px; background: var(--pan-2); border: 1px solid var(--pan-line); color: var(--ink-2); flex: none; }
.search input { width: 120px; border: 0; background: none; color: var(--ink); font: 600 13px var(--font); outline: none; }
.cur { display: flex; gap: 12px; align-items: center; padding-left: 12px; border-left: 1px solid var(--pan-line); }
.swatches { position: relative; width: 62px; height: 56px; flex: none; }
.curname { display: flex; flex-direction: column; gap: 2px; width: 170px; font: 600 11.5px/1.3 var(--font); color: var(--ink-2); }
.curname b { font: 900 15px/1.1 var(--font); color: var(--ink); text-transform: uppercase; letter-spacing: .01em; }
.curname small { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.curname .rb { color: var(--blue); font-weight: 700; -webkit-line-clamp: 1; }
.sw { position: absolute; width: 42px; height: 42px; border-radius: 11px; border: 0; padding: 0; overflow: hidden; cursor: pointer; background: var(--pan-3); }
.sw canvas, .sw .ico { width: 100%; height: 100%; display: block; padding: 3px; box-sizing: border-box; }
.sw .ico.er { display: grid; }
.sw-l { left: 0; top: 0; z-index: 1; box-shadow: 0 0 0 2px var(--accent), 0 6px 14px -4px rgba(0, 0, 0, .7); }
.sw-r { right: 0; bottom: 0; box-shadow: 0 0 0 2px var(--blue); }
.size { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 120px; }
.size-prev { height: 30px; display: grid; place-items: center; font: 800 12px/1 var(--font); color: var(--ink-2); }
.size-prev i { display: block; border-radius: 99px; background: var(--ink); opacity: .85; }
.size input { width: 100%; accent-color: var(--accent); }

/* ---------- Подсказка ---------- */
.tip {
  position: fixed; z-index: 50; max-width: 280px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: rgba(14, 14, 18, .96); color: #ececf1; font: 500 12.5px/1.4 var(--font); border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8); animation: tipIn .12s ease-out;
}
@keyframes tipIn { from { opacity: 0; transform: translateY(3px); } }
.tip b { display: block; font-weight: 800; font-size: 13.5px; margin-bottom: 2px; }
.tip kbd { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); font: 700 11px/1.2 var(--font); color: #fff; }
.tip .props { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tip .props span { padding: 3px 7px; border-radius: 7px; background: rgba(255, 255, 255, .07); font-size: 11px; font-weight: 700; color: #c9c9d1; }
.tip .muted { color: #9a9aa3; }

/* ---------- Тосты, чат ---------- */
.toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 12px; background: rgba(14, 14, 18, .95); color: #fff; font: 600 13px/1.3 var(--font);
  border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .8); animation: toastIn .3s cubic-bezier(.2, 1.4, .4, 1);
  display: flex; align-items: center; gap: 8px;
}
.toast i { width: 10px; height: 10px; border-radius: 9px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
.chat {
  position: fixed; right: 12px; top: 68px; bottom: 120px; width: 300px; z-index: 30; display: flex; flex-direction: column;
  background: var(--pan); border: 1px solid var(--pan-line); border-radius: 16px; backdrop-filter: blur(14px); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--pan-line); font: 800 14px var(--font); }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font: 500 13px/1.4 var(--font); -webkit-user-select: text; user-select: text; }
.chat-list b { font-weight: 800; margin-right: 6px; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--pan-line); }
.chat-form input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--pan-line); background: var(--pan-2); color: var(--ink); font: 500 14px var(--font); }

/* ---------- Окна ---------- */
.dlg {
  border: 0; padding: 0; border-radius: 22px; background: var(--pan-2); color: var(--ink); width: min(460px, calc(100vw - 24px));
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .85), 0 0 0 1px var(--pan-line); max-height: calc(100dvh - 40px);
}
.dlg.wide { width: min(880px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(5, 5, 8, .6); backdrop-filter: blur(6px); }
.dlg[open] { animation: dlgIn .28s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.dlg-in { padding: 22px; display: flex; flex-direction: column; gap: 14px; -webkit-user-select: text; user-select: text; }
.dlg h2 { margin: 0; font: 900 22px/1.15 var(--font); text-transform: uppercase; letter-spacing: .01em; }
.dlg .eyebrow { color: var(--accent); font: 800 11px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; }
.dlg .muted { color: var(--ink-2); margin: 0; font-size: 14px; line-height: 1.45; }
.dlg label { display: flex; flex-direction: column; gap: 6px; font: 700 13px var(--font); color: var(--ink-2); }
.dlg input[type=text], .dlg input[type=password], .dlg input:not([type]), .dlg textarea {
  height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--pan-line); background: var(--pan-3); color: var(--ink); font: 600 15px var(--font); outline: none;
}
.dlg textarea { height: 80px; padding: 10px 14px; resize: vertical; }
.dlg input:focus, .dlg textarea:focus { border-color: var(--accent); }
.dlg .check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; cursor: pointer; }
.dlg .check input { width: 18px; height: 18px; accent-color: var(--accent); }
.dlg .row { display: flex; gap: 8px; align-items: center; }
.dlg .row.end { justify-content: flex-end; }
.dlg .x { position: absolute; top: 12px; right: 12px; }
.dlg .err { color: #ff5468; font-weight: 700; font-size: 13px; margin: 0; min-height: 1em; }
.tabs2 { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: var(--pan-3); }
.tabs2 button { flex: 1; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font: 800 13px var(--font); cursor: pointer; }
.tabs2 button.on { background: var(--pan-2); color: var(--ink); box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .4); }
.linkbox { display: flex; gap: 6px; align-items: center; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--pan-3); font: 600 14px var(--font); }
.linkbox span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-big { font: 900 44px/1 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .14em; text-align: center; color: #fff; padding: 8px 0 4px; text-shadow: 0 0 30px rgba(224, 40, 60, .55); }
:root[data-theme="light"] .code-big { color: var(--ink); }
.plist { display: flex; flex-direction: column; gap: 6px; }
.plist .pi { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--pan-3); font: 700 14px var(--font); }
.plist .pi i { width: 12px; height: 12px; border-radius: 9px; flex: none; }
.plist .pi span { flex: 1; }
.plist .pi small { color: var(--ink-2); font-weight: 600; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--pan-line); background: var(--pan-3);
  color: var(--ink); font: 700 13px/1.25 var(--font); cursor: pointer; text-align: left; transition: transform .15s, border-color .15s;
}
.opt:hover { transform: translateY(-2px); border-color: rgba(224, 40, 60, .5); }
.opt.on { border-color: var(--accent); background: rgba(224, 40, 60, .12); }
.opt small { display: block; color: var(--ink-2); font-weight: 600; font-size: 12px; margin-top: 2px; }
.rooms { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.rooms button { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--pan-3); color: var(--ink); font: 700 14px var(--font); cursor: pointer; }
.rooms button:hover { background: rgba(224, 40, 60, .15); }
.btn { height: 42px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--pan-3); color: var(--ink); font: 800 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { filter: brightness(1.1); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.block { width: 100%; height: 48px; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.btn svg { width: 18px; height: 18px; }

/* Сцены и витрина */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.scard {
  position: relative; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; border: 1px solid var(--pan-line); background: var(--pan-3);
  cursor: pointer; text-align: left; padding: 0; color: var(--ink); transition: transform .2s cubic-bezier(.2, 1.3, .4, 1), box-shadow .2s;
}
.scard:hover { transform: translateY(-4px); box-shadow: 0 18px 36px -16px rgba(0, 0, 0, .8), 0 0 0 1px rgba(224, 40, 60, .5); }
.scard .pv { aspect-ratio: 16 / 9; background: #0b0b0e; display: block; width: 100%; object-fit: cover; image-rendering: pixelated; }
.scard .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.scard .meta b { font: 800 14px/1.2 var(--font); }
.scard .meta small { color: var(--ink-2); font: 600 12px/1.3 var(--font); display: flex; gap: 8px; align-items: center; }
.scard .likes { display: inline-flex; align-items: center; gap: 3px; }
.scard .likes svg { width: 13px; height: 13px; }
.sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.sizes button { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--pan-line); background: var(--pan-3); color: var(--ink); font: 700 13px var(--font); cursor: pointer; }
.sizes button.on { border-color: var(--accent); color: #ff5468; }
.sizes small { color: var(--ink-2); font-weight: 600; margin-left: 4px; }
.show-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.show-head .tabs2 { flex: none; }
.show-head input { flex: 1; min-width: 160px; }
.empty { color: var(--ink-2); text-align: center; padding: 40px 0; font-weight: 600; }

/* ---------- Телефон ---------- */
/* Раскладка включается классом .mob (app.js: узкий экран или телефон в альбомной ориентации) */
.m-only, .mdock { display: none; }
.m-slot { display: contents; }
.msheet { position: fixed; inset: 0; z-index: 60; }
.mob #app { grid-template: "tb" auto "stage" 1fr "dock" auto / 1fr; }
.mob .dock { display: none; }
.mob .m-only { display: grid; }
.mob .mdock { display: flex; }
.mob .tb { gap: 6px; padding: calc(6px + env(safe-area-inset-top)) 10px 6px; }
.mob .brand { margin-right: 0; order: 0; }
.mob .brand b { display: none; }
.mob .tb > #simGrp { order: 1; }
.mob .tb > .m-slot { order: 2; }
.mob .tb > #mViewBtn { order: 3; }
.mob .tb > .sp { order: 4; display: block; }
.mob .tb > .room { order: 5; }
.mob .tb > #mMenuBtn { order: 6; }
.mob .tb .ib { width: 42px; height: 42px; }
.mob #mViewBtn.on { background: linear-gradient(135deg, #3b0a5c, #d4321c 55%, #ffd447); color: #fff; }
.mob .cta { height: 42px; padding: 0 12px; }
.mob .cta-t { display: none; }
.mob .peers { display: none; }
.mob .hud-l { top: 8px; left: 8px; bottom: auto; padding: 5px 9px; font-size: 11px; }
.mob .hud-r { display: none; }
.mob .paused-badge { top: auto; bottom: 10px; }
.mob .chat { left: 8px; right: 8px; width: auto; top: 60px; bottom: 50%; }

/* Нижняя панель: вещество · инструмент · размер, под ними — лента недавних */
.mdock {
  grid-area: dock; flex-direction: column; gap: 8px; min-width: 0; z-index: 4;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--pan); border-top: 1px solid var(--pan-line); backdrop-filter: blur(14px);
}
.md-row { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.md-row > button, .md-size { border: 1px solid var(--pan-line); background: var(--pan-2); color: var(--ink); border-radius: 16px; cursor: pointer; }
.md-row > button:active { transform: scale(.97); background: var(--pan-3); }
.md-el { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; text-align: left; }
.md-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .04); }
.md-ico canvas { width: 38px; height: 38px; display: block; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .35)); }
.md-ico .ico.er { color: var(--ink-2); display: grid; place-items: center; }
.md-ico .ico.er svg { width: 24px; height: 24px; }
.md-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.md-txt b { font: 800 15px/1.1 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-txt small { font: 600 11.5px/1.25 var(--font); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-chev { color: var(--ink-2); display: grid; }
.md-chev svg { width: 18px; height: 18px; }
.md-tool { flex: none; width: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: 700 10.5px/1 var(--font); }
.md-tool svg { width: 22px; height: 22px; }
.md-size { flex: none; display: flex; align-items: center; padding: 3px; }
.md-size button { width: 36px; align-self: stretch; min-height: 44px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: 600 24px/1 var(--font); cursor: pointer; }
.md-size button:active { background: var(--pan-3); }
.md-dot { width: 30px; display: grid; place-items: center; }
.md-dot i { display: block; background: var(--ink); box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.md-strip { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; margin: 0 -10px; padding: 2px 10px; touch-action: pan-x; }
.md-strip::-webkit-scrollbar { display: none; }
.md-strip .el { width: 56px; height: 62px; padding-top: 5px; gap: 3px; border-radius: 13px; animation: none; }
.md-strip .el .ico { width: 34px; height: 34px; }
.md-strip .el .ico.er svg { width: 22px; height: 22px; }
.md-strip .el .nm { font-size: 9.5px; -webkit-line-clamp: 1; }
.md-strip .el:hover { transform: none; }
.md-strip .el::after { display: none; }

/* Выезжающий лист */
.ms-back { position: absolute; inset: 0; background: rgba(5, 5, 8, .55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .22s; }
.ms-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(80vh, 680px); display: flex; flex-direction: column;
  background: var(--pan-2); border-radius: 22px 22px 0 0; border-top: 1px solid var(--pan-line); color: var(--ink);
  box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, .85); transform: translateY(105%); transition: transform .26s cubic-bezier(.2, .9, .3, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.msheet.open .ms-back { opacity: 1; }
.msheet.open .ms-panel { transform: none; }
.ms-grab { width: 42px; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .18); margin: 9px auto 0; flex: none; }
.ms-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 8px 18px; flex: none; touch-action: none; }
.ms-head b { font: 900 17px/1 var(--font); text-transform: uppercase; letter-spacing: .02em; }
.ms-head .ib { width: 40px; height: 40px; background: var(--pan-3); border-radius: 12px; }
.ms-body { overflow-y: auto; padding: 0 14px 18px; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.ms-page.hidden { display: none; }

/* Палитра в листе */
.ms-info { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 16px; background: var(--pan-3); margin-bottom: 10px; }
.mi-ico { flex: none; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: rgba(0, 0, 0, .2); }
.mi-ico canvas { width: 50px; height: 50px; }
.mi-ico .ico.er { color: var(--ink-2); display: grid; } .mi-ico .ico.er svg { width: 28px; height: 28px; }
.mi-txt { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mi-txt b { font: 800 16px/1.15 var(--font); }
.mi-txt .muted { color: var(--ink-2); font: 500 13px/1.4 var(--font); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mi-txt .props { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.mi-txt .props span { padding: 4px 8px; border-radius: 99px; background: rgba(255, 255, 255, .06); font: 700 11px/1 var(--font); color: var(--ink-2); }
#msEls .cats {
  display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x;
  position: sticky; top: 0; z-index: 2; margin: 0 -14px 10px; padding: 2px 14px 10px; background: linear-gradient(var(--pan-2) 82%, transparent);
}
#msEls .cats::-webkit-scrollbar { display: none; }
#msEls .cat { flex: none; }
#msEls .cat { height: 36px; padding: 0 13px 0 10px; border-radius: 99px; background: var(--pan-3); font-size: 13px; }
#msEls .cat.on { background: var(--accent); }
#msEls .els { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; overflow: visible; padding: 0; max-height: none; }
#msEls .el { width: auto; height: 88px; }
#msEls .el .ico { width: 46px; height: 46px; }
#msEls .el .nm { font-size: 11px; }
#msEls .el:hover { transform: none; }
#msEls .search { grid-column: 1 / -1; height: 46px; }
#msEls .search input { flex: 1; font-size: 16px; }

/* Инструменты в листе */
#msTools .tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 2px 0 6px; background: none; border: 0; overflow: visible; }
#msTools .tools .sep { display: none; }
#msTools .tools .ib { width: auto; height: 72px; border-radius: 16px; background: var(--pan-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--ink); }
#msTools .tools .ib svg { width: 24px; height: 24px; }
#msTools .tools .ib span { font: 700 12px/1 var(--font); }
#msTools .tools .ib.on, #msTools .tools .ib[aria-pressed="true"] { background: var(--accent); color: #fff; }
#msTools #shapeBtn::after, #msTools #fitBtn::after { content: attr(data-label); font: 700 12px/1 var(--font); }

/* Меню в листе */
.ms-sec { margin-bottom: 16px; }
.ms-cap { font: 800 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin: 4px 2px 9px; }
.ms-row { display: flex; gap: 8px; align-items: stretch; }
#msTime .seg { flex: 1; }
#msTime .seg button { flex: 1; height: 46px; font-size: 15px; }
#msTime #stepBtn { width: 58px; height: auto; border-radius: 14px; background: var(--pan-3); display: flex; flex-direction: column; gap: 4px; }
#msTime #stepBtn::after, #msViews button::after, .ms-grid .ib::after { content: attr(data-label); font: 700 11px/1.1 var(--font); text-align: center; }
#msViews .seg { width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); }
#msViews .seg button { height: 58px; display: flex; flex-direction: column; gap: 6px; padding: 0 2px; }
#msViews .seg button::after { font-size: 10px; }
.ms-grid #editGrp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ms-grid #editGrp .ib { width: auto; height: 74px; display: flex; flex-direction: column; gap: 7px; border-radius: 16px; background: var(--pan-3); color: var(--ink); }
.ms-grid #editGrp .ib svg { width: 24px; height: 24px; }
.ms-grid #editGrp .ib.rec { color: #ff5468; }

/* Узкий телефон: на кнопке вещества только иконка (название видно в ленте) */
@media (max-width: 370px) {
  .mob .md-el { flex: none; gap: 6px; padding-right: 8px; }
  .mob .md-txt { display: none; }
  .mob .md-row { justify-content: space-between; }
  .mob .md-tool { flex: 1; }
}
/* Телефон в альбомной ориентации: всё в одну строку, лист — справа */
@media (orientation: landscape) {
  .mob .tb { padding-top: 4px; padding-bottom: 4px; }
  .mob .tb .ib, .mob .cta { width: 38px; height: 38px; }
  .mob .cta { width: auto; }
  .mob .mdock { flex-direction: row; align-items: center; padding: 6px calc(10px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)); }
  .mob .md-row { flex: none; }
  .mob .md-el { flex: none; padding: 3px 8px 3px 3px; gap: 6px; }
  .mob .md-txt { display: none; }
  .mob .md-strip { flex: 1; margin: 0; padding: 2px 0; }
  .mob .md-size button { min-height: 40px; }
  .mob .ms-panel { left: auto; top: 0; width: min(440px, 62vw); max-height: none; border-radius: 22px 0 0 22px; border-top: 0; border-left: 1px solid var(--pan-line); transform: translateX(105%); padding-right: env(safe-area-inset-right); }
  .mob .ms-grab { display: none; }
}

/* Окна (сцены, витрина, «с друзьями») на телефоне — на весь экран снизу */
.mob .dlg { width: 100vw; max-width: 100vw; max-height: calc(100dvh - 16px); margin: auto 0 0; border-radius: 22px 22px 0 0; }
.mob .dlg.wide { width: 100vw; }
.mob .dlg-in { padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); }
.mob .dlg h2 { font-size: 20px; padding-right: 48px; }
.mob .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: none; }
.mob .scard .meta { padding: 8px 10px 10px; }
.mob .scard .meta b { font-size: 12.5px; }
.mob .sizes { display: grid; grid-template-columns: repeat(2, 1fr); }
.mob .sizes button { padding: 10px; }
@media (prefers-reduced-motion: reduce) { .el, .dlg[open], .toast { animation: none; } }

/* Перемотка времени и запись */
.timeline {
  position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); width: min(760px, calc(100% - 24px)); z-index: 6;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--pan); border: 1px solid var(--pan-line);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8); backdrop-filter: blur(14px); cursor: default; animation: dlgIn .25s cubic-bezier(.2, 1.3, .4, 1);
}
.tl-track { position: relative; flex: 1; height: 34px; display: flex; align-items: center; }
.tl-track input { width: 100%; accent-color: var(--accent); position: relative; z-index: 1; }
.tl-ticks { position: absolute; left: 8px; right: 8px; top: 50%; height: 10px; transform: translateY(-50%); background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, transparent 1px 10%); pointer-events: none; }
.tl-label { min-width: 70px; text-align: center; font: 800 13px/1 var(--font); color: var(--ink); font-variant-numeric: tabular-nums; }
.ib.rec { color: #ff5468; }
.ib.rec.on { background: rgba(224, 40, 60, .2); animation: recPulse 1s ease-in-out infinite; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 6px rgba(224, 40, 60, .15); } }
.recbadge { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; background: rgba(224, 40, 60, .9); color: #fff; font: 800 12px/1 var(--font); pointer-events: none; }
.recbadge i { width: 9px; height: 9px; border-radius: 9px; background: #fff; animation: recPulse 1s infinite; }
.stage.previewing::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 3px rgba(63, 167, 255, .7); }
.mob .timeline { bottom: 10px; flex-wrap: wrap; } .mob .tl-track { flex-basis: 100%; order: -1; }
.hud-l .m.lowo { color: #ff7a5c; }
/* На телефоне нет правой кнопки мыши — второй цвет не показываем */
.mob .el.r:not(.l) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.mob .el.r::before { display: none; }

/* Призрак: на широком экране панель модератора (360px справа) не перекрывает полотно — приложение сжимается */
@media (min-width: 1180px) {
  body.ghost-panel-open #app { right: 360px; }
  body.ghost-panel-open .chat { right: 372px; }
  body.ghost-panel-open .toasts { left: calc((100% - 360px) / 2); }
  #app, .chat { transition: right .35s ease; }
}
/* Призрак только смотрит: кисти, палитра, время и правка ему не нужны — больше места полотну */
body.ghost-mode :is(#tools, #dock, #simGrp, #undoBtn, #clearBtn, #scenesBtn, #openBtn, #timeBtn, #mUndoSlot) { display: none !important; }
