/* =====================================================================
   «Рунная кузня» — облик приложения. Подключается после style.css:
   раскладка остаётся там, здесь — материалы, цвета, шрифты, состояния.
   Текстуры — forge/tex/*.webp, иконки — forge/icons.svg (спрайт).
   Рамки растягиваются через border-image (9-slice): первое число — угол
   в пикселях текстуры, после «/» — толщина рамки на экране.
   ===================================================================== */
:root {
  --bg: #0b0c0e;
  --surface: #14171b;
  --surface-2: #1b1f24;
  --border: #3a4047;
  --text: #e7e3da;
  --muted: #a9a49a;
  --faint: #6f6c66;
  --accent: #4fb3ff;          /* холодный свет рун: активное, выбранное */
  --accent-ink: #06121c;
  --rune: #4fb3ff;
  --rune-soft: #4fb3ff55;
  --amber: #ffb347;           /* жду команду, несохранённое */
  --ok: #58d38c;
  --warn: #ffb347;
  --danger: #e0473a;
  --speech: #8fd0ff;
  --radius: 0px;
  --font: "PT Serif", Georgia, serif;
  --serif: "Forum", "Times New Roman", serif;
  --steel: linear-gradient(180deg, #f1ede6 0%, #b9b4ab 45%, #7b776f 55%, #d9d4ca 100%);
  --T: /static/forge/tex;
}

html, body { background: #0b0c0e url(/static/forge/tex/basalt.webp) 0 0 / 627px 627px repeat; }
body { font: 15px/1.45 var(--font); color: var(--text); }
button, input, select, textarea { font-family: inherit; }
main { position: relative; z-index: 1; max-width: none; padding: 10px 14px 70px; }
body.workspace main { max-width: none; }
.muted { color: var(--muted); }
::selection { background: #4fb3ff55; }

svg.i { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -.2em; flex: none; color: inherit; }

/* заголовки — высеченная сталь */
h2 { font: 400 22px/1.1 var(--serif); letter-spacing: .06em; color: var(--text); margin: 0 0 12px; }
h3, .card-head h3 {
  font: 400 17px/1.2 var(--serif); letter-spacing: .14em; text-transform: uppercase; font-weight: 400;
  background: var(--steel); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card > h2:first-child {
  font: 400 18px/1.2 var(--serif); letter-spacing: .14em; text-transform: uppercase;
  background-image: url(/static/forge/tex/divider.webp), var(--steel);
  background-size: 100% 12px, auto; background-position: center bottom, 0 0; background-repeat: no-repeat;
  -webkit-background-clip: padding-box, text; background-clip: padding-box, text; color: transparent;
  padding-bottom: 14px; margin-bottom: 12px;
}
.card > h3:first-child, .card > .card-head:first-child, .card > .head:first-child {
  padding-bottom: 14px; margin-bottom: 10px;
  background-image: url(/static/forge/tex/divider.webp), var(--steel);
  background-size: 100% 12px, auto; background-position: center bottom, 0 0; background-repeat: no-repeat;
}
.card > .card-head:first-child, .card > .head:first-child { background: url(/static/forge/tex/divider.webp) center bottom / 100% 12px no-repeat; }

/* ---------- кованая плита: все карточки ---------- */
.card, .plate {
  position: relative;
  border: 26px solid transparent;
  border-image: url(/static/forge/tex/panel.webp) 52 fill / 26px round;
  background: none; border-radius: 0;
  box-shadow: 0 10px 26px #000000d9;
  padding: 2px 4px 6px;
}
.camp .card { padding: 2px 4px 6px; }
.card.empty { color: var(--muted); text-align: center; padding: 24px 12px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 8px; color: var(--text); font: 15px var(--font);
  border: 12px solid transparent; border-image: url(/static/forge/tex/btn.webp) 27 fill / 12px stretch;
  background: none; border-radius: 0; box-shadow: 0 3px 8px #000000b3; cursor: pointer;
  transition: filter .12s, box-shadow .12s;
}
.btn:hover { border-image-source: url(/static/forge/tex/btn-active.webp); box-shadow: 0 0 14px #4fb3ff44, 0 3px 8px #000; }
.btn:active { filter: brightness(.85); }
.btn.primary { color: #dff2ff; font-weight: 400; background: none; border-image-source: url(/static/forge/tex/btn-active.webp); box-shadow: 0 0 14px #4fb3ff44, 0 3px 8px #000; }
.btn.danger { color: #ffd9d4; background: none; border-image-source: url(/static/forge/tex/btn-danger.webp); box-shadow: 0 0 12px #e0473a33, 0 3px 8px #000; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 4px; border-width: 10px; border-image-width: 10px; }
.btn.icon { min-width: 36px; padding: 0; }
.btn.ghost { border-image: none; border: 1px solid transparent; box-shadow: none; color: var(--muted); padding: 0 10px; }
.btn.ghost:hover { color: #cfeaff; border-color: #2a6fa8; box-shadow: 0 0 10px #4fb3ff33; }
.btn:disabled { opacity: .45; cursor: default; filter: grayscale(.6); }
.btn .sq { width: 13px; height: 13px; background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* ---------- поля ---------- */
input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea {
  color: var(--text); font: 15px var(--font); min-height: 44px; padding: 2px 6px;
  border: 9px solid transparent; border-image: url(/static/forge/tex/field.webp) 16 fill / 9px stretch;
  background: none; border-radius: 0;
}
input:focus, select:focus, textarea:focus { outline: none; filter: drop-shadow(0 0 6px #4fb3ff66); border-color: transparent; }
input::placeholder { color: var(--faint); }
/* автозаполнение браузера красит текст своим тёмным цветом — возвращаем наш */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text); caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #0e1013 inset; transition: background-color 99999s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 26px; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a9a49a' stroke-width='2' fill='none'/%3E%3C/svg%3E") right 6px center no-repeat;
}
select option { background: #14171b; color: var(--text); }
select optgroup { background: #0b0d10; color: #8fd0ff; font-style: normal; font-weight: 600; }
/* длинный пункт списка или число у ползунка не должны вылезать за рамку плиты */
input, select, textarea { max-width: 100%; }
input[type=range] { min-width: 0; }
.actions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); }

/* ползунок: желоб + светящаяся заливка до бегунка (--p ставит app.js) */
input[type=range] { -webkit-appearance: none; appearance: none; height: 30px; background: none; cursor: pointer; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track {
  height: 12px; border: 1px solid #454b53; box-shadow: inset 0 2px 4px #000;
  background: linear-gradient(90deg, #1d6fb8, var(--rune)) 0 0 / var(--p) 100% no-repeat, #07080a;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 30px; margin-top: -10px; border: none;
  background: url(/static/forge/tex/slider-thumb.webp) center / contain no-repeat; filter: drop-shadow(0 2px 3px #000);
}
input[type=range]::-moz-range-track { height: 12px; border: 1px solid #454b53; background: #07080a; }
input[type=range]::-moz-range-progress { height: 12px; background: linear-gradient(90deg, #1d6fb8, var(--rune)); }
input[type=range]::-moz-range-thumb { width: 18px; height: 30px; border: none; background: url(/static/forge/tex/slider-thumb.webp) center / contain no-repeat; }
.range-val output { color: var(--muted); min-width: 46px; font-size: 14px; }

/* галочка — кованая ячейка с руной */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin: 0; flex: none; cursor: pointer;
  background: url(/static/forge/tex/check-off.webp) center / contain no-repeat;
}
input[type=checkbox]:checked { background-image: url(/static/forge/tex/check-on.webp); filter: drop-shadow(0 0 5px #4fb3ff88); }

/* полосы прокрутки */
* { scrollbar-color: #5d636b #07080a; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #07080a; }
::-webkit-scrollbar-thumb { background: url(/static/forge/tex/scroll-thumb.webp) center / 100% 100% no-repeat; }
::-webkit-scrollbar-button { display: none; }
.camp .col::-webkit-scrollbar-thumb { background: url(/static/forge/tex/scroll-thumb.webp) center / 100% 100% no-repeat; border: none; }

/* ---------- шапка ---------- */
.top {
  position: relative; z-index: 3; display: grid; grid-template-columns: 470px minmax(0, 1fr) 640px; gap: 10px;
  height: auto; padding: 10px 14px 0; background: none; backdrop-filter: none; border: none;
}
.top > .plate { padding: 0 4px; min-height: 126px; }
.brand {
  display: flex; align-items: center; gap: 14px;
  border: 30px solid transparent; border-image: url(/static/forge/tex/logo-plate.webp) 60 fill / 30px stretch;
}
.brand .rune-side { width: 26px; align-self: stretch; margin: -12px 0; background: url(/static/forge/tex/rune-strip-a.webp) center / contain no-repeat; filter: drop-shadow(0 0 6px #4fb3ff88); }
.brand h1 {
  margin: 0; font: 400 58px/.9 var(--serif); letter-spacing: .06em;
  background: linear-gradient(180deg, #d9c4a8 0%, #8f7155 40%, #5b4632 52%, #b89a78 75%, #e6d3b8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #000);
}
.brand .sub { margin-top: 8px; font: 400 13px var(--serif); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.brand .sub i { display: block; font-style: normal; color: var(--faint); letter-spacing: .3em; font-size: 11px; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; align-content: center; padding: 0 4px !important; }
.controls .field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.controls select { width: 100%; }
.ctl-sel { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctl-sel select { flex: 1; min-width: 0; }
.ctl-sel .field-label { margin: 0; white-space: nowrap; }
.ctl-vol { display: block; }
.ctl-vol .range-val { display: flex; align-items: center; gap: 10px; }
.ctl-vol input { flex: 1; }
.ctl-btns { display: grid; grid-template-columns: 1.1fr 1fr; gap: 10px; }
.who { position: relative; }
.who .btn { width: 100%; }
.btn.master { position: relative; }
/* кнопка мастера: имя и под ним — у кого пульт; шлем горит цветом состояния */
.btn.master { justify-content: flex-start; gap: 10px; padding: 0 6px; }
.btn.master > svg.i { width: 24px; height: 24px; color: #9a958c; transition: color .2s, filter .2s; }
.who-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; text-align: left; }
.who-txt #whoName { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pult-state { font: 400 11px/1.2 var(--serif); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.btn.master.pult-mine > svg.i { color: var(--ok); filter: drop-shadow(0 0 6px #58d38c99); }
.btn.master.pult-mine .pult-state { color: #9fe3bb; }
.btn.master.pult-busy > svg.i { color: var(--amber); filter: drop-shadow(0 0 6px #ffb34777); }
.btn.master.pult-busy .pult-state { color: #ffd08a; }
.pult-box { display: flex; flex-direction: column; gap: 6px; padding: 8px 4px 10px; margin-bottom: 4px;
  background: url(/static/forge/tex/divider.webp) center bottom / 100% 12px no-repeat; }
.pult-line { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.pult-line svg.i { color: #9a958c; }
.pult-line .ok { color: #9fe3bb; }
.pult-line .busy { color: #ffd08a; }
.pult-box .hint { font-size: 13px; }
.who-menu {
  position: absolute; right: -20px; top: calc(100% + 6px); z-index: 20; width: 280px; display: flex; flex-direction: column; gap: 6px;
}
.who-menu .btn { justify-content: flex-start; width: 100%; }
.who-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 6px; }
.who-head b { font: 400 20px var(--serif); letter-spacing: .04em; }
.who-head span { color: var(--muted); font-size: 13px; }

/* ---------- панель «Слушаю» ---------- */
.listen {
  display: flex; align-items: center; justify-content: center; gap: 22px; cursor: pointer;
  color: inherit; font: inherit; text-align: left; width: 100%;
}
.listen .wave { display: flex; align-items: center; gap: 4px; height: 56px; }
.listen .wave i {
  width: 3px; height: 50%; border-radius: 2px; background: var(--rune); box-shadow: 0 0 6px var(--rune);
  animation: wave 1.1s ease-in-out infinite;
}
.listen .wave i:nth-child(2n) { height: 80%; animation-duration: .8s; }
.listen .wave i:nth-child(3n) { height: 35%; animation-duration: 1.4s; }
.listen .wave i:nth-child(5n) { height: 95%; }
@keyframes wave { 0%, 100% { transform: scaleY(.35); opacity: .6; } 50% { transform: scaleY(1); opacity: 1; } }
.listen .mic {
  position: relative; width: 100px; height: 100px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: url(/static/forge/tex/ring-active.webp) center / contain no-repeat; box-shadow: 0 0 26px #4fb3ff55;
  --lvl: 0;
}
.listen .mic svg.i { width: 44px; height: 44px; fill: #cfeaff; color: #cfeaff; filter: drop-shadow(0 0 8px var(--rune)); }
/* кольцо дышит по уровню голоса */
.listen .mic::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--rune);
  opacity: calc(.12 + var(--lvl) * .88);
  transform: scale(calc(1 + var(--lvl) * .14));
  box-shadow: 0 0 calc(6px + var(--lvl) * 28px) var(--rune), inset 0 0 calc(var(--lvl) * 18px) var(--rune-soft);
  transition: transform .08s linear, opacity .08s linear;
}
.listen .label b { display: block; font: 400 40px/1 var(--serif); letter-spacing: .1em; color: #8fd0ff; text-shadow: 0 0 12px var(--rune); font-weight: 400; }
.listen .label span { display: block; margin-top: 6px; font-size: 19px; color: #7fb9e6; }

.listen.is-idle .wave i { transform: scaleY(.25); animation: none; opacity: .6; }
.listen.is-armed .mic::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  background: conic-gradient(var(--amber) var(--left, 70%), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 56px, #000 57px, #000 60px, transparent 61px);
          mask: radial-gradient(circle, transparent 56px, #000 57px, #000 60px, transparent 61px);
  filter: drop-shadow(0 0 6px var(--amber));
}
.listen.is-armed .label b { color: #ffd08a; text-shadow: 0 0 12px #ff9f2e; }
.listen.is-armed .label span { color: #f1c07a; }
.listen.is-armed .wave i { background: var(--amber); box-shadow: 0 0 6px #ff9f2e; }
.listen.is-armed .mic::before { border-color: var(--amber); box-shadow: 0 0 calc(6px + var(--lvl) * 24px) #ff9f2e; }
.listen.is-foreign .wave i { background: var(--danger); box-shadow: 0 0 6px var(--danger); animation-duration: .6s; }
.listen.is-foreign .mic { filter: hue-rotate(160deg) saturate(1.4); box-shadow: 0 0 30px #e0473a88; }
.listen.is-foreign .label b { color: #ff9a8f; text-shadow: 0 0 12px var(--danger); }
.listen.is-foreign .label span { color: #ff9a8f; }
.listen.is-loading .wave i { background: #4a5058; box-shadow: none; transform: none; height: 30%; animation: loadpulse 1.6s ease-in-out infinite; }
.listen.is-loading .wave i:nth-child(2n) { animation-delay: .2s; }
.listen.is-loading .wave i:nth-child(3n) { animation-delay: .4s; }
@keyframes loadpulse { 50% { background: #8fd0ff; height: 70%; } }
.listen.is-loading .label b { color: #a9c7dd; text-shadow: none; }
.listen.is-loading .mic::before, .listen.is-off .mic::before { display: none; }
.listen.is-off .wave i { background: #3a4047; box-shadow: none; animation: none; transform: scaleY(.3); }
.listen.is-off .mic { filter: grayscale(1) brightness(.6); box-shadow: none; }
.listen.is-off .label b { color: #8a867e; text-shadow: none; }
.listen.is-off .label span { color: var(--faint); }
.listen.is-error .label b { color: #ff9a8f; }
.listen:hover .label span { text-decoration: underline; text-decoration-color: #ffffff33; }

/* ---------- вкладки ---------- */
.tabs {
  position: relative; z-index: 2; display: grid; grid-template-columns: repeat(6, 1fr) 1fr; gap: 8px; align-items: center;
  margin: 10px 14px 0; padding: 0 2px; overflow: visible; border-bottom: none;
  border: 18px solid transparent; border-image: url(/static/forge/tex/panel.webp) 52 fill / 18px round;
}
.tabs button {
  display: flex; align-items: center; justify-content: center; gap: 12px; height: 50px; padding: 0;
  font: 400 21px var(--serif); letter-spacing: .12em; text-transform: uppercase; color: #c3bdb2; font-weight: 400;
  border: 12px solid transparent; border-left-width: 30px; border-right-width: 30px;
  border-image: url(/static/forge/tex/tab.webp) 20 42 fill / 12px 30px stretch;
  background: none; cursor: pointer;
}
.tabs button svg.i { width: 26px; height: 26px; fill: currentColor; }
.tabs button.active { color: #cfeaff; text-shadow: 0 0 10px var(--rune); border-image-source: url(/static/forge/tex/tab-active.webp); border-bottom-color: transparent; filter: drop-shadow(0 0 10px #4fb3ff55); }
.tabs button.active svg.i { filter: drop-shadow(0 0 6px var(--rune)); }
.motto { display: flex; align-items: center; justify-content: center; gap: 16px; font: 400 12px/1.3 var(--serif); letter-spacing: .2em; text-transform: uppercase; color: var(--faint); text-align: center; }
.rune-dot { display: inline-block; width: 26px; height: 26px; flex: none; background: url(/static/forge/tex/rune-dot-b.webp) center / contain no-repeat; filter: drop-shadow(0 0 5px #4fb3ff88); }
.rune-dot.amber { filter: hue-rotate(-160deg) saturate(2) drop-shadow(0 0 5px #ffb34788); }

@media (max-width: 1600px) {
  .top { grid-template-columns: 380px minmax(0, 1fr) 580px; }
  .brand h1 { font-size: 48px; }
  .listen .label b { font-size: 32px; }
  .tabs button { font-size: 18px; letter-spacing: .08em; }
  /* шесть вкладок: девизу рядом уже тесно */
  .tabs { grid-template-columns: repeat(6, 1fr); }
  .motto { display: none; }
}
@media (max-width: 1280px) {
  .top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .top .brand { display: none; }
  .tabs { grid-template-columns: repeat(6, 1fr); }
  .motto { display: none; }
}

/* ---------- списки, дерево, выбор ---------- */
.scene-item, .pick-item, .user-row, .fx-linked, .folder {
  border: 10px solid transparent; border-image: url(/static/forge/tex/row.webp) 18 fill / 10px stretch;
  background: none; border-radius: 0; padding: 2px 6px; box-shadow: none;
}
.scene-item:hover, .pick-item:hover, .folder:hover, .user-row:hover { background: none; filter: brightness(1.15); }
.scene-item.active, .folder.active, .pick-item:focus-visible {
  border-image: url(/static/forge/tex/chip-active.webp) 24 36 fill / 10px 16px stretch; border-width: 10px 16px;
  background: none; filter: drop-shadow(0 0 8px #4fb3ff55);
}
.folder.active { color: #cfeaff; }
.scene-item .n, .pick-item .t { font-weight: 400; font-size: 16px; }
.scene-item .s, .pick-item .s { color: var(--faint); font-size: 13px; }
.scene-item.global { border-top: none; }
.scene-list { gap: 6px; }
/* табличка: заглавные Forum сидят в строке несимметрично — обрезаем строку ровно по высоте
   заглавных (text-box) и даём одинаковые поля сверху и снизу; справа поле меньше на разрядку букв */
.tag {
  display: inline-block; vertical-align: middle;
  font: 400 11px/1 var(--serif); letter-spacing: .12em; text-transform: uppercase; font-weight: 400;
  text-box: trim-both cap alphabetic;
  padding: 5px calc(7px - .12em) 5px 7px; border-radius: 0; background: #0b1824; color: #8fd0ff; border: 1px solid #2a6fa8; box-shadow: 0 0 8px #4fb3ff44;
}
.badge-passive { color: #8fd0ff; }
.badge-here { color: var(--ok); }
.scene-item.preset .n::after { color: var(--faint); letter-spacing: .1em; text-transform: uppercase; font-size: 10px; }
.drop-root { border-radius: 0; border-color: #4a5058; color: var(--faint); }
.drop-root.over, .drop.over { border-color: var(--rune); color: #cfeaff; background: #10233466; }
.scene-item.drop-before { box-shadow: 0 -3px 0 var(--rune); }
.scene-item.drop-after { box-shadow: 0 3px 0 var(--rune); }
.scene-item.drop-inside { outline: 2px dashed var(--rune); }

/* дерево локаций: значок, имя с триггерами, метки справа; вложенные — со сдвигом и линией к родителю */
.loc-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 4px 6px; }
.loc-item .ico { display: grid; place-items: center; width: 34px; height: 34px; }
.loc-item .ico svg.i { width: 28px; height: 28px; color: #c9c3b8; }
.loc-item.active .ico svg.i { color: #9fd4ff; filter: drop-shadow(0 0 6px var(--rune)); }
.loc-item .txt { min-width: 0; }
.loc-item .n { font-size: 17px; line-height: 1.25; overflow-wrap: break-word; }
.loc-item .tags { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.loc-item .tag { white-space: nowrap; }
/* колонка дерева поуже — метки «здесь», «внутри» уходят под имя, чтобы имя не рвалось по буквам */
@media (max-width: 1499px) {
  .loc-item { grid-template-columns: 34px minmax(0, 1fr); }
  .loc-item .tags { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .loc-item .tags:empty { display: none; }
}
.tag.shared { color: var(--muted); border-color: #555b63; background: #14171b; box-shadow: none; }
.loc-item .item-actions { grid-column: 1 / -1; margin-top: 8px; }
.loc-item .item-actions .danger { margin-left: auto; }
/* линия к родителю: от середины строки влево и вверх до строки выше */
.loc-item[style*="margin-left"]::after {
  content: ""; position: absolute; left: -26px; top: -18px; width: 13px; height: calc(50% + 12px);
  border-left: 1px solid #5d636b; border-bottom: 1px solid #5d636b; pointer-events: none;
}
.loc-item.here::before {
  content: ""; position: absolute; left: -9px; top: 4px; bottom: 4px; width: 3px;
  background: var(--rune); box-shadow: 0 0 8px var(--rune);
}
.loc-item.global { margin-top: 0; border-top: 10px solid transparent; }

/* чипы триггеров: слово по центру, крестик — при наведении */
.chips { gap: 8px; padding: 6px; border: 1px solid #2c3137; border-radius: 0; background: #07080acc; box-shadow: inset 0 2px 6px #000; }
.chips input { border: none; border-image: none; min-height: 32px; }
.chip-x {
  position: relative; justify-content: center; padding: 0 8px 0 6px; border-radius: 0; background: none; min-height: 34px;
  border: 10px solid transparent; border-left-width: 16px; border-right-width: 16px;
  border-image: url(/static/forge/tex/chip.webp) 24 36 fill / 10px 16px stretch;
}
.chip-x button {
  position: absolute; right: -10px; top: 50%; transform: translateY(-50%); padding: 0 4px; line-height: 1;
  color: #ffb0a6; background: #0b0c0ee6; border-radius: 50%; opacity: 0; transition: opacity .12s;
}
.chip-x:hover button, .chip-x button:focus-visible { opacity: 1; }
.chip { border-radius: 0; background: #14171b; border-color: #454b53; font-size: 13px; }
.chip.ok { color: #b9f0cf; border-color: #2f6b47; box-shadow: 0 0 8px #58d38c33; }
.chip.warn { color: #ffd08a; border-color: #8a6a3a; }
.chip.err { color: #ffb0a6; border-color: #8a2e25; }

/* ---------- спойлеры и действия ---------- */
.sec { border: 1px solid #2c3137; border-radius: 0; background: #0b0d10cc; box-shadow: inset 0 1px 0 #ffffff0a; }
.sec > summary { border-radius: 0; }
.sec > summary:hover { background: #ffffff08; }
.sec > summary::before { content: "▸"; color: var(--muted); }
.sec[open] > summary::before { color: var(--rune); text-shadow: 0 0 6px var(--rune-soft); }
.sec-t { font: 400 15px var(--serif); letter-spacing: .14em; color: var(--text); background: var(--steel); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sec-s { color: var(--faint); font-size: 13px; }
.sec.act, .sec.fx {
  border: 16px solid transparent; border-image: url(/static/forge/tex/card.webp) 31 fill / 16px stretch;
  background: none; box-shadow: none;
}
.sec.act > summary, .sec.fx > summary { padding: 0 2px 6px; }
/* в узкой колонке кнопки действия остаются на месте, а длинное имя ужимается */
.sec > summary { min-width: 0; }
.sec-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sec-tools { flex: none; }
.sec.act .sec-t, .sec.fx .sec-t { font: 400 15px var(--serif); letter-spacing: .1em; text-transform: uppercase; background: none; color: #8fd0ff; -webkit-text-fill-color: #8fd0ff; }
.sec.fx .sec-t { text-transform: none; letter-spacing: .02em; font-size: 16px; color: var(--text); -webkit-text-fill-color: var(--text); }
.sec-b { padding: 2px 4px 4px; }
.card > .sec + .sec { margin-top: 10px; }
.action { border-radius: 0; background: #111418; border-color: #3a4047; }
.field > label, .controls .field-label { font-weight: 400; color: var(--muted); font-size: 13px; }
.field .hint, .hint { color: var(--muted); font-size: 13px; }
.hr { background: linear-gradient(90deg, transparent, #4a5058, transparent); }
.ed-head .name-in { font: 400 20px var(--serif); letter-spacing: .03em; padding: 0 8px; }
/* название и кнопки в шапке редактора — одной высоты */
.ed-head > .name-in, .ed-head > .btn { height: 44px; min-height: 44px; }
.user-row .role-sel { min-height: 38px; padding-top: 0; padding-bottom: 0; }
.banner {
  border-radius: 0; border: 1px solid #8a6a3a; background: #2a1f0dd9; color: #f1d7a4;
  box-shadow: inset 0 0 12px #000, 0 0 12px #ffb34722;
}
.err { border-radius: 0; background: #2b0d0bcc; border-color: #8a2e25; color: #ffd9d4; }
.empty { color: var(--muted); }

/* ---------- модальные окна, уведомления, панель сохранения ---------- */
.overlay { background: #000000c8; backdrop-filter: blur(2px); z-index: 50; }
.modal {
  border: 40px solid transparent; border-image: url(/static/forge/tex/modal.webp) 66 fill / 40px stretch;
  background: none; border-radius: 0; box-shadow: 0 20px 60px #000c; max-height: 86vh;
}
.modal-head { border-bottom: none; padding: 0 2px 14px; background: url(/static/forge/tex/divider.webp) center bottom / 100% 12px no-repeat; }
.modal-head b { font: 400 22px var(--serif); letter-spacing: .1em; text-transform: uppercase; color: transparent; background: var(--steel); -webkit-background-clip: text; background-clip: text; font-weight: 400; }
.modal-body { padding: 12px 2px 2px; }
.read-text { border-radius: 0; background: #07080acc; border-color: #2c3137; box-shadow: inset 0 0 18px #000; font: 20px/1.6 var(--font); text-align: center; }
.rec-bar { border-radius: 0; background: #07080a; border: 1px solid #3a4047; }
.rec-fill { background: linear-gradient(90deg, #1d6fb8, var(--rune)); box-shadow: 0 0 8px var(--rune); }
.score { font: 400 64px/1 var(--serif); }
.voice-state { border-radius: 0; background: #0b0d10cc; border-color: #2c3137; }
.voice-state.ok { border-color: #2f6b47; color: #b9f0cf; box-shadow: 0 0 12px #58d38c22; }
.meter { border-radius: 0; background: #07080a; border: 1px solid #3a4047; box-shadow: inset 0 2px 4px #000; }
.meter-fill { background: linear-gradient(90deg, #1f7a4a, var(--ok) 60%, #f2b64a); }
.meter-mark { background: var(--rune); box-shadow: 0 0 6px var(--rune); }

.toasts { z-index: 60; bottom: 70px; right: 24px; }
.toast {
  border: 12px solid transparent; border-image: url(/static/forge/tex/panel.webp) 52 fill / 12px round;
  background: none; border-radius: 0; box-shadow: 0 8px 20px #000c; padding: 2px 8px; min-width: 260px;
}
.toast.ok { color: #b9f0cf; }
.toast.err { color: #ffc9c1; }
.savebar {
  z-index: 40; bottom: 34px; gap: 14px; padding: 2px 4px 2px 10px; border-radius: 0;
  border: 20px solid transparent; border-image: url(/static/forge/tex/panel.webp) 52 fill / 20px round; background: none;
}

/* ---------- угли по нижнему краю: поверх плит, но под окнами и панелью сохранения ---------- */
.embers {
  position: fixed; left: 0; right: 0; bottom: 0; height: 90px; z-index: 25; pointer-events: none;
  background: url(/static/forge/tex/embers.webp) center bottom / auto 90px repeat-x;
  animation: smoulder 5s ease-in-out infinite alternate;
}
@keyframes smoulder { 0% { opacity: .7; } 100% { opacity: 1; } }

/* ---------- карта и метки ---------- */
.map {
  border: 22px solid transparent; border-image: url(/static/forge/tex/map-frame.webp) 43 / 22px stretch;
  border-radius: 0; box-shadow: 0 6px 18px #000; background: #0b0c0e;
}
.map.full { border-width: 30px; border-image-width: 30px; }
.marker {
  background: #0b0c0ee6; border: 1px solid #555b63; border-radius: 0; color: var(--text); font-size: 14px;
  padding: 3px 10px 3px 8px; gap: 8px; box-shadow: 0 2px 6px #000;
}
.marker .dot { width: 12px; height: 12px; border-radius: 0; transform: rotate(45deg); background: #6d737c; border: 2px solid #1a1d21; }
.marker:hover { border-color: #8fd0ff; }
.marker.here { border-color: var(--rune); color: #cfeaff; box-shadow: 0 0 12px #4fb3ff66; }
.marker.here .dot { background: var(--rune); box-shadow: 0 0 12px var(--rune); animation: breathe-dot 2.4s ease-in-out infinite; }
.marker.selected { border-color: #c9a36a; color: #f1dcb6; box-shadow: 0 0 10px #c9a36a55; }
@keyframes breathe-dot { 50% { box-shadow: 0 0 22px var(--rune), 0 0 40px var(--rune-soft); } }
.overlay-head b { font: 400 26px var(--serif); letter-spacing: .08em; color: #cfeaff; text-shadow: 0 0 12px var(--rune); }
.crumb { border-radius: 0; color: var(--muted); font-size: 15px; }
.crumb + .crumb::before { color: #5d636b; }
.crumb.cur { color: #8fd0ff; font-weight: 400; text-shadow: 0 0 8px var(--rune-soft); }

/* ---------- журнал ---------- */
.log { max-height: none; gap: 0; }
.ev { grid-template-columns: 52px 24px 1fr; border-radius: 0; padding: 8px 4px; border-bottom: 1px solid #ffffff0d; font-size: 14.5px; }
.ev:hover { background: #ffffff06; }
.ev .time { color: var(--faint); }
.ev.speech .text { color: var(--text); }
.ev.command .text { color: #8fd0ff; font-weight: 400; }
.ev.voice { background: linear-gradient(90deg, #e0473a1f, transparent 70%); }
.ev.voice .text { color: #ff9a8f; }
.ev.error .text { color: #ff8b7f; }
.ev .meta { color: var(--faint); font-size: 12.5px; }

/* ---------- библиотека ---------- */
.drop {
  border: 2px dashed #3f6f98; border-radius: 0; color: #9fcff3; background: radial-gradient(ellipse at 50% 50%, #102334aa, #0b0d10cc 70%);
  box-shadow: inset 0 0 22px #000;
}
.file { border-radius: 0; border-bottom: 1px solid #ffffff0d; }
.file:hover { background: #ffffff06; }
.folder .c { color: var(--faint); }

/* ---------- заголовок плиты: иконка + высеченное имя + кнопки ---------- */
.head { display: flex; align-items: center; gap: 12px; }
.head > svg.i { width: 26px; height: 26px; color: #c9c3b8; }
.head h3 { margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card > .head { padding-bottom: 14px; margin-bottom: 10px; }
.group-title { font: 400 13px var(--serif); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); margin: 14px 2px 8px; }

/* ---------- пульт: три колонки, каждая крутится сама ---------- */
@media (min-width: 1001px) {
  body.workspace #tab-board.active { height: 100%; }
  .board { height: 100%; }
}
.board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; min-height: 0; }
.board .col { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; }
body.unsaved .board .col { padding-bottom: 54px; }
.board .map-card, .board .log-card { flex: 1; display: flex; flex-direction: column; min-height: 220px; }
.log-card .log { flex: 1; min-height: 0; overflow: auto; }
.map-card .map-box { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; container-type: size; }
.map-card .map-box .map img { max-height: calc(100cqh - 44px); max-width: calc(100cqw - 44px); width: auto; }
@media (max-width: 1400px) { .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } .board .col:last-child { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .board { display: block; } .board .col { overflow: visible; margin-bottom: 12px; } }

/* «Где партия» */
.where-card .crumbs { margin-bottom: 10px; }
.here-card {
  display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 12px; padding: 2px;
  border: 16px solid transparent; border-image: url(/static/forge/tex/card.webp) 31 fill / 16px stretch;
}
.here-card .art { height: 100px; }
.here-name { font: 400 26px/1.1 var(--serif); letter-spacing: .03em; }
.here-pin { color: var(--rune); font-size: 14px; margin: 4px 0; text-shadow: 0 0 6px var(--rune-soft); }
.here-sub { color: var(--muted); font-size: 14px; }
.empty-here .here-name { color: var(--muted); font-size: 22px; }
.art { border: 1px solid #4a5058; box-shadow: inset 0 0 20px #000; background: #07080a; }
.art.rune { background: url(/static/forge/tex/art-placeholder.webp) center / cover; }
.art.icon { display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #10233488, #07080a 70%); }
.art.icon svg.i { width: 52%; height: 52%; color: #9fd4ff; filter: drop-shadow(0 0 10px var(--rune)); }
.art.icon.amb svg.i { color: #8fe0d4; filter: drop-shadow(0 0 10px #3fc9b4); }

/* крупные кнопки пульта: локации, эффекты, сцены */
.btn.scene-btn {
  justify-content: flex-start; text-align: left; min-height: 54px; font-size: 18px; padding: 0 6px; gap: 10px;
  border-radius: 0; background: none; transition: filter .12s, box-shadow .12s;
}
.btn.scene-btn svg.i { width: 22px; height: 22px; color: #cfc9be; }
.btn.scene-btn .t { font-weight: 400; display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.scene-btn .s { display: inline; margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.btn.scene-btn.up { justify-content: center; }
.btn.scene-btn.fired { animation: fired 1.2s ease-out; }
@keyframes fired { 0% { filter: brightness(1.8) drop-shadow(0 0 16px var(--rune)); } 100% { filter: none; } }
.btn.scene-btn:active { transform: scale(.98); }
.nav-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn.scene-btn { min-width: 0; }
.nav-btns .up { grid-column: 1 / -1; }
.fx-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.fx-btns .btn.scene-btn { min-height: 50px; font-size: 16px; }
.fx-btns.dim .scene-btn { opacity: .5; }
.fx-btns.dim .scene-btn:hover { opacity: 1; }

/* «Сейчас играет» */
.now { display: flex; flex-direction: column; gap: 10px; }
.layer {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 2px;
  border: 16px solid transparent; border-image: url(/static/forge/tex/card.webp) 31 fill / 16px stretch;
  background: none; border-radius: 0;
}
.layer.playing { border-color: transparent; }
.layer .art { height: 96px; }
.layer .kind { color: #7fb9e6; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .title { font: 400 23px/1.15 var(--serif); letter-spacing: .02em; margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .range-val input { flex: 1; width: auto; margin: 0; }
.layer .prog { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.layer .prog .bar { flex: 1; height: 4px; background: #07080a; border: 1px solid #2c3137; position: relative; }
.layer .prog .bar i { position: absolute; inset: 0 auto 0 0; background: #6d737c; transition: width 1s linear; }
.layer .next-name { font-size: 12.5px; color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .ctl { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; align-self: stretch; gap: 8px; }
.layer .ctl .row { gap: 6px; flex-wrap: nowrap; }
.eq { display: inline-flex; gap: 3px; align-items: flex-end; height: 24px; margin: 4px 2px 0; }
.eq i { width: 4px; background: var(--rune); box-shadow: 0 0 5px var(--rune); animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; } .eq i:nth-child(3) { animation-delay: .45s; } .eq i:nth-child(4) { animation-delay: .1s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

/* журнал */
.ev .ico { display: grid; place-items: center; }
.ev .ico svg.i { width: 18px; height: 18px; color: #7fb9e6; }
.ev.voice .ico svg.i, .ev.error .ico svg.i { color: #ff8b7f; }
.ev.command .ico svg.i { color: #8fd0ff; }
.log .empty { padding: 30px 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* плашки-пояснения */
.banner { display: flex; align-items: center; gap: 12px; }
.banner > svg.i { width: 22px; height: 22px; color: #ffb347; }
.banner.info { border-color: #2a6fa8; background: #0b1824d9; color: #cfe6f7; box-shadow: inset 0 0 12px #000, 0 0 12px #4fb3ff22; }
.banner.info > svg.i { color: #8fd0ff; }

/* =====================================================================
   Ширина колонок: между ними — полоса, за которую можно потянуть.
   Ширину хранит app.js в переменных --cnav/--cedit (кампании)
   и --bleft/--bright (пульт); двойной щелчок по полосе — вернуть как было.
   ===================================================================== */
.grip { position: relative; cursor: col-resize; align-self: stretch; touch-action: none; }
.grip::before {
  content: ""; position: absolute; top: 8px; bottom: 8px; left: 50%; width: 2px; margin-left: -1px;
  background: linear-gradient(180deg, transparent, #4a5058 12%, #4a5058 88%, transparent);
  transition: background .12s, box-shadow .12s;
}
.grip:hover::before, .grip.act::before {
  background: linear-gradient(180deg, transparent, var(--rune) 10%, var(--rune) 90%, transparent);
  box-shadow: 0 0 10px var(--rune-soft);
}
.grip.act { cursor: col-resize; }

.camp {
  grid-template-columns: var(--cnav, 270px) 12px minmax(300px, 1fr) 12px var(--cedit, minmax(460px, 1.15fr));
  grid-template-areas: "nav g1 map g2 edit";
  gap: 14px 0;
}
.camp .grip-1 { grid-area: g1; } .camp .grip-2 { grid-area: g2; }
/* карточка списка локаций тянется вниз, но не обрезает содержимое рамкой */
.camp .card.locs { flex: 1 0 auto; }
@media (max-width: 1499px) {
  .camp {
    grid-template-columns: var(--cnav, 310px) 12px minmax(0, 1fr);
    grid-template-areas: "nav g1 map" "nav g1 edit";
  }
  .camp .grip-2 { display: none; }
}
@media (max-width: 1000px) { .camp .grip { display: none; } }

.board { grid-template-columns: var(--bleft, minmax(0, 1fr)) 12px var(--bmid, minmax(0, 1.25fr)) 12px var(--bright, minmax(0, 1fr)); gap: 12px 0; }
@media (max-width: 1400px) {
  .board { grid-template-columns: var(--bleft, minmax(0, 1fr)) 12px minmax(0, 1.2fr); }
  .board .grip-2 { display: none; }
  .board .col:last-child { grid-column: 1 / -1; }
}
@media (max-width: 1000px) { .board .grip { display: none; } }

.scenes { grid-template-columns: var(--sside, 260px) 12px minmax(0, 1fr); column-gap: 4px; }
.lib { grid-template-columns: var(--lside, 300px) 12px minmax(0, 1fr); column-gap: 4px; }
@media (max-width: 800px) {
  .scenes, .lib { grid-template-columns: minmax(0, 1fr); }
  .scenes .grip, .lib .grip { display: none; }
}

/* карточки действий одной высоты; подсказка под источником — в одну строку */
.actions { align-items: stretch; }
.src-pick { flex: 1; min-width: 0; justify-content: flex-start; gap: 8px; padding: 0 6px; }
.src-pick svg.i { color: #9fd4ff; }
.src-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-path.unset { color: var(--faint); font-style: italic; }
.src-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.45em; }

/* =====================================================================
   Телефон: вкладки — нижней панелью, пульт — одной лентой по важности
   ===================================================================== */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .card, .plate { border-width: 16px; border-image-width: 16px; }
  .top { grid-template-columns: 1fr; padding: 6px 6px 0; gap: 6px; }
  .top .brand { display: none; }
  .top > .plate { min-height: 0; }
  .listen { justify-content: flex-start; gap: 12px; padding: 2px 4px !important; }
  .listen .wave { display: none; }
  .listen .mic { width: 64px; height: 64px; }
  .listen .mic svg.i { width: 28px; height: 28px; }
  .listen .label b { font-size: 24px; }
  .listen .label span { font-size: 14px; }
  .listen.is-armed .mic::after {
    -webkit-mask: radial-gradient(circle, transparent 36px, #000 37px, #000 40px, transparent 41px);
            mask: radial-gradient(circle, transparent 36px, #000 37px, #000 40px, transparent 41px);
  }
  .controls { grid-template-columns: 1fr 1fr; grid-template-areas: "mode camp" "vol vol" "btns btns"; gap: 4px 8px; }
  .controls > :nth-child(1) { grid-area: mode; } .controls > :nth-child(2) { grid-area: vol; }
  .controls > :nth-child(3) { grid-area: camp; } .controls > :nth-child(4) { grid-area: btns; }
  .ctl-sel > svg.i { display: none; }
  .controls select { font-size: 14px; }
  .ctl-sel .field-label, .ctl-vol .field-label { display: none; }
  .ctl-btns { grid-column: 1 / -1; }
  .who-menu { right: 0; }

  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0;
    grid-template-columns: repeat(6, 1fr); border-width: 12px 6px 6px; border-image-width: 12px 6px 6px;
  }
  .tabs button {
    flex-direction: column; gap: 2px; height: 52px; font-size: 9px; letter-spacing: 0; min-width: 0; overflow: hidden; white-space: nowrap;
    border: none; border-image: none; filter: none;
  }
  .tabs button svg.i { width: 22px; height: 22px; }
  .tabs button.active { border: none; border-image: none; }
  .tabs .motto { display: none; }
  /* одна колонка на телефоне: широкий редактор не должен растягивать страницу */
  .scenes, .lib, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .settings { grid-template-columns: minmax(0, 1fr); }
  main { padding: 6px 6px 96px; }
  .embers { bottom: 64px; height: 50px; background-size: auto 50px; }
  .savebar { bottom: 80px; width: calc(100% - 16px); justify-content: space-between; }
  .toasts { bottom: 150px; right: 8px; left: 8px; }

  /* пульт: самое частое — сверху и крупно */
  .board { display: flex; flex-direction: column; gap: 8px; }
  .board .col { display: contents; }
  .board .now-card { order: 1; }
  .board .fx-card { order: 2; }
  .board .where-card { order: 3; }
  .board .map-card { order: 4; min-height: 0; }
  .board .log-card { order: 5; min-height: 0; }
  .board .log-card .log { max-height: 260px; }
  .board .map-card .map-box { container-type: normal; }
  .board .map-card .map-box .map img { max-height: 50vh; max-width: 100%; }
  .fx-btns { grid-template-columns: 1fr 1fr; }
  .fx-btns .btn.scene-btn { min-height: 60px; font-size: 17px; }
  .layer { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; }
  .layer .art { height: 56px; }
  .layer .title { font-size: 18px; }
  .here-card { grid-template-columns: 70px minmax(0, 1fr); }
  .here-card .art { height: 64px; }
  .here-name { font-size: 21px; }
  .head > svg.i { width: 22px; height: 22px; }
  .card > .head { padding-bottom: 12px; margin-bottom: 8px; }
}

/* =====================================================================
   Библиотека: перенос треков мышкой и скачивание по ссылке
   ===================================================================== */
.file { cursor: grab; }
.file.dragging { opacity: .45; }
.file .grip-h { display: grid; place-items: center; width: 16px; color: var(--faint); }
.file .grip-h svg.i { width: 16px; height: 16px; }
.file:hover .grip-h { color: var(--muted); }
.lib .folder.drop-ready { outline: 1px dashed #2a6fa8; outline-offset: -4px; }
.lib .folder.drop-into { filter: brightness(1.3) drop-shadow(0 0 8px #4fb3ff88); outline: 2px solid var(--rune); outline-offset: -4px; }

.fetch { margin: -4px 0 14px; }
.fetch-row { display: flex; align-items: center; gap: 8px; }
.fetch-row > svg.i { width: 22px; height: 22px; color: #9fd4ff; }
.fetch-row input { flex: 1; min-width: 0; }
.fetch-card {
  display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; margin-top: 10px; padding: 4px;
  border: 16px solid transparent; border-image: url(/static/forge/tex/card.webp) 31 fill / 16px stretch;
}
.fetch-card .thumb { width: 160px; height: 90px; object-fit: cover; border: 1px solid #4a5058; }
.fetch-title { font: 400 20px/1.2 var(--serif); letter-spacing: .02em; margin-bottom: 4px; }
.fetch-opts { grid-column: 1 / -1; }
.fetch-opts .field { margin-bottom: 8px; }
.fetch-opts select, .fetch-opts input { width: 100%; }
.jobs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.jobs:empty { display: none; }
.job { display: grid; grid-template-columns: minmax(0, 1fr) 160px 110px auto; align-items: center; gap: 10px; font-size: 14px; padding: 2px 4px; border-bottom: 1px solid #ffffff0d; }
.job-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-bar { height: 6px; background: #07080a; border: 1px solid #2c3137; position: relative; }
.job-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1d6fb8, var(--rune)); box-shadow: 0 0 6px var(--rune); transition: width .5s; }
.job-state { color: var(--muted); font-size: 13px; }
.job.done .job-state { color: var(--ok); }
.job.done .job-bar i { background: var(--ok); box-shadow: none; }
.job.error .job-state { color: #ff8b7f; }
.job.error .job-bar i { background: var(--danger); box-shadow: none; }
@media (max-width: 760px) {
  .fetch-card { grid-template-columns: 1fr; }
  .fetch-card .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .job { grid-template-columns: minmax(0, 1fr) 80px auto; }
  .job-bar { display: none; }
}

/* =====================================================================
   Летопись: список игр слева, выбранная игра справа
   ===================================================================== */
.lib.journal { grid-template-columns: var(--jside, 340px) 12px minmax(0, 1fr); }
@media (max-width: 800px) { .lib.journal { grid-template-columns: minmax(0, 1fr); } }
.jitem .n { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.jitem .s { white-space: normal; }
.jhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 8px;
  background: url(/static/forge/tex/divider.webp) center bottom / 100% 12px no-repeat; }
.jhead a.btn { text-decoration: none; }
.jmeta { font-size: 14px; margin-bottom: 10px; }
.jfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.jchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font: 14px var(--font); cursor: pointer;
  color: #cfeaff; background: #0b1824; border: 1px solid #2a6fa8; box-shadow: 0 0 8px #4fb3ff33;
}
.jchip svg.i { width: 16px; height: 16px; }
.jchip.off { color: var(--faint); background: #0b0d10; border-color: #2c3137; box-shadow: none; text-decoration: line-through; }
.jsearch { flex: 1; min-width: 200px; }
.jlog { max-height: none; }
.jlog .ev { grid-template-columns: 76px 24px 1fr; }

/* кнопка прослушивания, пока трек звучит */
.btn.playing { border-image-source: url(/static/forge/tex/btn-active.webp); color: #cfeaff; box-shadow: 0 0 14px #4fb3ff66, 0 3px 8px #000; }
.btn.playing svg.i { filter: drop-shadow(0 0 6px var(--rune)); }
.file:has(.btn.playing) .name { color: #cfeaff; }

/* =====================================================================
   Дерево папок библиотеки: вложенная — сдвинута целиком, линия к родителю,
   стрелка сворачивает подпапки. Заголовок папки — с кнопками правки.
   ===================================================================== */
.lib .folder { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 4px; padding: 2px 6px 2px 2px; }
.lib .folder.active { padding-left: 0; }
.lib .folder + .folder { margin-top: 4px; }
.lib .folder .fname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* линии дерева: поворот к каждой вложенной папке и сплошная вертикаль, пока ниже есть папки того же уровня.
   Отсчёт от рамки строки (10px) и зазора между строками (4px): линия начинается у нижнего края папки выше */
.lib .folder.sub::after, .lib .folder.more::before, .lib .folder .trunk {
  content: ""; position: absolute; pointer-events: none; border-left: 1px solid #5d636b;
}
.lib .folder.sub::after { left: -19px; top: -14px; width: 10px; height: calc(50% + 14px); border-bottom: 1px solid #5d636b; }
.lib .folder.more::before { left: -19px; top: -14px; bottom: -10px; }
.lib .folder .trunk { left: calc(-19px - var(--up) * 18px); top: -14px; bottom: -10px; }
/* у выбранной строки левая рамка шире на 6px — сдвигаем линии обратно */
.lib .folder.active.sub::after, .lib .folder.active.more::before, .lib .folder.active .trunk { margin-left: -6px; }
.fold { display: grid; place-items: center; width: 18px; height: 22px; padding: 0; border: none; background: none; color: var(--muted); cursor: pointer; }
button.fold:hover { color: #cfeaff; filter: drop-shadow(0 0 4px var(--rune)); }
.fold svg.i { width: 16px; height: 16px; }

.lib-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px;
  background: url(/static/forge/tex/divider.webp) center bottom / 100% 12px no-repeat;
}
.lib-head h2 {
  flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere;
  font: 400 18px/1.2 var(--serif); letter-spacing: .14em; text-transform: uppercase;
  background: var(--steel); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lib-tools { display: flex; gap: 6px; }

.rmdir { display: flex; flex-direction: column; gap: 10px; }
.rmdir .banner { align-items: flex-start; }
.refs { margin: 6px 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; max-height: 220px; overflow: auto; }
.ref .muted { font-size: 12.5px; overflow-wrap: anywhere; }
.rm-opt { align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid #2c3137; background: #0b0d10cc; }
.rm-opt.on { border-color: #2a6fa8; box-shadow: 0 0 10px #4fb3ff22; }
.rm-opt.off { opacity: .55; cursor: default; }
.rm-opt input[type=radio] { margin-top: 3px; accent-color: var(--rune); }
.rm-opt > div { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.rm-opt select, .rm-opt input[type=text] { width: 100%; }

/* библиотека и летопись: правая плита прилипает к верху, пока листают длинный список слева */
.lib > .card:last-child {
  position: sticky; top: 10px; align-self: start;
  max-height: calc(100vh - 20px); overflow: auto; overscroll-behavior: contain;
}
@media (max-width: 800px) { .lib > .card:last-child { position: static; max-height: none; overflow: visible; } }
.fold-head { display: flex; align-items: center; gap: 6px; }
.fold-head h3 { flex: 1; margin: 0; }
.fold-head .btn.icon { min-width: 34px; font-size: 18px; line-height: 1; }

/* летопись: разрыв между событиями */
.jgap { display: flex; align-items: center; gap: 10px; padding: 6px 4px; color: var(--faint); font-size: 12.5px; font-style: italic; }
.jgap::before, .jgap::after { content: ""; flex: 1; border-top: 1px dashed #ffffff1a; }

/* ---------- заклинания ---------- */
/* вкладок стало больше шести: колонки по числу видимых кнопок */
.tabs, .tabs[class] { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tabs .motto { min-width: 0; }
@media (max-width: 1800px) { .tabs .motto { display: none; } }
@media (max-width: 1600px) { .tabs button { font-size: 16px; letter-spacing: .05em; gap: 8px; border-left-width: 22px; border-right-width: 22px; } }
@media (min-width: 761px) and (max-width: 1280px) { .tabs button svg.i { display: none; } }
.spell-i { color: #9fd4ff; filter: drop-shadow(0 0 4px #4fb3ff66); }
.spell-item { display: flex; align-items: center; gap: 12px; }
.spell-item > svg.i { width: 30px; height: 30px; flex: none; }
.spell-item .txt { min-width: 0; flex: 1; }
.spell-item .n, .spell-item .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spell-item .nosound { color: #ffb347; }
.spell-icon-btn { width: 64px; height: 64px; padding: 0; display: grid; place-items: center; }
.spell-icon-btn svg.i { width: 40px; height: 40px; }
.spell-btns .btn.scene-btn svg.i { color: #9fd4ff; }
.book-filters { gap: 10px; margin-bottom: 12px; }
.book-filters input { flex: 1 1 220px; min-width: 0; }
.book-filters select { flex: 0 1 180px; min-width: 0; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: min(52vh, 520px); overflow: auto; padding: 2px; }
.book-grid.icons { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.book-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; align-items: center; text-align: left;
  padding: 8px 10px; background: #ffffff08; border: 1px solid #ffffff14; border-radius: 6px; color: var(--text); cursor: pointer; font: inherit;
}
.book-item:hover { background: #ffffff10; }
.book-item svg.i { grid-row: span 2; width: 34px; height: 34px; }
.book-item .t { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-item .s { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-item.on { border-color: var(--rune); background: #4fb3ff1f; box-shadow: 0 0 10px #4fb3ff44 inset; }
.book-item.have:not(.on) { opacity: .55; }
.book-grid.icons .book-item { grid-template-columns: 1fr; place-items: center; padding: 10px; }
.book-grid.icons .book-item svg.i { grid-row: auto; width: 36px; height: 36px; }
.scenes.spells { grid-template-columns: var(--pside, 340px) 12px minmax(0, 1fr); }
@media (max-width: 1000px) { .scenes.spells { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  /* семь вкладок в нижней панели телефона */
  .tabs button { font-size: 8px; letter-spacing: -.02em; }
}

/* ---------- школы магии: у каждой свой цвет ---------- */
.s-abjuration { --sc: #5fb0ff; } .s-conjuration { --sc: #f2c14e; } .s-divination { --sc: #bcd6f5; }
.s-enchantment { --sc: #ff7ac8; } .s-evocation { --sc: #ff7043; } .s-illusion { --sc: #b48cff; }
.s-necromancy { --sc: #7ddc7a; } .s-transmutation { --sc: #e3a15f; } .s-none { --sc: #9fd4ff; }

.sp-tags { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sp-lvl, .sp-school {
  display: inline-block; padding: 2px 7px 1px; border-radius: 4px; font: 400 11.5px/1.35 var(--serif);
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-box: trim-both cap alphabetic;
}
.sp-lvl { color: #eee6d6; background: #ffffff14; border: 1px solid #ffffff2a; }
.sp-lvl.cantrip { color: #cfeaff; border-color: #4fb3ff66; background: #4fb3ff1a; }
.sp-lvl.feat { color: #ffd9a0; border-color: #ffb34766; background: #ffb3471a; }
.sp-school { color: var(--sc); border: 1px solid color-mix(in srgb, var(--sc) 55%, transparent); background: color-mix(in srgb, var(--sc) 14%, transparent); }
.sp-tags.big .sp-lvl, .sp-tags.big .sp-school { font-size: 12.5px; padding: 3px 9px 2px; }
.book-item .s { overflow: visible; }
.book-item .have-mark { color: #7ddc7a; }
.book-item { padding: 9px 10px; row-gap: 5px; }

/* ---------- карточка заклинания ---------- */
.spell-card {
  --sc: #9fd4ff; width: 360px; max-width: calc(100vw - 16px); padding: 14px 16px 12px; border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--sc) 12%, #17191c), #121315 60%);
  border: 1px solid color-mix(in srgb, var(--sc) 45%, #2a2d31);
  box-shadow: 0 14px 40px #000c, 0 0 0 1px #000, inset 0 1px 0 #ffffff12, 0 0 22px color-mix(in srgb, var(--sc) 18%, transparent);
  color: #e9e4da; font-size: 14px; line-height: 1.45;
}
.sc-head { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.sc-head svg.sc-icon { width: 52px; height: 52px; color: var(--sc); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--sc) 60%, transparent)); }
.sc-name { font: 400 20px/1.15 var(--serif); color: #fff6e6; letter-spacing: .02em; }
.sc-en { font-size: 12.5px; color: var(--faint); font-style: italic; margin: 1px 0 6px; }
.sc-pin { opacity: .7; }
.sc-pin:hover { opacity: 1; }
.sc-pin.on { opacity: 1; color: var(--sc); filter: drop-shadow(0 0 6px var(--sc)); }
.sc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 12px 0 8px; padding: 9px 11px; border-radius: 7px; background: #00000059; border: 1px solid #ffffff10; }
.sc-stats .sp-stat > span { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.sc-stats .sp-stat b { font-weight: 400; font-size: 14px; color: #f3eee4; }
.sc-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.sp-flag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #ffffff0f; border: 1px solid #ffffff22; color: #ddd6c8; }
.sp-flag.conc { color: #ffd27a; border-color: #ffd27a55; }
.sp-flag.save { color: #9fd4ff; border-color: #9fd4ff55; }
.sp-flag.atk { color: #ff9a8f; border-color: #ff9a8f55; }
.sc-sum { font-size: 15px; line-height: 1.5; color: #f5f0e6; }
.sc-higher { margin-top: 7px; font-size: 13.5px; color: #d8d0c2; }
.sc-higher b { color: var(--sc); font-weight: 400; }
.sc-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; margin-top: 7px; font-size: 13px; color: #d8d0c2; }
.sc-row > span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding-top: 2px; }
.sc-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #ffffff12; font-size: 11.5px; color: var(--faint); }
.sc-foot a { display: inline-flex; align-items: center; gap: 4px; color: #9fd4ff; text-decoration: none; white-space: nowrap; }
.sc-foot a:hover { text-decoration: underline; }
.sc-foot svg.i { width: 13px; height: 13px; }

.spell-tip { position: fixed; z-index: 90; pointer-events: auto; animation: tipin .12s ease-out; }
@keyframes tipin { from { opacity: 0; transform: translateY(4px); } }

/* ---------- закреплённые карточки ---------- */
.spell-pins {
  position: fixed; z-index: 80; right: 14px; top: 110px; bottom: 90px; width: 384px; display: flex; flex-direction: column;
  background: #0d0e10ee; border: 1px solid #4fb3ff44; border-radius: 12px; box-shadow: 0 16px 50px #000d; backdrop-filter: blur(3px);
}
.spell-pins.closed { bottom: auto; }
.pins-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; color: #cfeaff; font: 400 14px var(--serif); letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid #ffffff12; }
.pins-head svg.i { width: 16px; height: 16px; }
.pins-body { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.pins-body .spell-card { width: auto; box-shadow: inset 0 1px 0 #ffffff12; }
@media (max-width: 760px) {
  .spell-pins { left: 8px; right: 8px; width: auto; top: auto; bottom: 74px; max-height: 60vh; }
  .spell-card { width: 100%; }
}
/* закреплённые карточки справа — окна сдвигаются, чтобы не прятаться под ними */
@media (min-width: 1200px) { body.has-pins .modal-ov { padding-right: 410px; } body.has-pins .modal { max-width: calc(100vw - 450px); } }
.book-count { display: flex; align-items: center; gap: 10px; min-height: 30px; margin: -2px 0 8px; font-size: 14px; color: #cfc9be; }
.book-count b { font: 400 15px var(--serif); letter-spacing: .06em; color: #cfeaff; }
.book-count .book-picked { color: #9fd4ff; }
.book-filters option:disabled { color: #6c6860; }
.book-filters { display: grid; grid-template-columns: minmax(160px, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 10px; }
.book-filters > * { width: 100%; min-width: 0; }
.book-grid { max-height: calc(82vh - 270px); min-height: 180px; }
@media (max-width: 760px) { .book-filters { grid-template-columns: 1fr 1fr; } .book-filters input { grid-column: 1 / -1; } }
/* справочник: строки не растягиваются, когда найдено мало; метки — в одну строку и с воздухом */
.book-grid { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); align-content: start; align-items: start; }
.book-item { grid-template-columns: 38px minmax(0, 1fr); column-gap: 12px; row-gap: 7px; padding: 10px 12px; align-content: center; min-height: 66px; }
.book-item svg.i { width: 38px; height: 38px; }
.book-item .sp-tags { flex-wrap: nowrap; }
.sp-lvl, .sp-school { padding: 5px 9px 4px; border-radius: 5px; font-size: 11px; line-height: 1; }
.sp-tags.big .sp-lvl, .sp-tags.big .sp-school { padding: 6px 10px 5px; font-size: 12px; }
.sp-tags { gap: 6px; }
.book-filters { grid-template-columns: minmax(140px, 1fr) repeat(3, minmax(190px, max-content)); }
@media (max-width: 760px) { .book-filters { grid-template-columns: 1fr 1fr; } }
.book-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.book-filters input { grid-column: 1 / -1; }
.book-grid { height: calc(82vh - 332px); max-height: none; min-height: 200px; }
@media (max-width: 760px) { .book-filters { grid-template-columns: 1fr 1fr; } .book-filters select:last-child { grid-column: 1 / -1; } }
/* действия: подписи полей в ряду одной высоты — ползунки встают на одну линию */
.act .row > .field > label { display: flex; align-items: center; min-height: 20px; }
.field > label.check.mini { gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.check.mini input[type=checkbox] { width: 18px; height: 18px; }
.range-val.off { opacity: .4; }
.range-val.off input { cursor: not-allowed; }
/* ряд, где у поля есть подсказка снизу: выравниваем по верху, иначе соседние поля съезжают вниз */
.row:has(> .field > .hint) { align-items: flex-start; }
.act .row > .field { min-width: 0; flex: 1 1 150px; }
.act .row > .field.duck { flex: 1 1 100%; }
.act .field.act-type select, .act .row > .field select { width: 100%; }
.book-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .book-filters { grid-template-columns: 1fr 1fr; } .book-filters select:last-child { grid-column: auto; } }

/* ---------- стихии: цвет иконки заклинания ---------- */
.el-fire { --ec: #ff7a3d; } .el-cold { --ec: #9fe8ff; } .el-lightning { --ec: #ffe45c; } .el-thunder { --ec: #7f9cff; }
.el-acid { --ec: #c6f24a; } .el-poison { --ec: #5fd16f; } .el-necrotic { --ec: #b07cff; } .el-radiant { --ec: #ffd27a; }
.el-psychic { --ec: #ff78c8; } .el-force { --ec: #e4dcff; } .el-heal { --ec: #7dffc4; } .el-prismatic { --ec: #fff4e0; }
svg.spell-i { color: var(--ec, var(--sc, #9fd4ff)); filter: drop-shadow(0 0 5px color-mix(in srgb, var(--ec, var(--sc, #4fb3ff)) 55%, transparent)); }
svg.spell-i.el-prismatic { filter: drop-shadow(-1.5px 0 0 #ff7043aa) drop-shadow(1.5px 0 0 #5fb0ffaa) drop-shadow(0 1.5px 0 #7ddc7aaa) drop-shadow(0 0 6px #ffffff55); }
.sc-head svg.sc-icon.spell-i { color: var(--ec, var(--sc)); filter: drop-shadow(0 0 9px color-mix(in srgb, var(--ec, var(--sc)) 65%, transparent)); }
.sp-flag.el { color: var(--ec); border-color: color-mix(in srgb, var(--ec) 50%, transparent); background: color-mix(in srgb, var(--ec) 12%, transparent); }
.spell-btns .btn.scene-btn svg.spell-i { color: var(--ec, var(--sc)); }
/* компоненты заклинания: В · слова, С · жесты, М · материал */
.sp-comps { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sp-comp { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px; background: #ffffff0d; border: 1px solid #ffffff1f; font-size: 12.5px; font-weight: 400; cursor: help; white-space: nowrap; }
.sp-comp b { color: var(--sc, #9fd4ff); font-weight: 400; }

/* ---------- подсказки в стиле кузни ---------- */
.ui-tip {
  position: fixed; z-index: 120; max-width: min(360px, calc(100vw - 16px)); padding: 9px 13px 8px;
  font: 400 14px/1.45 var(--serif, Georgia, serif); color: #efe9dd; letter-spacing: .01em;
  background: linear-gradient(180deg, #1d2126f5, #121417f5); border: 1px solid #4fb3ff55; border-radius: 8px;
  box-shadow: 0 10px 28px #000c, 0 0 0 1px #000, inset 0 1px 0 #ffffff14, 0 0 14px #4fb3ff26;
  pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s;
  white-space: pre-line;
}
.ui-tip.on { opacity: 1; transform: none; }

/* ---------- «Есть несохранённые изменения»: посередине огненного подвала, поверх всего ---------- */
.savebar, .plate.savebar {
  position: fixed; left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); z-index: 110;
  display: flex; align-items: center; gap: 16px; padding: 4px 8px 4px 14px; min-width: 0; width: max-content; max-width: calc(100vw - 16px);
  border: 22px solid transparent; border-image: url(/static/forge/tex/panel.webp) 52 fill / 22px round; background: none;
  border-radius: 0; font: 400 16px var(--serif); color: #ffe2b0;
  filter: drop-shadow(0 12px 26px #000) drop-shadow(0 0 16px #ffb34755);
  animation: savepulse 2.4s ease-in-out infinite alternate;
}
.savebar > div { display: flex; gap: 10px; }
@keyframes savepulse { to { filter: drop-shadow(0 12px 26px #000) drop-shadow(0 0 24px #ffb34799); } }
@media (max-width: 760px) {
  .savebar, .plate.savebar { bottom: 70px; width: calc(100% - 16px); justify-content: space-between; font-size: 14px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .savebar { animation: none; } }

/* метки компонентов: правило подписей блока характеристик их не трогает */
.sc-stats .sp-stat > span { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.sc-stats .sp-stat .sp-comps { display: inline-flex; font-size: 12.5px; letter-spacing: 0; text-transform: none; color: inherit; margin-top: 2px; }
.sc-stats .sp-stat .sp-comp { display: inline-flex; font-size: 12.5px; letter-spacing: 0; text-transform: none; color: #e9e4da; }
.sc-stats .sp-stat .sp-comp b { font-size: 13px; color: var(--sc, #9fd4ff); }

/* ---------- карточка действия: ряды парами без переноса, «!» вместо сводки, источник в рамке ---------- */
.sec.act > summary .sec-s { display: none; }
.sec.act > summary .sec-t { flex: 1; }
.sec.act .row { flex-wrap: nowrap; }
.sec.act .row > .field { flex: 1 1 0; min-width: 0; }
.sec.act .row > .field select { width: 100%; min-width: 0; }
.sec.act .row.act-checks { gap: 22px; margin-top: 2px; }
.sec.act .row.act-checks > .check { flex: none; }
.btn.icon.act-warn { color: #ffd166; filter: drop-shadow(0 0 6px #ffb34799); }
.btn.icon.act-warn:hover { color: #ffe39a; }
.btn.icon.act-warn[hidden] { display: none !important; }
.sec.act .act-source {
  padding: 8px 10px 6px; border: 1px solid #4fb3ff3d; border-radius: 4px;
  background: linear-gradient(180deg, #4fb3ff12, #4fb3ff06); box-shadow: inset 0 1px 0 #ffffff0a;
}
.sec.act .act-source > label { color: #8fd0ff; }
.sec.act .act-source .src-hint:empty { display: none; }
/* карточки действий не уже 360px: иначе с «!» в шапке не влезает заголовок — лучше по одной в ряд */
.actions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); }
.sec.act > summary .sec-t { letter-spacing: .08em; }
/* узкая карточка действия (≤ 440px): кнопки в шапке чуть компактнее, чтобы заголовок читался целиком */
.sec.act { container-type: inline-size; container-name: act; }
@container act (max-width: 440px) {
  .sec.act > summary .sec-tools { gap: 4px; }
  .sec.act > summary .sec-tools .btn.icon { min-width: 26px; min-height: 36px; border-width: 11px; border-image-width: 11px; }
  .sec.act > summary .sec-t { letter-spacing: .04em; font-size: 14px; }
}
/* совсем узкая карточка (телефон): заголовок может уйти во вторую строку, в списках шрифт чуть мельче */
@container act (max-width: 340px) {
  .sec.act > summary .sec-t { white-space: normal; line-height: 1.15; overflow: visible; }
  .sec.act .row > .field select { font-size: 13.5px; padding-left: 6px; padding-right: 4px; }
}
/* компоненты: только синие буквы в квадратиках, расшифровка — в подсказке */
.sc-stats .sp-stat .sp-comps { gap: 5px; }
.sc-stats .sp-stat .sp-comp {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  font: 400 14px/1 var(--serif); color: var(--sc, #9fd4ff); letter-spacing: 0;
  background: color-mix(in srgb, var(--sc, #9fd4ff) 10%, #0b0d10); border: 1px solid color-mix(in srgb, var(--sc, #9fd4ff) 40%, transparent);
  border-radius: 4px; cursor: help;
}
.sc-stats .sp-stat .sp-comp:hover { border-color: var(--sc, #9fd4ff); box-shadow: 0 0 8px color-mix(in srgb, var(--sc, #9fd4ff) 40%, transparent); }
/* закреплённые карточки: сворачиваются до строки с названием */
.spell-card .sc-head.foldable { cursor: pointer; }
.spell-card .sc-head { grid-template-columns: 52px minmax(0, 1fr) auto auto; }
.spell-card .sc-fold { opacity: .7; }
.spell-card .sc-fold:hover { opacity: 1; }
.spell-card.folded { padding-bottom: 10px; }
.spell-card.folded .sc-body { display: none; }
.spell-card.folded .sc-head { grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; }
.spell-card.folded .sc-head svg.sc-icon { width: 34px; height: 34px; }
.spell-card.folded .sc-en { display: none; }
.spell-card.folded .sc-name { font-size: 17px; margin-bottom: 4px; }
.pins-body .spell-card.folded { padding-top: 10px; }
/* кнопки шапки карточки — одна компактная группа, чтобы названию и меткам хватало места */
.spell-card .sc-head, .spell-card.folded .sc-head { grid-template-columns: 52px minmax(0, 1fr) auto; }
.spell-card.folded .sc-head { grid-template-columns: 34px minmax(0, 1fr) auto; }
.sc-btns { display: flex; gap: 2px; margin: -4px -6px 0 0; }
.sc-btns .btn.icon { min-width: 30px; min-height: 30px; padding: 0; border: none; border-image: none; box-shadow: none; background: none; }
.sc-btns .btn.icon svg.i { width: 17px; height: 17px; }
.spell-card .sc-tags, .spell-card .sp-tags.big { flex-wrap: nowrap; }
/* шапка: три плиты одной высоты (базовый style.css центрирует их по-разному) */
.top { align-items: stretch; }
.top > .plate { height: auto; margin: 0; box-sizing: border-box; }
/* средние экраны: средняя плита уже — без декоративных волн и с надписью в одну строку, чтобы шапка не росла */
@media (min-width: 761px) and (max-width: 1600px) {
  .listen { gap: 14px; }
  .listen .wave { display: none; }
  .listen .label { min-width: 0; }
  .listen .label b { font-size: 28px; white-space: nowrap; }
  .listen .label span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- выбор источника: папки и треки списком, по строке на элемент ---------- */
.lp-list { display: flex; flex-direction: column; gap: 4px; }
.lp-list.files { max-height: min(46vh, 460px); overflow-y: auto; padding-right: 4px; }
.lp-list.dirs + .btn { margin-top: 14px; }
.lp-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  min-height: 46px; padding: 4px 6px 4px 14px; width: 100%; text-align: left; cursor: pointer;
  font: 400 15px var(--serif); color: var(--text);
  background: linear-gradient(180deg, #ffffff08, #ffffff03); border: 1px solid #ffffff14; border-radius: 4px;
  box-shadow: inset 0 1px 0 #ffffff08; transition: border-color .12s, background .12s;
}
.lp-row:hover, .lp-row:focus-visible { border-color: #4fb3ff66; background: linear-gradient(180deg, #4fb3ff14, #4fb3ff06); outline: none; }
.lp-row.cur { border-color: var(--rune); background: linear-gradient(180deg, #4fb3ff22, #4fb3ff0a); box-shadow: 0 0 10px #4fb3ff33 inset; }
.lp-row > svg.i { width: 20px; height: 20px; color: #9fd4ff; }
.lp-row.dir > svg.i:first-child { color: #d9b57a; }
/* длинное имя не переносится и плавно гаснет у правого края */
.lp-name {
  min-width: 0; white-space: nowrap; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
}
.lp-meta { color: var(--faint); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lp-row .lp-go { width: 16px; height: 16px; color: var(--faint); margin-right: 8px; }
.lp-row.file { grid-template-columns: 22px minmax(0, 1fr) auto 44px; padding-right: 4px; }
.lp-row .lp-play { min-height: 36px; min-width: 30px; }
@media (max-width: 760px) {
  .lp-row { gap: 8px; padding-left: 10px; }
  .lp-row.dir .lp-meta { display: none; }
}
.btn.lp-take { max-width: 100%; white-space: normal; text-align: left; line-height: 1.25; }
/* подсказки: читаемый текстовый шрифт вместо заголовочного и кегль крупнее */
.ui-tip { font: 400 16px/1.5 var(--font); letter-spacing: 0; color: #f4efe6; max-width: min(420px, calc(100vw - 16px)); padding: 10px 14px 9px; }

/* ---------- поиск звуков: ключи ---------- */
.settings > .card.finder-card.wide { grid-column: 1 / -1; }
.key-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid #ffffff10; }
.key-row:first-of-type { border-top: none; }
.key-head { display: flex; align-items: center; gap: 10px; }
.key-head b { font: 400 16px var(--serif); letter-spacing: .04em; color: #e9e4da; }
.key-mask { display: inline-flex; align-items: center; gap: 5px; color: #7ddc7a; font-variant-numeric: tabular-nums; }
.key-mask svg.i { width: 14px; height: 14px; }
.key-none { color: var(--faint); font-style: italic; }
.key-line { display: flex; gap: 8px; align-items: center; }
.key-line .key-in { flex: 1; min-width: 0; -webkit-text-security: disc; font-family: monospace; letter-spacing: .08em; }
.key-item { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.key-item .hint { flex: 1; margin: 0; }
.key-item svg.i { width: 14px; height: 14px; color: #7ddc7a; }
.key-shared { margin-top: 10px; padding-top: 12px; border-top: 1px solid #ffffff10; }
.finder-keys { gap: 8px 28px; margin-bottom: 8px; }
.num-sm { width: 100%; min-width: 0; }
.finder-users { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.finder-users th { text-align: left; font: 400 12px var(--serif); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 6px 8px; border-bottom: 1px solid #ffffff14; }
.finder-users td { padding: 6px 8px; border-bottom: 1px solid #ffffff0a; vertical-align: middle; }
.finder-users td:nth-child(4), .finder-users td:nth-child(5) { width: 120px; }
.finder-users td:nth-child(6) { width: 150px; }
.finder-users .tag { margin-right: 4px; }
.finder-users .tag.off { opacity: .35; }
@media (max-width: 1000px) { .finder-users { display: block; overflow-x: auto; } }

/* ---------- поиск на Freesound в библиотеке ---------- */
.finder { margin: 12px 0 14px; padding-top: 12px; border-top: 1px solid #ffffff10; }
.finder .fetch-row input { flex: 1; min-width: 0; }
.finder-filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 0 34px; }
.finder-filters select { width: auto; min-width: 180px; }
.finder-queries { display: flex; align-items: center; gap: 10px; margin: 10px 0 0 34px; }
.finder-queries .chips { flex: 1; min-width: 0; }
.finder .hint.warn { color: #ffcf8a; margin: 8px 0 0 34px; }
.finder-status { margin: 10px 0 6px 34px; }
.finder-list { margin-left: 34px; max-height: min(52vh, 560px); }
.lp-row.fs-row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 140px) 56px auto 44px; }
.lp-row.fs-row input[type=checkbox] { width: 20px; height: 20px; }
.lp-row .fs-author { overflow: hidden; text-overflow: ellipsis; color: #b8b0a2; }
.tag.lic { justify-self: start; }
.tag.lic.free { color: #7ddc7a; border-color: #7ddc7a66; }
.tag.lic.nc { color: #ffcf8a; border-color: #ffcf8a66; }
.finder-foot { margin: 10px 0 0 34px; align-items: center; }
@media (max-width: 760px) {
  .finder-filters, .finder-queries, .finder-status, .finder-list, .finder-foot, .finder .hint.warn { margin-left: 0; }
  .finder-queries { flex-wrap: wrap; }
  .lp-row.fs-row { grid-template-columns: 22px minmax(0, 1fr) auto 44px; }
  .lp-row.fs-row .fs-author, .lp-row.fs-row .lp-meta:not(.fs-author) { display: none; }
}
@media (max-width: 760px) {
  .finder .fetch-row { flex-wrap: wrap; }
  .finder .fetch-row input { flex: 1 1 calc(100% - 40px); }
  .finder .fetch-row .btn { flex: 1 1 100%; }
  .finder-filters select { flex: 1 1 100%; min-width: 0; }
  .finder-queries { flex-direction: column; align-items: stretch; gap: 6px; }
  .finder-queries .chips { width: 100%; }
}

/* ---------- логотип в шапке: руна — текст по центру — руна, промежутки равные (как на странице входа) ---------- */
.top .brand { justify-content: space-evenly; gap: 0; }
.top .brand > div:not(.rune-side) { text-align: center; }
.top .brand h1 { padding-left: .06em; }          /* разрядка букв добавляет пробел справа — компенсируем */
.top .brand .sub { padding-left: .22em; }
/* средние экраны: плита логотипа уже — надпись чуть меньше, чтобы руны не касались текста и рамки */
@media (max-width: 1600px) { .top .brand h1 { font-size: 42px; } .top .brand .sub { font-size: 11.5px; letter-spacing: .18em; } .top .brand .sub i { font-size: 10px; } }
/* результаты Freesound: у каждой строки своя сетка — колонки фиксированные, чтобы не было лесенки */
.lp-row.fs-row { grid-template-columns: 22px minmax(0, 1fr) 150px 56px 108px 44px; }
.lp-row.fs-row .fs-author { text-align: left; justify-self: stretch; }
.lp-row.fs-row .fs-author + .lp-meta { text-align: right; justify-self: stretch; }
.lp-row.fs-row .tag.lic { justify-self: start; }
@media (max-width: 1100px) { .lp-row.fs-row { grid-template-columns: 22px minmax(0, 1fr) 110px 52px 108px 44px; } }
@media (max-width: 760px) { .lp-row.fs-row { grid-template-columns: 22px minmax(0, 1fr) 108px 44px; } }
/* скачивание из Freesound: состояние строки вместо галки */
.fs-st { display: grid; place-items: center; width: 20px; height: 20px; }
.fs-st.ok { color: #7ddc7a; }
.fs-st.ok svg.i { width: 18px; height: 18px; }
.fs-st.bad { color: #ffb347; font: 700 15px var(--font); }
.spin { width: 16px; height: 16px; border: 2px solid #4fb3ff33; border-top-color: #8fd0ff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lp-row.fs-row.st-done { opacity: .6; cursor: default; }
.lp-row.fs-row.st-loading { border-color: #4fb3ff55; }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* --- Настройки: разделы слева, справа один раздел --- */
.set-page { max-width: 1440px; margin: 0 auto; }
.set-lead { margin: 2px 0 10px; color: var(--muted); }
.set-status { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 4px 0 16px; margin-bottom: 18px; border-bottom: 1px solid #3a3f45; }
.set-st { display: inline-flex; align-items: center; gap: 7px; color: var(--text); }
.set-st svg.i { width: 18px; height: 18px; flex: none; color: var(--muted); }
.set-st.ok, .set-st.ok svg.i { color: #a7dfba; }
.set-st.warn, .set-st.warn svg.i { color: #efc18d; }
.set-st.bad, .set-st.bad svg.i { color: #f0a097; }
.set-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 26px; align-items: start; }
.set-menu { display: grid; gap: 8px; position: sticky; top: 12px; }
.set-menu .cap { margin: 10px 6px 0; color: #acd9f8; font-size: 14px; }
.set-menu .cap:first-child { margin-top: 0; }
.set-menu .cap.server { margin-top: 18px; color: #e8c58c; }
.set-menu .btn { justify-content: flex-start; text-align: left; min-height: 48px; white-space: normal; line-height: 1.25; }
.set-content { min-width: 0; }
.set-panel { padding: 22px 26px 26px; }
.set-panel > h2 { margin-bottom: 4px; }
.set-scope { margin: 0 0 14px; color: #acd9f8; font-size: 14px; }
.set-scope.server { color: #e8c58c; }
.set-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-items: start; }
.set-pair.wide { gap: 0 36px; }
.set-group { padding: 16px 0 6px; border-top: 1px solid #3a3f45; min-width: 0; }
.set-panel > .set-group:first-of-type, .set-pair > .set-group, .set-panel > .finder-card > .set-group:first-child { border-top: 0; padding-top: 6px; }
.set-group > h3 { margin: 0 0 4px; font: 400 21px/1.2 var(--serif); letter-spacing: .03em; text-transform: none; color: #d4c9b6; }
.set-group > p { margin: 6px 0 12px; color: var(--muted); max-width: 72ch; }
.set-save { margin: 0 0 8px; font-size: 13px; color: #9fc3df; }
.set-save.now { color: #b9d8b2; }
.set-group .voice-state { margin: 8px 0 12px; }
.voice-state.bad { border-color: #7a3a33; color: #f0b5ad; }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.set-box { padding: 12px 14px; margin: 6px 0 14px; border: 1px solid #38556a; background: #0b141ccc; }
.set-box .hint { margin-top: 4px; }
.set-fine { margin: 6px 0 10px; border-top: 1px solid #353a40; }
.set-fine > summary { cursor: pointer; padding: 11px 0; color: #d0e4f3; list-style: none; display: flex; gap: 8px; align-items: baseline; }
.set-fine > summary::-webkit-details-marker { display: none; }
.set-fine > summary::before { content: "▸"; color: var(--rune); transition: transform .15s; }
.set-fine[open] > summary::before { transform: rotate(90deg); }
.set-fine > summary:hover { color: #fff; }
.set-fine > div { padding: 4px 0 2px 18px; }
.set-steps { margin: 6px 0 12px; padding-left: 22px; max-width: 72ch; }
.set-steps li { margin: 6px 0; }
.set-group .meter.big { height: 16px; margin: 12px 0 4px; }
.set-meter-labels { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.set-foot { margin-top: 14px; }
.set-panel .finder-card { padding: 0; }
@media (max-width: 900px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .set-menu { position: static; grid-template-columns: 1fr 1fr; }
  .set-menu .cap { grid-column: 1 / -1; }
  .set-menu .cap.server { margin-top: 8px; }
  .set-pair, .set-pair.wide { grid-template-columns: minmax(0, 1fr); }
  .set-pair.wide > .set-group + .set-group { border-top: 1px solid #3a3f45; padding-top: 16px; }
  .set-panel { padding: 18px 16px 20px; }
  .set-fine > div { padding-left: 8px; }
  .set-meter-labels { flex-wrap: wrap; }
}

/* --- Летопись: переключатель видов, игроки и партии --- */
.jviews { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.jviews .btn { min-height: 44px; }
.party-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.party-side { display: grid; gap: 16px; min-width: 0; }
.party-page .card > h2 { margin-bottom: 6px; }
.party-page .card > p { margin: 4px 0 12px; }
.player-list { display: grid; gap: 8px; margin-top: 12px; }
.player-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid #353a40; background: #0b0d10aa; }
.player-row .pinfo { flex: 1; min-width: 0; }
.player-row .n { font-size: 17px; }
.player-row .s { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px; }
.player-row .s.ok { color: #a7dfba; }
.player-row .pbtns { display: flex; gap: 6px; flex: none; }
.hero-card .btn.primary { margin-top: 4px; }
.party { padding: 12px 0; border-top: 1px solid #353a40; }
.party > h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; text-transform: none; letter-spacing: .03em; font: 400 19px/1.2 var(--serif); }
.party-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.hero-name { margin: 0 0 6px; font-size: 28px; }
.hero-consent { margin-top: 8px; padding: 10px 12px; border: 1px solid #38556a; background: #0b141ccc; align-items: flex-start; }
.hero-pick { display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
@media (max-width: 900px) {
  .party-page { grid-template-columns: minmax(0, 1fr); }
  .player-row { flex-wrap: wrap; }
  .player-row .pbtns { width: 100%; justify-content: flex-end; }
  .party-row { grid-template-columns: minmax(0, 1fr) auto; }
  .party-row input { grid-column: 1; grid-row: 2; }
  .party-row .btn { grid-column: 2; grid-row: 1 / span 2; }
}

/* --- Игра: плашка записи, «Начать игру», панель игры, реплики стола, история --- */
.game-badge { position: fixed; left: 14px; bottom: 14px; z-index: 40; display: flex; align-items: center; gap: 10px;
  max-width: min(640px, calc(100vw - 28px)); padding: 10px 14px; background: #0d1116f2; border: 1px solid #3a3f45; box-shadow: 0 6px 22px #000c; }
.gb-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #5a6068; }
.gb-dot.on { background: #ff4b3e; box-shadow: 0 0 10px #ff4b3e; animation: gbpulse 1.4s ease-in-out infinite; }
@keyframes gbpulse { 50% { opacity: .35; } }
.gb-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; }
.gb-text small { flex-basis: 100%; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-time { font-variant-numeric: tabular-nums; color: #ffb3ab; }
body.unsaved .game-badge { bottom: 84px; }
.start-party { display: grid; gap: 6px; max-height: 42vh; overflow: auto; margin-bottom: 4px; }
.start-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; padding: 4px 8px; border: 1px solid transparent; }
.start-row.on { border-color: #2d4a60; background: #0b141c99; }
.start-row .muted { font-size: 12px; white-space: nowrap; }
.game-panel { display: grid; gap: 6px; margin: 8px 0 12px; padding: 10px 12px; border: 1px solid #353a40; background: #0b0d10aa; }
.game-audio { display: grid; gap: 6px; margin-top: 4px; }
.ga-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 1.4fr); gap: 10px; align-items: center; }
.ga-row audio { width: 100%; height: 34px; }
.chron-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; color: #cfe6f7; }
.chron-state .rec-bar { flex-basis: 100%; }
.chron-state.ok { color: #a7dfba; }
.chron-state.bad { color: #f0b5ad; }
.ev.said .text { color: #e9e2d4; }
.said-who { font-weight: 700; color: #9fd4ff; }
.said-who.gm { color: #e8c58c; }
button.said-who.unknown { background: none; border: 0; border-bottom: 1px dashed #c3bdb2; padding: 0; color: #c3bdb2; cursor: pointer; font: inherit; font-weight: 700; }
.jviews { align-items: center; }
.camp-sum { margin: 2px 0 12px; padding: 8px 10px; border: 1px solid #353a40; background: #0b0d10aa; font-size: 13px; }
.camp-sum .hist-who { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
@media (max-width: 700px) {
  .start-row { grid-template-columns: minmax(0, 1fr) auto; }
  .start-row input { grid-column: 1 / -1; }
  .ga-row { grid-template-columns: minmax(0, 1fr); }
  .game-badge { left: 8px; right: 8px; bottom: 72px; max-width: none; flex-wrap: wrap; }
}
.player-row .pwords { align-items: center; gap: 6px; }
.player-row .pwords .check.mini { gap: 5px; font-size: 13px; color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; color: #9fd4ff; font: inherit; font-size: 13px; cursor: pointer; text-align: left; border-bottom: 1px dashed #4f7ea3; }
.linkish:hover { color: #fff; }

/* ---------- справка ---------- */
.help-panel { padding: 18px 30px 30px; min-width: 0; }
.help-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; margin-bottom: 4px; }
.help-bar .hint { margin-left: auto; }
.help-pick { display: none; }
.help-doc { max-width: 1200px; line-height: 1.55; color: var(--text); }
.help-doc h2 { font: 400 30px/1.15 var(--serif); letter-spacing: .04em; margin: 4px 0 14px; }
.help-doc h3 { font: 400 23px/1.2 var(--serif); letter-spacing: .03em; color: #d4c9b6; margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid #3a3f45; text-transform: none; }
.help-doc h4 { font: 600 16px/1.3 inherit; color: #acd9f8; margin: 20px 0 6px; text-transform: none; letter-spacing: 0; }
.help-doc h2, .help-doc h3, .help-doc h4 { scroll-margin-top: 12px; }
.help-doc p { margin: 8px 0; }
.help-doc ul, .help-doc ol { margin: 8px 0; padding-left: 24px; }
.help-doc li { margin: 4px 0; }
.help-doc li > p { margin: 0; }
.help-doc li > ul, .help-doc li > ol { margin: 4px 0; }
.help-doc strong { color: #f1e6cf; }
.help-doc a { color: #9fd0f5; text-decoration: underline; text-underline-offset: 2px; }
.help-doc a:hover { color: #c9e6fb; }
.help-doc code { font: 13px/1.4 ui-monospace, Consolas, monospace; padding: 1px 5px; background: #0b141c; border: 1px solid #2c3a46; border-radius: 3px; }
.help-doc pre { overflow-x: auto; padding: 10px 14px; background: #0b141ccc; border: 1px solid #2c3a46; }
.help-doc pre code { padding: 0; border: 0; background: none; white-space: pre; }
.help-table { overflow-x: auto; margin: 10px 0 14px; }
.help-doc table { border-collapse: collapse; width: 100%; }
.help-doc th, .help-doc td { padding: 7px 12px; border: 1px solid #3a3f45; text-align: left; vertical-align: top; }
.help-doc th { background: #0b141c; color: #d4c9b6; font-weight: 600; }
@media (max-width: 900px) {
  .help-panel { padding: 14px 16px 22px; }
  .help-bar .hint { display: none; }
  .help-page .set-menu { display: none; }
  .help-pick { display: block; flex: 1; min-width: 0; }
}
/* мастер и кампания в летописи — в одну строку */
.jpick { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0 10px; }
.jpick > .field { min-width: 0; }
.jpick select { width: 100%; }
/* сворачиваемый блок в рамке карточки: рамка у карточки, у самого блока — нет */
.sec-card > .sec { border: 0; background: none; box-shadow: none; }

/* ---------- библиотека: группы папок, автор, публикация, удаление через неделю ---------- */
.lib-cap { margin: 12px 4px 6px; font: 400 13px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: #acd9f8; }
.lib-cap:first-of-type { margin-top: 4px; }
.lib .file .tag { flex: none; white-space: nowrap; }
.tag.warn { color: #ffd9a0; border-color: #8a6a3a; background: #2a1f0dcc; }
.lib .file.doomed .name { color: var(--muted); text-decoration: line-through; text-decoration-color: #8a6a3a; }
.lib-notice { margin: 0 0 12px; }
.lib-notice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.terms-text { max-height: 55vh; overflow: auto; padding-right: 8px; }
