/* Стили игры, часть «game»: игра: очередь ходов, карточки героев, звук, сюжет, мастер, отдых, читы, таланты. Порядок подключения частей (index.html) важен: поздние правила перекрывают ранние. */
/* ── Игра ── */
.game-body { flex: 1; min-height: 0; display: flex; }
.map-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#map-wrap { position: relative; flex: 1; min-height: 0; background: #0f0c09; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#tooltip { position: absolute; pointer-events: none; background: rgba(15, 11, 8, .94); border: 1px solid var(--gold); max-width: 260px; z-index: 5; white-space: pre-line; }
#actionbar { min-height: 64px; padding: 8px 12px; border-top: 1px solid var(--line); background: rgba(20, 16, 12, .95); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ab-btn { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 4px 8px; font-size: 12px; line-height: 1.2; }
.ab-btn .ic { font-size: 20px; }
.ab-btn .key { position: absolute; top: 1px; left: 4px; font-size: 10px; color: var(--muted); }
.ab-btn .cd { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 5px; }
.ab-btn .mp { color: #8fb6ff; font-size: 10.5px; }

/* ── Очередь ходов (как в BG3) ── */
.initiative {
  position: absolute; top: 8px; left: var(--cards-w, 214px); right: 8px; margin: 0 auto; width: fit-content; z-index: 4;
  display: flex; align-items: flex-start; gap: 5px; overflow-x: auto; overflow-y: hidden;
  padding: 14px 10px 6px; 

  border: 1px solid rgba(217,164,65,.45); box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.init-banner { padding: 4px 14px; font-family: var(--font-display); color: var(--gold2); font-size: 16px; }
.init-round { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 46px; height: 46px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.init-round b { font-size: 20px; line-height: 1; }
.init-sep { align-self: center; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: var(--gold2); border: 1px dashed var(--gold); margin: 0 2px; }
.init-p { position: relative; display: flex; flex-direction: column; align-items: center; cursor: var(--cur-hand); transition: transform .2s; }
.init-p:hover { transform: translateY(2px); }
.init-face {
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, #fff 30%), var(--c) 55%, color-mix(in srgb, var(--c) 50%, #000 50%));
  border: 2px solid #4f8fd0; 
}
.init-p.npc .init-face { border-color: #c0453a; }
.init-p.cur .init-face { width: 56px; height: 56px; font-size: 32px; }
.init-p.cur::before { content: '▼'; position: absolute; top: -12px; color: var(--gold2); font-size: 11px; text-shadow: 0 0 6px var(--gold); }
.init-p.down .init-face { filter: grayscale(1) brightness(.6); }
.init-hp { width: 100%; height: 4px; margin-top: 3px; background: #1a1410; border-radius: 2px; overflow: hidden; }
.init-hp i { display: block; height: 100%; background: linear-gradient(90deg, #8a2a22, #e04a3a); }
.init-p:not(.npc) .init-hp i { background: linear-gradient(90deg, #2e7a2a, #5ad15a); }
.init-st { position: absolute; top: -4px; right: -6px; font-size: 11px; background: rgba(0,0,0,.7); border-radius: var(--radius); padding: 0 3px; }
.init-name { position: absolute; top: 100%; margin-top: 4px; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--gold2); text-shadow: 0 1px 3px #000; }
.init-p.cur { margin-bottom: 14px; }
/* таймер хода и «Конец хода» — в очереди ходов */
.initiative.timed { padding-bottom: 32px; }
.init-timer { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); padding: 2px 10px; border-radius: var(--radius); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; background: rgba(0,0,0,.4); border: 1px solid rgba(217,164,65,.4); }
.init-timer.low { color: #fff; background: #b8261c; border-color: #ff7a6a; animation: initTimerLow 1s ease-in-out infinite; }
@keyframes initTimerLow { 50% { transform: translateX(-50%) scale(1.12); box-shadow: 0 0 14px 3px rgba(255,70,50,.85); } }
/* «Конец хода» у очереди: золотой круг со значком, подпись и клавиша — мелко под ним, как «Раунд» слева */
.initiative .init-end {
  align-self: flex-start; position: sticky; right: 0; flex: none; margin-left: 10px; padding: 0; gap: 3px;
  background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--gold2);
}
.initiative .init-end:hover:not(:disabled) { background: none; }
.init-end kbd { font-size: 9px; font-weight: 700; padding: 0 3px; margin-left: 2px; border-radius: 3px; color: var(--gold2); border: 1px solid rgba(217,164,65,.5); }
@keyframes initEndUrge { 50% { box-shadow: 0 0 0 1px #000, 0 0 18px 5px rgba(255,214,100,.95); transform: scale(1.06); } }

/* ── Карточки героев слева (как в BG3) ── */
.party-cards {
  position: absolute; z-index: 4; padding-right: 10px;
  display: flex; flex-direction: column; max-height: calc(100% - 16px); overflow-y: auto; 
}
.party-cards:empty { display: none; }
.pcard {
  display: flex; cursor: var(--cur-hand);

  transition: transform .15s, border-color .15s, box-shadow .2s;
}
.pcard:hover { transform: translateX(3px); border-color: var(--gold); }
.pcard.me { border-color: rgba(240,192,96,.7); }
.pcard.cur { border-color: var(--gold2); box-shadow: 0 0 14px rgba(240,192,96,.55); transform: translateX(6px); }
.pcard.out { opacity: .5; }
.pc-face {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 25px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, #fff 30%), var(--c) 55%, color-mix(in srgb, var(--c) 50%, #000 50%));
  border: 2px solid var(--gold); box-shadow: inset 0 0 8px rgba(0,0,0,.5);
}
.pc-lvl { position: absolute; bottom: -4px; left: -4px; min-width: 18px; height: 18px; border-radius: var(--radius); background: #2a1f14; border: 1px solid var(--gold); font-size: 10px; font-weight: 700; display: grid; place-items: center; color: var(--gold2); }
.pc-face .dot { position: absolute; top: 0; right: 0; border: 1px solid #000; }
.pc-info { flex: 1; min-width: 0; }
.pc-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-bar { position: relative; height: 12px; margin-top: 3px; background: #140f0b; border: 1px solid #3a2e22; border-radius: 3px; overflow: hidden; }
.pc-bar i { position: absolute; inset: 0 auto 0 0; display: block; transition: width .4s; }
.pc-bar.hp i { background: linear-gradient(90deg, #8a2a22, #d0483a); }
.pc-bar.mp i { background: linear-gradient(90deg, #2a4a8a, #4a7fd0); }
.pc-bar span { position: relative; display: block; text-align: center; font-size: 9.5px; line-height: 11px; text-shadow: 0 1px 2px #000; }
.pc-st { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.pc-st .st-chip { font-size: 10.5px; padding: 1px 6px; white-space: nowrap; cursor: help; }
.pc-st .st-chip b { margin-left: 2px; }
/* свой (зелёный) / союзник (синий) / враг (красный) — полоска слева, как кольца на поле */
.pcard.rel.focus { border-color: var(--rel); }

.side { width: 380px; flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.side-tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 9px; border-bottom: 2px solid transparent; }
.side-tabs button.active { border-bottom-color: var(--gold2); color: var(--gold2); box-shadow: none; }
.side-panels { flex: 1 1 55%; min-height: 0; overflow-y: auto; }
.tab-panel { padding: 12px; display: none; }
.tab-panel.active { display: block; }
.side .chat-slot { flex: 1 1 45%; border-top: 1px solid var(--line); display: flex; }

.gm-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; background: rgba(0,0,0,.15); }
.gm-block > * + * { margin-top: 6px; }
.tools { display: flex; flex-wrap: wrap; gap: 4px; }
.tools button { font-size: 12.5px; padding: 5px 8px; }
.tool-opts:empty { display: none; }
.custom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.custom-grid .span2 { grid-column: span 2; }
.icon-select { width: 64px; flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.event-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.event-grid button { text-align: left; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
details summary { cursor: var(--cur-hand); color: var(--gold); font-size: 13px; margin: 6px 0; }

.sel-card { border: 1px solid var(--gold); border-radius: var(--radius); padding: 8px; margin-top: 8px; background: rgba(217,164,65,.07); }

/* персонаж */
.sheet-head { margin-bottom: 8px; }
.big-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; border: 2px solid rgba(255,255,255,.35); flex: none; }
.sheet-name { font-family: var(--font-display); font-size: 19px; color: var(--gold2); }
.bar { position: relative; height: 16px; background: #1a1410; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin: 4px 0; }
.bar > i { position: absolute; inset: 0 auto 0 0; display: block; }
.bar.hp > i { background: linear-gradient(90deg, #8a2a22, #c8473a); }
.bar.mp > i { background: linear-gradient(90deg, #2a4a8a, #4a7fd0); }
.bar.xp > i { background: linear-gradient(90deg, #8a6a20, #d9a441); }
.bar > span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 14px; text-shadow: 0 1px 2px #000; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 8px 0; }
.kv div { background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; text-align: center; font-size: 12px; color: var(--muted); }
.kv b { display: block; color: var(--text); font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 10px; }
.stats div { text-align: center; background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 2px; font-size: 11px; color: var(--muted); }
.stats b { display: block; font-size: 16px; color: var(--text); }
.inv-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.inv-item .ii { font-size: 20px; width: 30px; text-align: center; flex: none; }
/* иконки предметов (item-icons.js): рамка редкости уже на картинке */
.item-ic { display: inline-block; width: 36px; height: 36px; border-radius: 12%; vertical-align: middle; flex: none; }
.item-ic.inl { width: 1.5em; height: 1.5em; vertical-align: -0.4em; margin-right: .25em; }
.inv-item .ii .item-ic { width: 30px; height: 30px; }
.inv-item .in { flex: 1; min-width: 0; }
.inv-item .in small { display: block; color: var(--muted); }
.inv-item button { padding: 3px 7px; font-size: 12px; }
.party-row { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; background: rgba(0,0,0,.15); }
.party-row .pr-head { display: flex; align-items: center; gap: 8px; }

/* чат */
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.chat-slot > .chat { flex: 1; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px; font-size: 13px; }
.chat-log .m { margin: 3px 0; word-wrap: break-word; white-space: pre-line; }
.m .who { color: var(--gold2); font-weight: 600; }
.m.gm .who { color: #e08aff; }
.m.system { color: var(--muted); font-size: 12px; }
.m.combat { color: #e8b48a; font-size: 12px; }
.m.turn { color: var(--gold2); font-weight: 600; font-size: 12px; text-align: center; border-top: 1px solid var(--line); padding-top: 3px; margin-top: 6px; }
.m.roll { color: #9fd0ff; }
.m.event { color: #ffe39a; background: rgba(217,164,65,.1); border-left: 3px solid var(--gold); padding: 4px 6px; border-radius: 3px; }
.m.narrate { font-family: var(--font-display); font-style: italic; color: #f3e6c4; background: rgba(140, 100, 50, .18); border-left: 3px solid #b88a4a; padding: 6px 8px; border-radius: 3px; }
.dice-row { display: flex; gap: 3px; padding: 4px 8px; border-top: 1px solid var(--line); }
.dice-row button { flex: 1; padding: 3px 0; font-size: 12px; }
#gm-chatopts { padding: 4px 8px; }
#gm-chatopts input { flex: 1; }
#chat-form { padding: 6px 8px 8px; gap: 6px; }


/* ── Звук ── */
.set-btn { font-size: 16px; padding: 4px 8px; }
.set-body h4 { margin: 14px 0 2px; padding-bottom: 6px; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); background: linear-gradient(90deg, rgba(200,171,114,.55), transparent) left bottom / 100% 1px no-repeat; }
.set-body h4:first-child { margin-top: 0; }
.set-seg { display: flex; gap: 6px; }
.set-seg button { flex: 1; }
.set-seg button.on { border-color: var(--gold); background: #5a4326; color: var(--text); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #4a3c2c; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .screen { height: auto; min-height: 100vh; }
  .room-wrap { grid-template-columns: 1fr; }
  #room-chat-slot { min-height: 320px; }
  .game-body { flex-direction: column; }
  #map-wrap { height: 60vh; flex: none; }
  .side { width: 100%; border-left: 0; }
  .side-panels { max-height: 60vh; }
  .side .chat-slot { min-height: 320px; }
  .party-cards { width: auto; }
  #map-wrap { --cards-w: 76px; }
  .pc-info { display: none; }
  .pcard { padding: 4px; }
  .init-face { width: 32px; height: 32px; font-size: 18px; }
  .init-p.cur .init-face { width: 42px; height: 42px; font-size: 24px; }
}

/* ── Сюжет ИИ-мастера ── */
.story-bar {
  position: absolute; top: 8px; left: var(--cards-w, 214px); right: 8px; margin: 0 auto; width: fit-content; max-width: calc(100% - var(--cards-w, 214px) - 16px); z-index: 4;
  padding: 8px 14px; border-radius: var(--radius); text-align: center;
  background: linear-gradient(180deg, rgba(20,15,10,.92), rgba(20,15,10,.78));
  border: 1px solid rgba(217,164,65,.45); box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.sb-ch { font-family: var(--font-display); color: var(--gold2); font-size: 15px; }
.sb-obj { font-size: 13px; }
.sb-place { font-size: 12px; color: var(--gold); margin-top: 3px; }
.sb-npcs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
.sb-npcs button { border-color: var(--gold); animation: pop .25s ease-out; }

.dialog {
  position: absolute; bottom: 10px; left: var(--cards-w, 214px); right: 10px; margin: 0 auto; max-width: 760px; z-index: 6;
  display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(42,32,22,.97), rgba(26,20,14,.97));
  border: 2px solid var(--gold); box-shadow: 0 10px 30px rgba(0,0,0,.65); animation: pop .2s ease-out;
}
.dlg-face {
  flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 36px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, #fff 30%), var(--c) 55%, color-mix(in srgb, var(--c) 50%, #000 50%));
  border: 2px solid var(--gold2); box-shadow: inset 0 0 8px rgba(0,0,0,.5);
}
.dlg-main { flex: 1; min-width: 0; }
.dlg-head { display: flex; align-items: center; gap: 4px; }
.dlg-head b { font-family: var(--font-display); color: var(--gold2); font-size: 16px; }
.dlg-head .muted { font-size: 12.5px; }
.dlg-head button { padding: 2px 8px; }
.dlg-narr { font-family: var(--font-display); font-style: italic; color: var(--muted); font-size: 13px; margin-top: 2px; }
.dlg-line { font-size: 15px; margin: 4px 0 8px; max-height: 120px; overflow-y: auto; }
/* «Имя: реплика» — одной строкой, как в BG3 (печатается только сама реплика) */
.dlg-spk { color: var(--gold2); margin-right: .35em; }
.dlg-dots { color: var(--muted); font-style: italic; }
.dlg-dots i { animation: blink 1.2s infinite; font-style: normal; }
.dlg-dots i:nth-child(2) { animation-delay: .2s; }
.dlg-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.dlg-opts { display: flex; flex-direction: column; gap: 4px; }
.dlg-opts button { position: relative; text-align: left; white-space: normal; padding: 5px 10px 5px 28px; }
/* номер ответа — клавиша: колпачок в первой строке текста, на месте левого отступа кнопки */
.dlg-opts .key { position: relative; display: inline-grid; place-items: center; vertical-align: middle; top: -1px; margin: 0 6px 0 -22px; width: 16px; height: 16px; box-sizing: border-box;
  font: bold 10px/1 system-ui, sans-serif; color: var(--gold); background: rgba(255,255,255,.06); border: 1px solid rgba(217,164,65,.55); border-bottom-width: 2px; border-radius: 3px; }
.dlg-opts .chk { color: #9fd0ff; font-size: 12px; }
#dlg-say { margin-top: 6px; }
.dlg-hint { font-size: 11px; margin-top: 4px; }
.face-img.art { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* тайный разговор одного героя: лиловая рамка, над общим разговором, если тот тоже открыт */
.dialog.whisper { border-color: #9a6ad8; background: linear-gradient(180deg, rgba(36,24,48,.97), rgba(20,14,28,.97)); box-shadow: 0 10px 30px rgba(0,0,0,.65), 0 0 22px rgba(154,106,216,.35); }
.dialog.whisper.stacked { bottom: auto; top: 86px; }
.dialog.whisper .dlg-head b { color: #e0c8ff; }
.wh-tag { font-size: 11.5px; color: #d6b8ff; background: rgba(154,106,216,.18); border: 1px solid rgba(154,106,216,.5); padding: 1px 8px; border-radius: var(--radius); margin-right: 4px; white-space: nowrap; }

/* лавка торговца кампании */
.trade-box { max-height: 90vh; overflow-y: auto; }
.trade-who { display: flex; align-items: center; gap: 10px; }
.trade-who .dlg-face { width: 52px; height: 52px; font-size: 28px; }
.trade-who b { display: block; font-family: var(--font-display); color: var(--gold2); font-size: 16px; }
.trade-greet { font-family: var(--font-display); font-style: italic; margin: 6px 0 8px; }
.inv-list { display: flex; flex-direction: column; gap: 4px; }
.inv-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-bottom: 1px dashed var(--line); }
.inv-row .in { flex: 1; min-width: 0; }
.inv-row small { display: block; font-size: 11.5px; }

/* спутники во вкладке «Сюжет» и над картой */
.comp-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.comp-row .in { flex: 1; min-width: 0; }
.comp-row small { display: block; color: var(--muted); font-size: 11.5px; }
.comp-row .wv-bar { margin-top: 3px; }
.comp-row button { padding: 3px 8px; font-size: 12px; }
.comp-row button.active { border-color: #d8a040; color: #ffd9a0; }
.sb-comps button { border-color: #6a8ac0; }
.quests li.mine { color: #e0c8ff; }
.quests li small.q-mine { color: #b89ae0; }

.boss-bar {
  position: absolute; bottom: 10px; left: var(--cards-w, 214px); right: 10px; margin: 0 auto; width: min(520px, calc(100% - var(--cards-w, 214px) - 20px)); z-index: 4;
  padding: 6px 12px 8px; border-radius: var(--radius); text-align: center; pointer-events: none;
  background: rgba(20,12,24,.85); border: 1px solid #8d5cc4; box-shadow: 0 0 18px rgba(141,92,196,.45);
}
.bb-name { font-family: var(--font-display); color: #e0b8ff; font-size: 15px; letter-spacing: .5px; }
.bb-bar { position: relative; height: 14px; margin-top: 4px; background: #140c18; border: 1px solid #5a3a70; border-radius: 4px; overflow: hidden; }
.bb-bar i { position: absolute; inset: 0 auto 0 0; display: block; background: linear-gradient(90deg, #5a1a7a, #b04ae0); transition: width .4s; }
.bb-bar span { position: relative; display: block; font-size: 10.5px; line-height: 13px; text-shadow: 0 1px 2px #000; }

.m.npc { background: rgba(141,92,196,.1); border-left: 3px solid #8d5cc4; padding: 4px 6px; border-radius: 3px; }
.m.npc .who { color: #d8b0ff; }
.story-head { margin-bottom: 12px; }
.npc-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.npc-ic { font-size: 22px; width: 28px; text-align: center; }
.npc-row .in { flex: 1; min-width: 0; }
.npc-row small { display: block; color: var(--muted); }
.talk-list { margin-bottom: 10px; }
.talk-list > summary { cursor: pointer; font-family: var(--font-display); font-size: 15px; color: var(--gold2); padding: 2px 0 6px; }
.talk-list > summary b { color: var(--muted); font-family: inherit; font-size: 13px; margin-left: 4px; }
.journal { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
/* нелинейные кампании: задания, шкалы мира, знания */
.quests { list-style: none; padding: 0; margin: 0 0 10px; font-size: 13px; }
.quests li { display: flex; gap: 6px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.quests li > span { flex: none; width: 16px; text-align: center; }
.quests li small { display: block; color: var(--muted); font-size: 11.5px; }
.quests li.done { color: var(--muted); font-size: 12px; }
.wvars { display: grid; gap: 6px; margin-bottom: 10px; }
.wv-h { display: flex; justify-content: space-between; font-size: 12.5px; }
.wv-bar { position: relative; height: 7px; margin-top: 2px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.wv-bar i { position: absolute; top: 0; bottom: 0; display: block; background: linear-gradient(90deg, #a07a2a, var(--gold2)); transition: width .4s, left .4s; }
.wv-bar.two::after { content: ''; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: rgba(255,255,255,.35); }
.wv-seals i { background: linear-gradient(90deg, #7a2a2a, #e05a4a); }
.wv-memories i { background: linear-gradient(90deg, #2a5a7a, #7ac0ff); }
.wv-debts i { background: linear-gradient(90deg, #444, #aaa); }
.kn-row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kn-row > span { flex: none; font-size: 18px; width: 24px; text-align: center; }
.kn-row small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.kn-row.local b { color: #c8b0e8; }
.dlg-opts .kn { color: #c8a0ff; font-size: 12px; }
.dlg-opts .tag { color: var(--gold2); font-size: 12px; }
.dlg-opts button.known { border-color: #8d5cc4; }
.dlg-opts button.locked { opacity: .55; }
/* ответ без нового: реплика уже звучала (server/director/dialog.js optOld) */
.dlg-opts button.old { color: #8f8676; }
.dlg-opts button.old .key { opacity: .5; }
.dlg-opts button.locked .tag { color: #e0a080; }
.journal li { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.04); }

@media (max-width: 900px) {
  .dialog { left: 8px; right: 8px; padding: 10px; }
  .dlg-face { width: 44px; height: 44px; font-size: 24px; }
  .story-bar { left: 76px; }
}

/* ── Меню мастера: сетка разделов ── */
.gm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px; }
.gm-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px;
  font-size: 11.5px; line-height: 1.15; white-space: normal; text-align: center;
  background: linear-gradient(180deg, #3a2e22, #2a2119); border-radius: var(--radius);
}
.gm-tile span { font-size: 20px; }
.gm-tile.active { background: linear-gradient(180deg, #5a4426, #3d2f1d); border-color: var(--gold2); color: var(--gold2); box-shadow: 0 0 10px rgba(240,192,96,.3); }
.gm-menu { border: 1px solid var(--gold); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; background: rgba(217,164,65,.05); animation: pop .15s ease-out; }
.gm-menu > * + * { margin-top: 6px; }
.gm-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.gm-tools button { font-size: 12.5px; padding: 5px 8px; }
#gm-sel:empty { display: none; }
#gm-sel { margin-bottom: 10px; }

/* ── Отдых ── */
.rest-info { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.pip { opacity: .25; filter: grayscale(1); margin-left: 2px; }
.pip.on { opacity: 1; filter: none; }

/* ── Панель читов ── */
.cheat-panel {
  position: fixed; top: 58px; right: 396px; z-index: 30; width: 300px; max-height: calc(100vh - 80px); overflow-y: auto;
  background: linear-gradient(180deg, #2a2236, #1c1724); border: 2px solid #8d5cc4; border-radius: var(--radius);
  padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: pop .15s ease-out;
}
.cheat-panel > * + * { margin-top: 8px; }
.cp-head { align-items: center; }
.cp-head b { color: #d0b0ff; font-size: 15px; }
.cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.cp-grid button { font-size: 12.5px; }
.cp-god { font-size: 14px; padding: 9px; }
.cp-god.on { background: var(--btn-main); border-color: var(--gold2); color: #fff8e6; box-shadow: 0 0 12px rgba(240,192,96,.5); }
#btn-cheats { color: #d0b0ff; }
.pc-face.god { box-shadow: 0 0 12px rgba(255,215,90,.9), inset 0 0 8px rgba(0,0,0,.5); }
.pc-god { position: absolute; bottom: -4px; right: -6px; font-size: 13px; }

/* способность недоступна, но наведение показывает её дальность */
.ab-btn.off { opacity: .45; cursor: not-allowed; }

@media (max-width: 900px) {
  .cheat-panel { right: 8px; left: 8px; width: auto; }
  .gm-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Таланты и характеристики ── */
#btn-talents { color: var(--gold2); }
#btn-talents.glow { border-color: var(--gold); box-shadow: 0 0 10px rgba(240,192,96,.45); animation: tglow 1.6s ease-in-out infinite; }
@keyframes tglow { 50% { box-shadow: 0 0 18px rgba(240,192,96,.8); } }
.pts-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--gold); color: #2a1a08; font-weight: 700; font-size: 11px; text-align: center; }
.ab-btn.free { border-color: #6a8ad0; }
.stats div { position: relative; }
.stat-up { position: absolute; top: -7px; right: -5px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 12px; line-height: 1; background: var(--green); border-color: #8fd98a; color: #fff; }
.pts-note { background: rgba(79,154,74,.15); border: 1px solid var(--green); border-radius: var(--radius); padding: 5px 8px; margin: 8px 0 6px; font-size: 12.5px; }
.talent-sum { display: flex; align-items: center; gap: 8px; justify-content: space-between; background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; margin: 4px 0 12px; font-size: 13px; }
.gold { color: var(--gold2); }
.cc-trees { margin-top: 8px; font-size: 12px; }

.talent-win { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; animation: pop .15s ease-out; }
.tw-box { position: relative; width: min(1060px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.tw-head { display: flex; align-items: center; gap: 12px; }
.tw-pts { font-size: 14px; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line); }
.tw-pts.has { color: var(--gold2); }
.tw-pts b { font-size: 16px; }
.tw-trees { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tw-tree { border: 1px solid var(--line); padding: 10px; }
.tw-th { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 52px; }
.tw-ti { font-size: 26px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--tc); background: rgba(0,0,0,.35); flex: none; overflow: hidden; }
.tw-ti img { display: block; width: 100%; height: 100%; }
.tw-tn { flex: 1; min-width: 0; }
.tw-tn b { display: block; font-family: var(--font-display); font-size: 16px; color: var(--text); }
.tw-tn small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.tw-spent { font-size: 20px; font-weight: 700; color: var(--tc); min-width: 26px; text-align: center; }
.tw-grid { display: grid; grid-template-columns: 26px repeat(3, 1fr); grid-template-rows: repeat(7, 60px); gap: 8px 8px; align-items: center; justify-items: center; }
.tw-tier { grid-column: 1; font-size: 11px; color: #6a5c48; white-space: nowrap; }
.tw-tier.on { color: var(--muted); }
.tal { position: relative; z-index: 1; width: 54px; height: 54px; padding: 0; border-radius: var(--radius); display: grid; place-items: center; background: #1a1510; border: 2px solid #4a3c2c; transition: transform .1s; }
.tal:hover { transform: scale(1.06); }
.tal-ic { font-size: 26px; }
.tal-ic img { display: block; width: 50px; height: 50px; border-radius: var(--radius); }
.tal.grants .tal-ic img { border-radius: 50%; }
.tal-rank { position: absolute; bottom: -9px; right: -9px; min-width: 28px; padding: 0 4px; font-size: 11px; font-weight: 700; border-radius: var(--radius); background: #120e0a; border: 1px solid #4a3c2c; color: var(--muted); }
.tal.grants { border-radius: 50%; }
.tal.locked { filter: grayscale(1) brightness(.55); }
.tal.open { border-color: #7a6a50; }
.tal.can { border-color: #6fd06a; box-shadow: 0 0 10px rgba(111,208,106,.45); }
.tal.can .tal-rank { color: #9fe39a; border-color: #4f9a4a; }
.tal.some { border-color: #8fd98a; }
.tal.some .tal-rank { color: #9fe39a; border-color: #4f9a4a; }
.tal.max { border-color: var(--gold2); box-shadow: 0 0 10px rgba(240,192,96,.5); }
.tal.max .tal-rank { color: var(--gold2); border-color: var(--gold); }
.tal-arrow { z-index: 0; width: 4px; height: 100%; background: #3a3024; border-radius: 2px; }
.tal-arrow.on { background: var(--gold); }
.tw-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.tw-tip { position: absolute; z-index: 5; width: 300px; pointer-events: none; background: #120e0a; border: 1px solid var(--gold); border-radius: var(--radius); padding: 9px 11px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.tw-tip > * + * { margin-top: 6px; }
.tt-head { display: flex; justify-content: space-between; gap: 8px; }
.tt-head b { color: var(--gold2); font-size: 14px; }
.tt-next { color: #b8ad98; }
.tw-subs { display: flex; justify-content: space-between; gap: 8px; margin: -4px 0 8px 34px; font-size: 12px; }
.tw-subs span.off { opacity: .4; }
.tw-subs span { display: grid; text-align: center; max-width: 45%; }
.tw-subs small { color: var(--muted); font-size: 10.5px; }
.tt-ranks { margin: 0; padding-left: 22px; list-style: upper-roman; display: grid; gap: 3px; color: #8a7d68; }
.tt-ranks li.on { color: var(--text); }
.tt-ranks li.next { color: #b8ad98; }
.man-ranks { margin: 4px 0; padding-left: 22px; list-style: upper-roman; display: grid; gap: 3px; }
.man-sub { display: grid; gap: 6px; align-content: start; min-width: 0; }
.tt-ab { border-top: 1px solid var(--line); padding-top: 6px; }
.tt-ab b { color: #9fd0ff; }
.tt-req { color: #ff9a8a; }
.tt-ok { color: #9fe39a; }

@media (max-width: 900px) {
  .tw-trees { grid-template-columns: 1fr; }
  .tw-head { flex-wrap: wrap; }
}
