:root {
  --bg: #0b0812;
  --bg-2: #130d1f;
  --panel: rgba(22, 15, 34, 0.78);
  --panel-solid: #181024;
  --line: rgba(232, 193, 90, 0.22);
  --line-strong: rgba(232, 193, 90, 0.5);
  --gold: #e8c15a;
  --gold-2: #b8862f;
  --gold-3: #f7e3a1;
  --bronze: #9a6a35;
  --violet: #8d5cf6;
  --violet-2: #b894ff;
  --text: #efe6d2;
  --muted: #a79fb8;
  --danger: #e0645f;
  --ok: #6fcf97;
  --radius: 14px;
  --serif: 'Alegreya', Georgia, 'Times New Roman', serif;
  --display: 'Cinzel', 'Alegreya', Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--serif);
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; }
a { color: var(--gold); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; margin: 0; }
h1 { font-size: 30px; color: var(--gold-3); }
h2 { font-size: 20px; color: var(--gold-3); }
h3 { font-size: 17px; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.grow { flex: 1; min-width: 0; }
.full { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.center { align-items: center; text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---------- элементы форм ---------- */
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: rgba(8, 5, 14, 0.7);
  border: 1px solid rgba(232, 193, 90, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 193, 90, 0.15); }
textarea { resize: vertical; }
select option { background: var(--panel-solid); }
input[type='color'] { padding: 2px; width: 44px; height: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.field.inline, label.inline { flex-direction: row; align-items: center; gap: 10px; display: flex; }
.form-error { color: var(--danger); min-height: 1.2em; font-size: 15px; }

.btn {
  font: 600 15px/1 var(--display);
  letter-spacing: 0.06em;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
  color: var(--text);
  background: transparent;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.gold {
  color: #1e1405;
  background: linear-gradient(180deg, #f6dd8c, #d9a93f 55%, #b8862f);
  border-color: #f7e3a1;
  box-shadow: 0 4px 18px rgba(232, 193, 90, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn.ghost { border-color: var(--line-strong); color: var(--gold-3); }
.btn.ghost:hover:not(:disabled) { background: rgba(232, 193, 90, 0.08); }
.btn.danger { background: #8b2a2a; border-color: #c65050; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: rgba(224, 100, 95, 0.5); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.wide { width: 100%; padding: 14px; font-size: 16px; }
.link { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; padding: 0; }
.link:hover { text-decoration: underline; }
.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(15, 10, 24, 0.7);
  color: var(--gold-3);
  cursor: pointer;
  font-size: 18px;
  flex: none;
}
.icon-btn:hover { border-color: var(--gold); background: rgba(40, 28, 60, 0.9); }
.badge { font: 600 11px/1 var(--display); letter-spacing: 0.08em; padding: 4px 7px; border-radius: 6px; border: 1px solid; }
.badge.warn { color: #f2c46d; border-color: rgba(242, 196, 109, 0.4); }
.badge.dm { color: var(--violet-2); border-color: rgba(184, 148, 255, 0.4); }
.badge.imp { color: var(--gold); border-color: rgba(232, 193, 90, 0.5); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.range { padding: 0; accent-color: var(--gold); flex: 1; }
.range-row { display: flex; gap: 8px; align-items: center; }
.num { width: 72px; padding: 5px 8px; font-size: 14px; }

.avatar { width: 40px; height: 57px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-strong); flex: none; }
.avatar.sm { width: 34px; height: 48px; border-radius: 7px; }
.avatar.xs { width: 26px; height: 37px; border-radius: 6px; }
.avatar-empty {
  display: grid; place-items: center;
  background: linear-gradient(160deg, #3a2463, #1a1030);
  color: var(--gold-3);
  font: 600 13px var(--display);
}
.avatar-empty.xs { font-size: 10px; }

/* ---------- тосты и модалки ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; align-items: center; pointer-events: none; }
.toast {
  background: rgba(20, 13, 32, 0.95);
  border: 1px solid var(--line-strong);
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast-error { border-color: rgba(224, 100, 95, 0.7); color: #ffd6d4; }
.toast-success { border-color: rgba(111, 207, 151, 0.6); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.modal-back { position: fixed; inset: 0; background: rgba(5, 3, 10, 0.72); display: grid; place-items: center; z-index: 900; padding: 16px; animation: fade 0.2s; backdrop-filter: blur(3px); }
.modal { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel-solid); }
.modal.wide { width: min(720px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
@keyframes fade { from { opacity: 0; } }

.crop { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.crop-frame { border: 2px solid var(--gold); border-radius: 8px; overflow: hidden; line-height: 0; box-shadow: 0 0 0 6px rgba(232, 193, 90, 0.1); }
.crop-canvas { cursor: grab; touch-action: none; }
.crop .range { width: 280px; flex: none; }
.crop .row { align-self: stretch; }

/* ---------- экран входа ---------- */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #2a1450 0%, #120a22 45%, #07050c 100%);
  padding: 24px 16px;
}
.nebula {
  position: absolute; inset: -30%;
  background:
    radial-gradient(closest-side at 30% 40%, rgba(141, 92, 246, 0.25), transparent),
    radial-gradient(closest-side at 70% 60%, rgba(83, 52, 180, 0.22), transparent),
    radial-gradient(closest-side at 55% 25%, rgba(232, 193, 90, 0.06), transparent);
  animation: drift 40s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes drift { to { transform: rotate(12deg) scale(1.08); } }
.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 120px, #e8d9ff, transparent),
    radial-gradient(1.5px 1.5px at 160px 60px, #fff3c4, transparent),
    radial-gradient(1px 1px at 230px 180px, #fff, transparent),
    radial-gradient(1px 1px at 300px 40px, #d7c6ff, transparent),
    radial-gradient(1.5px 1.5px at 360px 150px, #fff, transparent);
  background-size: 400px 220px;
  opacity: 0.55;
  animation: twinkle 5s ease-in-out infinite alternate;
  pointer-events: none;
}
.stars-2 { background-size: 560px 340px; background-position: 130px 90px; opacity: 0.35; animation-duration: 7s; animation-delay: -3s; }
@keyframes twinkle { to { opacity: 0.15; } }

.login-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 420px; }
.logo-wrap { position: relative; width: min(340px, 80vw, 40vh); }
.logo { position: relative; width: 100%; display: block; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.6)); animation: logo-in 1s ease-out; }
.portal-glow {
  position: absolute; left: 50%; top: 38%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(157, 108, 255, 0.55), rgba(157, 108, 255, 0) 65%);
  filter: blur(10px);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.55; transform: translate(-50%, -50%) scale(1.12); } }
@keyframes logo-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.login-card {
  width: 100%;
  background: linear-gradient(180deg, rgba(28, 18, 44, 0.86), rgba(15, 10, 24, 0.9));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(247, 227, 161, 0.08);
  backdrop-filter: blur(12px);
}
.login-card.enter { animation: logo-in 0.35s ease-out; }
.card-title { text-align: center; font-size: 19px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.email-badge { align-self: center; font-size: 15px; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--gold-3); background: rgba(232, 193, 90, 0.06); }
.code-input { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.3em; text-transform: uppercase; text-align: center; font-size: 20px; }
.login-foot { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- лобби ---------- */
.lobby { min-height: 100vh; position: relative; }
.lobby-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 15% -10%, rgba(141, 92, 246, 0.22), transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgba(232, 193, 90, 0.08), transparent 40%),
    linear-gradient(180deg, #110b1c, #0b0812 60%);
}
.lobby-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 32px;
  background: rgba(11, 8, 18, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--display); color: var(--gold); letter-spacing: 0.08em; }
.brand img { height: 42px; }
.tabs { display: flex; gap: 6px; }
.tab { font: 600 15px var(--display); letter-spacing: 0.08em; color: var(--muted); padding: 10px 16px; border-radius: 10px; position: relative; }
.tab:hover { color: var(--gold-3); }
.tab.active { color: var(--gold); background: rgba(232, 193, 90, 0.08); }
.tab.active::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 3px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.user-menu { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 99px; border: 1px solid var(--line); color: var(--text); }
.user-chip.active, .user-chip:hover { border-color: var(--gold); }
.user-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 14px var(--display); color: #1e1405; background: linear-gradient(180deg, #f6dd8c, #b8862f); }
.lobby-content { max-width: 1320px; margin: 0 auto; padding: 32px; display: flex; flex-direction: column; gap: 26px; }
.section-head { display: flex; flex-direction: column; gap: 6px; }
.section-head.row { flex-direction: row; justify-content: space-between; align-items: flex-end; }
.sub-head { margin-top: 10px; }

.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 26px; }
.poster {
  position: relative;
  aspect-ratio: 7 / 10;
  border-radius: 14px;
  overflow: hidden;
  display: block;
  color: var(--text);
  background: #150e22;
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}
.poster:hover { transform: translateY(-6px); border-color: var(--gold); box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), 0 0 30px rgba(141, 92, 246, 0.25); }
.poster-art, .poster-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #3b2170, #120a20 70%);
}
.poster-placeholder img { width: 40% !important; height: auto !important; position: static !important; opacity: 0.7; }
.poster-info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 60px 14px 14px;
  background: linear-gradient(180deg, transparent, rgba(8, 5, 14, 0.85) 35%, rgba(8, 5, 14, 0.97));
  display: flex; flex-direction: column; gap: 6px;
}
.poster-info h3 { font-size: 18px; color: var(--gold-3); line-height: 1.2; }
.poster-meta { display: flex; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.poster-meta .online { color: var(--ok); }
.poster-when { display: flex; flex-direction: column; font-size: 13px; border-top: 1px solid var(--line); padding-top: 6px; }
.poster-when strong { color: var(--gold); font-weight: 500; font-size: 15px; }
.poster-when small { color: var(--muted); }
.poster-when.past strong { color: var(--muted); }
.when-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.role-badge { position: absolute; top: 10px; right: 10px; font: 700 11px var(--display); letter-spacing: 0.1em; padding: 5px 8px; border-radius: 6px; background: rgba(20, 12, 34, 0.85); border: 1px solid var(--violet-2); color: var(--violet-2); }
.poster-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: repeating-linear-gradient(135deg, rgba(232, 193, 90, 0.03) 0 12px, transparent 12px 24px), #120b1d;
  border: 2px dashed var(--line-strong);
  color: var(--gold-3);
  font-family: var(--display);
  text-align: center;
}
.poster-new .plus {
  width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 54px; line-height: 1; color: var(--gold);
  border: 2px solid var(--gold);
  box-shadow: 0 0 30px rgba(141, 92, 246, 0.4), inset 0 0 20px rgba(141, 92, 246, 0.3);
  margin-bottom: 8px;
}
.poster-new span { font-size: 17px; letter-spacing: 0.08em; }
.empty-state { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* редактор игры */
.editor { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.editor-side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 90px; }
.editor-main { display: flex; flex-direction: column; gap: 20px; }
.poster-edit { position: relative; aspect-ratio: 7 / 10; width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-strong); background: #150e22; cursor: pointer; padding: 0; }
.poster-edit img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-edit-hint, .portrait-hint {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px;
  font: 600 13px var(--display); letter-spacing: 0.08em; color: var(--gold-3);
  background: linear-gradient(180deg, transparent, rgba(8, 5, 14, 0.9));
  opacity: 0; transition: opacity 0.2s;
}
.poster-edit:hover .poster-edit-hint, .portrait:hover .portrait-hint, .poster-edit:has(.poster-placeholder) .poster-edit-hint { opacity: 1; }
.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(8, 5, 14, 0.45); border: 1px solid rgba(232, 193, 90, 0.1); }
.invite-code { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 14px; border-radius: 12px; border: 1px dashed var(--gold); background: rgba(232, 193, 90, 0.06); }
.invite-code .code { font: 700 26px ui-monospace, Consolas, monospace; letter-spacing: 0.25em; color: var(--gold); }
.editor form.row input { flex: 1; }

/* профиль */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 20px; }
.character-card { display: flex; gap: 18px; align-items: flex-start; padding: 16px; }
.portrait { position: relative; width: 140px; height: 200px; flex: none; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); background: #150e22; cursor: pointer; padding: 0; }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait-empty { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--gold); gap: 4px; background: radial-gradient(circle at 50% 40%, #2d1a55, #120a20 75%); }
.portrait-empty span { font-size: 44px; line-height: 1; }
.portrait-empty small { color: var(--muted); font-size: 12px; }

/* ---------- игровое пространство ---------- */
.game-screen { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(ellipse at center, #1a1128, #07050c 80%); }
.map-box { position: absolute; inset: 0; }
.map-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.map-canvas.over-token { cursor: pointer; }
.map-canvas.grabbing { cursor: grabbing; }
.map-empty { position: absolute; left: calc(50% - 190px); top: 50%; transform: translate(-50%, -50%); color: var(--muted); font-size: 18px; pointer-events: none; font-style: italic; text-align: center; }

.game-top { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px; border-radius: 12px; background: rgba(12, 8, 20, 0.78); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.game-title { display: flex; flex-direction: column; line-height: 1.15; }
.game-title span { font: 600 17px var(--display); color: var(--gold-3); letter-spacing: 0.05em; }
.game-title small { color: var(--muted); font-size: 13px; }
.map-tools { position: absolute; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.map-help { position: absolute; left: 64px; bottom: 16px; font-size: 13px; color: var(--muted); background: rgba(12, 8, 20, 0.7); padding: 6px 12px; border-radius: 8px; pointer-events: none; }

.dm-stack { position: absolute; top: 74px; left: 14px; width: 310px; max-height: calc(100vh - 150px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; scrollbar-width: thin; scrollbar-color: rgba(184, 148, 255, 0.35) transparent; }
.dm-panel { width: 100%; flex: none; border-radius: 12px; background: rgba(14, 9, 24, 0.9); border: 1px solid rgba(184, 148, 255, 0.35); backdrop-filter: blur(10px); }
.dm-toggle { width: 100%; text-align: left; background: none; border: 0; color: var(--violet-2); font: 600 14px var(--display); letter-spacing: 0.06em; padding: 11px 14px; cursor: pointer; }
.dm-panel.collapsed { width: auto; }

/* саундборд */
.sb-badge { margin-left: 8px; min-width: 20px; padding: 2px 6px; border-radius: 99px; background: var(--violet); color: #fff; font: 700 11px var(--serif); }
.sb-body { gap: 12px; }
.sb-add { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid rgba(184, 148, 255, 0.2); }
.sb-add input { padding: 7px 10px; font-size: 14px; }
.sb-add-row { display: flex; gap: 6px; }
.sb-add-row input { flex: 1; }
.sb-list { display: flex; flex-direction: column; gap: 8px; }
.sb-item { padding: 8px; border-radius: 10px; background: rgba(8, 5, 14, 0.55); border: 1px solid rgba(184, 148, 255, 0.15); display: flex; flex-direction: column; gap: 6px; }
.sb-item.playing { border-color: rgba(184, 148, 255, 0.6); box-shadow: inset 0 0 18px rgba(141, 92, 246, 0.18); }
.sb-head { display: flex; align-items: center; gap: 6px; }
.sb-head .inline-edit { flex: 1; min-width: 0; font-size: 14px; padding: 2px 4px; }
.sb-kind { color: var(--violet-2); width: 18px; text-align: center; flex: none; }
.sb-status { font-size: 11px; color: var(--violet-2); white-space: nowrap; animation: pulse-text 1.6s ease-in-out infinite; }
@keyframes pulse-text { 50% { opacity: 0.45; } }
.sb-controls { display: flex; align-items: center; gap: 4px; }
.sb-btn { width: 32px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(12, 8, 20, 0.8); color: var(--gold-3); cursor: pointer; font-size: 14px; flex: none; }
.sb-btn:hover:not(:disabled) { border-color: var(--gold); }
.sb-btn.on { background: linear-gradient(180deg, #a57cff, #6a3fd6); border-color: #cdb6ff; color: #fff; }
.sb-btn:disabled { opacity: 0.35; cursor: default; }
.sb-btn:last-child { margin-left: auto; }
.sb-every { width: 58px; padding: 4px 6px; }
.sb-volume { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sb-pct { width: 38px; text-align: right; color: var(--muted); font-size: 12px; }

.yt-host { position: fixed; left: -10000px; top: 0; width: 200px; height: 200px; overflow: hidden; pointer-events: none; opacity: 0; }
.sound-unlock { position: fixed; left: 50%; top: 90px; transform: translateX(-50%); z-index: 700; padding: 10px 18px; border-radius: 99px; border: 1px solid var(--gold); background: rgba(18, 11, 30, 0.95); color: var(--gold-3); font: 600 14px var(--serif); cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: pop-in 0.25s ease-out; }
.dm-panel.collapsed .dm-body { display: none; }
.dm-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 16px; }
.dm-section { display: flex; flex-direction: column; gap: 10px; }
.dm-section .field > span { font-size: 13px; }
.dm-section select { padding: 6px 8px; font-size: 14px; }

.log-panel {
  position: absolute; top: 14px; right: 14px; bottom: 14px; width: 360px;
  display: flex; flex-direction: column;
  background: rgba(14, 9, 24, 0.66);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.log-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 10px; }
.log-title { font: 600 14px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.online-list { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.online-list .avatar { box-shadow: 0 0 0 2px rgba(111, 207, 151, 0.55); }
.log-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; scrollbar-color: rgba(232, 193, 90, 0.3) transparent; }
.log-empty { color: var(--muted); text-align: center; font-style: italic; padding: 30px 10px; }
.msg { display: flex; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(8, 5, 14, 0.5); border: 1px solid rgba(232, 193, 90, 0.08); animation: msg-in 0.25s ease-out; }
.msg.mine { background: rgba(62, 38, 110, 0.35); }
.msg.is-important { border-color: rgba(232, 193, 90, 0.4); box-shadow: inset 0 0 20px rgba(232, 193, 90, 0.06); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.msg-head strong { color: var(--gold-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head time { margin-left: auto; color: var(--muted); font-size: 12px; }
.msg-text { overflow-wrap: anywhere; font-size: 15px; }
.roll-line { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.roll-info { flex: 1; min-width: 0; }
.roll-text { font-style: italic; font-size: 14px; }
.roll-formula { font: 600 13px ui-monospace, Consolas, monospace; color: var(--violet-2); }
.roll-dice { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.roll-result {
  min-width: 52px; height: 44px; padding: 0 8px;
  display: grid; place-items: center;
  font: 700 24px var(--display); color: var(--gold);
  border-radius: 10px;
  background: radial-gradient(circle at 50% 30%, rgba(232, 193, 90, 0.18), rgba(8, 5, 14, 0.6));
  border: 1px solid var(--line-strong);
}
.roll-result.crit { color: #fff1b8; border-color: var(--gold); box-shadow: 0 0 16px rgba(232, 193, 90, 0.5); }
.roll-result.fail { color: #ffb4b0; border-color: rgba(224, 100, 95, 0.7); }

.log-form { position: relative; padding: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.log-input-row { display: flex; gap: 8px; align-items: center; }
.log-input { flex: 1; padding: 10px 12px; font-size: 15px; }
.dice-btn { width: 46px; height: 46px; flex: none; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(8, 5, 14, 0.7); cursor: pointer; display: grid; place-items: center; padding: 0; transition: transform 0.2s; }
.dice-btn:hover { transform: rotate(-18deg) scale(1.06); border-color: var(--gold); }
.send-btn { width: 42px; height: 42px; flex: none; border-radius: 10px; border: 1px solid var(--gold-2); background: linear-gradient(180deg, #f6dd8c, #b8862f); color: #1e1405; font-size: 16px; cursor: pointer; }
.important { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; user-select: none; }
.important input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line-strong); background: rgba(8, 5, 14, 0.7); display: grid; place-items: center; flex: none; }
.important input:checked + .check-box { background: linear-gradient(180deg, #f6dd8c, #b8862f); border-color: var(--gold-3); }
.important input:checked + .check-box::after { content: '✓'; color: #1e1405; font-weight: 700; font-size: 14px; }
.important input:focus-visible + .check-box { box-shadow: 0 0 0 3px rgba(232, 193, 90, 0.3); }
.important small { margin-left: auto; font-size: 12px; }

.dice-pop {
  position: absolute; bottom: calc(100% + 8px); left: 10px; right: 10px;
  background: rgba(18, 11, 30, 0.97);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.18s ease-out;
  z-index: 5;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.die-pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border-radius: 10px; border: 1px solid rgba(232, 193, 90, 0.15); background: rgba(8, 5, 14, 0.5); color: var(--text); cursor: pointer; font: inherit; }
.die-pick:hover { border-color: var(--gold); }
.die-pick.picked { border-color: var(--gold); background: rgba(232, 193, 90, 0.1); }
.die-name { font: 700 14px var(--serif); }
.die-count { position: absolute; top: 4px; right: 6px; font: 700 12px var(--display); color: var(--gold); }
.dice-mod { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--muted); }
.mod-ctrl { display: flex; align-items: center; gap: 4px; }
.mod-ctrl button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.6); color: var(--gold-3); cursor: pointer; font-size: 18px; }
.mod-input { width: 64px; text-align: center; padding: 5px; }
.dice-preview { text-align: center; font: 600 15px ui-monospace, Consolas, monospace; color: var(--violet-2); padding: 6px; border-radius: 8px; background: rgba(8, 5, 14, 0.5); }

/* ---------- сцены ---------- */
.scene-layer { position: absolute; inset: 0; }
.log-compose { display: flex; gap: 8px; align-items: center; }
.log-compose > form { flex: 1; min-width: 0; }
.scenes-btn { margin-left: 6px; }
.stack.tight { gap: 2px; }

.no-scene-box { position: absolute; left: calc(50% - 190px); top: 50%; transform: translate(-50%, -50%); width: min(460px, 80vw); text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.no-scene-box img { width: 72px; opacity: 0.8; }

/* нарративная сцена */
.scene-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #2a1a40, #07050c 80%); }
.scene-bg img, .scene-bg video { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade 0.8s ease-out; }
.scene-bg-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); font-style: italic; text-align: center; max-width: 60vw; }
.scene-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 3, 10, 0.72) 0%, rgba(5, 3, 10, 0) 18%, rgba(5, 3, 10, 0) 70%, rgba(5, 3, 10, 0.7) 100%),
    radial-gradient(ellipse at center, transparent 55%, rgba(5, 3, 10, 0.55) 100%);
}
.scene-title { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; max-width: 44vw; }
.scene-title h1 { font-size: 36px; color: #f6ecd2; letter-spacing: 0.06em; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 0, 0, 0.6); line-height: 1.1; }
.scene-subtitle { margin-top: 4px; font: 600 13px var(--display); letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
.scene-side-tools { position: absolute; top: 18px; right: 372px; display: flex; flex-direction: column; gap: 10px; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(12, 8, 20, 0.7); color: var(--gold-3); font-size: 18px; cursor: pointer; backdrop-filter: blur(8px); }
.round-btn:hover { border-color: var(--gold); }

/* лог нарративной сцены — справа, под панелью отряда и NPC, той же ширины */
.log-panel.compact { top: auto; left: auto; right: 14px; bottom: 14px; width: 344px; height: min(42vh, 440px); background: rgba(10, 7, 18, 0.58); }
.narrative .cast { max-height: calc(100vh - min(42vh, 440px) - 42px); }
.log-panel.compact .msg { padding: 6px 8px; }
.log-panel.compact .roll-result { min-width: 44px; height: 38px; font-size: 20px; }

.roll-dock { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.roll-dock .dice-btn {
  width: 84px; height: 84px; border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle at 50% 35%, #3a2362, #140c22 75%);
  box-shadow: 0 0 0 5px rgba(12, 8, 20, 0.75), 0 0 30px rgba(141, 92, 246, 0.45), 0 10px 30px rgba(0, 0, 0, 0.6);
}
.roll-dock .dice-btn svg { width: 50px; height: 50px; }
.roll-dock .important { padding: 6px 14px; border-radius: 99px; background: rgba(12, 8, 20, 0.72); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.roll-dock .important small { display: none; }
.roll-dock .dice-pop { left: 50%; right: auto; width: 340px; transform: translateX(-50%); bottom: calc(100% + 12px); }

/* персонажи на сцене */
.cast { position: absolute; top: 14px; right: 14px; width: 344px; max-height: 62vh; display: flex; flex-direction: column; background: rgba(10, 7, 18, 0.55); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(12px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.cast-tabs { display: flex; border-bottom: 1px solid var(--line); }
.cast-tab { flex: 1; background: none; border: 0; padding: 13px 8px 11px; font: 600 14px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cast-tab.active { color: var(--gold-3); border-bottom-color: var(--gold); }
.cast-body { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; scrollbar-color: rgba(232, 193, 90, 0.3) transparent; }
.cast-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 12px; cursor: pointer; }
.cast-row:hover, .cast-row.active { background: rgba(232, 193, 90, 0.08); }
.cast-row.is-hidden { opacity: 0.55; }
.cast-thumb { position: relative; flex: none; }
.cast-portrait { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid rgba(232, 193, 90, 0.45); display: block; }
.cast-portrait.empty { display: grid; place-items: center; background: linear-gradient(160deg, #3a2463, #1a1030); color: var(--gold-3); font: 600 16px var(--display); }
.online-dot { position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid #120b1d; }
.cast-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cast-text strong { font: 600 16px var(--display); color: #f3e6c4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast-text small { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.cast-row:hover .cast-actions { opacity: 1; }
.mini-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: rgba(12, 8, 20, 0.8); color: var(--gold-3); cursor: pointer; font-size: 13px; }
.mini-btn:hover { border-color: var(--gold); }
.cast-section { margin: 10px 8px 2px; font-size: 14px; letter-spacing: 0.08em; text-transform: none; color: var(--gold-3); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.cast-empty { color: var(--muted); font-style: italic; font-size: 14px; padding: 14px 10px; text-align: center; }
.cast-add { align-self: flex-end; margin: 6px 4px 4px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(12, 8, 20, 0.8); color: var(--gold); font-size: 26px; line-height: 1; cursor: pointer; flex: none; }
.cast-add:hover { border-color: var(--gold); box-shadow: 0 0 16px rgba(232, 193, 90, 0.3); }
.cast-card { position: absolute; top: 0; right: calc(100% + 12px); width: 250px; padding: 14px; border-radius: 14px; background: rgba(12, 8, 20, 0.82); border: 1px solid var(--line); backdrop-filter: blur(12px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); animation: pop-in 0.18s ease-out; }
.cast-card-head { text-align: center; display: flex; flex-direction: column; margin-bottom: 10px; }
.cast-card-head strong { font: 700 15px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: #f6ecd2; }
.cast-card-head small { font: 600 12px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.cast-card-art { position: relative; aspect-ratio: 7 / 10; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); }
.cast-card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cast-card-empty { width: 100%; height: 100%; display: grid; place-items: center; font: 600 48px var(--display); color: var(--gold-3); background: radial-gradient(circle at 50% 40%, #2d1a55, #120a20 75%); }
.cast-card-tag { position: absolute; right: 8px; bottom: 8px; font: 700 11px var(--display); letter-spacing: 0.1em; padding: 5px 9px; border-radius: 6px; background: rgba(12, 8, 20, 0.85); border: 1px solid var(--gold-2); color: var(--gold); }

/* состояния на фишках */
.token-actions { position: absolute; z-index: 5; display: flex; gap: 6px; }
.token-action { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 99px; border: 1px solid var(--gold); background: rgba(14, 9, 24, 0.94); color: var(--gold-3); font: 600 13px var(--serif); cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55); animation: pop-in 0.15s ease-out; }
.token-action span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #2a1b40; border: 1px solid #f2cf6b; }
.token-action:hover { background: rgba(40, 26, 62, 0.96); }
.cond-pop { position: absolute; z-index: 6; width: 372px; padding: 12px; border-radius: 14px; background: rgba(14, 9, 24, 0.97); border: 1px solid var(--line-strong); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 10px; animation: pop-in 0.15s ease-out; }
.cond-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cond-head strong { font: 600 15px var(--display); color: var(--gold-3); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 13px; }
.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.cond-item { --c: #999; display: flex; align-items: center; gap: 7px; min-width: 0; padding: 5px 7px; border-radius: 9px; border: 1px solid rgba(232, 193, 90, 0.12); background: rgba(8, 5, 14, 0.55); color: var(--muted); font: 13px var(--serif); cursor: pointer; text-align: left; }
.cond-item:hover { border-color: var(--c); color: var(--text); }
.cond-item.on { border-color: var(--c); color: #fff; background: color-mix(in srgb, var(--c) 18%, rgba(8, 5, 14, 0.8)); }
.cond-icon { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #140d20; border: 2px solid var(--c); opacity: 0.55; }
.cond-item.on .cond-icon { opacity: 1; }
.cond-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cond-level { display: flex; align-items: center; gap: 3px; }
.cond-level button { width: 18px; height: 18px; padding: 0; border-radius: 5px; border: 1px solid var(--c); background: transparent; color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.cond-level b { min-width: 10px; text-align: center; }

/* раздатка */
.handout-stage { position: fixed; inset: 0; z-index: 780; display: grid; place-items: center; padding: 20px; background: rgba(5, 3, 10, 0.78); backdrop-filter: blur(3px); animation: fade 0.25s ease-out; transition: opacity 0.2s; }
.handout-stage.out { opacity: 0; }
.handout-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px 32px; border-radius: 16px; background: linear-gradient(180deg, #1c1229, #110b1b); border: 1px solid var(--line-strong); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); animation: card-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); display: flex; flex-direction: column; gap: 14px; }
.handout-kicker { font: 600 12px var(--display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--violet-2); text-align: center; }
.handout-title { text-align: center; font-size: 26px; color: var(--gold-3); }
.handout-image { display: block; text-align: center; }
.handout-image img { max-width: 100%; max-height: 62vh; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.handout-body p { margin: 0 0 10px; font-size: 18px; line-height: 1.6; white-space: pre-wrap; }
.handout-x { position: absolute; top: 12px; right: 12px; }
/* письмо: пергамент и рукописный шрифт */
.handout-card.letter {
  color: #3a2614;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.35), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(120, 72, 24, 0.25), transparent 55%),
    linear-gradient(180deg, #ecd9ae, #dcc08a 60%, #cfae72);
  border: 1px solid #8a6034;
  box-shadow: inset 0 0 60px rgba(120, 72, 24, 0.45), 0 30px 90px rgba(0, 0, 0, 0.7);
}
.handout-card.letter .handout-kicker { color: #7a4a1a; }
.handout-card.letter .handout-title { color: #4a2c10; font-family: 'Marck Script', var(--serif); font-size: 34px; letter-spacing: 0; }
.handout-card.letter .handout-body p { font-family: 'Marck Script', var(--serif); font-size: 23px; line-height: 1.5; color: #3a2614; }
.handout-card.letter .handout-image img { border: 6px solid #f3e6c4; box-shadow: 0 6px 18px rgba(60, 30, 5, 0.45); }
.handout-card.letter .handout-x { background: rgba(60, 30, 5, 0.25); border-color: rgba(60, 30, 5, 0.4); color: #3a2614; }
.handout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.handout-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.55); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.handout-tile:hover { border-color: var(--gold); }
.handout-tile.new { border-color: var(--gold); box-shadow: 0 0 18px rgba(232, 193, 90, 0.25); }
.handout-tile img, .handout-tile-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.handout-tile-empty { display: grid; place-items: center; font-size: 34px; background: linear-gradient(160deg, #dcc08a, #a5814a); color: #4a2c10; }
.handout-tile .badge { position: absolute; top: 12px; right: 12px; background: rgba(12, 8, 20, 0.85); }
.handout-thumb { width: 54px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; }
.handout-thumb.empty { display: grid; place-items: center; background: linear-gradient(160deg, #dcc08a, #a5814a); color: #4a2c10; }
.handout-editor { display: grid; grid-template-columns: 1fr 200px; gap: 16px; align-items: start; }
.handout-preview { width: 200px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-strong); }
.handout-preview.empty { display: grid; place-items: center; font-size: 48px; background: linear-gradient(160deg, #dcc08a, #a5814a); color: #4a2c10; }
@media (max-width: 640px) {
  .handout-editor { grid-template-columns: 1fr; }
  .handout-card { padding: 22px 18px; }
}

/* заметки мастера */
.dm-notes .dm-toggle { display: flex; align-items: center; gap: 8px; }
.notes-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(232, 193, 90, 0.7); }
.notes-area { width: 100%; resize: vertical; min-height: 120px; max-height: 50vh; font-size: 14px; line-height: 1.5; background: rgba(8, 5, 14, 0.75); }
.notes-foot { display: flex; justify-content: space-between; align-items: center; margin-top: -4px; }
.notes-mark { font-size: 12px; }

/* главы и порядок сцен */
.scenes-head { align-items: center; }
.chapter-add { margin-left: auto; flex-wrap: nowrap; }
.chapter-add input { width: 240px; padding: 6px 10px; font-size: 14px; }
.chapter { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid rgba(232, 193, 90, 0.12); background: rgba(8, 5, 14, 0.25); }
.chapter-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; }
.chapter-head.loose { padding: 6px 10px; }
.chapter-title { flex: 1; min-width: 0; font-size: 17px; }
.chapter-loose-title { flex: 1; font: 600 14px var(--display); letter-spacing: 0.08em; color: var(--muted); }
.chapter-fold { width: 26px; height: 26px; border: 0; background: none; color: var(--gold); cursor: pointer; font-size: 14px; padding: 0; }
.chapter-scenes { display: flex; flex-direction: column; gap: 6px; min-height: 12px; border-radius: 10px; }
.chapter-empty { margin: 0; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; font-style: italic; border: 1px dashed var(--line); border-radius: 10px; }
.chapter.folded .chapter-head { opacity: 0.9; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 16px; letter-spacing: -2px; padding: 0 2px; user-select: none; flex: none; }
.drag-handle:hover { color: var(--gold); }
.scene-row.dragging, .chapter-head.dragging { opacity: 0.4; }
.scene-row.drop-before, .chapter-head.drop-before { box-shadow: 0 -3px 0 var(--gold); }
.scene-row.drop-after { box-shadow: 0 3px 0 var(--gold); }
.chapter-scenes.drop-into, .chapter-head.drop-into { outline: 2px dashed var(--gold); outline-offset: 2px; }
.scene-info { min-width: 200px; }
.scene-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scene-chapter { padding: 2px 6px; font-size: 12px; max-width: 190px; }
.scene-row .scene-actions { max-width: 330px; }

/* подготовка сцены без показа игрокам */
.preview-bar { width: 100%; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(160deg, rgba(76, 40, 140, 0.92), rgba(30, 16, 56, 0.94)); border: 1px solid var(--violet-2); box-shadow: 0 0 24px rgba(141, 92, 246, 0.35); }
.preview-title { font: 600 14px var(--display); letter-spacing: 0.08em; color: #e6dbff; }
.preview-bar strong { color: var(--gold-3); }
.game-top.preview { border-color: var(--violet-2); box-shadow: 0 0 0 1px rgba(184, 148, 255, 0.4), 0 0 20px rgba(141, 92, 246, 0.35); }
.scene-row.viewed { border-color: var(--violet-2); box-shadow: inset 0 0 18px rgba(141, 92, 246, 0.15); }

/* ауры и шаблоны */
.map-canvas.placing { cursor: crosshair; }
.tmpl-pop { position: absolute; left: 64px; bottom: 56px; z-index: 6; width: 340px; padding: 12px; border-radius: 14px; background: rgba(14, 9, 24, 0.97); border: 1px solid var(--line-strong); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 10px; animation: pop-in 0.15s ease-out; }
.tmpl-pop input:not([type]) { padding: 6px 10px; font-size: 14px; }
.shape-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.shape-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.55); color: var(--muted); font: 13px var(--serif); cursor: pointer; }
.shape-btn span { font-size: 22px; line-height: 1; color: var(--gold-3); }
.shape-btn.on { border-color: var(--gold); color: var(--text); background: rgba(232, 193, 90, 0.1); }
.presets { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.presets .btn.sm { padding: 4px 8px; font-size: 12px; }
.swatches { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.5); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--gold-3); }
.swatches input[type='color'] { width: 30px; height: 24px; padding: 1px; }
.place-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(calc(-50% - 187px)); z-index: 6; padding: 8px 16px; border-radius: 99px; background: rgba(14, 9, 24, 0.94); border: 1px solid var(--gold); color: var(--gold-3); font-size: 14px; pointer-events: none; white-space: nowrap; }
.aura-pop { width: 320px; }
.aura-row { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: rgba(8, 5, 14, 0.55); border: 1px solid rgba(232, 193, 90, 0.12); }
.aura-row .row { flex-wrap: nowrap; gap: 6px; }
.aura-row input:not([type]) { flex: 1; min-width: 0; padding: 5px 8px; font-size: 14px; }
.aura-row .sh-num { width: 62px; }

/* бой */
.combat-bar { position: absolute; top: 14px; left: 360px; right: 388px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 4; }
.combat-bar > * { pointer-events: auto; }
.fight-btn { padding: 12px 26px; font-size: 16px; letter-spacing: 0.12em; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(224, 100, 95, 0.25); }
.init-strip { display: flex; gap: 5px; align-items: flex-start; max-width: 100%; overflow-x: auto; padding: 6px 8px 14px; border-radius: 12px; background: linear-gradient(180deg, rgba(10, 7, 18, 0.72), rgba(10, 7, 18, 0.35)); scrollbar-width: thin; }
.init-card { position: relative; flex: none; width: 54px; aspect-ratio: 7 / 10; border-radius: 4px; overflow: visible; border: 2px solid; background: #1a1128; transition: transform 0.25s, filter 0.3s, opacity 0.3s; }
.init-card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; border-radius: 2px; }
.init-card.player { border-color: #4caf7a; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.init-card.npc { border-color: #c0473f; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.init-card.player { border-color: var(--pc, #1c8f7a); }
.init-card.npc.neutral { border-color: #9aa0ab; }
.init-card.npc.elite { border-color: #7c4dff; }
.init-card.npc.boss { border-color: #c96a1c; }
.init-card.me { border-color: #5aa9e6; }
.init-card.done { filter: grayscale(1) brightness(0.55); opacity: 0.8; }
.init-card.waiting img, .init-card.waiting .init-initials { filter: grayscale(0.7) brightness(0.7); }
.init-card.current { width: 66px; border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 24px rgba(255, 255, 255, 0.35); }
.init-card.current::after { content: '▲'; position: absolute; left: 50%; bottom: -15px; transform: translateX(-50%); color: #fff; font-size: 11px; text-shadow: 0 1px 4px #000; }
.init-initials { width: 100%; height: 100%; display: grid; place-items: center; font: 600 15px var(--display); color: var(--gold-3); background: linear-gradient(160deg, #3a2463, #1a1030); }
.init-value { position: absolute; right: -4px; bottom: -6px; min-width: 20px; padding: 1px 4px; border-radius: 6px; background: rgba(8, 5, 14, 0.92); border: 1px solid var(--line-strong); font: 700 11px var(--serif); color: var(--gold-3); text-align: center; }
.init-value.pending { color: var(--violet-2); animation: pulse-text 1.4s ease-in-out infinite; }
.init-remove { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong); background: #1a1128; color: var(--gold-3); font-size: 9px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s; padding: 0; }
.init-card:hover .init-remove { opacity: 1; }
.combat-info { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 16px; border-radius: 99px; background: rgba(12, 8, 20, 0.85); border: 1px solid var(--line); backdrop-filter: blur(8px); flex-wrap: wrap; justify-content: center; }
.combat-status { font-size: 15px; }
.combat-status strong { color: var(--gold-3); }
.combat-actions { display: flex; gap: 6px; }
.init-rolls { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(12, 8, 20, 0.9); border: 1px solid var(--line-strong); }
.init-roll { display: flex; align-items: center; gap: 8px; }
.init-roll > span:first-child { min-width: 130px; font-weight: 600; }
.init-roll .num { width: 58px; padding: 4px 6px; }
/* эффекты с длительностью в полосе боя */
.effect-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 100%; }
.effect-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; background: rgba(12, 8, 20, 0.88); border: 1px solid rgba(155, 107, 255, 0.45); font-size: 13px; max-width: 100%; }
.effect-chip.conc { border-color: rgba(232, 193, 90, 0.55); }
.effect-chip.mine { box-shadow: 0 0 0 1px rgba(90, 169, 230, 0.35); }
.effect-chip i { font-style: normal; }
.effect-chip b { color: var(--gold-3); font-weight: 600; white-space: nowrap; }
.effect-on { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.effect-left { padding: 1px 7px; border-radius: 99px; background: rgba(155, 107, 255, 0.22); color: var(--violet-2); font-weight: 600; white-space: nowrap; }
.effect-chip:not(:has(.effect-x)) { padding-right: 10px; }
.effect-x { width: 20px; height: 20px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.effect-x:hover { background: rgba(224, 82, 74, 0.25); color: #fff; }
.init-effects { position: absolute; left: -4px; top: -6px; padding: 0 4px; border-radius: 6px; background: rgba(8, 5, 14, 0.92); border: 1px solid rgba(155, 107, 255, 0.6); color: var(--violet-2); font-size: 11px; font-weight: 700; line-height: 16px; }
.conc-check > span:first-child { min-width: 0; font-weight: 400; }
.conc-check strong { color: var(--gold-3); }
.effect-targets { display: flex; flex-wrap: wrap; gap: 5px; }
.effect-targets button { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-strong, var(--line)); background: transparent; color: var(--text, #e6dcf2); font: 13px var(--serif); cursor: pointer; }
.effect-targets button.player { border-color: rgba(28, 143, 122, 0.6); }
.effect-targets button.npc { border-color: rgba(192, 71, 63, 0.6); }
.effect-targets button.on { background: rgba(232, 193, 90, 0.2); border-color: var(--gold-3); color: var(--gold-3); }
.effect-form .num { width: 90px; }
.effect-quick { gap: 6px; margin-top: -6px; }
.npc-entry { display: flex; flex-direction: column; gap: 0; border-radius: 10px; background: rgba(8, 5, 14, 0.45); border: 1px solid rgba(232, 193, 90, 0.1); }
.npc-entry > .member-row { background: transparent; border: 0; }
.npc-copies { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 10px 8px 56px; }
.npc-copies .num { width: 56px; padding: 3px 6px; }
.npc-copies .small { font-size: 13px; }
.npc-kind { display: flex; flex-direction: column; gap: 4px; }
.npc-kind select, .npc-create select { padding: 4px 6px; font-size: 13px; }
.npc-init { display: flex; align-items: center; gap: 4px; color: var(--gold); font-size: 13px; }
.npc-init .num { width: 54px; padding: 4px 6px; }

.round-banner { position: fixed; left: 0; right: 0; top: 34%; z-index: 750; display: flex; align-items: center; justify-content: center; gap: 22px; pointer-events: none; animation: round-in 2.6s ease-in-out forwards; }
.round-banner strong { font: 700 56px var(--display); letter-spacing: 0.14em; color: #f6ecd2; text-shadow: 0 0 30px rgba(232, 193, 90, 0.55), 0 3px 12px rgba(0, 0, 0, 0.9); }
.round-line { width: min(220px, 18vw); height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
@keyframes round-in {
  0% { opacity: 0; transform: scale(0.9); }
  15%, 75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}
.msg-system { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 4px 8px; font: 600 13px var(--display); letter-spacing: 0.08em; color: var(--gold); text-align: center; }
.msg-system::before, .msg-system::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.msg-system time { font: 11px var(--serif); color: var(--muted); letter-spacing: 0; }

/* менеджеры сцен и NPC */
.kind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kind-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.5); color: var(--text); cursor: pointer; font: inherit; }
.kind-card strong { font: 600 16px var(--display); color: var(--gold-3); }
.kind-card small { color: var(--muted); font-size: 14px; line-height: 1.3; }
.kind-card.active { border-color: var(--gold); background: rgba(232, 193, 90, 0.08); box-shadow: 0 0 0 3px rgba(232, 193, 90, 0.12); }
.kind-icon { font-size: 22px; color: var(--gold); }
.row.fields { align-items: flex-start; }
.scene-list, .npc-library { display: flex; flex-direction: column; gap: 8px; }
.scene-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; background: rgba(8, 5, 14, 0.45); border: 1px solid rgba(232, 193, 90, 0.1); }
.scene-row.active { border-color: var(--gold); }
.scene-thumb { width: 96px; height: 60px; border-radius: 8px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.scene-thumb.empty { display: grid; place-items: center; color: var(--gold); font-size: 22px; background: #150e22; }
.scene-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.inline-edit { background: transparent; border-color: transparent; padding: 2px 6px; font: 600 16px var(--display); color: var(--gold-3); }
.inline-edit.sub { font: 14px var(--serif); color: var(--muted); }
.inline-edit:hover { border-color: var(--line); }
.npc-create { display: flex; gap: 16px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px dashed var(--line-strong); }
.portrait.sm { width: 105px; height: 150px; }

/* ---------- лист персонажа ---------- */
.sheet-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 650;
  width: min(640px, 100vw);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(22, 14, 34, 0.98), rgba(12, 8, 20, 0.98));
  border-right: 1px solid var(--line-strong);
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
  transform: translateX(-102%); transition: transform 0.25s ease-out;
  outline: none;
}
.sheet-drawer.open { transform: none; }
.sheet-head { display: flex; gap: 14px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); position: relative; }
.sheet-portrait .avatar { width: 84px; height: 120px; border-radius: 10px; }
.sheet-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sheet-head .sheet-name { font: 600 22px var(--display); color: var(--gold-3); padding: 4px 8px; background: transparent; border-color: transparent; }
.sheet-name:hover, .sheet-name:focus { border-color: var(--line); }
.sheet-id-row { display: flex; gap: 8px; }
.sheet-id-row .sh-field { flex: 1; min-width: 0; }
.sheet-id-row .sh-field.narrow { flex: 0 0 64px; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; }
.sheet-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.sheet-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 10px 8px; color: var(--muted); font: 600 13px var(--display); letter-spacing: 0.05em; cursor: pointer; white-space: nowrap; }
.sheet-tab.active { color: var(--gold-3); border-bottom-color: var(--gold); }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; scrollbar-color: rgba(232, 193, 90, 0.3) transparent; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
.sheet-status { margin-right: auto; font-size: 13px; color: var(--muted); }

.sh-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sh-field > span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.sh-field.wide { width: 100%; }
.sh-text, .sh-num, .sh-select { padding: 5px 8px; font-size: 14px; }
.sh-num { width: 74px; text-align: center; }
.sh-area { width: 100%; font-size: 14px; line-height: 1.45; padding: 8px 10px; resize: vertical; }
.sh-inline { display: flex; align-items: center; gap: 8px; }
.sh-inline .sh-num { width: 58px; }
.sh-section { display: flex; flex-direction: column; gap: 8px; }
.sh-section h4 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sh-strip { display: flex; flex-wrap: wrap; gap: 14px 22px; padding: 10px 12px; border-radius: 12px; background: rgba(8, 5, 14, 0.5); border: 1px solid rgba(232, 193, 90, 0.12); }
.sh-strip b { font: 700 20px var(--display); color: var(--gold-3); }
.sh-strip.big .sh-num { font-size: 18px; font-weight: 700; width: 70px; }
.sh-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gold-2); background: transparent; cursor: pointer; padding: 0; flex: none; }
.sh-check.on { background: radial-gradient(circle, var(--gold) 45%, transparent 50%); }
.sh-roll { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; border-radius: 6px; }
.sh-roll:not(.static):hover { color: var(--gold); text-shadow: 0 0 10px rgba(232, 193, 90, 0.5); }
.sh-roll:not(.static):hover::after { content: ' 🎲'; font-size: 12px; }
.sh-mini { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: rgba(12, 8, 20, 0.8); color: var(--gold-3); cursor: pointer; padding: 0; flex: none; font-size: 13px; }
.sh-mini:hover { border-color: var(--gold); }
.sh-mini.del:hover { border-color: var(--danger); color: var(--danger); }

.ab-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ab-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 12px; background: rgba(8, 5, 14, 0.55); border: 1px solid var(--line); text-align: center; }
.ab-name { font: 600 11px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ab-card .sh-roll b, .ab-card > span > b { font: 700 26px var(--display); color: var(--gold-3); }
.ab-score { width: 56px; padding: 2px; font-size: 13px; }
.ab-save { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.ab-save .sh-check { width: 14px; height: 14px; border-width: 1.5px; }
.sk-list { columns: 2; column-gap: 22px; }
.sk-group { break-inside: avoid; padding: 8px 0 10px; border-top: 1px solid var(--line); }
.sk-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 4px; font: 600 11px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2); }
.sk-group-head small { font: 600 12px var(--serif); letter-spacing: 0; color: var(--muted); }
.sk-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; }
.sk-row:hover { background: rgba(232, 193, 90, 0.05); }
.sk-row b { margin-left: auto; font: 700 15px var(--serif); color: var(--gold-3); }
.sk-name small { margin-left: 6px; font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.sk-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--gold-2); background: transparent; cursor: pointer; padding: 0; flex: none; }
.sk-dot[data-level='1'] { background: radial-gradient(circle, var(--gold) 45%, transparent 50%); }
.sk-dot[data-level='2'] { background: var(--gold); box-shadow: 0 0 0 2px rgba(232, 193, 90, 0.35); }

.hp-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.hp-cur { font-size: 18px; font-weight: 700; color: var(--gold-3); }
.hp-ops { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.hp-ops .sh-num { width: 80px; }
.death { display: flex; flex-direction: column; gap: 4px; margin-left: auto; }
.pips { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.pips > span { width: 58px; }
.pip { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--gold-2); background: transparent; cursor: pointer; padding: 0; }
.pip.on { background: var(--gold); }
.death .pips:last-child .pip.on { background: var(--danger); border-color: var(--danger); }
.atk-list, .res-list { display: flex; flex-direction: column; gap: 8px; }
.atk-row { display: grid; grid-template-columns: 1fr 64px 1.2fr auto auto auto; gap: 6px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(8, 5, 14, 0.5); border: 1px solid rgba(232, 193, 90, 0.1); }
.atk-notes { grid-column: 1 / -1; font-size: 13px; }
.atk-bonus { text-align: center; }
.res-row { display: flex; align-items: center; gap: 6px; }
.res-row .sh-text { flex: 1; }
.res-row .sh-num { width: 58px; }
.res-count { min-width: 24px; text-align: center; color: var(--gold-3); }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border-radius: 10px; background: rgba(8, 5, 14, 0.5); border: 1px solid rgba(232, 193, 90, 0.1); }
.slot-cell > b { font: 700 14px var(--display); color: var(--gold); width: 14px; }
.slot-cell .sh-num { width: 48px; padding: 3px; }
.slot-pips { display: flex; gap: 3px; flex-wrap: wrap; }
.slot-pips .pip.on { background: rgba(141, 92, 246, 0.85); border-color: var(--violet-2); }
.coins { display: flex; gap: 10px; flex-wrap: wrap; }
.coins .sh-num { width: 88px; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cast-card-sheet { width: 100%; margin-top: 10px; }

.lss-preview .lss-who { display: flex; flex-direction: column; }
.lss-who strong { font: 600 20px var(--display); color: var(--gold-3); }
.lss-abilities { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.lss-abilities > div { display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 8px; background: rgba(8, 5, 14, 0.55); border: 1px solid var(--line); }
.lss-abilities small { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; }
.lss-abilities b { font: 700 18px var(--display); color: var(--gold-3); }
.lss-abilities span { font-size: 12px; color: var(--muted); }
.lss-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.lss-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.lss-warn { color: #f2c46d; font-size: 14px; }

@media (max-width: 640px) {
  .ab-grid { grid-template-columns: repeat(3, 1fr); }
  .persona-grid { grid-template-columns: 1fr; }
  .sk-list { columns: 1; }
  .slot-grid, .looks { grid-template-columns: repeat(2, 1fr); }
  .atk-row { grid-template-columns: 1fr 56px auto auto auto; }
  .atk-dmg { grid-column: 1 / -1; grid-row: 2; }
  .sheet-id-row { flex-wrap: wrap; }
  .lss-abilities { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- анимация важного броска ---------- */
.roll-stage {
  position: fixed; inset: 0; z-index: 800;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(20, 10, 40, 0.55), rgba(3, 2, 6, 0.8));
  animation: fade 0.3s ease-out;
  cursor: pointer;
  transition: opacity 0.35s;
}
.roll-stage.out { opacity: 0; }
.roll-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  padding: 38px 36px 30px;
  text-align: center;
  color: #efe3c6;
  border-radius: 46% 46% 30px 30px / 90px 90px 30px 30px;
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(ellipse at 50% 60%, #2a1c3e 0%, #150f1f 55%, #0c0911 100%);
  border: 2px solid #8a6034;
  box-shadow:
    0 0 0 6px #0f0b14,
    0 0 0 7px rgba(154, 106, 53, 0.6),
    0 40px 100px rgba(0, 0, 0, 0.75),
    inset 0 0 60px rgba(0, 0, 0, 0.6);
  animation: card-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.roll-card::before {
  content: ''; position: absolute; inset: 10px;
  border-radius: inherit;
  border: 1px solid rgba(184, 134, 47, 0.45);
  pointer-events: none;
}
@keyframes card-in { from { opacity: 0; transform: scale(0.85) translateY(20px); } }
.corner { position: absolute; width: 64px; height: 64px; color: #b8862f; pointer-events: none; }
.corner-tl { top: -10px; left: -10px; }
.corner-tr { top: -10px; right: -10px; transform: scaleX(-1); }
.corner-bl { bottom: -10px; left: -10px; transform: scaleY(-1); }
.corner-br { bottom: -10px; right: -10px; transform: scale(-1, -1); }
.roll-kicker { font: 600 15px var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: #efe3c6; }
.roll-who { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font: 600 22px var(--display); color: var(--gold-3); }
.roll-label { font-style: italic; color: #d9cba6; margin-top: 2px; }
.roll-expr { font: 600 14px ui-monospace, Consolas, monospace; color: var(--violet-2); margin-top: 4px; }
.tray-wrap { position: relative; margin: 18px -12px 10px; }
.braid {
  position: absolute; left: -24px; right: -24px; top: 50%; height: 16px; transform: translateY(-50%);
  background:
    repeating-linear-gradient(60deg, #c4935a 0 3px, #6b4524 3px 7px, #d9a96b 7px 9px, #6b4524 9px 12px),
    #8a6034;
  border-top: 1px solid #e0b880;
  border-bottom: 1px solid #3d2612;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  border-radius: 3px;
}
.braid::before, .braid::after { content: '◆'; position: absolute; top: 50%; transform: translateY(-50%); color: #e0b880; font-size: 16px; }
.braid::before { left: -4px; }
.braid::after { right: -4px; }
.tray {
  position: relative;
  margin: 0 auto;
  width: 92%;
  min-height: 130px;
  border-radius: 26px;
  background: radial-gradient(ellipse at 50% 40%, #2c2040, #120c1c 75%);
  border: 1px solid rgba(184, 134, 47, 0.55);
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 -2px 0 rgba(232, 193, 90, 0.08), 0 6px 20px rgba(0, 0, 0, 0.5);
  overflow: visible;
}
.die { position: absolute; will-change: transform; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6)); }
.die svg { width: 100%; height: 100%; display: block; }
.die.landed.crit { filter: drop-shadow(0 0 16px rgba(247, 220, 134, 0.9)); animation: glow 1.4s ease-in-out infinite alternate; }
.die.landed.fail { filter: drop-shadow(0 0 14px rgba(224, 100, 95, 0.8)); }
@keyframes glow { to { filter: drop-shadow(0 0 26px rgba(247, 220, 134, 1)); } }
.die-shadow { position: absolute; height: 12px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0, 0, 0, 0.7), transparent 70%); }
.roll-total {
  font: 700 64px/1 var(--display);
  color: #fff;
  text-shadow: 0 0 24px rgba(184, 148, 255, 0.5), 0 2px 0 #000;
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.35s, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  margin-top: 6px;
}
.roll-card.revealed .roll-total { opacity: 1; transform: none; }
.roll-card.is-crit .roll-total { color: #fff1b8; text-shadow: 0 0 30px rgba(247, 220, 134, 0.9); }
.roll-card.is-fail .roll-total { color: #ffc2bd; text-shadow: 0 0 30px rgba(224, 100, 95, 0.8); }
.roll-verdict { font: 600 16px var(--display); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 4px; opacity: 0; transition: opacity 0.4s 0.2s; }
.roll-verdict.crit { color: var(--gold); }
.roll-verdict.fail { color: var(--danger); }
.roll-card.revealed .roll-verdict { opacity: 1; }
.roll-breakdown { margin-top: 10px; color: #bfb3cf; font-size: 15px; opacity: 0; transition: opacity 0.4s 0.15s; }
.roll-card.revealed .roll-breakdown { opacity: 1; }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .lobby-header { padding: 10px 16px; gap: 14px; flex-wrap: wrap; }
  .brand span, .user-chip span:last-child { display: none; }
  .lobby-content { padding: 20px 16px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; max-width: 240px; }
  .character-grid { grid-template-columns: 1fr; }
  .log-panel { top: auto; height: 46vh; left: 8px; right: 8px; bottom: 8px; width: auto; }
  .map-help { display: none; }
  .map-tools { bottom: calc(46vh + 20px); }
  .map-empty { left: 50%; top: 25%; }
  .dm-stack { width: calc(100vw - 28px); max-height: 40vh; z-index: 6; }
  .combat-bar { left: 8px; right: 8px; top: 64px; }
  .round-banner strong { font-size: 36px; }
  .no-scene-box { left: 50%; top: 25%; }
  .scene-title { top: 70px; max-width: 90vw; }
  .scene-title h1 { font-size: 24px; }
  .cast, .narrative .cast { top: auto; bottom: calc(30vh + 124px); right: 8px; width: min(300px, calc(100vw - 16px)); max-height: 30vh; }
  .cast-card { right: 0; top: auto; bottom: calc(100% + 8px); width: 200px; }
  .cast-portrait { width: 44px; height: 44px; }
  .scene-side-tools { right: 8px; top: 70px; }
  .log-panel.compact { left: 8px; right: 8px; width: auto; height: 30vh; }
  .roll-dock { bottom: calc(30vh + 22px); flex-direction: row; }
  .roll-dock .dice-btn { width: 64px; height: 64px; }
  .roll-dock .dice-pop { width: min(340px, calc(100vw - 16px)); }
  .kind-cards { grid-template-columns: 1fr; }
  .scene-row { flex-wrap: wrap; }
  .npc-create { flex-direction: column; align-items: center; }
}
@media (max-width: 480px) {
  .character-card { flex-direction: column; align-items: center; }
  .section-head.row { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* --- блок характеристик NPC --- */
.icon-btn.on { border-color: var(--gold); color: var(--gold-3); }
.npc-stats .row.wrap { flex-wrap: wrap; gap: 14px; }
.npc-stats input.num { width: 72px; }
.npc-abilities { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.npc-ability { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; }
.npc-ability span { font: 600 11px var(--display); letter-spacing: 0.08em; color: var(--gold-3); }
.npc-ability input.num { width: 56px; text-align: center; }
.npc-ability small { min-height: 1em; }
.npc-attack input.num { width: 64px; }
.npc-attack input:not(.num):not(.grow) { width: 170px; }
.npc-stats textarea { resize: vertical; }
@media (max-width: 560px) {
  .npc-abilities { grid-template-columns: repeat(3, 1fr); }
  .npc-attack { flex-wrap: wrap; }
}
/* окно «Хиты» у фишки */
.npc-hp { display: flex; flex-direction: column; gap: 6px; }
.npc-hp-bar { height: 10px; border-radius: 99px; background: #1d1430; border: 1px solid var(--line); overflow: hidden; }
.npc-hp-bar i { display: block; height: 100%; transition: width 0.2s; }
.npc-hp-bar i.ok { background: #5fb85a; }
.npc-hp-bar i.mid { background: #d8b040; }
.npc-hp-bar i.low { background: #d0483a; }
.npc-hp-num { display: flex; align-items: center; gap: 8px; color: var(--muted, #b9aecd); }
.npc-hp-num b { font: 600 22px var(--display); color: var(--gold-3); }
.cond-pop .npc-hp-amount { width: 70px; }
.npc-facts { color: #d9cfe8; }
.npc-mods { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.npc-mod { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 8px; border: 1px solid var(--line); background: #1a1128; color: #f3e6c4; font: 600 13px var(--serif); cursor: pointer; }
.npc-mod:hover { border-color: var(--gold); }
.npc-mod small { font: 600 9px var(--display); letter-spacing: 0.06em; color: var(--gold-3); }
.npc-roll span { font-weight: 600; }
.npc-traits { white-space: pre-wrap; max-height: 120px; overflow: auto; }

/* подсказка с правилами состояния */
.cond-tip { --c: #999; position: fixed; z-index: 60; width: 300px; padding: 10px 12px; border-radius: 12px; background: rgba(14, 9, 24, 0.98); border: 1px solid var(--c); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6); pointer-events: none; font: 13px/1.4 var(--serif); color: #e6dcf2; }
.cond-tip-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cond-tip-head .cond-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--c) 40%, #140d20); opacity: 1; }
.cond-tip-head strong { font: 600 15px var(--display); color: var(--c); }
.cond-tip ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; }
.cond-tip-levels { list-style: none; margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.cond-tip-levels li { display: flex; gap: 8px; color: var(--muted); }
.cond-tip-levels li b { width: 14px; text-align: center; color: var(--gold-2); }
.cond-tip-levels li.on { color: #fff; }
.cond-tip-levels li.on b { color: var(--c); }

/* --- слои карты (ДМ) --- */
.layers-bar { position: absolute; z-index: 7; top: 74px; left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 420px)); min-width: 320px; padding: 10px 12px; border-radius: 14px; background: rgba(14, 9, 24, 0.95); border: 1px solid var(--gold); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 8px; animation: pop-in 0.15s ease-out; }
.layers-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.layers-title { font: 600 14px var(--display); color: var(--gold-3); margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong, var(--line)); border-radius: 9px; overflow: hidden; }
.seg button { padding: 5px 12px; border: 0; background: transparent; color: var(--muted); font: 600 13px var(--serif); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: rgba(232, 193, 90, 0.18); color: var(--gold-3); }
.btn.on { border-color: var(--gold); color: var(--gold-3); }
@media (max-width: 900px) {
  .layers-bar { width: calc(100% - 24px); min-width: 0; top: 64px; }
}

.map-buttons { flex-wrap: wrap; }
.fog-bar { border-color: #8c7bb0; }

/* --- разделённый отряд --- */
.preview-bar.split { border-color: #5fb8a8; }
.preview-bar.split .preview-title { color: #8fe0d0; }
.preview-bar .row.wrap { flex-wrap: wrap; }
.away-row { align-items: center; }
.badge.split { color: #8fe0d0; border-color: rgba(95, 184, 168, 0.5); }
.scene-row.split { box-shadow: inset 3px 0 0 #5fb8a8; }
.scene-players { color: #8fe0d0; font-size: 12px; }
.move-list { max-height: 50vh; overflow: auto; }
.move-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.move-row:hover { border-color: var(--gold); }
.move-row.here { opacity: 0.55; cursor: default; }
.move-row .online-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #5fd068; vertical-align: middle; }

/* --- заставка-переход «Врата» (js/gate.js) --- */
.gate { position: fixed; inset: 0; z-index: 9000; visibility: hidden; pointer-events: none; overflow: hidden; }
.gate.shown { visibility: visible; pointer-events: auto; }
.gate-door {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  transition: transform 0.72s cubic-bezier(0.76, 0, 0.24, 1);
  background:
    radial-gradient(ellipse 60% 45% at var(--seam) 52%, rgba(140, 90, 230, 0.28), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 120px),
    linear-gradient(180deg, #22153a 0%, #120b20 55%, #0b0714 100%);
}
.gate-door.left { left: 0; --seam: 100%; transform: translateX(-102%); box-shadow: inset -3px 0 0 #b89040, inset -9px 0 18px rgba(232, 193, 90, 0.18), 12px 0 40px rgba(0, 0, 0, 0.6); }
.gate-door.right { right: 0; --seam: 0%; transform: translateX(102%); box-shadow: inset 3px 0 0 #b89040, inset 9px 0 18px rgba(232, 193, 90, 0.18), -12px 0 40px rgba(0, 0, 0, 0.6); }
.gate.closing .gate-door, .gate.closed .gate-door { transform: translateX(0); }
.gate.opening .gate-door { transition-duration: 0.85s; transition-delay: 0.12s; }
/* половинки арки: вместе образуют свод с вершиной на шве */
.gate-arch { position: absolute; top: 9vh; bottom: -2px; border: 2px solid rgba(232, 193, 90, 0.55); border-bottom: 0; }
.gate-arch::after { content: ''; position: absolute; inset: 14px 0 0 0; border: 1px solid rgba(232, 193, 90, 0.28); border-bottom: 0; }
.left .gate-arch { left: 14%; right: 0; border-right: 0; border-top-left-radius: 100% 62%; }
.left .gate-arch::after { left: 14px; border-right: 0; border-top-left-radius: 100% 62%; }
.right .gate-arch { right: 14%; left: 0; border-left: 0; border-top-right-radius: 100% 62%; }
.right .gate-arch::after { right: 14px; border-left: 0; border-top-right-radius: 100% 62%; }
/* заклёпки вдоль шва */
.gate-studs { position: absolute; top: 0; bottom: 0; width: 10px; background: radial-gradient(circle, #d8b45a 0 2.4px, rgba(0, 0, 0, 0.5) 3px, transparent 3.6px) center / 10px 46px repeat-y; opacity: 0.75; }
.left .gate-studs { right: 16px; }
.right .gate-studs { left: 16px; }
/* полоска света на шве: тлеет, пока врата закрыты, и вспыхивает при открытии */
.gate-seam { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; opacity: 0;
  background: linear-gradient(180deg, transparent, #ffe9a8 20%, #fff6d8 50%, #ffe9a8 80%, transparent);
  box-shadow: 0 0 18px 4px rgba(255, 220, 140, 0.55); transition: opacity 0.3s; }
.gate.closed .gate-seam { opacity: 0.55; animation: seam-breathe 1.8s ease-in-out infinite; }
.gate.opening .gate-seam { animation: seam-flash 0.6s ease-out forwards; }
@keyframes seam-breathe { 50% { opacity: 0.9; } }
@keyframes seam-flash { 0% { opacity: 1; transform: scaleX(1); } 30% { opacity: 1; transform: scaleX(14); } 100% { opacity: 0; transform: scaleX(40); } }
/* печать с логотипом */
.gate-seal { position: absolute; left: 50%; top: 50%; width: min(320px, 52vmin); aspect-ratio: 1; display: grid; place-items: center;
  transform: translate(-50%, -50%) scale(0.82); opacity: 0; transition: opacity 0.4s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gate.closing .gate-seal { transition-delay: 0.38s; }
.gate.closing .gate-seal, .gate.closed .gate-seal { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.gate.opening .gate-seal { opacity: 0; transform: translate(-50%, -50%) scale(1.18); transition-duration: 0.35s; }
.gate-seal img { position: relative; width: 82%; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.7)); }
.gate-glow { position: absolute; inset: -18%; border-radius: 50%; background: radial-gradient(circle, rgba(150, 100, 255, 0.45), rgba(232, 193, 90, 0.12) 45%, transparent 68%); animation: gate-pulse 2.2s ease-in-out infinite; }
.gate-ring { position: absolute; inset: 2%; border-radius: 50%; border: 1.5px dashed rgba(232, 193, 90, 0.45); animation: gate-spin 18s linear infinite; }
.gate-ring::after { content: ''; position: absolute; inset: 7%; border-radius: 50%; border: 1px solid rgba(232, 193, 90, 0.22); }
@keyframes gate-pulse { 50% { transform: scale(1.08); opacity: 0.75; } }
@keyframes gate-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .gate-door, .gate.opening .gate-door { transition: none; transform: none; }
  .gate { opacity: 0; transition: opacity 0.18s; }
  .gate.closing, .gate.closed { opacity: 1; }
  .gate.opening { opacity: 0; }
  .gate-glow, .gate-ring, .gate.closed .gate-seam { animation: none; }
  .gate-seal, .gate.opening .gate-seal { transition: none; }
}
/* шов уходит под печать — не режет логотип */
.gate-seam { -webkit-mask-image: linear-gradient(180deg, #000 0 30%, transparent 40% 60%, #000 70%); mask-image: linear-gradient(180deg, #000 0 30%, transparent 40% 60%, #000 70%); }
.gate.opening .gate-seam { -webkit-mask-image: none; mask-image: none; }
.gate-glow { background: radial-gradient(circle, rgba(16, 10, 28, 0.94) 0 33%, rgba(120, 80, 220, 0.42) 45%, rgba(232, 193, 90, 0.1) 58%, transparent 70%); }
.gate-glow { background: radial-gradient(circle closest-side, rgba(16, 10, 28, 0.96) 0 60%, rgba(120, 80, 220, 0.42) 74%, rgba(232, 193, 90, 0.1) 86%, transparent 100%); }

/* --- карта мира --- */
.world-overlay { position: fixed; inset: 0; z-index: 950; display: flex; flex-direction: column; background: #0c0813; animation: fade 0.2s; }
.world-overlay[hidden] { display: none; }
.world-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: rgba(14, 9, 24, 0.96); border-bottom: 1px solid var(--line); z-index: 2; }
.world-title { display: flex; flex-direction: column; gap: 2px; margin-right: 6px; }
.world-title strong { font: 600 17px var(--display); color: var(--gold-3); }
.world-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
.world-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.world-box { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.world-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.world-canvas.grabbing { cursor: grabbing; }
.world-canvas.over-item { cursor: pointer; }
.world-canvas[data-mode='ruler'], .world-canvas[data-mode='calibrate'], .world-canvas[data-mode='addPoi'] { cursor: crosshair; }
.world-empty { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; text-align: center; pointer-events: none; }
.world-empty > div { pointer-events: auto; padding: 24px 28px; border-radius: 16px; background: rgba(14, 9, 24, 0.9); border: 1px solid var(--line); max-width: 420px; }
.world-empty[hidden] { display: none; }
.world-tip, .world-pop { position: absolute; z-index: 3; border-radius: 12px; background: rgba(14, 9, 24, 0.97); border: 1px solid var(--gold); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6); }
.world-tip { max-width: 320px; padding: 10px 12px; pointer-events: none; display: flex; flex-direction: column; gap: 6px; font: 14px/1.4 var(--serif); color: #e6dcf2; }
.world-tip-head { display: flex; align-items: center; gap: 10px; }
.world-tip-head > div { display: flex; flex-direction: column; }
.world-tip-head strong { font: 600 16px var(--display); color: var(--gold-3); }
.world-tip-icon { font-size: 26px; line-height: 1; }
.world-tip-info { white-space: pre-wrap; }
.world-tip-route { font-size: 13px; color: #ffe9a8; border-top: 1px solid var(--line); padding-top: 6px; }
.world-pop { width: 300px; padding: 12px; }
.world-pop textarea { resize: vertical; }
.world-pop .num { width: 100px; }
.world-measure { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; display: flex; gap: 14px 22px; align-items: center; flex-wrap: wrap; justify-content: center;
  padding: 10px 16px; border-radius: 14px; background: rgba(14, 9, 24, 0.94); border: 1px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); max-width: calc(100% - 32px); }
.world-measure > div { display: flex; flex-direction: column; align-items: center; }
.world-measure-total strong { font: 700 20px var(--display); color: #ffe9a8; }
.world-pace strong { font: 600 15px var(--serif); color: #f3e6c4; }
.world-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 3; padding: 6px 14px; border-radius: 99px; background: rgba(14, 9, 24, 0.9); border: 1px solid var(--line); font-size: 13px; color: var(--muted); pointer-events: none; text-align: center; max-width: calc(100% - 32px); }
@media (max-width: 700px) {
  .world-head { padding: 8px; }
  .world-hint { top: auto; bottom: 110px; }
}
.world-measure { width: max-content; }

/* --- скрытые броски --- */
.roll-flags { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.roll-flags .important small { margin-left: 2px; }
.roll-dock .roll-flags { gap: 8px; }
.hidden-roll input:checked + .check-box { background: linear-gradient(180deg, #b79cff, #6a4bc4); border-color: #c9b6ff; }
.hidden-roll input:checked + .check-box::after { color: #fff; }
.badge.secret { color: #c9b6ff; border-color: rgba(185, 160, 255, 0.45); }
.msg.is-hidden { border-style: dashed; border-color: rgba(185, 160, 255, 0.45); }
.roll-line.secret .roll-text { color: var(--muted); font-style: italic; }
.roll-line.secret .roll-result { color: var(--muted); }

/* --- урон по клику из лога (ДМ) --- */
button.roll-result.clickable { cursor: pointer; transition: transform 0.1s, box-shadow 0.15s; }
button.roll-result.clickable:hover { transform: scale(1.06); box-shadow: 0 0 0 2px rgba(224, 100, 95, 0.55), 0 0 14px rgba(224, 100, 95, 0.35); }
.dmg-pop { position: fixed; z-index: 960; width: 330px; max-height: calc(100vh - 16px); overflow: auto; padding: 12px; border-radius: 14px; background: rgba(14, 9, 24, 0.98); border: 1px solid #c65050; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.65); display: flex; flex-direction: column; gap: 10px; animation: pop-in 0.15s ease-out; }
.dmg-head { display: flex; align-items: center; gap: 10px; }
.dmg-head strong { font: 700 20px var(--display); color: #ffd7d3; }
.dmg-pop .num { width: 76px; margin-left: auto; }
.dmg-list { display: flex; flex-direction: column; gap: 4px; }
.dmg-group { margin-top: 4px; font: 600 11px var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.dmg-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.dmg-row:hover { border-color: var(--line); }
.dmg-row.is-hidden { opacity: 0.7; }
.dmg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmg-hp { font: 600 13px var(--serif); color: #b9e7b0; }
.dmg-hp.down, .dmg-after.down { color: #ff9f98; }
.dmg-after { font: 600 13px var(--serif); color: #ffe9a8; min-width: 38px; text-align: right; }

/* --- рисование на карте --- */
.draw-pop .seg { align-self: flex-start; }
.map-canvas[data-draw='pen'] { cursor: crosshair; }
.map-canvas[data-draw='erase'] { cursor: cell; }
.map-tools .icon-btn.on { border-color: var(--gold); background: rgba(232, 193, 90, 0.16); }

/* --- версия портала --- */
.app-version { position: fixed; right: 6px; bottom: 3px; z-index: 9500; font: 10px/1 var(--serif); letter-spacing: 0.04em; color: #e8dcc0; opacity: 0.32; pointer-events: none; user-select: none; }

/* --- карты мест --- */
.world-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.world-crumbs strong { font: 600 17px var(--display); color: var(--gold-3); }
.world-crumbs .crumb { padding: 0; border: 0; background: none; font: 600 15px var(--display); color: var(--muted); cursor: pointer; }
.world-crumbs .crumb:hover { color: var(--gold-3); text-decoration: underline; }
.crumb-sep { color: var(--muted); margin: 0 2px; }
.world-tip-map { font-size: 13px; color: #9fd8ff; border-top: 1px solid var(--line); padding-top: 6px; }
.world-poi-map { padding: 6px 0 2px; border-bottom: 1px solid var(--line); }

/* --- книга заклинаний --- */
.spellbook-back { position: fixed; inset: 0; z-index: 940; display: grid; place-items: center; padding: 16px; background: rgba(5, 3, 10, 0.72); backdrop-filter: blur(3px); animation: fade 0.2s; }
/* окно поверх книги заклинаний или журнала (настройки Notion, подтверждения) */
.spellbook-back:not([hidden]) ~ .modal-back { z-index: 950; }
.spellbook { width: min(1100px, 100%); height: min(820px, 100%); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.spellbook-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.spellbook-head h2 { margin: 0; font: 600 20px var(--display); color: var(--gold-3); white-space: nowrap; }
.spell-search { flex: 1; min-width: 120px; }
.spellbook-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.spell-levels button { padding: 4px 9px; }
.spellbook-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(240px, 340px) 1fr; }
.spell-list { overflow-y: auto; border-right: 1px solid var(--line); padding: 6px; scrollbar-width: thin; }
.spell-group { position: sticky; top: -6px; z-index: 1; padding: 8px 8px 4px; background: rgba(14, 9, 24, 0.97); font: 600 11px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2); }
.spell-row { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 8px; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text, #e6dcf2); text-align: left; cursor: pointer; font: 14px var(--serif); }
.spell-row small { grid-column: 1 / -1; font-size: 11px; }
.spell-row:hover { border-color: var(--line); }
.spell-row.on { border-color: var(--gold); background: rgba(232, 193, 90, 0.08); }
.spell-row.owned .spell-row-name { color: #b9e7b0; }
.spell-row-tags { display: flex; gap: 4px; }
.spell-row-tags i, .spell-chip i { font: 600 10px var(--display); font-style: normal; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.spell-row-tags i.phb { color: #c9b6ff; }
.spell-row-tags i.owned { color: #b9e7b0; border-color: rgba(127, 199, 122, 0.5); }
.spell-detail { overflow-y: auto; padding: 16px 20px; scrollbar-width: thin; display: flex; flex-direction: column; gap: 14px; }
.spell-placeholder { margin: auto; }
.spell-add { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; bottom: -16px; padding: 10px 0; background: linear-gradient(transparent, rgba(14, 9, 24, 0.98) 30%); }
.spellbook-foot { padding: 6px 16px; font-size: 11px; border-top: 1px solid var(--line); }
.spell-empty { padding: 20px; text-align: center; }
@media (max-width: 760px) {
  .spellbook-body { grid-template-columns: 1fr; grid-template-rows: 40% 1fr; }
  .spell-list { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* карточка заклинания */
.spell-card { display: flex; flex-direction: column; gap: 8px; font: 15px/1.5 var(--serif); color: #e6dcf2; }
.spell-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.spell-card-head h3 { margin: 0; font: 600 22px var(--display); color: var(--gold-3); }
.spell-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-style: italic; color: #d9cfe8; }
.spell-tag { font: 600 11px var(--display); font-style: normal; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line); }
.spell-tag.conc { color: #9fd8ff; border-color: rgba(127, 208, 255, 0.45); }
.spell-tag.ritual { color: #b9e7b0; border-color: rgba(127, 199, 122, 0.45); }
.spell-tag.phb { color: #c9b6ff; border-color: rgba(185, 160, 255, 0.45); }
.spell-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; padding: 8px 10px; border-radius: 10px; background: rgba(8, 5, 14, 0.5); border: 1px solid var(--line); }
.spell-facts dt { color: var(--gold-2); font-weight: 600; }
.spell-facts dd { margin: 0; }
.spell-mech { display: flex; flex-wrap: wrap; gap: 6px; }
.spell-mech span { font-size: 13px; padding: 2px 8px; border-radius: 6px; background: rgba(224, 100, 95, 0.12); border: 1px solid rgba(224, 100, 95, 0.35); color: #ffd7d3; }
.spell-desc p { margin: 0 0 8px; }
.spell-desc ul { margin: 0 0 8px; padding-left: 20px; }
.spell-higher { margin-top: 6px; }
.spell-higher p { display: inline; }
.spell-table { border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; }
.spell-table th, .spell-table td { border: 1px solid var(--line); padding: 3px 8px; text-align: left; }
.spell-table th { color: var(--gold-2); }
.spell-nodesc { font-style: italic; }
.spell-card.compact { font-size: 13.5px; gap: 6px; }
.spell-card.compact h3 { font-size: 17px; }
.spell-card.compact .spell-facts { font-size: 12.5px; padding: 6px 8px; }

/* заклинания в листе */
.spells-tools { align-items: center; flex-wrap: wrap; }
.spell-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.spell-chips.empty { padding: 6px 0; }
.spell-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-strong, var(--line)); background: rgba(40, 26, 62, 0.6); color: #f3e6c4; font: 14px var(--serif); cursor: pointer; }
.spell-chip:hover { border-color: var(--gold); background: rgba(62, 40, 96, 0.8); }
.spell-chip.rolls { border-color: rgba(224, 100, 95, 0.55); }
.spell-chip.rolls::before { content: '🎲'; font-size: 11px; }
.spell-chip.unknown { cursor: default; background: none; color: var(--muted); border-style: dashed; }
.spell-tip { position: fixed; z-index: 970; width: min(420px, calc(100vw - 16px)); max-height: 70vh; overflow: hidden; padding: 12px 14px; border-radius: 12px; background: rgba(14, 9, 24, 0.98); border: 1px solid var(--gold); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.65); pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent); }
.spell-tip-hint { margin-top: 6px; font-size: 12px; color: #ffd7d3; }
.cast-pop { position: fixed; z-index: 975; width: 280px; padding: 12px; border-radius: 12px; background: rgba(14, 9, 24, 0.98); border: 1px solid #c65050; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.65); display: flex; flex-direction: column; gap: 8px; animation: pop-in 0.15s ease-out; }
.cast-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cast-pop-head strong { font: 600 16px var(--display); color: var(--gold-3); }
.cast-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.cast-slots button { display: flex; flex-direction: column; align-items: center; min-width: 42px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: #1a1128; color: #f3e6c4; cursor: pointer; }
.cast-slots button b { font: 700 15px var(--display); }
.cast-slots button small { font-size: 10px; color: var(--muted); }
.cast-slots button.on { border-color: var(--gold); background: rgba(232, 193, 90, 0.16); }
.cast-slots button.empty { opacity: 0.5; }

/* --- предметы с эффектами в листе --- */
.fx-badge { margin-left: 6px; padding: 1px 6px; border-radius: 6px; font: 700 12px var(--serif); color: #1e1405; background: linear-gradient(180deg, #f6dd8c, #c8973a); cursor: help; white-space: nowrap; }
.fx-badge[hidden] { display: none; }
.ab-card .fx-badge { margin: 2px auto 0; display: inline-block; }
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.45); }
.item-row.off { opacity: 0.55; }
.item-head { display: flex; align-items: center; gap: 8px; }
.item-name { flex: 1; font-weight: 600; }
.item-mods { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item-mod { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 99px; font-size: 13px; color: #ffe9a8; border: 1px solid rgba(232, 193, 90, 0.45); background: rgba(232, 193, 90, 0.08); }
.item-mod button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 4px; }
.item-mod button:hover { color: #ff9f98; }
.item-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item-add select { max-width: 220px; }
.item-add .sh-num { width: 64px; }
.item-notes { font-size: 13px; }

/* --- журнал кампании --- */
.journal-back[hidden] { display: none; }
.journal-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #ff6b5e; box-shadow: 0 0 6px rgba(255, 107, 94, 0.8); vertical-align: middle; }
.journal-dot[hidden] { display: none; }
.journal-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.journal-tabs button { padding: 6px 14px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--muted); font: 600 14px var(--serif); cursor: pointer; }
.journal-tabs button:hover { color: var(--gold-3); }
.journal-tabs button.on { border-color: var(--gold); color: var(--gold-3); background: rgba(232, 193, 90, 0.1); }
.journal-tabs small { color: var(--muted); font-weight: 400; }
.journal-search { flex: 1; min-width: 120px; }
.journal-new { width: 100%; margin-bottom: 6px; }
.journal-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text, #e6dcf2); text-align: left; cursor: pointer; font: 14px var(--serif); }
.journal-row:hover { border-color: var(--line); }
.journal-row.on { border-color: var(--gold); background: rgba(232, 193, 90, 0.08); }
.journal-row.is-hidden { opacity: 0.65; }
.journal-row .grow { display: flex; flex-direction: column; min-width: 0; }
.journal-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-row-tags { display: flex; gap: 4px; font-size: 12px; color: var(--muted); }
.journal-row-tags i { font-style: normal; }
.j-badge { font: 600 11px var(--display); letter-spacing: 0.04em; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); }
.j-badge.q-active { color: #ffe9a8; border-color: rgba(232, 193, 90, 0.5); }
.j-badge.q-done { color: #b9e7b0; border-color: rgba(127, 199, 122, 0.5); }
.j-badge.q-failed { color: #ff9f98; border-color: rgba(224, 100, 95, 0.5); }
.j-badge.n-ally { color: #b9e7b0; border-color: rgba(127, 199, 122, 0.5); }
.j-badge.n-enemy { color: #ff9f98; border-color: rgba(224, 100, 95, 0.5); }
.j-badge.n-neutral { color: #9fd8ff; border-color: rgba(127, 208, 255, 0.45); }
.j-badge.n-unknown { color: var(--muted); }
.journal-view { display: flex; flex-direction: column; gap: 14px; }
.journal-view-head { display: flex; gap: 14px; align-items: flex-start; }
.journal-view-head h3 { margin: 0 0 4px; font: 600 22px var(--display); color: var(--gold-3); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.journal-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.journal-portrait { width: 84px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--gold); }
.journal-body { white-space: pre-wrap; font: 15px/1.6 var(--serif); color: #e6dcf2; }
.journal-comments { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.journal-comments h4 { margin: 0; }
.journal-comment { padding: 8px 10px; border-radius: 10px; background: rgba(8, 5, 14, 0.5); border: 1px solid var(--line); }
.journal-comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.journal-comment-head strong { color: var(--gold-3); }
.journal-comment-head time { margin-left: auto; font-size: 12px; }
.journal-comment-text { white-space: pre-wrap; font-size: 14px; margin-top: 2px; }
.journal-comment-form { display: flex; gap: 8px; align-items: flex-end; }
.journal-comment-input { flex: 1; resize: vertical; }
.journal-edit textarea { resize: vertical; }

/* --- пресеты бросков --- */
.dice-tabs { display: flex; margin-bottom: 2px; }
.dice-tabs button { flex: 1; padding: 6px 8px; }
.dice-view, .dice-presets { display: flex; flex-direction: column; gap: 12px; }
.dice-view[hidden], .dice-presets[hidden] { display: none; }
.dice-presets { max-height: 380px; overflow-y: auto; scrollbar-width: thin; }
.preset-row { display: flex; align-items: center; gap: 6px; }
.preset-roll { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.55); color: #f3e6c4; cursor: pointer; text-align: left; }
.preset-roll:hover { border-color: var(--gold); background: rgba(62, 40, 96, 0.6); }
.preset-roll strong { font: 600 15px var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.preset-roll small { font: 600 13px ui-monospace, Consolas, monospace; color: var(--violet-2); }
.preset-empty { margin: 4px 0; }
.preset-title { font: 600 15px var(--display); color: var(--gold-3); }
.preset-groups { display: flex; flex-direction: column; gap: 6px; }
.preset-group { display: flex; align-items: center; gap: 8px; }
.preset-group .mod-input { width: 64px; }
.preset-group select { flex: 1; }

.journal-notion { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.journal-notion .btn { flex: 1; }

/* цвет рамки фишки игрока */
.token-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.token-swatch { width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer; background: #120c1c; border: 5px solid var(--r1); box-shadow: 0 0 0 1px var(--r2), inset 0 0 0 1px var(--r0); transition: transform 0.12s; }
.token-swatch:hover { transform: scale(1.1); }
.token-swatch.on { outline: 2px solid var(--gold-3); outline-offset: 3px; }
.cond-pop .token-swatches { margin: 6px 0; }

/* --- бестиарий и конструктор столкновений --- */
.best-tabs { flex: none; }
.bestiary .spellbook-head .spell-search { flex: 1; }
.bestiary .spellbook-head .spell-search[hidden] { display: none; }
.mon-card { display: flex; flex-direction: column; gap: 6px; font: 15px/1.5 var(--serif); color: #e6dcf2; }
.mon-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mon-head h3 { margin: 0; font: 600 22px var(--display); color: var(--gold-3); }
.mon-kind { margin: -4px 0 4px; font-style: italic; color: var(--muted); }
.mon-facts { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid rgba(232, 193, 90, 0.3); }
.mon-line strong { color: var(--gold-3); font-weight: 600; }
.mon-abilities { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 8px 0; border-top: 1px solid rgba(232, 193, 90, 0.3); text-align: center; }
.mon-abilities b { display: block; font: 600 12px var(--display); color: var(--gold-3); }
.mon-abilities span { font-size: 14px; white-space: nowrap; }
.mon-section { margin: 10px 0 2px; padding-bottom: 3px; border-bottom: 1px solid rgba(232, 193, 90, 0.45); font: 600 17px var(--display); color: var(--gold-3); }
.mon-entry p { margin: 0 0 4px; }
.mon-entry ul { margin: 0 0 4px; padding-left: 20px; }
.mon-entry strong { font-weight: 700; color: #f3e6c4; }
.mon-rolls { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.mon-roll { padding: 0 7px; border-radius: 99px; border: 1px solid var(--line-strong, var(--line)); background: rgba(155, 107, 255, 0.12); color: var(--violet-2); font: 600 12px var(--serif); cursor: pointer; line-height: 20px; }
.mon-roll:hover { border-color: var(--violet-2); color: #fff; }
.mon-modal { max-height: 72vh; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.best-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.45); }
.best-actions .num { width: 64px; }
.best-saved .spell-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.best-enc { gap: 8px; }
.best-foe { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(8, 5, 14, 0.4); }
.best-foe small { font-size: 12px; }
.best-cr { font: 600 12px var(--display); color: var(--muted); white-space: nowrap; }
.best-count { display: flex; align-items: center; gap: 6px; }
.best-count b { min-width: 20px; text-align: center; }
.best-xp { min-width: 64px; text-align: right; font-weight: 600; color: var(--gold-3); }
.best-party { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.best-level { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; border-radius: 99px; border: 1px solid rgba(28, 143, 122, 0.6); }
.best-level .num { width: 48px; padding: 2px 4px; }
.best-verdict { font: 600 22px var(--display); }
.best-verdict.trivial { color: var(--muted); }
.best-verdict.easy { color: #7fc77a; }
.best-verdict.medium { color: #e0c060; }
.best-verdict.hard { color: #e08a50; }
.best-verdict.deadly { color: #ff6b5e; }
.best-scale { position: relative; height: 14px; margin: 18px 0 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); }
.best-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--muted); transition: width 0.25s; }
.best-fill.easy { background: #5fb85a; } .best-fill.medium { background: #d8b040; } .best-fill.hard { background: #d8783a; } .best-fill.deadly { background: #d0483a; }
.best-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: rgba(255, 255, 255, 0.5); z-index: 1; }
.best-mark small { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.best-sum { display: flex; flex-direction: column; gap: 2px; }
.best-save { margin-top: 8px; }
.bestiary .spellbook-head > .icon-btn { margin-left: auto; }
