:root {
  --gold: #c7a25a; --gold-hi: #f0d090; --bronze: #6b5332; --bronze-dk: #3a2a18;
  --ink: #0b0908; --text: #e8dcc0; --muted: #8f7a5a;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --title: Forum, "Cormorant Garamond", Georgia, serif;
  --stone: linear-gradient(180deg, #2a2420 0%, #1a1613 45%, #120f0d 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text);
  font: 600 15px var(--serif); }
/* Игра, а не документ: долгое нажатие пальцем не выделяет текст и не открывает меню «копировать» — кроме полей ввода. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable] { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
canvas#game { display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; }
[hidden] { display: none !important; }
button { font: 600 14px var(--serif); color: var(--text); cursor: pointer; padding: 6px 12px;
  background: linear-gradient(180deg, #3a2c1e, #1e1610); border: 1px solid var(--bronze);
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.15), 0 1px 2px #000; text-shadow: 0 1px 1px #000; }
button:hover { background: linear-gradient(180deg, #4e3a26, #2a1e14); border-color: var(--gold); color: #fff3d8; }
button:active { transform: translateY(1px); }
input { font: 600 15px var(--serif); color: var(--text); background: rgba(8, 6, 5, 0.85); border: 1px solid var(--bronze);
  padding: 7px 10px; outline: none; box-shadow: inset 0 1px 4px #000; }
input:focus { border-color: var(--gold); }

.panel { position: absolute; padding: 16px; color: var(--text);
  background: radial-gradient(ellipse at top, rgba(60, 44, 30, 0.35), transparent 60%), linear-gradient(180deg, rgba(26, 20, 16, 0.97), rgba(12, 9, 7, 0.97));
  border: 2px solid var(--bronze);
  box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--bronze-dk), inset 0 0 0 1px rgba(240, 200, 120, 0.12), inset 0 0 30px rgba(0, 0, 0, 0.8), 0 10px 40px rgba(0, 0, 0, 0.8); }
.panel::before, .panel::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid var(--gold); pointer-events: none; }
.panel::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -5px; right: -5px; border-left: 0; border-top: 0; }
.close { position: absolute; top: 8px; right: 8px; padding: 1px 8px; font-size: 13px; }

/* ---------- вход ---------- */
#login { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(400px, calc(var(--W, 100vw) - 32px));
  display: flex; flex-direction: column; gap: 10px; text-align: center; padding: 22px 22px 18px; }
#login .crest { width: 54px; height: 54px; margin: -50px auto 0; transform: rotate(45deg);
  background: radial-gradient(circle, #8a1a10 0 28%, #2a0806 30% 100%); border: 2px solid var(--gold);
  box-shadow: 0 0 20px rgba(255, 80, 20, 0.5), 0 0 0 3px #000; }
#login h1 { margin: 4px 0 0; font: 400 34px var(--title); letter-spacing: 2px; color: var(--gold-hi);
  background: linear-gradient(180deg, #fff0c0, #c7a25a 55%, #7a5a2a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 2px #000) drop-shadow(0 0 12px rgba(255, 140, 40, 0.35)); }
#login .sub { margin: -4px 0 6px; color: var(--muted); letter-spacing: 3px; text-transform: uppercase; font-size: 12px; }
#classes { display: flex; gap: 8px; }
#classes button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 8px; }
#classes .portrait { width: 56px; height: 56px; border: 1px solid var(--bronze-dk); }
#classes .sel { border-color: var(--gold); background: linear-gradient(180deg, #5a3e20, #2a1c10); box-shadow: 0 0 12px rgba(240, 180, 80, 0.35), inset 0 0 8px rgba(255, 200, 100, 0.2); color: #fff3d0; }
#play { font: 400 19px var(--title); letter-spacing: 1px; padding: 10px; margin-top: 4px;
  background: linear-gradient(180deg, #8a2a14, #4a0e06); border-color: #c0603a; box-shadow: 0 0 14px rgba(200, 60, 20, 0.4), inset 0 1px 0 rgba(255, 200, 150, 0.3); }
#play:hover { background: linear-gradient(180deg, #a83a1c, #5a1408); }
#loginErr { color: #ff6a5a; min-height: 1em; margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.5; }

/* ---------- создание героя ---------- */
#create { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(760px, calc(var(--W, 100vw) - 24px)); max-height: calc(var(--H, 100vh) - 24px);
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px; }
#create h2 { margin: 0; text-align: center; font: 400 28px var(--title); color: var(--gold-hi); letter-spacing: 1px; }
#crRaces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
#crRaces button { padding: 8px 4px; font-size: 13px; }
#crRaces button.sel, .seg button.sel { border-color: var(--gold); background: linear-gradient(180deg, #5a3e20, #2a1c10); color: #fff3d0;
  box-shadow: 0 0 12px rgba(240, 180, 80, 0.35), inset 0 0 8px rgba(255, 200, 100, 0.2); }
#crBody { display: flex; gap: 14px; }
#crPreviewBox { flex: 0 0 220px; display: flex; flex-direction: column; gap: 6px; }
#crPreview { width: 220px; height: 260px; background: radial-gradient(ellipse at 50% 70%, rgba(120, 60, 20, 0.35), rgba(0, 0, 0, 0.6) 70%);
  border: 1px solid var(--bronze-dk); }
#crRaceInfo { font-size: 12px; line-height: 1.45; color: var(--text); }
#crRaceInfo b { color: var(--gold-hi); }
#crRaceInfo .pro { color: #9fe39f; } #crRaceInfo .con { color: #ff8a7a; }
#crOpts { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.crRow { display: flex; align-items: center; gap: 10px; }
.crRow > span { flex: 0 0 96px; color: var(--muted); font-size: 13px; }
.seg { display: flex; gap: 4px; } .seg button { padding: 6px 12px; font-size: 13px; }
.seg button:disabled { opacity: 0.35; cursor: not-allowed; }
.step { display: flex; align-items: center; gap: 8px; } .step button { padding: 3px 10px; } .step b { min-width: 46px; text-align: center; }
.sw { display: flex; gap: 5px; flex-wrap: wrap; }
.sw i { width: 24px; height: 24px; border: 1px solid #000; outline: 1px solid var(--bronze-dk); cursor: pointer; }
.sw i.sel { outline: 2px solid var(--gold); }
#crErr { color: #ff6a5a; min-height: 1em; margin: 0; text-align: center; }
.crBtns { display: flex; gap: 10px; justify-content: space-between; }
#crGo { font: 400 19px var(--title); padding: 10px 26px; background: linear-gradient(180deg, #8a2a14, #4a0e06); border-color: #c0603a; }
@media (max-width: 640px) {
  #crRaces { grid-template-columns: repeat(3, 1fr); }
  #crBody { flex-direction: column; align-items: stretch; }
  #crPreviewBox { flex: none; align-items: center; }
  .crRow > span { flex-basis: 80px; }
  #crRaces button, .seg button, .step button { min-height: 44px; }
}

/* ---------- верх ---------- */
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none;
  max-width: calc(var(--W, 100vw) - 210px); }
#zone { display: inline-block; font: 400 18px var(--title); letter-spacing: 1px; color: var(--gold-hi); padding: 4px 26px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.7) 18%, rgba(0, 0, 0, 0.7) 82%, transparent);
  border-top: 1px solid rgba(199, 162, 90, 0.5); border-bottom: 1px solid rgba(199, 162, 90, 0.5); text-shadow: 0 0 6px #000; white-space: nowrap; }
#sub { margin-top: 4px; font-size: 14px; text-shadow: 0 0 4px #000, 0 0 2px #000; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
#karma { color: #ff5050; }
#quest { color: #b0f0a0; }

/* ---------- нижняя панель ---------- */
#orbs { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; align-items: flex-end;
  width: min(780px, var(--W, 100vw)); padding: 0 4px 6px; pointer-events: none; }
#orbs > * { pointer-events: auto; }
.orb { flex: none; width: 112px; height: 112px; border-radius: 50%; position: relative; overflow: hidden; z-index: 2;
  background: radial-gradient(circle at 50% 50%, #0a0605 55%, #1a120c 100%);
  border: 4px solid #8a6a3a; box-shadow: 0 0 0 2px #000, 0 0 0 5px #4a3620, 0 0 0 7px #000, 0 0 18px rgba(0, 0, 0, 0.9), inset 0 0 18px #000; }
.orb.hp { margin-right: -14px; }
.orb.mp { margin-left: -14px; }
.orb .liquid { position: absolute; bottom: 0; left: 0; right: 0; transition: height 0.25s ease-out; }
.orb .liquid i { position: absolute; left: -50%; width: 200%; height: 18px; top: -8px; border-radius: 45%;
  animation: wave 4s linear infinite; }
.orb.hp .liquid { background: radial-gradient(circle at 40% 20%, #ff3a2a, #9a0a06 55%, #3a0202); }
.orb.hp .liquid i { background: radial-gradient(ellipse at 50% 60%, rgba(255,120,90,0.55) 0 30%, rgba(255,60,40,0) 70%); }
.orb.mp .liquid { background: radial-gradient(circle at 40% 20%, #3a6aff, #0a1a9a 55%, #02063a); }
.orb.mp .liquid i { background: radial-gradient(ellipse at 50% 60%, rgba(120,170,255,0.55) 0 30%, rgba(60,100,255,0) 70%); animation-duration: 5s; }
@keyframes wave { from { transform: translateX(-25%) rotate(0deg); } 50% { transform: translateX(0%) rotate(2deg); } to { transform: translateX(-25%) rotate(0deg); } }
.orb .gloss { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse 45% 30% at 38% 22%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.55) 100%); }
.orb span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 14px var(--serif);
  text-shadow: 0 0 3px #000, 0 1px 2px #000; color: #fff; }
.lowhp .orb.hp { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px #000, 0 0 0 5px #4a3620, 0 0 0 7px #000, 0 0 26px rgba(255, 30, 10, 0.9), inset 0 0 18px #000; } }

#bar { flex: 1; min-width: 0; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px;
  padding: 7px 22px 8px; margin-bottom: 4px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 2px, rgba(0, 0, 0, 0.03) 2px 5px), var(--stone);
  border: 2px solid #6b5332; border-bottom: 0; border-radius: 6px 6px 0 0;
  box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 220, 160, 0.18), inset 0 0 20px rgba(0, 0, 0, 0.9), 0 -4px 20px rgba(0, 0, 0, 0.6); }
#xpbar { height: 12px; position: relative; background: #0a0806; border: 1px solid #4a3620; box-shadow: inset 0 1px 3px #000; }
#xpFill { height: 100%; background: linear-gradient(180deg, #f0d080, #b08030 60%, #6a4a18); box-shadow: 0 0 6px rgba(240, 200, 100, 0.5); transition: width 0.3s; }
#xpbar::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0, 0, 0, 0.7) calc(10% - 1px) 10%); }
#lvl { position: absolute; inset: -2px 0 0 0; text-align: center; font: 700 12px var(--serif); text-shadow: 0 0 3px #000, 0 0 2px #000; z-index: 1; }
#belt { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#skills, #potions { display: flex; gap: 5px; }
.skill, .pot { width: 54px; height: 54px; position: relative; flex: none; background: #0a0806; overflow: hidden;
  border: 2px solid #7a5e36; box-shadow: 0 0 0 1px #000, inset 0 0 6px #000; }
.skill img, .pot img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pot img { inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
.skill b, .pot b { position: absolute; top: 1px; left: 3px; font: 700 12px var(--serif); color: var(--gold-hi); text-shadow: 0 0 3px #000, 0 0 2px #000; z-index: 2; }
.skill small { position: absolute; bottom: 1px; right: 3px; font-size: 12px; color: #9ab8ff; text-shadow: 0 0 3px #000; z-index: 2; }
.skill .nm { display: none; }
.skill .cd { position: absolute; inset: 0; z-index: 1; }
.skill:hover .nm { display: block; position: absolute; left: 0; right: 0; bottom: 14px; font-size: 12px; text-align: center; color: #fff; text-shadow: 0 0 3px #000; z-index: 3; }
.pot { cursor: pointer; width: 44px; height: 54px; }
.pot span { position: absolute; bottom: 1px; right: 3px; font: 700 12px var(--serif); text-shadow: 0 0 3px #000; z-index: 2; }
#potHp { color: #ff9a8a; } #potMp { color: #9ab0ff; }
#side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
#gold { color: #ffd76a; font: 700 15px var(--serif); text-shadow: 0 0 4px #000; white-space: nowrap; }
#gold::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px;
  background: radial-gradient(circle at 35% 35%, #fff0a0, #c89a20 60%, #6a4a08); box-shadow: 0 0 4px rgba(255, 200, 80, 0.6); }
#invBtn { padding: 3px 10px; font-size: 13px; }
#soundBtn { padding: 3px 7px; font-size: 13px; line-height: 1; }

/* ---------- чат ---------- */
#chat { position: absolute; left: 10px; bottom: 140px; width: min(380px, calc(var(--W, 100vw) - 20px)); }
#chatLog { max-height: 170px; overflow-y: auto; font-size: 14px; text-shadow: 0 0 3px #000, 0 0 2px #000, 0 1px 1px #000; margin-bottom: 4px;
  mask-image: linear-gradient(180deg, transparent, #000 30%); -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%); }
#chatIn { width: 100%; background: rgba(8, 6, 5, 0.6); opacity: 0.75; }
#chatIn:focus { opacity: 1; }

/* ---------- инвентарь ---------- */
#cpbar { height: 6px; position: relative; margin-bottom: 2px; background: #0a0806; border: 1px solid #4a3620; }
#cpFill { height: 100%; background: linear-gradient(180deg, #ffe88a, #c9a227); transition: width 0.2s; }
#cpText { position: absolute; right: 4px; top: -13px; font: 700 12px var(--serif); color: #ffe88a; text-shadow: 0 0 3px #000; }
#book { top: 190px; left: 10px; width: min(360px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 340px); min-height: 160px; overflow-y: auto; }
#bookSp { color: var(--gold-hi); margin: 2px 0 8px; font-size: 13px; }
.bk { display: flex; gap: 8px; align-items: center; padding: 6px; border-bottom: 1px solid rgba(160, 120, 70, 0.25); }
.bk img { width: 34px; height: 34px; border: 1px solid var(--bronze-dk); flex: none; }
.bk .tx { flex: 1; font-size: 12px; line-height: 1.35; }
.bk .tx b { font-size: 13px; color: var(--gold-hi); }
.bk.locked { opacity: 0.55; }
.bk button { padding: 2px 8px; font-size: 12px; }
.bkBtns { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.skill.empty { opacity: 0.35; }
#party { position: absolute; top: 60px; left: 10px; width: 170px; display: flex; flex-direction: column; gap: 5px; pointer-events: auto; }
.pm { background: rgba(10, 8, 6, 0.8); border: 1px solid var(--bronze-dk); padding: 4px 6px; }
.pm.dead { opacity: 0.45; }
.pmName { font: 700 12px var(--serif); color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmName small { color: var(--muted); font-weight: 400; }
.pmBar { height: 5px; background: #120c08; margin-top: 2px; }
.pmBar i { display: block; height: 100%; }
.pmBar.hp i { background: linear-gradient(180deg, #e04a3a, #8a1a10); }
.pmBar.mp i { background: linear-gradient(180deg, #4a7ae0, #1a3a8a); }
#party button { font-size: 12px; padding: 2px 6px; }
#trade { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(460px, calc(var(--W, 100vw) - 24px)); max-height: calc(var(--H, 100vh) - 40px); overflow-y: auto; z-index: 4; }
#trade h3 { margin: 0 0 8px; color: var(--gold-hi); }
#trade h4 { margin: 8px 0 4px; font-size: 13px; color: var(--muted); }
.tCols { display: flex; gap: 10px; }
.tCol { flex: 1; border: 1px solid var(--bronze-dk); padding: 6px; min-height: 120px; }
.tCol.ok { border-color: #6ad86a; box-shadow: inset 0 0 10px rgba(100, 220, 100, 0.25); }
.tItem { font-size: 13px; padding: 3px 4px; cursor: pointer; border-bottom: 1px solid rgba(160, 120, 70, 0.15); }
.tItem:hover { background: rgba(255, 220, 150, 0.08); }
.tEmpty { color: var(--muted); font-size: 12px; }
.tBag { max-height: 140px; overflow-y: auto; border: 1px solid var(--bronze-dk); padding: 4px; }
#trade label { display: block; margin-top: 6px; font-size: 12px; } #trade input { width: 90px; }
#trade .row { display: flex; justify-content: space-between; margin-top: 10px; }
#tracker { position: absolute; top: 64px; right: 200px; width: 230px; pointer-events: none; font-size: 12px; text-shadow: 0 0 3px #000, 0 0 2px #000; }
#tracker .tq b { color: var(--gold-hi); } #tracker .tq { margin-bottom: 4px; color: #e8dcc0; }
#tracker .tq.ready { color: #9fe39f; }
#questLog { top: 190px; left: 50%; transform: translateX(-50%); width: min(380px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 340px); overflow-y: auto; }
#questLog h3 { margin: 0 0 6px; color: var(--gold-hi); }
.qrow { border-bottom: 1px solid rgba(160, 120, 70, 0.2); padding: 6px 2px; font-size: 13px; }
.qrow b { color: var(--gold-hi); } .qrow .qs { color: #e8dcc0; } .qrow.ready .qs { color: #9fe39f; }
.qrow button { margin-top: 4px; font-size: 12px; padding: 2px 8px; }
#dlgQuests .qrow { font-size: 12px; }
/* задания v2: цели шага, награда, метки, развилка, квестовые предметы в журнале */
.qgoals { list-style: none; margin: 3px 0 0; padding: 0; }
.qgoals li { display: flex; justify-content: space-between; gap: 8px; color: #e8dcc0; padding: 1px 0 1px 10px; position: relative; }
.qgoals li::before { content: '•'; position: absolute; left: 0; color: var(--bronze, #a07846); }
.qgoals li b { color: #e8dcc0; font-weight: 600; white-space: nowrap; }
.qgoals li.done, .qgoals li.done b { color: #9fe39f; }
.qrw { color: #e8c878; margin-top: 2px; }
.qtag { display: inline-block; font-size: 11px; padding: 0 5px; border: 1px solid rgba(160, 120, 70, 0.6); border-radius: 3px; color: #d8c8a0; vertical-align: 1px; }
.qhead { margin: 8px 0 2px; color: var(--gold-hi); font-weight: 700; font-size: 13px; }
.qitem .qs { color: #b8a888; font-size: 12px; }
.qchoice { margin-top: 5px; padding: 6px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(200, 160, 80, 0.45); }
.qchoice .qct { color: var(--gold-hi); margin-bottom: 4px; }
.qopts { display: flex; flex-wrap: wrap; gap: 6px; }
.qrow .qopts button { flex: 1 1 140px; margin-top: 0; font-size: 13px; padding: 5px 8px; }
.qopts button.picked { outline: 1px solid var(--gold-hi); }
#tracker .tg { padding-left: 4px; } #tracker .tg.done { color: #9fe39f; }
/* доска заданий и контракты (П5) */
.qboard { margin-top: 6px; padding: 4px 6px 6px; border: 1px solid rgba(200, 160, 80, 0.45); background: rgba(40, 28, 12, 0.35); }
.qboard .qhead { margin-top: 2px; }
.qbinfo { color: #d8c8a0; font-size: 12px; margin-bottom: 2px; }
.qtgt { color: #f0c27a; margin-top: 2px; overflow-wrap: anywhere; }
.qbrow { opacity: 0.75; } .qbrow .qst { float: right; color: #b8a888; font-size: 11px; }
.qbrow.taken .qst { color: #9fd0ff; } .qbrow.done .qst { color: #9fe39f; } .qbrow.locked .qst { color: #e0a070; }
.qreroll { display: block; width: 100%; margin-top: 6px; font-size: 12px; padding: 3px 8px; }
#dlgTele button.locked { opacity: 0.55; filter: grayscale(0.8); }
#dlgTele button.locked small { color: #e0b070; opacity: 1; }
@media (max-width: 900px) { #tracker { right: 10px; top: 200px; width: 180px; } }
#shopPanel { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(var(--W, 100vw) - 24px)); max-height: calc(var(--H, 100vh) - 40px); overflow-y: auto; z-index: 4; }
#shopPanel h3 { margin: 0 0 8px; color: var(--gold-hi); } #shopPanel #shopTitle { width: 100%; margin-bottom: 8px; }
.shRow { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px; border-bottom: 1px solid rgba(160, 120, 70, 0.15); }
.shRow span { flex: 1; } .shRow input[type=number] { width: 80px; } .shRow b { color: #ffd76a; }
#shopPanel .row { display: flex; justify-content: space-between; margin-top: 10px; }
#clanPanel, #friendsPanel { top: 190px; left: 50%; transform: translateX(-50%); width: min(340px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 340px); overflow-y: auto; }
#clanPanel h3, #friendsPanel h3 { margin: 0 0 6px; color: var(--gold-hi); } #clanPanel h4, #friendsPanel h4 { margin: 4px 0 8px; font-size: 13px; color: var(--gold-hi); }
.cm button { margin-left: 4px; padding: 0 6px; font-size: 12px; }
.cm { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 2px; color: var(--muted); border-bottom: 1px solid rgba(160, 120, 70, 0.15); }
.cm.on { color: var(--text); } .cm.on span { color: #9fe39f; }
#partyInvite { top: 40%; left: 50%; transform: translateX(-50%); text-align: center; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
#partyInvite .row { display: flex; gap: 10px; justify-content: center; }
.pot.shot { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.pot.shot i { font: 700 12px var(--serif); font-style: normal; color: #bfe0ff; }
.pot.shot.on { box-shadow: 0 0 10px rgba(140, 200, 255, 0.9), inset 0 0 8px rgba(140, 200, 255, 0.5); border-color: #8cc8ff; }
.skill.on { box-shadow: 0 0 10px rgba(255, 220, 120, 0.9), inset 0 0 8px rgba(255, 220, 120, 0.5); }
#inventory { top: 190px; right: 10px; width: min(350px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 340px); min-height: 160px; overflow-y: auto; }
#inventory h3, #dialog h3 { margin: 0 0 10px; font: 400 21px var(--title); letter-spacing: 1px; color: var(--gold-hi); text-shadow: 0 2px 2px #000; }
#inventory h3 small { color: var(--muted); font-size: 12px; }
#inventory h4 { margin: 10px 0 6px; font: 400 15px var(--title); color: var(--gold); border-bottom: 1px solid rgba(199, 162, 90, 0.3); padding-bottom: 3px; }
#inventory h4 small { color: var(--muted); }
#stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; font-size: 13px; padding: 8px; background: rgba(0, 0, 0, 0.4); border: 1px solid #3a2a18; }
#stats div { display: flex; justify-content: space-between; color: #b8a888; }
#stats b { color: #f0e0c0; }
.item { display: flex; gap: 8px; border: 1px solid #3d2c1d; padding: 6px; margin-bottom: 5px; font-size: 13px; text-align: left;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.25)); }
.item .ico { width: 44px; height: 44px; flex: none; background: radial-gradient(circle, #1e1812, #0a0806); border: 1px solid #5a4428; box-shadow: inset 0 0 6px #000; }
.item .ico img { width: 100%; height: 100%; display: block; }
.item .body { flex: 1; min-width: 0; }
.item.r-magic .ico { border-color: #4a5aa8; box-shadow: inset 0 0 10px rgba(80, 110, 255, 0.35); }
.item.r-rare .ico { border-color: #a89a3a; box-shadow: inset 0 0 10px rgba(255, 220, 60, 0.35); }
.item.r-unique { border-color: #6a5432; }
.item.r-unique .ico { border-color: var(--gold); box-shadow: inset 0 0 12px rgba(230, 180, 90, 0.5), 0 0 6px rgba(230, 180, 90, 0.3); }
.item.empty { opacity: 0.6; align-items: center; }
.item .nm { font-weight: 700; font-size: 14px; }
.item .st { color: #8aa8ff; font-size: 12px; }
.item .btns { margin-top: 4px; }
.item button { padding: 1px 9px; font-size: 12px; margin-right: 4px; }
.slotLabel { color: var(--muted); font-size: 12px; }
.emptyBag { padding: 6px; }

/* ---------- диалог ---------- */
#dialog { left: 50%; top: 16%; transform: translateX(-50%); width: min(480px, calc(var(--W, 100vw) - 32px)); display: flex; flex-direction: column; gap: 9px; }
.dlgHead { display: flex; align-items: center; gap: 12px; padding-right: 26px; }
#dlgPortrait canvas { width: 64px; height: 64px; display: block; border: 2px solid var(--bronze); box-shadow: 0 0 0 1px #000, 0 0 10px rgba(0, 0, 0, 0.8); }
#dialog h3 { margin: 0; }
#dlgLog { max-height: 240px; min-height: 60px; overflow-y: auto; font-size: 15px; line-height: 1.35; padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid #3a2a18; box-shadow: inset 0 0 10px #000; }
#dlgLog .npc { color: #e8d098; margin: 4px 0; }
#dlgLog .me { color: #a8c8ff; margin: 4px 0; }
#dlgLog .typing { color: var(--muted); font-style: italic; }
#dlgShop { display: flex; gap: 6px; flex-wrap: wrap; }
#dlgShop button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; }
#dlgShop img { width: 22px; height: 22px; }
#worldMap { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; cursor: pointer; }
#dlgTele { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 40vh; overflow-y: auto; }
#dlgTele button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; }
#dlgTele button small { opacity: 0.75; font-size: 12px; }
#dlgTele button.poor small { color: #e07a6a; }
@media (max-width: 480px) { #dlgTele { grid-template-columns: 1fr; } }

/* ---------- смерть ---------- */
#death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.2), rgba(30, 0, 0, 0.75)); text-align: center; }
#death .title { font: 400 clamp(36px, 9vw, 72px) var(--title); letter-spacing: 6px; color: #c0201a;
  text-shadow: 0 0 20px rgba(255, 30, 10, 0.6), 0 3px 3px #000; animation: rise 1.2s ease-out; }
#death small { font-size: 18px; color: #e8c0b0; text-shadow: 0 0 4px #000; }
#death button { pointer-events: auto; margin-top: 10px; padding: 8px 22px; font-size: 15px; }
#profBox { margin: 6px 0 10px; border: 1px solid var(--bronze-dk); padding: 4px; }
#profBtn { width: 100%; margin-bottom: 6px; }
#subBtn { width: 100%; margin-bottom: 6px; }
#subBox { margin: 6px 0 10px; border: 1px solid var(--bronze-dk); padding: 4px; }
#subBox .bk.cur { outline: 1px solid var(--gold, #ffd76a); }
@keyframes rise { from { opacity: 0; transform: scale(1.2); letter-spacing: 16px; } }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0806; }
::-webkit-scrollbar-thumb { background: #4a3620; border: 1px solid #000; }

#tgLogin { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#tgLogin .or { color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
#tgWidget { min-height: 40px; }

/* ---------- инвентарь v2: кукла, сумка, подсказка, заточка, магазин ---------- */
#doll { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; max-width: 250px; margin: 0 auto; }
#bag { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.cell { position: relative; aspect-ratio: 1; min-width: 0; padding: 0; background: radial-gradient(circle, #1e1812, #0a0806); border: 2px solid var(--c, #3d2c1d); box-shadow: inset 0 0 8px #000, 0 0 6px color-mix(in srgb, var(--c, transparent) 40%, transparent); cursor: pointer; }
.cell img { width: 100%; height: 100%; display: block; padding: 3px; box-sizing: border-box; }
.cell.empty, .cell.void { cursor: default; border-color: #2a2016; box-shadow: inset 0 0 6px #000; }
.cell.void { visibility: hidden; }
.cell.empty small { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; line-height: 1.1; color: #5a4a36; padding: 2px; }
.cell.sel { outline: 2px solid var(--gold-hi); outline-offset: 1px; }
.cell.target { animation: cellPulse 0.9s ease-in-out infinite alternate; }
@keyframes cellPulse { to { box-shadow: inset 0 0 8px #000, 0 0 12px 2px #ffd76a; } }
.cell .en { position: absolute; top: 1px; right: 3px; font: 700 12px var(--serif); font-style: normal; color: #ffd76a; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.cell .gr { position: absolute; bottom: 1px; left: 3px; font: 700 12px var(--serif); color: #b8a888; text-shadow: 0 1px 2px #000; }
#mats { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 3px 8px; font-size: 12px; text-align: left; }
.chip.on { border-color: #ffd76a; box-shadow: 0 0 8px rgba(255, 215, 106, 0.6); }
.chip.dead { color: var(--muted); border: 1px solid #3d2c1d; background: transparent; cursor: default; }
#enchBar { margin: 8px 0 0; padding: 6px 8px; font-size: 13px; background: rgba(255, 215, 106, 0.12); border: 1px solid #a89a3a; }
#enchBar button { margin-left: 6px; padding: 1px 8px; font-size: 12px; }
#enchDlg { margin: 8px 0 0; padding: 8px; font-size: 13px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--gold); }
#enchDlg .warn { color: #ff7a6a; font-weight: 700; margin: 4px 0; }
#enchDlg .okTxt { color: #9ad07a; margin: 4px 0; }
#enchDlg .row { display: flex; gap: 8px; margin-top: 6px; }
#inventory.flashOk { animation: flashOk 0.7s; }
#inventory.flashBad { animation: flashBad 0.7s; }
@keyframes flashOk { 30% { box-shadow: 0 0 30px 6px rgba(255, 215, 106, 0.9); } }
@keyframes flashBad { 30% { box-shadow: 0 0 30px 6px rgba(255, 60, 40, 0.9); } }

#itemTip { position: fixed; top: 190px; right: 370px; width: 270px; max-height: calc(var(--H, 100vh) - 220px); overflow-y: auto; font-size: 13px; z-index: 6; }
#inventory[hidden] ~ #itemTip { display: none; }
#itemTip .tNm { font: 700 16px var(--serif); padding-right: 22px; }
#itemTip .tEn { color: #ffd76a; }
#itemTip .tSub { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
#itemTip .tReq.bad { color: #ff7a6a; }
#itemTip .tBase { color: #f0e0c0; margin: 4px 0; }
#itemTip .tAf { color: #8aa8ff; margin: 4px 0; }
#itemTip .tPr { color: #ffb84a; margin: 4px 0; }
#itemTip .tPr small { color: var(--muted); }
#itemTip .tUq { margin: 4px 0; color: #e0b030; }
#itemTip .tUq i { display: block; color: #a89878; margin-top: 3px; }
#itemTip .tSet { margin: 4px 0; color: #5a6a58; }
#itemTip .tSet b { color: #3fc060; }
#itemTip .tSet .on { color: #9ad07a; }
#itemTip .tEnch, #itemTip .tVal { color: var(--muted); font-size: 12px; margin-top: 3px; }
#itemTip .tBtns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
#itemTip .tBtns button { padding: 3px 10px; font-size: 13px; }
#itemTip .tBtns button.dim { opacity: 0.55; }

#npcShop { top: 120px; left: 50%; transform: translateX(-50%); width: min(460px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 200px); overflow-y: auto; z-index: 7; }
#smith, #warehouse, #mailWin, #findWin, #matchWin { top: 120px; left: 50%; transform: translateX(-50%); width: min(520px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 200px); overflow-y: auto; z-index: 7; }
#smith h3, #warehouse h3, #mailWin h3, #findWin h3, #matchWin h3, #npcShop h3 { margin: 0 0 8px; font: 400 21px var(--title); color: var(--gold-hi); }
.shTabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
#smith .shRow button.on { border-color: var(--gold-hi); color: var(--gold-hi); }
.shTabs button { padding: 2px 10px; font-size: 13px; }
.shTabs button.on { border-color: var(--gold-hi); color: var(--gold-hi); }
#smith .shRow, #warehouse .shRow, #mailWin .shRow, #findWin .shRow, #matchWin .shRow, #npcShop .shRow { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid #2a2016; font-size: 13px; }
#smith .shRow img, #warehouse .shRow img, #mailWin .shRow img, #findWin .shRow img, #matchWin .shRow img, #npcShop .shRow img { width: 28px; height: 28px; flex: none; }
#smith .shRow span, #warehouse .shRow span, #mailWin .shRow span, #findWin .shRow span, #matchWin .shRow span, #npcShop .shRow span { flex: 1; min-width: 0; }
#smith .shRow small, #warehouse .shRow small, #mailWin .shRow small, #findWin .shRow small, #matchWin .shRow small, #npcShop .shRow small { color: var(--muted); } #npcShop .shRow small.bad { color: #ff7a6a; }
#smith .shRow b, #warehouse .shRow b, #mailWin .shRow b, #findWin .shRow b, #matchWin .shRow b, #npcShop .shRow b { color: #ffd76a; }
#smith .shRow button, #warehouse .shRow button, #mailWin .shRow button, #findWin .shRow button, #matchWin .shRow button, #npcShop .shRow button { padding: 1px 9px; font-size: 12px; }
/* ---------- питомцы и верховая езда ---------- */
#petShop { top: 100px; left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 20px)); max-height: calc(100vh - 180px); overflow-y: auto; z-index: 7; }
#petShop h3 { margin: 0 0 8px; font: 400 21px var(--title); color: var(--gold-hi); }
#petShop h4 { margin: 8px 0 4px; font: 400 15px var(--title); color: var(--gold); border-bottom: 1px solid rgba(199, 162, 90, 0.3); }
#petShop .shRow { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid #2a2016; font-size: 13px; }
#petShop .shRow img { width: 28px; height: 28px; flex: none; }
#petShop .shRow span { flex: 1; min-width: 0; }
#petShop .shRow small { color: var(--muted); } #petShop .shRow small.bad { color: #ff7a6a; }
#petShop .shRow b { color: #ffd76a; }
#petShop .shRow button { padding: 1px 9px; font-size: 12px; }
#petShop button.poor { opacity: 0.55; }
#petWin { left: 190px; top: 60px; width: 210px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; z-index: 3; }
#petWin.hungry { border-color: #c0402a; }
.pwHead { display: flex; align-items: baseline; gap: 6px; padding-right: 2px; }
.pwHead b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9fe39f; font-size: 15px; }
.pwHead small { color: var(--muted); } .pwHead button { padding: 0 7px; font-size: 14px; line-height: 18px; } .pwHead button.on { border-color: var(--gold-hi); }
.pwBar { position: relative; height: 11px; background: #14100c; border: 1px solid #000; }
.pwBar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; }
.pwBar span { position: absolute; inset: 0; text-align: center; font: 700 10px/11px var(--serif); text-shadow: 0 0 2px #000; }
.pwBar.hp i { background: linear-gradient(180deg, #e0463a, #8a1810); } .pwBar.mp i { background: linear-gradient(180deg, #4a7aff, #1a2a8a); }
.pwBar.food i { background: linear-gradient(180deg, #d8a43a, #7a5412); } .pwBar.xp { height: 4px; } .pwBar.xp i { background: #c7a25a; }
.pwCmds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-top: 2px; }
.pwCmds button { padding: 3px 2px; font-size: 12px; } .pwCmds button.on { border-color: var(--gold-hi); color: var(--gold-hi); }
.pwSk { font-size: 11px; color: var(--muted); }
#mountBtn { position: absolute; right: 12px; bottom: 150px; z-index: 4; display: flex; align-items: center; gap: 6px; padding: 6px 12px; pointer-events: auto; }
#mountBtn img { width: 26px; height: 26px; } #mountBtn.on { border-color: #7ad8ff; color: #bfeaff; }
@media (max-width: 760px) {
  #petWin { left: 8px; top: 54px; width: 168px; padding: 6px 8px; }
  #mountBtn { bottom: 118px; right: 8px; padding: 8px 12px; font-size: 15px; }
  #petShop { top: 60px; max-height: calc(100vh - 140px); }
}
#npcShop .shScrolls { margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--gold); }

@media (max-width: 760px) {
  /* Телефон: подсказка — нижний лист с кнопками под большой палец */
  #itemTip { top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 55vh; }
  #itemTip .tBtns button { padding: 8px 14px; font-size: 14px; }
  #doll { max-width: 100%; }
}

/* ---------- настройки звука ---------- */
#audioBtn { padding: 3px 7px; font-size: 14px; line-height: 1; }
#audioPanel { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(340px, calc(var(--W, 100vw) - 24px)); max-height: calc(var(--H, 100vh) - 24px); overflow-y: auto; z-index: 40; }
#audioPanel h3 { margin: 0 0 10px; font-family: var(--title); color: var(--gold-hi); }
#audioPanel .arow { display: grid; grid-template-columns: 96px 1fr 34px; align-items: center; gap: 8px; margin: 6px 0; min-height: 30px; }
#audioPanel .arow:first-of-type { grid-template-columns: 1fr 24px; }
#audioPanel .arow small { color: var(--muted); text-align: right; }
#audioPanel select { grid-column: 2 / 4; background: #14100c; color: var(--text, #e8d8b0); border: 1px solid #5a4528; border-radius: 3px; padding: 5px 6px; font: inherit; }
#audioPanel input[type=range] { width: 100%; padding: 0; height: 28px; accent-color: var(--gold); background: none; border: 0; box-shadow: none; }
#audioPanel input[type=range]:disabled { opacity: 0.4; }
#audioPanel input[type=checkbox] { width: 20px; height: 20px; justify-self: start; accent-color: var(--gold); }
#audioPanel ul { padding-left: 18px; margin: 6px 0; } #audioPanel li { margin: 5px 0; }
#audioPanel a { color: var(--gold-hi); }
#audioPanel button:not(.close) { margin-top: 10px; }
/* ---------- баффы над панелью умений, заряды монаха, рамка призванного ---------- */
#above { display: flex; align-items: flex-end; gap: 8px; min-height: 0; flex-wrap: wrap; }
#above:empty { display: none; }
#buffs { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; min-width: 0; justify-content: flex-end; pointer-events: none; }
#buffs:empty { display: none; }
.bf { position: relative; width: 28px; height: 28px; border: 1px solid #7a5e36; background: #0a0806; box-shadow: 0 0 0 1px #000;
  font: 700 13px var(--serif); color: #f2dfb0; display: flex; align-items: center; justify-content: center; text-shadow: 0 0 3px #000; }
.bf.bad { border-color: #c0392b; box-shadow: 0 0 0 1px #000, 0 0 5px rgba(220, 60, 40, 0.7); }
.bf em { position: absolute; left: 0; right: 0; bottom: -1px; font: 700 12px var(--serif); font-style: normal; text-align: center; color: #fff;
  background: rgba(0, 0, 0, 0.72); line-height: 11px; }
#charges { display: flex; gap: 4px; align-items: center; padding: 0 4px; }
#charges i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #8a6a2a; background: #1a1208; box-shadow: inset 0 0 4px #000; }
#charges i.on { background: radial-gradient(circle at 35% 35%, #fff4b0, #ffb020 60%, #a05a08); border-color: #ffd76a; box-shadow: 0 0 8px rgba(255, 190, 60, 0.9); }
#svFrame { display: flex; flex-direction: column; gap: 2px; width: 150px; background: rgba(10, 8, 6, 0.8); border: 1px solid var(--bronze-dk); padding: 3px 5px; pointer-events: auto; }
.svName { display: flex; justify-content: space-between; font: 700 12px var(--serif); color: #9fe0ff; }
.svName span { font-weight: 400; font-size: 12px; color: #cfe8f0; }
.svHp { height: 6px; background: #1a0a08; border: 1px solid #000; }
#svHpFill { height: 100%; width: 100%; background: linear-gradient(180deg, #5ad0ff, #2a7aa8); transition: width 0.2s; }
.svMp { height: 3px; }
#svMpFill { height: 100%; width: 100%; background: linear-gradient(180deg, #8a9cff, #4a58c8); transition: width 0.3s; }
#svMain { display: flex; flex-direction: column; gap: 2px; }
#svCubics { font: 400 11px var(--serif); color: #c8f0d8; max-width: 150px; }
.svBtns { display: flex; gap: 3px; }
.svBtns button { flex: 1; padding: 1px 0; font-size: 13px; line-height: 18px; }
.svBtns button.on { border-color: var(--gold-hi); color: var(--gold-hi); }
#swapBtn { padding: 3px 7px; font-size: 13px; line-height: 1; }
#dlgBuff { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
#dlgBuff p { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }
#dlgBuff button { padding: 3px 9px; font-size: 13px; }
#dlgBuff button.on { border-color: #7fd89a; color: #9fe39f; }
#dlgBuff button.all { border-color: var(--gold-hi); color: var(--gold-hi); }
@media (max-width: 480px) {
  .bf { width: 24px; height: 24px; font-size: 12px; }
  #above { gap: 4px; }
  #svFrame { width: auto; flex-direction: row; align-items: center; gap: 6px; padding: 2px 4px; }
  .svName span { display: none; }
  .svName b { font-size: 12px; }
  .svHp { width: 54px; }
  .svBtns button { padding: 0 6px; }
}
.skill { cursor: pointer; touch-action: manipulation; }
/* ---------- ремесло ---------- */
#craft { top: 90px; left: 50%; transform: translateX(-50%); width: min(720px, calc(var(--W, 100vw) - 20px)); max-height: calc(var(--H, 100vh) - 180px); overflow-y: auto; z-index: 7; }
#craft h3 { margin: 0 0 6px; font: 400 21px var(--title); letter-spacing: 1px; color: var(--gold-hi); } #craft h3 small { color: var(--muted); font-size: 12px; }
#craft h4 { margin: 8px 0 4px; font: 400 15px var(--title); color: var(--gold); border-bottom: 1px solid rgba(199, 162, 90, 0.3); }
.crSkills { font-size: 12px; color: var(--muted); margin-bottom: 6px; } .crSkills b { color: var(--gold-hi); }
.crFilters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; align-items: center; }
.crFilters button { padding: 2px 8px; font-size: 12px; } .crFilters button.on { border-color: var(--gold-hi); color: var(--gold-hi); }
.crFilters input { width: 90px; padding: 2px 6px; font-size: 12px; margin-left: auto; }
.crCols { display: grid; grid-template-columns: minmax(180px, 2fr) 3fr; gap: 10px; }
.crList { max-height: 420px; overflow-y: auto; border: 1px solid var(--bronze-dk); background: rgba(0, 0, 0, 0.3); }
.crItem { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; width: 100%; padding: 4px 8px; text-align: left; border: 0; border-bottom: 1px solid rgba(160, 120, 70, 0.15); background: transparent; }
.crItem small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.crItem.can span { color: #9fe39f; } .crItem.lock span { color: #8f7a5a; }
.crItem.sel { background: linear-gradient(90deg, rgba(240, 200, 120, 0.2), transparent); box-shadow: inset 2px 0 var(--gold); }
.crDetail { border: 1px solid var(--bronze-dk); padding: 8px; background: rgba(0, 0, 0, 0.3); font-size: 13px; }
.crOut { display: flex; gap: 10px; } .crOut img { width: 48px; height: 48px; flex: none; border: 1px solid #5a4428; background: radial-gradient(circle, #1e1812, #0a0806); }
.crOut .tNm { font: 700 15px var(--serif); } .crOut .tSub { color: var(--muted); font-size: 12px; } .crOut .tBase { color: #f0e0c0; }
.crIng { display: flex; justify-content: space-between; padding: 2px 4px; border-bottom: 1px solid rgba(160, 120, 70, 0.12); }
.crIng.ok b { color: #9fe39f; } .crIng.bad b { color: #ff7a6a; }
.crMeta { display: flex; gap: 14px; margin-top: 6px; } .crMeta .bad { color: #ff7a6a; } .crMeta b { color: var(--gold-hi); }
#craft .warn { color: #ff7a6a; font-weight: 700; margin: 4px 0; }
.crGo { display: flex; gap: 8px; margin-top: 8px; } .crGo input { width: 56px; } .crGo button { flex: 1; font: 400 17px var(--title); }
#craft button.dim { opacity: 0.5; }
#craft .shRow { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid #2a2016; font-size: 13px; }
#craft .shRow img { width: 28px; height: 28px; flex: none; } #craft .shRow span { flex: 1; min-width: 0; } #craft .shRow small { color: var(--muted); }
#craftToast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 9; padding: 8px 16px; text-align: center; font-size: 15px; pointer-events: none;
  background: rgba(10, 8, 6, 0.92); border: 2px solid var(--bronze); animation: crToast 3.5s ease-out; }
#craftToast.ok { border-color: #6ad86a; box-shadow: 0 0 16px rgba(100, 220, 100, 0.5); } #craftToast.bad { border-color: #c0503a; box-shadow: 0 0 16px rgba(220, 80, 60, 0.5); }
#craftToast b { color: var(--gold-hi); } #craftToast[hidden] { display: none; }
@keyframes crToast { 0% { opacity: 0; margin-top: 10px; } 8% { opacity: 1; margin-top: 0; } 80% { opacity: 1; } 100% { opacity: 0; } }
.matRow { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12px; border-bottom: 1px solid rgba(160, 120, 70, 0.12); }
.matRow span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .matRow b { color: #ffd76a; }
.matRow button { padding: 0 6px; font-size: 12px; }
.mIco { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; font: 700 12px var(--serif); font-style: normal; color: #1a1208;
  background: var(--c, #ccc); border-radius: 50%; border: 1px solid #000; overflow: hidden; } .mIco img { width: 100%; height: 100%; }
#matBag .shTabs { flex-wrap: wrap; } #matBag .shTabs button { padding: 0 6px; font-size: 12px; }
#itemTip .tBy { color: #9fe39f; font-size: 12px; font-style: italic; margin-top: 3px; }
@media (max-width: 640px) { #craft { top: 60px; max-height: calc(var(--H, 100vh) - 140px); } .crCols { grid-template-columns: 1fr; } .crList { max-height: 160px; } }
#smith .shRow button.dim, #npcShop .shRow button.dim { opacity: 0.45; }

/* кубики на редкую вещь группы (client/rolls.js) и кнопки лута группы */
#rolls { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 5px; z-index: 8; pointer-events: none; }
#rolls .rollBox { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(20, 14, 8, 0.92); border: 1px solid var(--gold-hi); border-radius: 6px; pointer-events: auto; font-size: 13px; }
#rolls .rollBox img { width: 28px; height: 28px; }
#rolls .rollBox small { color: var(--muted); }
#rolls .rollBox button { padding: 2px 9px; font-size: 12px; }
#party .pLoot { display: flex; flex-direction: column; gap: 3px; }
#party .pLoot button:disabled { opacity: 0.75; cursor: default; }

/* Почта, поиск по лавкам, подбор группы (волна 2): формы, ряды, мобильный вид. */
.mlForm label, .mtFilt label { display: block; font-size: 12px; color: var(--muted); margin: 4px 0; }
.mlForm input:not([type=checkbox]), .mlForm textarea, .mlForm select, .mtFilt input { display: block; width: 100%; box-sizing: border-box; font-size: 16px; margin-top: 2px; }
.mlForm textarea { resize: vertical; }
.mlNums { display: flex; gap: 8px; flex-wrap: wrap; } .mlNums > label { flex: 1 1 90px; min-width: 0; } .mlNums > button { align-self: flex-end; min-height: 34px; }
.mlRow { cursor: pointer; } .mlRow.unread b { color: #ffe8a0; } .mlRow.unread { background: rgba(255, 215, 106, 0.07); }
.mlSubj { font-size: 15px; color: var(--gold-hi); margin: 4px 0; } .mlText { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; padding: 6px; background: rgba(0, 0, 0, 0.25); border: 1px solid #2a2016; margin-bottom: 6px; }
.mlBtns { flex-wrap: wrap; } .mlBag { max-height: 180px; overflow-y: auto; } .mlBag .shRow { cursor: pointer; }
.bad { color: #ff7a6a; }
.sfPrice { white-space: nowrap; } .sfBtns { flex: none !important; display: flex; gap: 4px; } .sfChk { display: flex !important; align-items: center; gap: 6px; }
.mtRow.dim { opacity: 0.55; }
.mlNums input, .mlNums select { min-width: 0; } #mailWin, #findWin, #matchWin { overflow-x: hidden; }
#mailWin button, #findWin button, #matchWin button { min-height: 30px; }
#mailWin button:disabled, #matchWin button:disabled { opacity: 0.45; }
#gmenu .gm button[data-badge]:not([data-badge=""])::after { content: attr(data-badge); margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #c0301a; color: #fff; font-size: 11px; text-align: center; }
#menuBtn[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: -6px; right: -5px; min-width: 16px; height: 16px; border-radius: 8px; background: #c0301a; color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
@media (max-width: 640px) {
  #mailWin, #findWin, #matchWin { top: 56px; width: calc(var(--W, 100vw) - 12px); max-height: calc(var(--H, 100vh) - 130px); }
  .sfRow { flex-wrap: wrap; } .sfRow .sfBtns { width: 100%; justify-content: flex-end; }
  .mlNums > label { flex-basis: 70px; }
}
