:root {
  --gold: #e8c26a;
  --gold2: #b8893a;
  --panel: rgba(20, 16, 28, 0.82);
  --border: rgba(232, 194, 106, 0.35);
  --text: #f1e8d6;
  --muted: #b6a98f;
  --red: #d8453a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0a12; color: var(--text); font-family: 'Nunito', system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- Фон меню ---------- */
#menu-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
#menu-bg .sky { position: absolute; inset: 0; background: linear-gradient(180deg, #120c2a 0%, #3a1d4a 38%, #b2503a 72%, #f0a24a 100%); }
#menu-bg .stars { position: absolute; inset: 0 0 40% 0; background-image:
  radial-gradient(1px 1px at 10% 20%, #fff8, transparent), radial-gradient(1px 1px at 30% 10%, #fff9, transparent),
  radial-gradient(1.5px 1.5px at 55% 25%, #fffa, transparent), radial-gradient(1px 1px at 70% 8%, #fff8, transparent),
  radial-gradient(1px 1px at 85% 30%, #fff7, transparent), radial-gradient(1.5px 1.5px at 20% 35%, #fff6, transparent),
  radial-gradient(1px 1px at 45% 5%, #fff9, transparent), radial-gradient(1px 1px at 92% 15%, #fff8, transparent);
  animation: twinkle 5s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .5 } to { opacity: 1 } }
#menu-bg .mountains { position: absolute; left: 0; width: 100%; }
#menu-bg .mountains.far { bottom: 18%; height: 38%; fill: #2a1838; opacity: .85; }
#menu-bg .mountains.near { bottom: 0; height: 26%; fill: #0d0a14; }
#menu-bg .castle { position: absolute; bottom: 14%; left: 50%; transform: translateX(-50%); width: min(70vw, 720px); height: 40vh; fill: #160f20; }
#menu-bg .castle .win { fill: #ffb347; filter: drop-shadow(0 0 6px #ff9a2a); animation: flicker 3s infinite; }
@keyframes flicker { 0%,100% { opacity: 1 } 45% { opacity: .75 } 50% { opacity: .95 } 70% { opacity: .8 } }
#menu-bg .fog { position: absolute; left: -50%; right: -50%; bottom: 0; height: 40%; background: radial-gradient(ellipse at center, rgba(255,180,120,.15), transparent 60%); animation: drift 18s linear infinite alternate; }
@keyframes drift { from { transform: translateX(-8%) } to { transform: translateX(8%) } }
.ember { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: #ffb050; box-shadow: 0 0 8px #ff8a20; animation: rise linear forwards; }
@keyframes rise { to { transform: translate(var(--dx), -105vh); opacity: 0 } }

/* ---------- Экраны ---------- */
.screen { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 20px; }
.logo { text-align: center; text-shadow: 0 4px 24px #000; }
.logo h1 { font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(34px, 6vw, 72px); margin: 0; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff3c8, #e8c26a 50%, #9c6a24); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #3a2410); }
.logo-sub { font-family: 'Cinzel', serif; letter-spacing: 10px; text-transform: uppercase; color: var(--gold); font-size: 14px; }
.logo-line { margin: 10px auto; width: 240px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.online { color: var(--muted); font-size: 14px; }
.online b { color: #7dff9a; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: min(380px, 92vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(8px); }
.card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.card input:not([type=range]) { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.35); color: var(--text); font-size: 15px; outline: none; transition: border .2s, box-shadow .2s; }
.card input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,194,106,.15); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: rgba(0,0,0,.3); padding: 4px; border-radius: 10px; }
.tab { flex: 1; padding: 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; transition: .2s; }
.tab.active { background: linear-gradient(180deg, #5a3f1c, #3a2812); color: var(--gold); box-shadow: inset 0 0 0 1px var(--border); }
.tabs.small { margin: 12px 0; }
.btn { display: block; width: 100%; padding: 12px; margin-top: 10px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,.05);
  color: var(--text); font-weight: 700; font-size: 15px; transition: transform .1s, background .2s, box-shadow .2s; }
.btn:hover { background: rgba(255,255,255,.1); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #f0cf7a, #b8893a); color: #2a1a06; border-color: #ffe29a; box-shadow: 0 6px 20px rgba(232,194,106,.25); text-shadow: 0 1px 0 #fff5; }
.btn.primary:hover { box-shadow: 0 6px 28px rgba(232,194,106,.45); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: wait; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.error { color: #ff8a7a; min-height: 18px; font-size: 13px; margin: 4px 0; }
.welcome { font-size: 17px; margin-bottom: 6px; }
.welcome b { color: var(--gold); }
.char-line { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.footer-hint { color: var(--muted); font-size: 12px; opacity: .8; text-align: center; }

/* ---------- Редактор ---------- */
.creator { display: flex; gap: 24px; align-items: stretch; width: min(1100px, 96vw); height: min(720px, 92vh); }
.preview-wrap { flex: 1; position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 80%, rgba(255,170,90,.25), rgba(10,8,18,.6) 70%); }
#preview { width: 100%; height: 100%; display: block; cursor: grab; }
.preview-hint { position: absolute; bottom: 14px; width: 100%; text-align: center; color: var(--muted); font-size: 12px; }
.preview-name { position: absolute; top: 18px; width: 100%; text-align: center; font-family: 'Cinzel', serif; font-size: 28px; color: var(--gold); text-shadow: 0 2px 10px #000; }
.options { width: 380px; display: flex; flex-direction: column; }
.options h2 { font-family: 'Cinzel', serif; color: var(--gold); margin: 0 0 14px; text-align: center; }
.opt-scroll { flex: 1; overflow-y: auto; padding-right: 6px; }
.opt-scroll::-webkit-scrollbar { width: 6px; } .opt-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.opt > span { font-size: 13px; color: var(--muted); min-width: 92px; }
.seg { display: flex; background: rgba(0,0,0,.3); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 6px; font-weight: 700; }
.seg button.on { background: #4a3418; color: var(--gold); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); cursor: pointer; transition: transform .15s; }
.sw:hover { transform: scale(1.15); }
.sw.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,194,106,.35); transform: scale(1.1); }
.sw.none { background: repeating-linear-gradient(45deg, #333 0 4px, #555 4px 8px); }
.chooser { display: flex; align-items: center; gap: 8px; }
.chooser b { min-width: 110px; text-align: center; font-size: 14px; }
.chooser button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: rgba(0,0,0,.3); color: var(--gold); font-size: 18px; line-height: 1; }
input[type=range] { width: 170px; accent-color: var(--gold); }

/* ---------- Загрузка ---------- */
#loading { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(8,6,14,.92); }
.loader-box { text-align: center; }
.spinner { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; border: 3px solid rgba(232,194,106,.2); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
#loading-text { font-family: 'Cinzel', serif; font-size: 20px; color: var(--gold); }
.tip { color: var(--muted); margin-top: 10px; font-size: 14px; max-width: 420px; }

/* ---------- HUD ---------- */
#game { position: fixed; inset: 0; z-index: 5; user-select: none; }
#canvas-wrap, #canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dmg-num { position: absolute; font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 6px #000; transform: translate(-50%, -50%); animation: floatUp 1s ease-out forwards; white-space: nowrap; }
.dmg-num.crit { color: #ffd23a; font-size: 28px; }
.dmg-num.hurt { color: #ff5a4a; }
.dmg-num.heal { color: #6aff8a; }
@keyframes floatUp { from { opacity: 1; margin-top: 0 } to { opacity: 0; margin-top: -60px } }
.chat-bubble { position: absolute; transform: translate(-50%, -100%); background: rgba(255,255,255,.92); color: #222; padding: 5px 10px; border-radius: 10px; font-size: 13px; max-width: 220px; text-align: center; }

.hud-player { position: absolute; top: 16px; left: 16px; display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px 10px 10px; }
.portrait { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Cinzel', serif; font-weight: 900; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #f0cf7a, #7a5418); color: #2a1a06; border: 2px solid #ffe29a; }
.bars { width: 220px; }
.pname { font-weight: 700; margin-bottom: 4px; color: var(--gold); }
.bar { position: relative; height: 16px; background: rgba(0,0,0,.55); border-radius: 8px; overflow: hidden; margin-bottom: 4px; border: 1px solid rgba(255,255,255,.08); }
.bar > div { height: 100%; transition: width .25s; }
.bar.hp > div { background: linear-gradient(180deg, #ff6a5a, #b8241a); }
.bar.xp { height: 8px; }
.bar.xp > div { background: linear-gradient(180deg, #8ad0ff, #3a7ac8); }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.bar.xp span { display: none; }
.gold { font-size: 14px; }
.gold b { color: var(--gold); }
.gold .dmg { margin-left: 12px; color: var(--muted); }

.hud-target { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid rgba(216,69,58,.5); border-radius: 12px; padding: 8px 14px; width: 260px; text-align: center; }
.tname { font-weight: 700; margin-bottom: 5px; color: #ffb0a0; }

.hud-map { position: absolute; top: 16px; right: 16px; text-align: center; }
#minimap { border-radius: 50%; border: 3px solid var(--gold2); box-shadow: 0 6px 24px rgba(0,0,0,.6); background: #111; }
.biome { font-family: 'Cinzel', serif; color: var(--gold); margin-top: 6px; font-weight: 700; text-shadow: 0 2px 4px #000; }
.coords { font-size: 11px; color: var(--muted); text-shadow: 0 1px 2px #000; }

.prompt { position: absolute; bottom: 30%; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--border); padding: 8px 16px; border-radius: 10px; font-weight: 700; }
.prompt kbd { background: var(--gold); color: #2a1a06; padding: 1px 7px; border-radius: 4px; margin-right: 6px; }

#toasts { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--border); padding: 7px 16px; border-radius: 20px; font-weight: 700; font-size: 14px; animation: toastIn .3s ease-out, toastOut .5s 2.6s forwards; }
.toast.loot { color: #aef0a0; } .toast.gold { color: var(--gold); } .toast.err { color: #ff8a7a; }
.toast.level { color: #fff3a0; font-size: 22px; font-family: 'Cinzel', serif; border-color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) } }

.chat { position: absolute; left: 16px; bottom: 16px; width: min(400px, 60vw); }
.chat-log { max-height: 190px; overflow-y: auto; font-size: 13px; padding: 8px 10px; background: rgba(0,0,0,.35); border-radius: 10px 10px 0 0; text-shadow: 0 1px 2px #000; }
.chat-log div { margin: 2px 0; word-wrap: break-word; }
.chat-log .n { color: var(--gold); font-weight: 700; }
.chat-log .sys { color: #9ad0ff; font-style: italic; }
#chat-input { width: 100%; padding: 8px 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.55); color: var(--text); border-radius: 0 0 10px 10px; outline: none; font-size: 13px; }
#chat-input:focus { border-color: var(--gold); }

.hotbar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.slot { width: 74px; height: 56px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; gap: 2px; }
.slot b { font-size: 10px; color: var(--gold); }
.slot.cool { opacity: .5; }

.window { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 420px; max-height: 76vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.7); backdrop-filter: blur(8px); }
.window.wide { width: 520px; }
.win-head { font-family: 'Cinzel', serif; font-size: 20px; color: var(--gold); display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.close { border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.inv-weapon { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.inv-weapon b { color: var(--gold); }
.inv-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.item { position: relative; aspect-ratio: 1; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 30px; cursor: default; }
.item .cnt { position: absolute; right: 5px; bottom: 3px; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.item.hide { border-color: rgba(200,140,80,.5); } .item.plant { border-color: rgba(120,220,120,.45); } .item.consumable { border-color: rgba(255,100,160,.45); }
.item.empty { opacity: .25; }
.item:hover .tip2 { display: block; }
.tip2 { display: none; position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%); background: #000d; padding: 5px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 3; }
.shop-greet { font-style: italic; color: var(--muted); font-size: 14px; }
.shop-list { margin-top: 10px; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; background: rgba(0,0,0,.25); margin-bottom: 6px; }
.shop-row .ic { font-size: 26px; width: 34px; text-align: center; }
.shop-row .nm { flex: 1; }
.shop-row .nm small { display: block; color: var(--muted); }
.shop-row .pr { color: var(--gold); font-weight: 800; min-width: 60px; text-align: right; }
.shop-row .btn { width: auto; margin: 0; padding: 6px 12px; font-size: 13px; }
.empty-note { text-align: center; color: var(--muted); padding: 20px; }

.death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse, rgba(80,0,0,.45), rgba(0,0,0,.85)); }
.death h2 { font-family: 'Cinzel', serif; font-size: 48px; color: #ff6a5a; margin: 0; text-shadow: 0 4px 20px #000; }
.death .btn { width: 280px; }
.help { position: absolute; right: 16px; bottom: 16px; font-size: 12px; line-height: 1.55; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--muted); }
.help b { color: var(--gold); }

@media (max-width: 800px) {
  .creator { flex-direction: column; height: auto; }
  .preview-wrap { height: 40vh; }
  .options { width: 100%; }
  .help { display: none; }
}

/* ================= Игровой интерфейс (гибрид Roblox + Minecraft) ================= */
.download-link { color: #9ad0ff; font-size: 14px; font-weight: 700; text-decoration: none; background: rgba(0,0,0,.35); padding: 8px 16px; border-radius: 20px; border: 1px solid rgba(154,208,255,.3); }
.download-link:hover { background: rgba(154,208,255,.15); }

#game { font-family: 'Montserrat', 'Nunito', system-ui, sans-serif; font-weight: 600; color: #fff; -webkit-tap-highlight-color: transparent; }
#game.cur-attack canvas { cursor: crosshair; }
#game.cur-hand canvas { cursor: pointer; }
#game.cur-hidden, #game.cur-hidden canvas { cursor: none; }
#game kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.92); color: #1b1b1f; font: 800 12px 'Montserrat', sans-serif; text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,.35); }
#hurt-vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(220,0,0,.55)); transition: opacity .35s; }

.rb-glass { background: rgba(18, 20, 24, .62); backdrop-filter: blur(6px); }

/* Прицел */
#crosshair { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; transform: translate(-50%,-50%); pointer-events: none; }
#crosshair::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.55); }
#crosshair::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
#crosshair.on-target::before { background: #ff4a4a; }
#crosshair.on-target::after { border-color: #ff6a6a; transform: scale(.8); transition: transform .1s; }
#atk-cool { position: absolute; left: 50%; top: calc(50% + 24px); transform: translateX(-50%); width: 34px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.45); overflow: hidden; pointer-events: none; }
#atk-cool div { height: 100%; background: #fff; }
#gather-ring { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; transform: translate(-50%,-50%) rotate(-90deg); pointer-events: none; }
#gather-ring circle { fill: none; stroke: rgba(0,0,0,.45); stroke-width: 4; }
#gather-ring #gather-arc { stroke: #00e07a; stroke-linecap: round; stroke-dasharray: 100.5; stroke-dashoffset: 100.5; }

/* Верхняя панель */
#game { --hud: 1; --pad: 1; }
#topbar, #rb-chat, #qtrack { transform-origin: top left; scale: var(--hud); }
#hud-toggle, #boss, #cave-timer { transform-origin: top center; scale: var(--hud); }
#leaderboard, #notifs { transform-origin: top right; scale: var(--hud); }
#target-frame, #brew, #rb-bottom, .hud-map, #pprompt { scale: var(--hud); }
#joy, .t-btn { scale: var(--pad); }
#topbar { position: absolute; top: 10px; left: 10px; display: flex; gap: 8px; z-index: 6; }
#hud-toggle { position: absolute; top: 10px; left: 210px; z-index: 19; width: 44px; height: 44px; }
#game.hud-off #hud-toggle { left: 10px; }
#game.touch #hud-toggle { left: auto; right: 210px; }
#game.touch.hud-off #hud-toggle { right: 10px; }
#game.hud-off #topbar,
#game.hud-off #rb-chat,
#game.hud-off #leaderboard,
#game.hud-off #target-frame,
#game.hud-off #zone-title,
#game.hud-off #notifs,
#game.hud-off #pprompt,
#game.hud-off #brew,
#game.hud-off .hud-map,
#game.hud-off #rb-bottom,
#game.hud-off #crosshair,
#game.hud-off #aim,
#game.hud-off #boss,
#game.hud-off #cave-timer,
#game.hud-off #announce,
#game.hud-off #atk-cool,
#game.hud-off #gather-ring,
#game.hud-off #touch,
#game.hud-off #labels,
#game.hud-off #qtrack,
#game.hud-off #debug,
#game.hud-off .rb-screen,
#game.hud-off #cursor-item,
#game.hud-off #rb-tip { display: none !important; }
#qtrack { position: absolute; top: 64px; left: 12px; z-index: 5; max-width: 280px; padding: 8px 10px; border-radius: 12px; background: rgba(18,20,24,.62); color: #fff; font-size: 13px; line-height: 1.35; pointer-events: none; }
#qtrack b { display: block; color: #ffd27a; }
#qtrack .bar { height: 4px; margin-top: 4px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
#qtrack .bar i { display: block; height: 100%; background: #e8c26a; }
.forge-note { margin: 0 0 8px; color: #c8c0b4; font-size: 13px; }
.forge-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.forge-row .grow { flex: 1; min-width: 0; }
.forge-row .rb-btn { width: auto; margin: 0; flex-shrink: 0; padding: 9px 18px; }
#forge-body { width: min(560px, 88vw); }
.forge-play { margin-top: 12px; }
.forge-bar { position: relative; height: 28px; border-radius: 8px; background: #2a241c; overflow: hidden; margin: 8px 0; }
.forge-zone { position: absolute; top: 0; bottom: 0; background: rgba(80, 190, 90, .85); }
.forge-mark { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 8px #fff; }
#forge-hit { width: 100%; margin-top: 6px; }
.tb-btn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(18,20,24,.6); color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: background .15s, transform .1s; }
.tb-btn:hover { background: rgba(60,64,72,.75); }
.tb-btn:active { transform: scale(.94); }
.tb-btn.on { background: rgba(255,255,255,.9); }
.logo-tower { width: 26px; height: 26px; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }

/* Чат */
#rb-chat { position: absolute; top: 62px; left: 10px; width: min(430px, 44vw); z-index: 5; }
#chat-log { max-height: 210px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 6px 10px; border-radius: 10px 10px 0 0; transition: background .3s; }
#rb-chat.open #chat-log, #rb-chat:hover #chat-log { background: rgba(18,20,24,.45); overflow-y: auto; }
#chat-log div { font-size: 14px; line-height: 1.35; text-shadow: 0 1px 2px #000, 0 0 4px rgba(0,0,0,.6); transition: opacity .6s; word-wrap: break-word; margin: 1px 0; }
#chat-log div.faded { opacity: 0; }
#rb-chat.open #chat-log div, #rb-chat:hover #chat-log div { opacity: 1; }
#chat-log .n { font-weight: 800; }
#chat-log .sys { color: #ffe36a; }
#chat-bar { padding: 6px; border-radius: 0 0 10px 10px; background: rgba(18,20,24,.35); opacity: .0; transition: opacity .2s; }
#rb-chat.open #chat-bar, #rb-chat:hover #chat-bar { opacity: 1; background: rgba(18,20,24,.6); }
#chat-input { display: block; width: 100%; padding: 8px 12px; border-radius: 8px; border: 0; background: rgba(255,255,255,.12); color: #fff; font: 600 14px 'Montserrat', sans-serif; outline: none; }
#chat-input::placeholder { color: rgba(255,255,255,.55); }
#chat-input:focus { background: rgba(255,255,255,.2); box-shadow: 0 0 0 2px #335fff; }

/* Таблица игроков */
#leaderboard { position: absolute; top: 10px; right: 10px; width: 250px; border-radius: 10px; overflow: hidden; font-size: 13px; z-index: 5; }
#leaderboard .lb-head, #leaderboard .lb-row { display: grid; grid-template-columns: 1fr 40px 60px; padding: 5px 10px; gap: 4px; }
#leaderboard .lb-head { background: rgba(18,20,24,.78); font-weight: 800; color: #d8dbe0; }
#leaderboard .lb-row { background: rgba(18,20,24,.48); border-top: 1px solid rgba(255,255,255,.06); }
#leaderboard .lb-row.me { background: rgba(51,95,255,.45); }
#leaderboard .lb-row span:not(:first-child), #leaderboard .lb-head span:not(:first-child) { text-align: right; }
#leaderboard .lb-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#leaderboard.collapsed #lb-rows { display: none; }

/* Цель */
#target-frame { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 300px; padding: 8px 12px 10px; border-radius: 10px; background: rgba(18,20,24,.62); text-align: center; pointer-events: none; }
.tf-name { font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.tf-bar { position: relative; height: 14px; border-radius: 7px; background: rgba(0,0,0,.55); overflow: hidden; }
#tf-fill { height: 100%; border-radius: 7px; background: linear-gradient(#ff6a5a, #d0281c); transition: width .2s; }
#tf-hp { position: absolute; inset: 0; font-size: 10px; line-height: 14px; font-weight: 800; text-shadow: 0 1px 2px #000; }

#zone-title { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-size: 34px; font-weight: 800; text-shadow: 0 3px 12px rgba(0,0,0,.7), 0 1px 0 #000; pointer-events: none; animation: zoneIn 3.2s forwards; white-space: nowrap; }
#zone-title small { display: block; font-size: 14px; text-align: center; opacity: .8; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; }
@keyframes zoneIn { 0% { opacity: 0; transform: translate(-50%, 10px) } 12% { opacity: 1; transform: translate(-50%, 0) } 80% { opacity: 1 } 100% { opacity: 0 } }

#debug { position: absolute; top: 62px; left: 450px; font: 600 13px/1.45 monospace; white-space: pre; background: rgba(0,0,0,.5); padding: 6px 10px; border-radius: 8px; pointer-events: none; }

/* Уведомления */
#notifs { display: none; }
.notif { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 320px; padding: 9px 14px; border-radius: 10px; background: rgba(18,20,24,.78); font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.35); animation: nIn .25s ease-out, nOut .4s 3s forwards; border-left: 4px solid #8a8f98; }
.notif .ic { font-size: 20px; }
.notif.loot { border-color: #00b06f; } .notif.gold { border-color: #ffc62a; } .notif.err { border-color: #ff4a4a; } .notif.level { border-color: #335fff; font-size: 16px; }
@keyframes nIn { from { opacity: 0; transform: translateX(40px) } }
@keyframes nOut { to { opacity: 0; transform: translateX(40px) } }

/* ProximityPrompt */
#brew { position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%); z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: auto; }
#brew-choices { display: flex; flex-direction: column; gap: 6px; align-items: center; }
#brew-choices button { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; border: 1px solid #ffe29a; background: linear-gradient(180deg, #f0cf7a, #b8893a); color: #2a1a06; border-radius: 10px; padding: 8px 16px; cursor: pointer; }
#brew-bar { position: relative; width: 220px; height: 22px; border-radius: 11px; overflow: hidden; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.25); }
#brew-fill { height: 100%; width: 0; background: linear-gradient(90deg, #5a3ad0, #e8c24a); }
#brew-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; pointer-events: none; }
#pprompt { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px; border-radius: 12px; background: rgba(18,20,24,.72); transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; white-space: nowrap; z-index: 4; }
.pp-key { position: relative; width: 42px; height: 42px; border-radius: 10px; background: rgba(255,255,255,.95); color: #111; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.pp-key svg { position: absolute; inset: -4px; width: 50px; height: 50px; transform: rotate(-90deg); }
.pp-key circle { fill: none; stroke: #00e07a; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 106.8; stroke-dashoffset: 106.8; }
.pp-text b { display: block; font-size: 15px; font-weight: 800; }
.pp-text small { display: block; font-size: 12px; opacity: .75; }

/* Миникарта */
#game .hud-map { position: absolute; top: auto; bottom: 12px; right: 12px; text-align: center; z-index: 4; }
#game #minimap { border-radius: 16px; border: 0; box-shadow: 0 0 0 3px rgba(18,20,24,.6), 0 6px 18px rgba(0,0,0,.4); background: #111; }
#game .biome { font-family: 'Montserrat', sans-serif; color: #fff; font-size: 12px; font-weight: 800; margin-top: 6px; text-shadow: 0 1px 3px #000; }

/* Низ: здоровье, опыт, панель предметов */
#rb-bottom { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 5; }
#held-name { font-size: 15px; font-weight: 800; text-shadow: 0 1px 3px #000; height: 20px; transition: opacity .5s; }
.stat-row { display: flex; gap: 8px; align-items: center; }
.chip { padding: 4px 10px; border-radius: 14px; background: rgba(18,20,24,.6); font-size: 13px; min-width: 56px; text-align: center; white-space: nowrap; flex-shrink: 0; }
.chip b { font-weight: 800; }
#health { position: relative; width: 240px; flex-shrink: 1; min-width: 140px; height: 20px; border-radius: 10px; background: rgba(18,20,24,.65); overflow: hidden; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
#hp-fill { height: 100%; border-radius: 10px; background: linear-gradient(#3cf07a, #10b04a); transition: width .25s, background .3s; }
#health.mid #hp-fill { background: linear-gradient(#ffd84a, #e0a010); }
#health.low #hp-fill { background: linear-gradient(#ff6a5a, #d0281c); animation: lowPulse .6s infinite alternate; }
@keyframes lowPulse { to { filter: brightness(1.4) } }
#hp-text { position: absolute; inset: 0; font-size: 11px; line-height: 20px; font-weight: 800; text-align: center; text-shadow: 0 1px 2px #000; }
#xp { position: relative; width: 410px; height: 6px; border-radius: 3px; background: rgba(18,20,24,.6); margin: 3px 0 2px; }
#xp-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #5a8aff, #9ad0ff); width: 0; transition: width .3s; }
#xp .lvl { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); min-width: 26px; height: 22px; line-height: 22px; padding: 0 6px; border-radius: 11px; background: #335fff; font-size: 12px; font-weight: 800; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
#hotbar { display: flex; gap: 6px; }
.hb { position: relative; width: 56px; height: 56px; border-radius: 10px; background: rgba(18,20,24,.55); display: flex; align-items: center; justify-content: center; font-size: 28px; cursor: pointer; transition: transform .12s, background .12s; box-shadow: inset 0 0 0 2px rgba(255,255,255,.06); }
.hb:hover { background: rgba(60,64,72,.7); }
.hb.sel { background: rgba(255,255,255,.28); box-shadow: inset 0 0 0 3px #fff; transform: translateY(-4px); }
.hb .key { position: absolute; left: 6px; top: 3px; font-size: 11px; font-weight: 800; opacity: .8; }
.hb .cnt, .slot2 .cnt, #cursor-item .cnt { position: absolute; right: 5px; bottom: 2px; font-size: 13px; font-weight: 800; text-shadow: 0 1px 2px #000, 0 0 3px #000; }

/* Экраны (рюкзак, лавка, меню) */
#game .rb-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.25); z-index: 20; }
#game .rb-screen.dim { background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.rb-panel { background: rgba(24,26,30,.9); border-radius: 16px; padding: 14px 16px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); max-height: 94vh; overflow-y: auto; }
.rb-head { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.rb-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 15px; }
.rb-x:hover { background: #ff4a4a; }
.inv-body { display: flex; gap: 16px; }
.inv-side { width: 170px; }
#inv-preview { display: block; width: 170px; height: 210px; border-radius: 12px; background: radial-gradient(ellipse at 50% 70%, rgba(90,110,255,.35), rgba(0,0,0,.3)); }
.inv-info { font-size: 13px; line-height: 1.7; margin-top: 8px; }
.inv-info b { color: #9ad0ff; }
.rb-sub { font-size: 13px; font-weight: 800; opacity: .7; margin: 10px 2px 6px; text-transform: uppercase; letter-spacing: 1px; }
.rb-grid { display: grid; grid-template-columns: repeat(9, 50px); gap: 5px; }
.rb-grid.hot { margin-top: 10px; }
.slot2 { position: relative; width: 50px; height: 50px; border-radius: 9px; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; font-size: 26px; cursor: pointer; user-select: none; transition: background .1s; }
.slot2:hover { background: rgba(255,255,255,.2); }
.slot2.selhot { box-shadow: inset 0 0 0 2px #fff; }
.slot2.sellable:hover { background: rgba(255,198,42,.35); }
.rb-hint { font-size: 11px; opacity: .6; margin-top: 10px; max-width: 490px; line-height: 1.5; }
#cursor-item { position: fixed; pointer-events: none; z-index: 60; font-size: 30px; transform: translate(-50%,-50%); filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
#rb-tip { position: fixed; pointer-events: none; z-index: 61; background: rgba(12,13,16,.95); border-radius: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.45; max-width: 260px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
#rb-tip .t { font-weight: 800; font-size: 14px; }
#rb-tip .gray { opacity: .65; } #rb-tip .gold { color: #ffd84a; } #rb-tip .blue { color: #9ad0ff; }

.rb-btn { display: block; width: 100%; margin: 5px 0; padding: 10px 14px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font: 700 14px 'Montserrat', sans-serif; transition: background .12s, transform .1s; }
.rb-btn:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.rb-btn:active:not(:disabled) { transform: scale(.98); }
.rb-btn:disabled { opacity: .45; cursor: default; }
.rb-btn.blue { background: #335fff; } .rb-btn.blue:hover:not(:disabled) { background: #4a72ff; }
.rb-btn.green { background: #00a862; } .rb-btn.green:hover:not(:disabled) { background: #00c070; }
.rb-btn kbd { margin-right: 8px; }
.shop-cols { display: grid; grid-template-columns: 360px auto; gap: 18px; }
.sell-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.sell-row .rb-btn { margin: 0; font-size: 13px; }
.sub-hint { text-transform: none; letter-spacing: 0; font-weight: 600; opacity: .8; margin-left: 6px; }
.rb-grid.small { grid-template-columns: repeat(9, 44px); gap: 4px; }
.rb-grid.small .slot2 { width: 44px; height: 44px; font-size: 23px; }
.offer { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 7px 8px; margin-bottom: 6px; }
.offer .ic { font-size: 26px; width: 34px; text-align: center; }
.offer .nm { flex: 1; font-size: 14px; font-weight: 700; }
.offer .nm small { display: block; opacity: .65; font-size: 11px; font-weight: 600; }
.offer .pr { color: #ffd84a; font-size: 14px; font-weight: 800; }
.offer .rb-btn { width: auto; margin: 0; padding: 7px 12px; font-size: 13px; background: #00a862; }
.offer .rb-btn:disabled { background: rgba(255,255,255,.1); }
#offers { max-height: min(62vh, 520px); overflow-y: auto; padding-right: 4px; }
.offer-cat { font-size: 11px; font-weight: 800; opacity: .55; text-transform: uppercase; letter-spacing: 1px; margin: 10px 2px 5px; }

/* Доспехи, монеты, редкость предметов */
.equip-row { display: flex; gap: 18px; align-items: flex-end; margin-bottom: 4px; }
.equip-row .rb-sub { display: block; margin-top: 0; }
.rb-grid.armor { grid-template-columns: repeat(4, 50px); }
.slot2.armor-slot:empty::before { content: attr(data-ph); opacity: .22; filter: grayscale(1); }
.gold-drop { flex: 1; }
.gold-line { display: flex; gap: 6px; }
.gold-line input { width: 90px; min-width: 0; padding: 0 10px; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,.1); color: #fff; font: 700 14px 'Montserrat', sans-serif; }
.gold-line .rb-btn { width: auto; margin: 0; padding: 0 12px; height: 40px; font-size: 13px; }
.slot2.t1, .hb.t1 { box-shadow: inset 0 -3px 0 #a0703a; }
.slot2.t2, .hb.t2 { box-shadow: inset 0 -3px 0 #c8ccd4; }
.slot2.t3, .hb.t3 { box-shadow: inset 0 -3px 0 #5a8aff; }
.slot2.t4, .hb.t4 { box-shadow: inset 0 -3px 0 #e8c24a; }
.hb.sel.t1, .hb.sel.t2, .hb.sel.t3, .hb.sel.t4 { box-shadow: inset 0 0 0 3px #fff; }
.pi { width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; vertical-align: middle; }
.hb .pi { width: 36px; height: 36px; }
.offer .ic .pi, #rb-tip .pi, #cursor-item .pi { width: 28px; height: 28px; }
.ui-box { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(51,95,255,.1); box-shadow: inset 0 0 0 1px rgba(90,140,255,.28); }
.ui-box > div { font-size: 14px; }
.ui-box small { display: block; opacity: .65; font-size: 12px; margin-top: 3px; line-height: 1.4; }
.ui-box .rb-btn { width: auto; min-width: 150px; margin: 8px 0 0; }
.pvp-box { display: flex; gap: 12px; align-items: center; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255,74,58,.1); box-shadow: inset 0 0 0 1px rgba(255,90,74,.3); }
.pvp-box > div { flex: 1; font-size: 14px; }
.pvp-box small { display: block; opacity: .65; font-size: 12px; margin-top: 3px; line-height: 1.4; }
.pvp-box .rb-btn { width: auto; min-width: 150px; margin: 0; }
.pvp-box .rb-btn.on { background: #e8453a; }
.pvp-box .rb-btn.wait { background: rgba(255,255,255,.1); color: rgba(255,255,255,.55); cursor: not-allowed; }
.chip.pvp-chip { background: rgba(232,69,58,.85); font-weight: 800; }
.dmg-num.other { font-size: 15px; opacity: .85; }
.dmg-num.miss { color: #c8ccd4; font-size: 15px; }

/* Эмоции */
#emotes { position: absolute; left: 50%; top: 50%; width: min(440px, 94vw); transform: translate(-50%,-50%); border-radius: 18px; padding: 12px; background: rgba(18,20,24,.78); z-index: 21; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
#emotes .em-head { font-weight: 800; margin: 0 4px 10px; display: flex; justify-content: space-between; align-items: baseline; }
#emotes .em-head small { opacity: .55; font-weight: 600; font-size: 12px; }
.em-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#emotes button { height: 74px; border-radius: 14px; border: 0; background: rgba(255,255,255,.08); color: #fff; font: 700 11px 'Montserrat', sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; transition: background .12s, transform .12s; }
#emotes button span { font-size: 26px; }
#emotes button:hover { background: #335fff; transform: scale(1.08); }

/* Меню */
.menu-box { width: min(680px, 94vw); background: rgba(24,26,30,.94); border-radius: 18px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.menu-box.small { width: min(400px, 92vw); }
.menu-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.menu-tabs button { flex: 1; padding: 10px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; font: 700 14px 'Montserrat', sans-serif; }
.menu-tabs button.on { background: #fff; color: #111; }
.menu-page { min-height: 220px; max-height: 50vh; overflow-y: auto; }
#menu-players .mp-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.06); margin-bottom: 5px; font-size: 14px; }
#menu-players .mp-row small { opacity: .65; }
.rb-slider { display: block; margin: 12px 4px; font-size: 14px; }
.rb-slider b { float: right; }
.rb-slider input { display: block; width: 100%; margin-top: 8px; accent-color: #335fff; }
.rb-toggles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.controls-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13px; padding: 4px; }
.menu-actions { display: flex; gap: 8px; margin-top: 14px; }
.menu-actions .rb-btn { margin: 0; }
.confirm-text { font-size: 17px; font-weight: 700; text-align: center; padding: 18px 8px 4px; }

/* Смерть */
#death { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 11vh; pointer-events: none; z-index: 15; background: linear-gradient(rgba(0,0,0,.3), transparent 40%); }
.death-card { pointer-events: auto; text-align: center; background: rgba(18,20,24,.72); border-radius: 16px; padding: 16px 26px; }
.death-title { font-size: 40px; font-weight: 800; color: #ff5a4a; text-shadow: 0 3px 0 #000; }
.death-card p { margin: 6px 0; font-size: 14px; }
.death-timer { opacity: .8; }

/* Пузыри чата и таблички */
.chat-bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; color: #111; padding: 7px 12px; border-radius: 14px; font: 700 13px 'Montserrat', sans-serif; max-width: 240px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,.3); animation: bubIn .2s ease-out; }
.chat-bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-top-color: #fff; border-bottom: 0; }
@keyframes bubIn { from { transform: translate(-50%, -80%) scale(.6); opacity: 0 } }
.dmg-num { font-family: 'Montserrat', sans-serif; font-weight: 800; -webkit-text-stroke: 1px rgba(0,0,0,.6); animation: popUp 1s ease-out forwards; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) } 30% { transform: translate(-50%, -50%) scale(1) } 100% { opacity: 0; transform: translate(-50%, -150%) } }

/* Сенсорное управление */
#touch { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
#joy { position: absolute; left: 30px; bottom: 30px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.t-btn { position: absolute; pointer-events: auto; touch-action: none; width: 84px; height: 84px; border-radius: 50%; border: 0; background: rgba(18,20,24,.45); box-shadow: inset 0 0 0 3px rgba(255,255,255,.35); color: #fff; font-size: 34px; }
.t-btn.small { width: 56px; height: 56px; font-size: 22px; }
.t-btn.on, .t-btn:active { background: rgba(255,255,255,.4); }
#t-jump { right: 30px; bottom: 40px; }
#t-atk { right: 130px; bottom: 70px; }
#t-dash { right: 122px; bottom: 8px; }
.t-btn.cool { opacity: .38; }
#t-use { right: 40px; bottom: 150px; }
#t-run { right: 110px; bottom: 170px; }
#t-drop { left: 14px; top: 50%; transform: translateY(-50%); opacity: .75; }
#t-sneak { left: 10px; bottom: 10px; z-index: 2; }
#t-view { right: 30px; bottom: 220px; }

/* Мобильные устройства */
#game.touch #rb-bottom { bottom: 6px; transform: translateX(-50%) scale(.82); transform-origin: bottom center; }
#game.touch .hud-map { top: 10px; bottom: auto; right: auto; left: 50%; transform: translateX(-50%) scale(.6); transform-origin: top center; }
#game.touch .hud-map .biome { display: none; }
#game.touch #leaderboard { width: 190px; font-size: 11px; }
#game.touch #leaderboard .lb-row { display: none; }
#game.touch #leaderboard .lb-row.me { display: grid; }
#game.touch #notifs { bottom: auto; top: 60px; right: 200px; }
#game.touch #rb-chat { width: 36vw; }
#game.touch #chat-log { max-height: 84px; -webkit-mask-image: linear-gradient(transparent, #000 14px); mask-image: linear-gradient(transparent, #000 14px); }
#game.touch #chat-log div { font-size: 12px; }
#game.touch #target-frame { width: 260px; }
#game.touch #target-frame { top: 104px; }
#game.touch .rb-grid { grid-template-columns: repeat(9, 40px); gap: 4px; }
#game.touch .slot2 { width: 40px; height: 40px; font-size: 21px; }
#game.touch .inv-side { display: none; }
#game.touch .rb-grid.armor { grid-template-columns: repeat(4, 40px); }
#game.touch .equip-row { gap: 10px; }
#game.touch .rb-hint { display: none; }
#game.touch .shop-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
#game.touch .rb-grid.small { grid-template-columns: repeat(9, minmax(0, 1fr)); }
#game.touch .rb-grid.small .slot2 { width: auto; height: auto; aspect-ratio: 1; }
#game.touch .rb-panel { padding: 10px; }
@media (max-height: 520px) {
  .screen { gap: 10px; padding: 10px; justify-content: flex-start; overflow-y: auto; }
  .logo h1 { font-size: 30px; }
  .logo-sub, .logo-line, .footer-hint { display: none; }
  .card { padding: 14px; }
  .card label { margin-bottom: 8px; }
  .creator { height: 94vh; flex-direction: row; }
  .preview-wrap { height: auto; }
  .options { width: 50%; }
}

/* Полоска маны, прицел лука, пещера, кланы, колесо эмоций */
.bars { display: flex; flex-direction: column; gap: 3px; width: 240px; flex-shrink: 1; min-width: 140px; }
.bars #health { width: 100%; }
#mana { position: relative; height: 12px; border-radius: 8px; background: rgba(18,20,24,.65); overflow: hidden; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
#mana-fill { height: 100%; width: 0; background: linear-gradient(#8ec8ff, #335fff); transition: width .25s; }
#mana-text { position: absolute; inset: 0; font-size: 10px; line-height: 12px; font-weight: 800; text-align: center; text-shadow: 0 1px 2px #000; }
#aim { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%,-50%); pointer-events: none; }
#aim i { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.55); }
#aim i:nth-child(1) { left: 50%; top: 0; width: 2px; height: 10px; margin-left: -1px; }
#aim i:nth-child(2) { left: 50%; bottom: 0; width: 2px; height: 10px; margin-left: -1px; }
#aim i:nth-child(3) { top: 50%; left: 0; width: 10px; height: 2px; margin-top: -1px; }
#aim i:nth-child(4) { top: 50%; right: 0; width: 10px; height: 2px; margin-top: -1px; }
#aim b { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.55); }
#aim .aim-charge { position: absolute; left: 50%; top: 54px; width: 70px; height: 4px; margin-left: -35px; border-radius: 2px; background: rgba(0,0,0,.45); }
#aim-fill { height: 100%; width: 0; border-radius: 2px; background: #ffd84a; }
#aim.full #aim-fill { background: #3cf07a; }
#aim.dry #aim b, #aim.dry i { background: #ff5a4a; }
#aim-ammo { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); font-size: 12px; font-weight: 800; text-shadow: 0 1px 3px #000; white-space: nowrap; }
#boss { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); width: 420px; max-width: 92vw; padding: 8px 12px 10px; border-radius: 10px; background: rgba(18,20,24,.72); text-align: center; pointer-events: none; z-index: 5; }
#boss .boss-name { font-weight: 800; color: #ffb24a; margin-bottom: 4px; }
.boss-bar { position: relative; height: 16px; border-radius: 8px; background: rgba(0,0,0,.45); overflow: hidden; }
#boss-fill { height: 100%; width: 0; background: linear-gradient(#ff6a3a, #a81818); }
#boss-hp { position: absolute; inset: 0; font-size: 11px; line-height: 16px; font-weight: 800; text-shadow: 0 1px 2px #000; }
#cave-timer { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 10px; background: rgba(18,20,24,.72); font-weight: 800; color: #ffb24a; pointer-events: none; z-index: 5; }
#announce { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); max-width: 80vw; padding: 12px 22px; border-radius: 14px; background: rgba(18,20,24,.78); font-size: 22px; font-weight: 800; text-align: center; color: #ffd84a; text-shadow: 0 2px 8px #000; pointer-events: none; z-index: 7; }
#sell-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.sell-qty { display: flex; gap: 6px; align-items: center; }
.sell-qty input { width: 64px; height: 32px; border: 0; border-radius: 8px; background: rgba(0,0,0,.35); color: #fff; text-align: center; font: 800 14px Nunito, sans-serif; }
.sell-qty .rb-btn { width: auto; margin: 0; padding: 7px 10px; }
.lb-row .tag, .chat-log .tag { color: #e8c26a; }
.chat-log .clan { color: #e8c26a; font-style: italic; }
#clan-body { min-width: min(640px, 92vw); }
.clan-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.06); margin-bottom: 5px; font-size: 14px; }
.clan-row .grow { flex: 1; }
.clan-row .rb-btn, #clan-body .rb-btn { width: auto; margin: 0; padding: 6px 10px; font-size: 12px; }
.clan-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.clan-form input, .clan-form textarea { border: 0; border-radius: 8px; background: rgba(0,0,0,.35); color: #fff; font: 700 14px Nunito, sans-serif; padding: 8px 10px; }
.clan-form textarea { width: 100%; resize: none; height: 52px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: #fff; }
#emotes { width: 460px; height: 460px; background: transparent; box-shadow: none; padding: 0; pointer-events: none; }
#wheel { position: relative; width: 420px; height: 420px; pointer-events: none; }
#wheel .ring { position: absolute; inset: 0; }
#wheel button { position: absolute; left: 50%; top: 50%; width: 76px; height: 58px; margin: -29px 0 0 -38px; pointer-events: auto; opacity: .45; }
#wheel .ring.on button { opacity: 1; }
.wheel-hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 110px; text-align: center; font-weight: 800; font-size: 13px; pointer-events: none; text-shadow: 0 2px 6px #000; }
#game.touch #qtrack { top: 64px; left: auto; right: 96px; max-width: 180px; font-size: 12px; }
#game.touch #boss { top: 148px; }
#game.touch.cave-boss .hud-map { display: none; }
#game.touch.cave-boss #boss { top: 10px; width: min(280px, 72vw); }
#game.touch #cave-timer { top: 148px; }
#game.touch .sell-row { grid-template-columns: 1fr; }
#game:not(.touch) .touch-only, #game.touch .pc-only { display: none !important; }
#game.touch .menu-actions kbd { display: none; }
#game.touch.ui-open #touch,
#game.touch.ui-open .hud-map,
#game.touch.ui-open #qtrack,
#game.touch.ui-open #leaderboard,
#game.touch.ui-open #rb-bottom { display: none; }
@media (max-height: 520px) {
  #emotes { transform: translate(-50%, -50%) scale(.72); }
  .tabs { margin-bottom: 10px; }
  .card input:not([type=range]) { margin-top: 4px; padding: 8px 12px; }
  .menu-box { padding: 12px; }
  .menu-tabs { margin-bottom: 10px; }
  .menu-page { max-height: 58vh; min-height: 0; }
}
@media (max-width: 700px) {
  #game.touch #rb-bottom { transform: translateX(-50%) scale(.64); }
  #game.touch #joy { left: 16px; bottom: 20px; width: 130px; height: 130px; }
  #game.touch .t-btn { width: 70px; height: 70px; font-size: 30px; }
  #game.touch .t-btn.small { width: 48px; height: 48px; font-size: 20px; }
  #game.touch #t-jump { right: 22px; bottom: 30px; }
  #game.touch #t-atk { right: 104px; bottom: 88px; }
  #game.touch #t-dash { right: 99px; bottom: 34px; }
  #game.touch #t-use { right: 30px; bottom: 120px; }
  #game.touch #t-run { right: 96px; bottom: 170px; }
  #game.touch #t-view { right: 24px; bottom: 186px; }
  #game.touch #t-sneak { left: 8px; bottom: 8px; }
  #game.touch #qtrack { max-width: 150px; }
}
