/* ============================================================
   Оформление мини-приложения: тёмное фэнтези, золото и угли
   ============================================================ */
:root {
  --bg: #0c0a10;
  --bg2: #15111c;
  --panel: rgba(28, 22, 34, 0.82);
  --panel-solid: #1c1622;
  --line: rgba(212, 162, 76, 0.22);
  --line-strong: rgba(212, 162, 76, 0.5);
  --gold: #d9a94e;
  --gold-hi: #f3d08a;
  --ember: #e0663b;
  --blood: #c4413b;
  --emerald: #4fb58a;
  --arcane: #8d7bea;
  --text: #ece3d3;
  --muted: #a39887;
  --parchment: #efe2c4;
  --ink: #2a1f14;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --display: 'Forum', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background:
    radial-gradient(120% 70% at 50% -10%, #2a1d33 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 110%, #2b140f 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#embers { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: .7; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.muted { color: var(--muted); }
.eyebrow { font: 600 11px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; }
.title { font: 400 30px/1.1 var(--display); color: var(--gold-hi); margin: 0; letter-spacing: .01em; text-shadow: 0 0 24px rgba(217, 169, 78, .25); }

/* ---------- Экраны ---------- */
.screen { position: fixed; inset: 0; z-index: 1; display: none; flex-direction: column; height: 100dvh; }
.screen.active { display: flex; animation: fadeIn .45s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Загрузка ---------- */
.loading { margin: auto; text-align: center; padding: 24px; max-width: 320px; }
.loading .title { margin-top: 22px; }
.loading .muted { margin-top: 10px; }

/* ---------- d20 ---------- */
.d20 { width: 84px; height: 84px; filter: drop-shadow(0 0 18px rgba(217, 169, 78, .35)); }
.d20.big { width: 150px; height: 150px; }
.d20-face { fill: #241a2c; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; }
.d20-inner { fill: rgba(217, 169, 78, .12); stroke: var(--gold); stroke-width: 1.4; stroke-linejoin: round; }
.d20-edge { stroke: rgba(217, 169, 78, .55); stroke-width: 1; fill: none; }
.d20 text { font: 400 26px var(--display); fill: var(--gold-hi); text-anchor: middle; }
.spin { animation: spin 2.4s cubic-bezier(.6, .1, .3, .9) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tumble { animation: tumble .9s cubic-bezier(.3, .7, .2, 1); }
@keyframes tumble {
  0% { transform: rotate(0) scale(.6); opacity: .2; }
  60% { transform: rotate(560deg) scale(1.08); opacity: 1; }
  100% { transform: rotate(720deg) scale(1); }
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 600; letter-spacing: .01em;
  transition: transform .12s, filter .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.gold {
  color: #241707;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, #b4822f);
  box-shadow: 0 6px 22px rgba(217, 169, 78, .25), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.btn.ghost { border: 1px solid var(--line-strong); color: var(--gold-hi); background: rgba(217, 169, 78, .06); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  color: var(--gold-hi); font-size: 18px; backdrop-filter: blur(8px);
}

/* ---------- Создание героя ---------- */
.create { display: flex; flex-direction: column; height: 100%; max-width: 560px; width: 100%; margin: 0 auto; }
.create-head { padding: 22px 18px 6px; text-align: center; }
.steps { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.steps i { width: 26px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); transition: background .3s; }
.steps i.on { background: var(--gold); }
.step { display: none; flex: 1; overflow-y: auto; padding: 14px 16px 18px; }
.step.active { display: block; animation: fadeIn .35s ease; }
.step-hint { color: var(--muted); margin: 0 0 14px; text-align: center; font-size: 14px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field em { font-style: normal; opacity: .6; }
.field input, .field textarea, .input-row textarea {
  width: 100%; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; outline: none; resize: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .input-row textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 169, 78, .14); }
.field input { font: 400 22px var(--display); color: var(--gold-hi); }

.grid.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card {
  text-align: left; padding: 14px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); transition: border-color .2s, transform .15s, background .2s; position: relative; overflow: hidden;
}
.card:active { transform: scale(.98); }
.card.selected { border-color: var(--gold); background: linear-gradient(160deg, rgba(217, 169, 78, .18), rgba(28, 22, 34, .9)); box-shadow: 0 0 0 1px var(--gold) inset, 0 8px 26px rgba(217, 169, 78, .15); }
.card .emoji { font-size: 28px; line-height: 1; }
.card h3 { font: 400 20px/1.1 var(--display); color: var(--gold-hi); margin: 8px 0 4px; }
.card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.stat-roll { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; background: var(--panel);
}
.stat small { display: block; font: 600 11px var(--sans); letter-spacing: .14em; color: var(--muted); }
.stat b { display: block; font: 400 30px/1.15 var(--display); color: var(--gold-hi); }
.stat i { font-style: normal; font-size: 12px; color: var(--gold); }
.stat.pop { animation: pop .5s ease backwards; }
@keyframes pop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }
#btn-reroll { width: 100%; }
.summary { margin-top: 16px; padding: 14px; border-radius: var(--radius); border: 1px dashed var(--line-strong); font-size: 14px; color: var(--muted); }
.summary b { color: var(--text); }
.create-foot { display: flex; gap: 10px; padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: rgba(12, 10, 16, .7); backdrop-filter: blur(10px); }
.create-foot .btn { flex: 1; }
.create-foot .btn.ghost { flex: .55; }

/* ---------- HUD ---------- */
.hud { display: flex; gap: 12px; align-items: center; padding: 12px 14px 8px; background: linear-gradient(180deg, rgba(12, 10, 16, .95), rgba(12, 10, 16, .6)); position: relative; z-index: 2; }
.portrait {
  width: 50px; height: 50px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: radial-gradient(circle at 35% 30%, #3b2a45, #17111d); border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 169, 78, .15), 0 0 20px rgba(217, 169, 78, .25);
}
.hud-main { flex: 1; min-width: 0; }
.hud-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.hud-top strong { font: 400 19px/1 var(--display); color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 999px; background: rgba(217, 169, 78, .15); color: var(--gold-hi); white-space: nowrap; }
.gold-count { margin-left: auto; font-weight: 600; font-size: 14px; color: var(--gold-hi); white-space: nowrap; }
.bar { position: relative; height: 15px; border-radius: 8px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; transition: width .6s cubic-bezier(.3, .8, .3, 1); }
.bar.hp i { background: linear-gradient(90deg, #8f2320, var(--blood) 60%, #e3675d); }
.bar.hp span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-shadow: 0 1px 2px #000; }
.bar.xp { height: 5px; margin-top: 5px; }
.bar.xp i { background: linear-gradient(90deg, #9b6b22, var(--gold-hi)); }
.bar.flash { animation: flash .5s ease; }
@keyframes flash { 50% { box-shadow: 0 0 0 2px var(--blood), 0 0 16px var(--blood); } }

.location-strip {
  display: flex; align-items: center; gap: 6px; margin: 0 14px 4px; padding: 7px 12px; border-radius: 12px;
  background: rgba(217, 169, 78, .07); border: 1px solid var(--line); font-size: 13px; position: relative; z-index: 2;
}
.location-strip b { font: 400 16px var(--display); color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Вкладки ---------- */
.tab { display: none; flex: 1; min-height: 0; flex-direction: column; position: relative; z-index: 1; }
.tab.active { display: flex; }
.scroll { overflow-y: auto; flex: 1; }
.pad { padding: 14px; }
.tabbar {
  display: flex; border-top: 1px solid var(--line); background: rgba(12, 10, 16, .92); backdrop-filter: blur(10px);
  padding-bottom: var(--safe-b); position: relative; z-index: 2;
}
.tabbar button { flex: 1; padding: 8px 0 9px; font-size: 11px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; transition: color .2s; }
.tabbar button span { font-size: 19px; filter: grayscale(.8); opacity: .7; transition: filter .2s, opacity .2s, transform .2s; }
.tabbar button.active { color: var(--gold-hi); }
.tabbar button.active span { filter: none; opacity: 1; transform: translateY(-1px); }

/* ---------- Лента истории ---------- */
.feed { flex: 1; overflow-y: auto; padding: 10px 14px 18px; scroll-behavior: smooth; }
.msg { margin: 0 0 14px; animation: fadeIn .4s ease; }
.msg.player { display: flex; justify-content: flex-end; }
.msg.player .bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-size: 14.5px;
  background: linear-gradient(160deg, #3a2b4a, #2a2034); border: 1px solid rgba(141, 123, 234, .3);
}
.msg.gm .page {
  position: relative; padding: 16px 16px 14px; border-radius: 6px 18px 18px 18px; color: var(--ink);
  background:
    radial-gradient(120% 90% at 10% 0%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(100% 100% at 100% 100%, rgba(150, 105, 50, .28), transparent 60%),
    var(--parchment);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 0 40px rgba(120, 80, 30, .25);
  font: 500 18px/1.45 var(--serif);
}
.msg.gm .page p { margin: 0 0 .6em; }
.msg.gm .page p:last-child { margin-bottom: 0; }
.msg.gm.first .page p:first-child::first-letter {
  float: left; font: 400 46px/.82 var(--display); color: #7a2a17; padding: 6px 7px 0 0;
}
.msg.system .sys { text-align: center; font-size: 12.5px; color: var(--gold); padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--line-strong); }
.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 17px; padding: 6px 2px; }
.typing .quill { display: inline-block; animation: write 1s ease-in-out infinite; }
@keyframes write { 50% { transform: translate(4px, -2px) rotate(8deg); } }

.check-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; padding: 4px 10px; border-radius: 999px;
  font: 700 11.5px var(--sans); letter-spacing: .03em;
}
.check-chip.ok { background: rgba(47, 120, 86, .16); color: #1f5e40; border: 1px solid rgba(47, 120, 86, .4); }
.check-chip.fail { background: rgba(160, 45, 35, .14); color: #8b2a20; border: 1px solid rgba(160, 45, 35, .4); }
.changes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chg { font: 600 12px var(--sans); padding: 4px 9px; border-radius: 999px; background: rgba(42, 31, 20, .08); border: 1px solid rgba(42, 31, 20, .2); }
.chg.bad { color: #9b2b21; } .chg.good { color: #1f6a47; } .chg.gold { color: #8a5b10; } .chg.epic { color: #5a3fb8; } .chg.place { color: #2f4f8a; } .chg.boss { color: #9b2b21; font-weight: 700; }

/* ---------- Поле ввода ---------- */
.composer { padding: 8px 12px calc(10px); background: linear-gradient(180deg, transparent, rgba(12, 10, 16, .92) 30%); }
.options { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.options::-webkit-scrollbar { display: none; }
.opt {
  flex: none; max-width: 78vw; padding: 8px 13px; border-radius: 999px; font-size: 13.5px; text-align: left;
  border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .08); color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .2s, transform .12s;
}
.opt:active { transform: scale(.96); background: rgba(217, 169, 78, .2); }
.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row textarea { max-height: 120px; min-height: 46px; font-size: 15px; }
.send {
  width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); box-shadow: 0 4px 16px rgba(217, 169, 78, .3);
}
.send svg { width: 22px; height: 22px; fill: #241707; }
.send:disabled { opacity: .4; }

/* ---------- Лист героя ---------- */
.sheet-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.sheet-head .portrait { width: 70px; height: 70px; font-size: 36px; }
.sheet-head h2 { font: 400 26px/1.1 var(--display); color: var(--gold-hi); margin: 0 0 4px; }
.sheet-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.section { margin: 18px 0 10px; display: flex; align-items: center; gap: 10px; font: 400 18px var(--display); color: var(--gold-hi); }
.section::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.stats6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inv { display: grid; gap: 6px; }
.inv-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.inv-item b { margin-left: auto; color: var(--gold); font-size: 13px; }
.chronicle { font: 500 16px/1.5 var(--serif); color: var(--parchment); white-space: pre-line; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; text-align: center; }
.kv small { display: block; color: var(--muted); font-size: 11px; }
.kv b { font: 400 20px var(--display); color: var(--gold-hi); }
.admin-btn { width: 100%; margin-top: 22px; }

/* ---------- Карта ---------- */
.map-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
#map-canvas { width: 100%; height: 100%; display: block; }
.map-tools { position: absolute; right: 12px; top: 12px; display: grid; gap: 8px; }
.map-legend { position: absolute; left: 12px; top: 12px; font-size: 11.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 7px 10px; border-radius: 10px; backdrop-filter: blur(8px); }
.map-card {
  position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 14px; border-radius: 16px; background: var(--panel-solid);
  border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transform: translateY(140%); transition: transform .3s cubic-bezier(.3, .8, .3, 1);
}
.map-card.show { transform: none; }
.map-card h3 { margin: 0 0 4px; font: 400 21px var(--display); color: var(--gold-hi); }
.map-card p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.map-card .btn { margin-top: 10px; width: 100%; min-height: 42px; }

/* ---------- Оверлеи ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(6, 4, 8, .78); backdrop-filter: blur(6px); }
.overlay.show { display: grid; animation: fadeIn .25s ease; }
.dice-box, .death-box { text-align: center; padding: 24px; max-width: 340px; }
.dice-total { font: 400 20px var(--display); color: var(--text); margin: 14px 0 4px; min-height: 26px; }
.dice-verdict { font: 400 30px var(--display); margin: 0; min-height: 38px; letter-spacing: .04em; }
.dice-verdict.ok { color: #6fdca9; text-shadow: 0 0 22px rgba(79, 181, 138, .6); }
.dice-verdict.fail { color: #ff7a6b; text-shadow: 0 0 22px rgba(196, 65, 59, .6); }
.dice-verdict.crit { color: var(--gold-hi); text-shadow: 0 0 28px rgba(243, 208, 138, .9); }
.death-box .skull { font-size: 64px; animation: pop .7s ease; }
.death-box .title { margin: 10px 0; }
.death-box .btn { width: 100%; margin-top: 12px; }

/* ---------- Уведомление ---------- */
.toast {
  position: fixed; left: 50%; top: 14px; z-index: 30; transform: translate(-50%, -150%); transition: transform .35s cubic-bezier(.3, .8, .3, 1);
  max-width: calc(100% - 28px); padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 500;
  background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { border-color: rgba(196, 65, 59, .7); }
.toast.lvl { border-color: var(--gold); color: var(--gold-hi); }

.levelup { position: fixed; inset: 0; z-index: 25; pointer-events: none; display: grid; place-items: center; }
.levelup div { font: 400 44px var(--display); color: var(--gold-hi); text-shadow: 0 0 30px rgba(243, 208, 138, .9); animation: lvl 2.2s ease forwards; }
@keyframes lvl { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1.1); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }

/* ---------- Онлайн ---------- */
.hidden { display: none !important; }
.online-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: rgba(79, 181, 138, .12); border: 1px solid rgba(79, 181, 138, .35); color: #9fe6c4; font-size: 12.5px; font-weight: 600; flex: none;
}
.online-pill i, .on-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 8px var(--emerald); display: inline-block; flex: none; }
.off-dot { width: 7px; height: 7px; border-radius: 50%; background: #5d5466; display: inline-block; flex: none; }
.tabbar button { position: relative; }
.dot { position: absolute; top: 6px; left: calc(50% + 10px); width: 8px; height: 8px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 8px var(--ember); }
.seg .dot { position: static; display: inline-block; margin-left: 4px; }

.seg { display: flex; gap: 6px; margin: 8px 14px 4px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.seg button { flex: 1; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button.active { background: rgba(217, 169, 78, .16); color: var(--gold-hi); }
.seg-pane { display: none; flex: 1; min-height: 0; }
.seg-pane.active { display: flex; flex-direction: column; }
#seg-people.active { display: block; }
.small-note { font-size: 12.5px; margin: -4px 0 10px; }

.heroes { display: grid; gap: 8px; }
.hero-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.hero-row .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; background: radial-gradient(circle at 35% 30%, #3b2a45, #17111d); border: 1.5px solid var(--line-strong); flex: none; }
.hero-row .who { flex: 1; min-width: 0; }
.hero-row .who b { display: block; font: 400 17px/1.15 var(--display); color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-row .who small { color: var(--muted); font-size: 12px; }
.hero-row .tagx { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(141, 123, 234, .15); color: #c3b8ff; white-space: nowrap; }

.card-box { padding: 14px; border-radius: 16px; background: linear-gradient(160deg, rgba(217, 169, 78, .12), rgba(28, 22, 34, .9)); border: 1px solid var(--line-strong); margin-bottom: 14px; }
.card-box h3 { margin: 0 0 8px; font: 400 20px var(--display); color: var(--gold-hi); }
.card-box .row2 { display: flex; gap: 8px; margin-top: 10px; }
.card-box .row2 .btn { flex: 1; min-height: 42px; }
.member { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.member:last-of-type { border-bottom: 0; }
.member .nm { flex: 1; min-width: 0; font-size: 14px; }
.member .nm small { color: var(--muted); }
.member .hpmini { width: 70px; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.member .hpmini i { display: block; height: 100%; background: var(--blood); }
.member .kick { color: var(--muted); font-size: 13px; padding: 4px 6px; }
.turn-line { margin-top: 10px; font-size: 13px; color: var(--muted); }
.turn-line b { color: var(--gold-hi); }

.party-bar { margin: 0 12px 4px; padding: 8px 12px; border-radius: 12px; font-size: 12.5px; background: rgba(141, 123, 234, .1); border: 1px solid rgba(141, 123, 234, .3); color: #d6cfff; display: flex; gap: 8px; align-items: center; }
.party-bar b { color: #fff; }
.party-bar.my-turn { background: rgba(217, 169, 78, .14); border-color: var(--line-strong); color: var(--gold-hi); }

.msg.other { display: flex; justify-content: flex-start; }
.msg.other .bubble { max-width: 85%; padding: 8px 14px 10px; border-radius: 16px 16px 16px 4px; font-size: 14.5px; background: linear-gradient(160deg, #1f3a35, #182a29); border: 1px solid rgba(79, 181, 138, .3); }
.msg .who-name { display: block; font-size: 11.5px; font-weight: 700; color: #9fe6c4; margin-bottom: 2px; }
.page .gm-to { font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: #8a6a3a; margin-bottom: 6px; }
.ally-line { margin-top: 6px; font: 600 12px var(--sans); color: #5a4630; }

.chan { display: flex; gap: 6px; padding: 4px 14px 6px; overflow-x: auto; scrollbar-width: none; }
.chan button { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.chan button.active { border-color: var(--gold); color: var(--gold-hi); background: rgba(217, 169, 78, .1); }
.chat-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 14px 10px; }
.cm { margin-bottom: 9px; max-width: 88%; }
.cm .nm { font-size: 11.5px; font-weight: 700; color: var(--gold); }
.cm .nm small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.cm .tx { margin-top: 2px; padding: 7px 11px; border-radius: 4px 14px 14px 14px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; word-wrap: break-word; }
.cm.mine { margin-left: auto; text-align: right; }
.cm.mine .tx { border-radius: 14px 4px 14px 14px; background: #2d2238; text-align: left; }
.chat-empty { text-align: center; color: var(--muted); margin-top: 30px; font-size: 13.5px; }
.chat-input { padding: 8px 12px 10px; }
.chat-input input { flex: 1; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; }
.chat-input input:focus { border-color: var(--gold); }

.sheet-card { width: min(380px, calc(100vw - 28px)); padding: 20px; border-radius: 20px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 20px 50px rgba(0, 0, 0, .6); position: relative; max-height: 86vh; overflow-y: auto; }
.sheet-card .x { position: absolute; right: 12px; top: 10px; font-size: 20px; color: var(--muted); padding: 4px 8px; }
.sheet-card .head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.sheet-card .head .portrait { width: 62px; height: 62px; font-size: 32px; }
.sheet-card h2 { margin: 0 0 3px; font: 400 24px/1.1 var(--display); color: var(--gold-hi); }
.sheet-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.sheet-card .bio { margin-top: 12px; font: 500 16px/1.45 var(--serif); color: var(--parchment); }
.sheet-card .btn { width: 100%; margin-top: 14px; }
.sheet-card .why { margin-top: 12px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- Чат (отдельная вкладка) ---------- */
.badge-n { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--ember); color: #fff; font: 700 10.5px/17px var(--sans); font-style: normal; text-align: center; box-shadow: 0 0 8px rgba(224, 102, 59, .6); }
#tab-chat { position: relative; }
.chan { padding-top: 10px; }
.chan button { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.chan button .un { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ember); color: #fff; font-size: 10px; line-height: 16px; font-weight: 700; }
.chan button .on-dot, .chan button .off-dot { width: 6px; height: 6px; }
.chat-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-feed { padding-top: 4px; }
.day-sep { text-align: center; margin: 12px 0 8px; font-size: 11.5px; color: var(--muted); }
.day-sep span { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); }
.cm { margin-bottom: 3px; }
.cm.grp-start { margin-top: 9px; }
.cm .tx { cursor: pointer; transition: background .15s; }
.cm .tx:active { background: rgba(217, 169, 78, .18); }
.cm .nm b { cursor: pointer; }
.cm .quote { display: block; margin: 0 0 4px; padding: 3px 8px; border-left: 2px solid var(--gold); border-radius: 4px; background: rgba(217, 169, 78, .08); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm .quote b { color: var(--gold); font-weight: 600; margin-right: 4px; }
.cm .mention { color: var(--gold-hi); font-weight: 600; }
.cm.to-me .tx { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 169, 78, .35) inset; }
.cm.sys { max-width: 100%; text-align: center; margin: 10px 0; }
.cm.sys .tx { display: inline-block; background: rgba(196, 65, 59, .1); border: 1px dashed rgba(224, 102, 59, .45); color: #ffc9b3; font-size: 13px; border-radius: 12px; cursor: default; }
.cm .tm { font-size: 10.5px; color: var(--muted); margin-left: 6px; }
.to-new { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: var(--gold); color: #241707; font-weight: 700; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
.reply-bar { display: flex; align-items: center; gap: 10px; margin: 0 12px; padding: 7px 10px; border-left: 3px solid var(--gold); background: rgba(217, 169, 78, .08); border-radius: 8px; font-size: 12.5px; }
.reply-bar div { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.reply-bar b { color: var(--gold-hi); margin-right: 6px; }
.reply-bar button { color: var(--muted); font-size: 16px; padding: 2px 6px; }

/* ---------- Арена: карточка в «Мире» ---------- */
.arena-card { position: relative; overflow: hidden; padding: 16px; border-radius: 18px; margin-bottom: 14px;
  background: radial-gradient(120% 120% at 100% 0%, rgba(196, 65, 59, .35), transparent 60%), linear-gradient(160deg, #2b1418, #1b1218);
  border: 1px solid rgba(224, 102, 59, .45); }
.arena-card h3 { margin: 0 0 6px; font: 400 22px var(--display); color: #ffb39a; }
.arena-card p { margin: 0 0 12px; font-size: 13px; color: #d9c5bd; }
.arena-card .warn { color: #ff8c7a; font-weight: 600; }
.arena-card .diff { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.arena-card .diff button { padding: 10px 6px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(224, 102, 59, .4); color: #ffd4c6; font-weight: 600; font-size: 13px; }
.arena-card .diff button small { display: block; font-weight: 500; color: #b99a90; font-size: 11px; margin-top: 2px; }
.arena-card .row2 { display: flex; gap: 8px; margin-top: 10px; }
.arena-card .row2 .btn { flex: 1; min-height: 40px; font-size: 13.5px; }
.lb { display: grid; gap: 6px; }
.lb div { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; }
.lb div b { color: var(--gold-hi); font-weight: 600; }
.lb div small { margin-left: auto; color: var(--muted); }
.lb .dead { opacity: .75; }

/* ---------- Арена: экран боя ---------- */
.arena { position: fixed; inset: 0; z-index: 15; display: none; flex-direction: column; height: 100dvh;
  background: radial-gradient(90% 60% at 50% 0%, #3a1416, transparent 70%), radial-gradient(80% 60% at 50% 100%, #2a1a0c, transparent 70%), #0d090b; }
.arena.show { display: flex; animation: fadeIn .3s ease; }
.arena-top { display: flex; align-items: center; padding: 14px 16px 6px; }
.arena-title { font: 400 22px var(--display); color: #ffb39a; text-shadow: 0 0 18px rgba(224, 102, 59, .5); }
.arena-round { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fighters { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 6px 14px 4px; }
.vs { font: 400 22px var(--display); color: #ff8c7a; text-shadow: 0 0 14px rgba(224, 102, 59, .7); }
.fighter { padding: 12px 10px; border-radius: 16px; background: rgba(28, 22, 34, .85); border: 1px solid var(--line); text-align: center; min-width: 0; transition: transform .2s; }
.fighter.foe { border-color: rgba(224, 102, 59, .45); }
.fighter.hit { animation: shake .45s ease; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.fighter .av { font-size: 34px; line-height: 1.1; }
.fighter b { display: block; font: 400 16px/1.15 var(--display); color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.fighter.foe b { color: #ffb39a; }
.fighter small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fighter .hpb { position: relative; height: 14px; border-radius: 7px; margin-top: 8px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.fighter .hpb i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #8f2320, var(--blood) 60%, #e3675d); transition: width .6s cubic-bezier(.3, .8, .3, 1); }
.fighter .hpb span { position: absolute; inset: 0; font-size: 10px; font-weight: 700; line-height: 14px; text-shadow: 0 1px 2px #000; }
.fighter .tags { margin-top: 6px; font-size: 10.5px; color: var(--muted); }
.arena-status { text-align: center; padding: 6px 14px; font-size: 13px; color: var(--gold-hi); min-height: 30px; }
.arena-status .timer { color: #ff8c7a; font-weight: 700; }
.arena-log { flex: 1; min-height: 0; overflow-y: auto; margin: 0 14px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.arena-log .rd { margin: 8px 0 4px; font: 600 11px var(--sans); letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.arena-log p { margin: 0 0 5px; color: #e6dccd; }
.arena-log p.new { animation: fadeIn .4s ease backwards; }
.arena-log p.kill { color: #ff8c7a; font-weight: 600; }
.arena-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px 14px calc(14px + var(--safe-b)); }
.arena-actions .act { min-height: 50px; border-radius: 14px; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(28, 22, 34, .9); border: 1px solid var(--line-strong); color: var(--gold-hi); }
.arena-actions .act small { font-weight: 500; font-size: 10.5px; color: var(--muted); }
.arena-actions .act.main { grid-column: span 2; background: linear-gradient(180deg, #e3675d, #a8322c); color: #fff; border-color: transparent; font-size: 16px; }
.arena-actions .act.ab { background: linear-gradient(180deg, rgba(141, 123, 234, .35), rgba(28, 22, 34, .9)); border-color: rgba(141, 123, 234, .5); color: #e1dbff; }
.arena-actions .act:disabled { opacity: .35; }
.arena-actions .act.chosen { outline: 2px solid var(--gold); opacity: 1; }
.arena-actions .wide { grid-column: span 2; }
.result { grid-column: span 2; text-align: center; padding: 6px 0 4px; }
.result h2 { margin: 0; font: 400 34px var(--display); }
.result.win h2 { color: var(--gold-hi); text-shadow: 0 0 24px rgba(243, 208, 138, .7); }
.result.lose h2 { color: #ff7a6b; text-shadow: 0 0 24px rgba(196, 65, 59, .7); }
.result p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

@media (min-width: 600px) {
  .grid.cards { grid-template-columns: repeat(3, 1fr); }
  .feed, .composer, .hud, .location-strip { max-width: 720px; width: 100%; margin-left: auto; margin-right: auto; }
  .location-strip { width: calc(100% - 28px); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============================================================
   Сумка, торговля, добыча
   ============================================================ */
.bag { flex: 0 0 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .08); font-size: 21px; display: grid; place-items: center; }
.bag:active { transform: scale(.94); }
.inv-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; padding-right: 34px; }
.inv-head h2 { margin: 0; font: 400 24px var(--display); color: var(--gold-hi); }
.inv-head .purse { margin-left: auto; color: var(--gold-hi); font-weight: 600; }
.inv-tabs { display: flex; gap: 6px; margin: 10px 0 8px; }
.inv-tabs button { flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: 600 13px var(--sans); }
.inv-tabs button.on { border-color: var(--gold); color: var(--gold-hi); background: rgba(217, 169, 78, .12); }
.inv-note { font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.inv-note.warn { color: #e8a36a; }
.inv-group { margin: 12px 0 6px; font: 600 11px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.it { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; margin-bottom: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: left; color: var(--text); font: 14px var(--sans); }
.it .ic { font-size: 20px; width: 26px; text-align: center; }
.it .nm { flex: 1; min-width: 0; }
.it .nm small { display: block; color: var(--muted); font-size: 11.5px; }
.it .q { color: var(--gold); font-weight: 700; font-size: 13px; }
.it .pr { color: var(--gold-hi); font-weight: 600; font-size: 13px; white-space: nowrap; }
.it.bound { opacity: .55; }
.it.open { border-color: var(--gold); }
.it-acts { display: flex; gap: 6px; margin: -2px 0 10px; flex-wrap: wrap; }
.it-acts button { flex: 1; min-width: 30%; padding: 9px 8px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .07); color: var(--gold-hi); font: 600 12.5px var(--sans); }
.it-acts button.sell { background: linear-gradient(180deg, #e3b85e, #b8832e); color: #241707; border: 0; }
.it-acts button.danger { color: #ff9a8c; border-color: rgba(196, 65, 59, .5); background: rgba(196, 65, 59, .08); }
.it-acts button:disabled { opacity: .4; }
.loot-gold { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(217, 169, 78, .1); border: 1px solid var(--line-strong); margin-bottom: 8px; color: var(--gold-hi); font-weight: 600; }
.loot-gold button, .it .take { margin-left: auto; padding: 7px 12px; border-radius: 10px; border: 0; background: linear-gradient(180deg, #e3b85e, #b8832e); color: #241707; font: 700 12.5px var(--sans); }
.it .take:disabled { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }

/* ============================================================
   Пошаговый бой в истории
   ============================================================ */
.fight-bar { margin: 0 12px 6px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(90deg, rgba(196, 65, 59, .22), rgba(196, 65, 59, .08)); border: 1px solid rgba(227, 103, 93, .5); color: #ffd1c8; font-size: 13px; }
.fight-bar .top { display: flex; align-items: center; gap: 8px; }
.fight-bar .top b { color: #fff; font-weight: 600; }
.fight-bar .top span { margin-left: auto; font-size: 12px; opacity: .85; }
.fight-bar .hpe { height: 7px; border-radius: 99px; background: rgba(0, 0, 0, .35); margin-top: 6px; overflow: hidden; }
.fight-bar .hpe i { display: block; height: 100%; background: linear-gradient(90deg, #ff6b5e, #c4413b); transition: width .6s ease; }
.fight-bar .hint { font-size: 11.5px; opacity: .75; margin-top: 4px; }
.duel { margin: 0 0 10px; border-radius: 12px; border: 1px solid rgba(139, 42, 32, .35); background: rgba(139, 42, 32, .06); padding: 9px 11px; font-family: var(--sans); }
.duel .foe-move { font-size: 13.5px; color: #6b2018; margin-bottom: 8px; font-style: italic; }
.duel .foe-move b { font-style: normal; }
.duel .rolls { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); }
.duel .rolls .r { flex: 1; text-align: center; padding: 6px 4px; border-radius: 10px; background: rgba(42, 31, 20, .07); border: 1px solid rgba(42, 31, 20, .15); }
.duel .rolls .r.win { background: rgba(47, 120, 86, .16); border-color: rgba(47, 120, 86, .45); }
.duel .rolls .r b { display: block; font: 700 18px var(--sans); }
.duel .rolls .r small { display: block; opacity: .7; font-size: 11px; }
.duel .rolls .vs { font: 700 11px var(--sans); color: #8b2a20; }
.duel .res { margin-top: 7px; font: 600 12.5px var(--sans); color: #3a2a1a; }
.duel .ehp { height: 6px; border-radius: 99px; background: rgba(42, 31, 20, .12); margin-top: 7px; overflow: hidden; }
.duel .ehp i { display: block; height: 100%; background: #c4413b; }
.combat-start { margin: 0 0 10px; padding: 8px 11px; border-radius: 12px; background: rgba(139, 42, 32, .1); border: 1px solid rgba(139, 42, 32, .4); color: #6b2018; font: 600 13px var(--sans); }
.combat-start small { display: block; font-weight: 400; opacity: .85; margin-top: 2px; }

.vs-box { text-align: center; padding: 24px; width: min(360px, 92vw); }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 14px; }
.vs-side { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.vs-side small { color: var(--muted); font-size: 12.5px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-side span { color: var(--gold-hi); font-size: 13px; min-height: 18px; }
.vs-die { width: 78px; height: 78px; border-radius: 18px; display: grid; place-items: center; font: 700 34px var(--sans); color: #241707;
  background: linear-gradient(160deg, #f3d08a, #c08a34); box-shadow: 0 6px 22px rgba(217, 169, 78, .4); }
.vs-die.foe { background: linear-gradient(160deg, #ff8f80, #a8322c); color: #fff; box-shadow: 0 6px 22px rgba(196, 65, 59, .45); }
.vs-die.spin { animation: vsSpin .5s linear infinite; }
.vs-die.won { transform: scale(1.12); outline: 3px solid #6fdca9; outline-offset: 3px; }
@keyframes vsSpin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(.9); } 100% { transform: rotate(360deg) scale(1); } }
.vs-x { font: 400 26px var(--display); color: var(--ember); }
.vs-verdict { font: 400 26px var(--display); margin: 0; min-height: 34px; }
.vs-verdict.ok { color: #6fdca9; } .vs-verdict.fail { color: #ff7a6b; } .vs-verdict.tie { color: var(--gold-hi); }

/* ============================================================
   Отношения и опасная зона на листе героя
   ============================================================ */
.rel { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; margin-bottom: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-align: left; font: 14px var(--sans); }
.rel .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(217, 169, 78, .1); border: 1px solid var(--line-strong); font-size: 17px; flex: 0 0 34px; }
.rel .nm { flex: 1; min-width: 0; }
.rel .nm b { font-weight: 600; }
.rel .nm small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel .tier { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.rel .bar { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .08); margin-top: 5px; position: relative; overflow: hidden; }
.rel .bar i { position: absolute; top: 0; bottom: 0; }
.bond-tag { display: inline-block; margin-left: 6px; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 159, 178, .14); color: #ffb3c3; border: 1px solid rgba(255, 159, 178, .35); }
.danger-zone { margin-top: 22px; padding: 14px; border-radius: 14px; border: 1px dashed rgba(196, 65, 59, .5); background: rgba(196, 65, 59, .06); }
.danger-zone p { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.danger-zone .btn { width: 100%; color: #ffb3a8; border-color: rgba(196, 65, 59, .6); background: rgba(196, 65, 59, .1); }
.arena-say { display: block; width: calc(100% - 24px); margin: 6px 12px 0; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(227, 103, 93, .35); background: rgba(0, 0, 0, .35); color: var(--text); font: 13.5px var(--sans); outline: none; }
.arena-say:focus { border-color: #e3675d; }
.chg.note { color: #6b4a1a; font-weight: 500; }
.chg.love { color: #b0306a; }
.duel .wtags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.duel .wtags span { font: 600 11.5px var(--sans); padding: 2px 8px; border-radius: 99px; background: rgba(139, 42, 32, .1); border: 1px solid rgba(139, 42, 32, .35); color: #6b2018; }
.duel .wconds { margin-top: 6px; font: 12px var(--sans); color: #5a3a24; }
.gear-panel { margin: 8px 0 4px; padding: 10px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .06); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gear-panel .gs { padding: 7px 9px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; min-width: 0; cursor: pointer; }
.gear-panel .gs.empty { opacity: .55; cursor: default; }
.gear-panel .gs span { margin-right: 4px; }
.gear-panel .gs b { font-weight: 600; color: var(--text); }
.gear-panel .gs small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.gear-panel .gsum { grid-column: span 2; font-size: 12px; color: var(--muted); padding: 2px 2px 0; }
.gear-panel .gsum b { color: var(--gold-hi); }
.it .worn { font-size: 10.5px; font-weight: 700; color: #6fdca9; background: rgba(79, 181, 138, .12); border: 1px solid rgba(79, 181, 138, .4); padding: 1px 6px; border-radius: 99px; margin-left: 4px; }
.prop { display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-strong); }
.prop .av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(217, 169, 78, .12); font-size: 18px; flex: 0 0 34px; }
.prop .nm { flex: 1; min-width: 0; font-size: 14px; }
.prop .nm small { display: block; color: var(--muted); font-size: 11.5px; }
.prop .pa { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.prop .pa button { padding: 6px 10px; border-radius: 9px; border: 0; background: linear-gradient(180deg, #e3b85e, #b8832e); color: #241707; font: 700 12px var(--sans); }
.prop .pa button:disabled { opacity: .4; }
.own-line { margin: 6px 0; font-size: 13px; color: var(--gold-hi); }

/* ============================================================
   Портреты, часы, лавка, ремесло, мир (босс, Вестник, гильдии, заказы)
   ============================================================ */
.portrait img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.portrait-big { width: 160px; height: 160px; margin: 6px auto 12px; border-radius: 18px; overflow: hidden; border: 2px solid var(--gold); display: grid; place-items: center; font-size: 70px; background: var(--panel); }
.portrait-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hud-clock { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; padding: 0 6px; }
.location-strip .online-pill { margin-left: 0; }
.title-line { color: var(--gold) !important; font-size: 12.5px !important; margin-top: 3px !important; }
.quick-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: -4px 0 14px; }
.quick-row button { padding: 9px 2px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .07); color: var(--gold-hi); font: 600 11px var(--sans); line-height: 1.25; }
.gtag { color: #9fd0ff; font-weight: 700; font-size: .9em; }
.cm .nm .ttl { font-size: 10.5px; color: var(--gold); margin-left: 6px; font-weight: 500; }
.sheet-input { display: block; width: 100%; margin: 6px 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .3); color: var(--text); font: 14px var(--sans); outline: none; }
.sheet-input:focus { border-color: var(--gold); }
select.sheet-input { appearance: auto; }
.small-btn { margin-top: 8px; width: 100%; }
.legacy { margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px solid rgba(255, 159, 58, .5); background: rgba(255, 159, 58, .08); }
.legacy .lg-head { display: flex; gap: 8px; align-items: center; font-weight: 600; color: #ffcf8a; }
.legacy p { font-size: 12.5px; color: var(--muted); margin: 6px 0; }
.legacy select { width: 100%; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.35); color: var(--text); border: 1px solid var(--line-strong); }

.shop-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; }
.shop-item .ic { font-size: 26px; width: 34px; text-align: center; }
.shop-item .nm { flex: 1; min-width: 0; }
.shop-item .nm small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
.shop-item .buy { padding: 9px 12px; border-radius: 12px; border: 0; background: linear-gradient(180deg, #ffd86b, #e3a11d); color: #2a1a02; font: 800 13px var(--sans); white-space: nowrap; }
.shop-item .buy:disabled { background: rgba(79, 181, 138, .2); color: #8fdc8f; }
.credits { display: flex; flex-wrap: wrap; gap: 6px; }
.credits span { font-size: 12px; padding: 4px 9px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }

.title-row, .prof, .recipe { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 6px; }
.title-row.locked, .recipe.locked { opacity: .5; }
.title-row .nm, .prof .nm, .recipe .nm { flex: 1; min-width: 0; font-size: 14px; }
.title-row small, .prof small, .recipe small { display: block; color: var(--muted); font-size: 11.5px; }
.title-row button, .mini { padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .08); color: var(--gold-hi); font: 600 12px var(--sans); white-space: nowrap; }
.mini.gold { background: linear-gradient(180deg, #e3b85e, #b8832e); color: #241707; border: 0; }
.mini:disabled { opacity: .4; }
.prof > span:first-child { font-size: 24px; }
.skill { display: block; height: 5px; border-radius: 99px; background: rgba(255,255,255,.08); margin: 5px 0 2px; overflow: hidden; }
.skill i { display: block; height: 100%; background: linear-gradient(90deg, #d9a94e, #f3d08a); }
.learn { display: flex; flex-wrap: wrap; gap: 6px; }
.learn button { padding: 8px 11px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); font: 600 12.5px var(--sans); }
.learn button:disabled { opacity: .45; }

.boss-card { margin: 0 0 14px; padding: 14px; border-radius: 16px; background: linear-gradient(160deg, rgba(120, 20, 30, .55), rgba(28, 22, 34, .9)); border: 1px solid rgba(255, 90, 90, .55); box-shadow: 0 0 24px rgba(196, 65, 59, .25); }
.boss-card h3 { margin: 0 0 4px; font: 400 22px var(--display); color: #ffb3a8; }
.boss-card h3 small { display: block; font: 500 12px var(--sans); color: #ff8f80; letter-spacing: .05em; }
.boss-card p { margin: 0 0 8px; font-size: 13px; color: #e8d6d0; }
.boss-card .meta { font-size: 12px; color: #d9b8b0; margin: 6px 0; }
.boss-card .warn { color: #ff9a8c; }
.bhp { position: relative; height: 16px; border-radius: 99px; background: rgba(0,0,0,.45); overflow: hidden; border: 1px solid rgba(255, 90, 90, .4); }
.bhp i { display: block; height: 100%; background: linear-gradient(90deg, #ff5a5a, #a8322c); transition: width .6s; }
.bhp span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px var(--sans); color: #fff; }
.boss-btn { width: 100%; background: linear-gradient(180deg, #e3675d, #a8322c); color: #fff; margin-top: 4px; }
.boss-card.mini { padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: none; }
.boss-card.t1 { background: linear-gradient(160deg, rgba(90, 60, 30, .5), rgba(28, 22, 34, .9)); border-color: rgba(227, 154, 93, .5); }
.boss-card.t2 { background: linear-gradient(160deg, rgba(100, 30, 70, .5), rgba(28, 22, 34, .9)); border-color: rgba(214, 100, 170, .5); }
.boss-card.t4 { background: linear-gradient(160deg, rgba(120, 70, 10, .6), rgba(40, 10, 20, .95)); border-color: #f3d08a; box-shadow: 0 0 30px rgba(243, 208, 138, .3); }
.bm-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bm-top > div { flex: 1; min-width: 0; }
.bm-top b { display: block; font: 400 17px var(--display); color: #ffd2c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-top small { display: block; font-size: 11.5px; color: #e3b0a5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-ic { font-size: 24px; }
.boss-card.mini .meta { margin: 4px 0 0; }
.bhp.thin { height: 6px; }
.tier-chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font: 700 10.5px var(--sans); letter-spacing: .04em; text-transform: uppercase; background: rgba(0,0,0,.35); color: #ffb3a8; border: 1px solid currentColor; white-space: nowrap; margin-bottom: 6px; }
.bm-top .tier-chip { margin: 0; }
.tier-chip.t1 { color: #e3a46d; } .tier-chip.t2 { color: #e58ac4; } .tier-chip.t3 { color: #ff7a6e; } .tier-chip.t4 { color: #f3d08a; }
.dg.ok { color: #7fd1a5; } .dg.mid { color: #f0c46a; } .dg.bad { color: #ff7a6e; font-weight: 700; }
.boss-bar { display: flex; align-items: center; gap: 8px; margin: 0 12px 6px; padding: 8px 10px; border-radius: 12px; background: rgba(110, 20, 28, .55); border: 1px solid rgba(255, 90, 90, .45); font-size: 12.5px; color: #f3d6cf; }
.boss-bar span { flex: 1; min-width: 0; }
.boss-bar .boss-btn { width: auto; margin: 0; padding: 7px 12px; flex-shrink: 0; }
.boss-line { color: #ff9a8c; }
.blog { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.3); max-height: 150px; overflow-y: auto; }
.blog p { font-size: 11.5px; margin: 0 0 4px; color: #e6d8cf; }

.news-card { margin: 0 0 14px; padding: 14px; border-radius: 16px; background: linear-gradient(180deg, #efe2c4, #e2cfa6); color: var(--ink); border: 1px solid #b89a63; }
.news-card h3 { margin: 0 0 8px; font: 400 20px var(--display); color: #3a2a14; }
.news-body { font: 15px/1.45 var(--serif); }
.news-body.short { max-height: 110px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.news-card .btn.ghost { color: #5b3d12; border-color: #a7864f; background: rgba(255,255,255,.3); }
.news-full { margin-bottom: 18px; }
.news-full h2 { font: 400 22px var(--display); color: var(--gold-hi); margin: 0 0 2px; }
.news-full .news-body { margin-top: 8px; color: var(--text); }

.guild .member .nm { cursor: pointer; }
.guild .meta, .board .meta { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.bounty { padding: 9px 10px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid var(--line); margin-bottom: 6px; }
.bounty .bt { display: flex; gap: 8px; align-items: baseline; }
.bounty .bt b { flex: 1; font-weight: 600; font-size: 14px; }
.bounty .rw { color: var(--gold-hi); font-weight: 700; white-space: nowrap; }
.bounty small { display: block; font-size: 12px; margin-top: 3px; }
.bounty .ba { margin-top: 6px; }
.bounty .ba button { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(217, 169, 78, .1); color: var(--gold-hi); font: 600 12px var(--sans); }
.trade-row { display: flex; align-items: center; gap: 8px; padding: 7px 4px; font-size: 14px; }
.qty { width: 60px; padding: 5px 7px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgba(0,0,0,.3); color: var(--text); }
.qty.wide { width: 100px; }
.emblems { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.emblems label { cursor: pointer; }
.emblems input { display: none; }
.emblems span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); font-size: 20px; background: var(--panel); }
.emblems input:checked + span { border-color: var(--gold); background: rgba(217, 169, 78, .2); }
.guild .row2 { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; }
.guild .row2 .btn { min-height: 38px; padding: 6px 4px; font-size: 12.5px; }
.boss-card.mini .meta { white-space: normal; overflow-wrap: anywhere; }

/* навыки и заклинания */
.skill-card { padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; }
.skill-card.locked { opacity: .55; }
.sk-top { display: flex; align-items: center; gap: 10px; }
.sk-ic { font-size: 24px; width: 30px; text-align: center; flex-shrink: 0; }
.sk-top .nm { flex: 1; min-width: 0; }
.sk-top .nm b { display: block; font-size: 14.5px; }
.sk-top .nm small { display: block; font-size: 11.5px; color: var(--muted); }
.sk-top .use { flex-shrink: 0; padding: 8px 12px; border-radius: 10px; border: 0; background: linear-gradient(180deg, #e3675d, #a8322c); color: #fff; font: 700 12.5px var(--sans); }
.sk-top .use:disabled { background: var(--panel-2, #2a2230); color: var(--muted); }
.skill-card ul { margin: 6px 0 0 40px; padding: 0; list-style: none; }
.skill-card li { font-size: 12.5px; color: var(--text); margin: 2px 0; }
.skill-card li::before { content: '· '; color: var(--gold); }
.sk-lock { margin: 6px 0 0 40px; font-size: 12px; color: #e8a36a; }
.fight-row { display: flex; align-items: center; gap: 8px; }
.fight-row .hint { flex: 1; }
.skills-btn { flex-shrink: 0; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(227, 103, 93, .6); background: rgba(196, 65, 59, .25); color: #ffd1c8; font: 700 12px var(--sans); }
.fight-bar .hint.buff { color: #f3d08a; }

/* бой отряда */
.duel.compact { margin: 6px 0 0; padding: 8px 0 0; border: 0; border-top: 1px dashed rgba(155, 43, 33, .3); border-radius: 0; background: none; box-shadow: none; }
.duel.compact .rolls { margin-top: 2px; }
.party-round .tgt { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: rgba(155, 43, 33, .15); color: #8a2a20; font: 700 11px var(--sans); white-space: nowrap; }
.round-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: 12.5px; }
.round-row span { opacity: .75; }
.round-row span.ok { opacity: 1; color: #9fe0b8; }
.round-timer { margin-left: auto; font: 700 12px var(--sans); color: #f3d08a; }
