* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0f10; color: #e6e2d6; font: 14px/1.35 "Segoe UI", Roboto, Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { background: #3b3f36; color: #e6e2d6; border: 1px solid #6d6a55; padding: 6px 12px; border-radius: 3px; cursor: pointer; font: inherit; }
button:hover { background: #4d5245; }
button.big { font-size: 18px; padding: 10px 26px; background: #6b4b1f; border-color: #c99a4b; }
button.big:hover { background: #855d27; }
button.sm { font-size: 11px; padding: 2px 8px; }
button:disabled { opacity: .45; cursor: default; }
input { background: #1a1c1b; color: #eee; border: 1px solid #555; padding: 6px 8px; border-radius: 3px; font: inherit; }
.muted { color: #9b9787; } .small { font-size: 12px; } .err { color: #ff7a6a; min-height: 18px; }
.good { color: #8fd18b; } .warn { color: #f0c060; } .bad { color: #ff7a6a; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(20,24,22,.75), rgba(5,6,6,.95)); z-index: 50; }
.menu-box { width: min(720px, 94vw); max-height: 94vh; overflow: auto; background: rgba(22,24,22,.92); border: 1px solid #5b5844; padding: 22px 26px; border-radius: 4px; box-shadow: 0 10px 40px #000; }
.menu-box h1 { margin: 0; letter-spacing: 6px; font-size: 34px; color: #d9cfae; } .menu-box h1 span { color: #c9883b; }
.menu-box h2 { margin-top: 0; color: #e6795f; letter-spacing: 3px; }
.menu-box .sub { margin-top: 2px; color: #9b9787; }
/* Шапка меню: название игры и плашка разработчика (логотип YMIGAME на светлой подложке — он рассчитан на белый фон) */
.menu-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dev-badge { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 8px 4px; background: linear-gradient(#fbfaff, #ece8fb); border-radius: 7px; opacity: .8; box-shadow: 0 0 0 1px rgba(150,110,255,.25), 0 2px 6px rgba(0,0,0,.4); }
.dev-badge small { font-size: 8px; letter-spacing: 1.5px; text-transform: uppercase; color: #6a52b8; }
.dev-badge img { display: block; width: 96px; height: auto; }
@media (max-width: 560px) { .dev-badge img { width: 80px; } }
.menu-box label { display: block; margin: 10px 0; } .menu-box label input { margin-left: 8px; width: 240px; }
.menu-box label.chk { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.menu-box label.chk input { margin: 0; width: auto; padding: 0; flex: none; min-width: 0; }
/* Конструктор внешности */
.look { display: flex; gap: 14px; align-items: stretch; }
.look canvas { width: 190px; height: 250px; flex: none; background: radial-gradient(#3a3d33, #1a1c18); border: 1px solid #4a4836; border-radius: 3px; cursor: grab; touch-action: none; }
.look-slots { flex: 1; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.look-row { display: flex; align-items: center; gap: 6px; }
.look-row .lbl { width: 70px; color: #9b9787; }
.look-row .val { width: 130px; text-align: center; }
.look-row .sw { display: inline-block; width: 40px; height: 14px; border: 1px solid #000; vertical-align: middle; }
@media (max-width: 520px) { .look canvas { width: 120px; height: 180px; } .look-row .val { width: 96px; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row input { flex: 1; min-width: 180px; }
.servers { border: 1px solid #3c3b31; max-height: 220px; overflow: auto; }
.srv { display: grid; grid-template-columns: 1fr 90px 80px 70px; padding: 7px 10px; border-bottom: 1px solid #2b2a23; cursor: pointer; }
.srv:hover { background: #2b2d27; } .srv.sel { background: #3d3a28; } .srv .n { font-weight: 600; } .srv .d { color: #9b9787; font-size: 12px; grid-column: 1 / -1; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#cross { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: #fff; border-radius: 50%; box-shadow: 0 0 2px #000; }
#cross.spread { width: 26px; height: 26px; margin: -13px; background: none; border: 1px solid rgba(255,255,255,.55); }
#hitmark { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; opacity: 0; transition: opacity .25s; background:
  linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%); }
#hitmark.on { opacity: 1; transition: none; } #hitmark.kill { filter: hue-rotate(-50deg) saturate(8); }
#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0 32vh, #000 32.3vh); }
#scope::before, #scope::after { content: ""; position: absolute; background: #000; }
#scope::before { left: 0; right: 0; top: 50%; height: 1px; } #scope::after { top: 0; bottom: 0; left: 50%; width: 1px; }
#vitals { position: absolute; left: 14px; bottom: 14px; width: 210px; }
.bar { position: relative; height: 16px; margin-top: 4px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.12); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; } .bar b { position: relative; font-size: 11px; font-weight: 500; padding-left: 6px; text-shadow: 0 1px 2px #000; }
.bar.hp i { background: #9a2f25; } .bar.food i { background: #a07a2a; } .bar.water i { background: #2b6a9a; } .bar.stam i { background: #6e8f3a; }
#status { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
#status span { background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 2px; font-size: 12px; border-left: 3px solid #f0c060; }
#status span.bad { border-color: #ff5a4a; color: #ffb3a9; } #status span.good { border-color: #8fd18b; color: #cfe; }
#topinfo { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.45); padding: 3px 12px; font-size: 12px; border-radius: 2px; }
#zoneinfo { position: absolute; top: 32px; left: 50%; transform: translateX(-50%); font-size: 13px; text-shadow: 0 1px 3px #000; text-align: center; }
#compass { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); font: 600 13px monospace; letter-spacing: 2px; color: #ddd; text-shadow: 0 1px 2px #000; }
#wallet { position: absolute; right: 14px; bottom: 96px; font-size: 15px; color: #e8c66b; text-shadow: 0 1px 2px #000; }
#hotbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 4px; pointer-events: auto; }
.slot { position: relative; width: 62px; height: 62px; background: rgba(15,17,16,.75); border: 1px solid rgba(255,255,255,.18); font-size: 10.5px; padding: 3px; overflow: hidden; cursor: pointer; }
.slot.act { border: 2px solid #e6b45a; } .slot .k { position: absolute; left: 3px; top: 1px; color: #888; }
.slot .nm { position: absolute; left: 3px; right: 3px; top: 15px; line-height: 1.1; max-height: 34px; overflow: hidden; }
.slot .cnt { position: absolute; right: 3px; bottom: 2px; font-weight: 700; } .slot .dur { position: absolute; left: 0; bottom: 0; height: 3px; background: #6fc36b; }
.slot .q { position: absolute; right: 3px; top: 2px; width: 7px; height: 7px; border-radius: 50%; }
.slot > span { z-index: 1; text-shadow: 0 1px 2px #000; }
.slot .ic { position: absolute; left: 4px; top: 4px; width: 54px; height: 54px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.slot.bp { background: rgba(28,48,82,.8); } .slot .bpm { position: absolute; left: 3px; bottom: 2px; font-weight: 700; color: #8fb6ff; }
.lic { width: 32px; height: 32px; object-fit: contain; vertical-align: middle; margin-right: 6px; float: left; }
.lic.bp { background: rgba(40,70,120,.6); border-radius: 3px; }
.slot.empty { opacity: .65; } .slot.drag { opacity: .4; } .slot.over { outline: 2px dashed #e6b45a; }
#ammo { position: absolute; right: 14px; bottom: 14px; font: 700 26px monospace; text-shadow: 0 1px 3px #000; text-align: right; }
#ammo small { display: block; font: 12px "Segoe UI", sans-serif; color: #bbb; }
#prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 4px 12px; font-size: 13px; border-radius: 2px; white-space: pre; text-align: center; }
#prompt:empty { display: none; }
#progress { position: absolute; left: 50%; top: 64%; width: 260px; height: 14px; transform: translateX(-50%); background: rgba(0,0,0,.6); border: 1px solid #777; }
#progress i { position: absolute; left: 0; top: 0; bottom: 0; background: #c9883b; } #progress b { position: relative; font-size: 11px; padding-left: 6px; }
#vehhud { position: absolute; right: 14px; bottom: 150px; background: rgba(0,0,0,.55); padding: 6px 10px; font: 13px monospace; white-space: pre; }
#feed { position: absolute; right: 12px; top: 10px; width: 320px; text-align: right; font-size: 12.5px; }
#feed div { background: rgba(0,0,0,.5); margin-bottom: 3px; padding: 2px 8px; display: inline-block; float: right; clear: both; }
#msgs { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); text-align: center; width: 80vw; }
#msgs div { font-size: 15px; text-shadow: 0 1px 3px #000, 0 0 8px #000; margin: 3px; }
#chat { position: absolute; left: 14px; bottom: 150px; width: 380px; pointer-events: auto; }
#chatlog { max-height: 200px; overflow: hidden; font-size: 12.5px; display: flex; flex-direction: column; justify-content: flex-end; }
#chatlog div { background: rgba(0,0,0,.35); padding: 1px 6px; margin-top: 1px; text-shadow: 0 1px 1px #000; }
#chatlog .ch-l { color: #cfe8ff; } #chatlog .ch-s { color: #9bf09b; } #chatlog .ch-f { color: #f0d08b; } #chatlog .ch-sys { color: #f0c060; }
#chatin { width: 100%; margin-top: 4px; }
/* Круговое меню стройки / молотка */
#radial { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 30; }
#radial .rd-ring::before { content: ''; position: absolute; left: -175px; top: -175px; width: 350px; height: 350px; border-radius: 50%;
  background: radial-gradient(circle, rgba(10,12,14,.25) 0 26%, rgba(10,12,14,.62) 27% 70%, rgba(10,12,14,0) 71%); pointer-events: none; }
#radial .rd-c { position: absolute; left: -70px; top: -34px; width: 140px; text-align: center; pointer-events: auto; cursor: pointer; text-shadow: 0 1px 2px #000; }
#radial .rd-c b { display: block; font-size: 15px; } #radial .rd-c span { display: block; font-size: 12px; opacity: .85; }
#radial .rd-it { position: absolute; transform: translate(-50%, -50%); width: 92px; min-height: 74px; padding: 6px 4px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18); background: rgba(30,34,38,.88); color: #e8e4da; font: 600 12px/1.2 system-ui, sans-serif; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; touch-action: none; pointer-events: auto; }
#radial .rd-it img { width: 38px; height: 38px; object-fit: contain; pointer-events: none; }
#radial .rd-it.sel { background: rgba(200,150,60,.92); color: #fff; border-color: #ffd890; transform: translate(-50%, -50%) scale(1.08); }
#radial .rd-it.off { opacity: .45; }
body.mobile #radial .rd-it { width: 78px; min-height: 64px; font-size: 11px; }
body.mobile #radial .rd-ring::before { left: -150px; top: -150px; width: 300px; height: 300px; }
#buildhud { position: absolute; right: 14px; top: 40%; background: rgba(0,0,0,.6); padding: 8px 12px; font-size: 13px; white-space: pre; }
#minimap { position: absolute; right: 12px; top: 120px; width: 180px; height: 180px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; overflow: hidden; background: #000; opacity: .85; }
#minimap canvas { width: 100%; height: 100%; }
#camtag { position: absolute; left: 14px; top: 10px; font-size: 12px; background: rgba(0,0,0,.4); padding: 2px 8px; }

#win { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(980px, 96vw); max-height: 88vh; display: flex; flex-direction: column; background: rgba(20,22,20,.96); border: 1px solid #5b5844; z-index: 30; box-shadow: 0 10px 50px #000; }
.win-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #2a2b24; border-bottom: 1px solid #5b5844; }
#winBody { overflow: auto; padding: 10px 14px; }
.cols { display: flex; gap: 18px; flex-wrap: wrap; } .cols > div { flex: 1; min-width: 280px; }
.grid { display: grid; grid-template-columns: repeat(6, 62px); gap: 4px; } .grid.g8 { grid-template-columns: repeat(6, 62px); }
.eqrow { display: flex; gap: 4px; margin: 6px 0; } .eqrow .slot .k { color: #b9a77c; }
h4 { margin: 10px 0 6px; color: #d9cfae; font-weight: 600; }
.list { display: flex; flex-direction: column; gap: 3px; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.li.lock { opacity: .5; } .li .cost { color: #9b9787; font-size: 12px; } .li.cant .cost { color: #c9786a; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; } .tabs button.on { background: #6b4b1f; border-color: #c99a4b; }
#tip { position: fixed; z-index: 40; pointer-events: none; background: rgba(10,10,10,.95); border: 1px solid #666; padding: 6px 9px; font-size: 12px; max-width: 280px; white-space: pre-line; }
.mapwrap { position: relative; } .mapwrap canvas { width: min(80vh, 90vw); height: min(80vh, 90vw); display: block; margin: auto; background: #111; }

#touch { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#stick { position: absolute; left: 4vw; bottom: 6vh; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.2); pointer-events: auto; }
#stick i { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; background: rgba(255,255,255,.3); }
/* Кнопки справа: огонь в углу, вокруг него две дуги (координаты — центр огня + радиус 82/134 px) */
#tbtns { position: absolute; right: 2vw; bottom: 3vh; width: 190px; height: 190px; pointer-events: none; transform-origin: 100% 100%; }
#tbtns button, #tmenu button { position: absolute; width: 42px; height: 42px; border-radius: 50%; background: rgba(30,30,30,.5); border: 2px solid rgba(255,255,255,.28); font-size: 17px; padding: 0; pointer-events: auto; color: #fff; }
#tbtns button.on, #tmenu button.on { background: rgba(200,140,60,.6); }
#tbtns .t-fire { right: 0; bottom: 0; width: 64px; height: 64px; font-size: 24px; background: rgba(150,40,30,.6); }
#tbtns .t-a0 { right: 93px; bottom: 11px; } #tbtns .t-a1 { right: 82px; bottom: 52px; }
#tbtns .t-a2 { right: 52px; bottom: 82px; } #tbtns .t-a3 { right: 11px; bottom: 93px; }
#tbtns .t-b0 { right: 143px; bottom: 34px; } #tbtns .t-b1 { right: 106px; bottom: 106px; } #tbtns .t-b2 { right: 34px; bottom: 143px; }
#tbtns .t-b1.on { background: rgba(60,170,80,.7); }
#tmenu { position: absolute; right: calc(2vw + 200px); bottom: 3vh; display: flex; gap: 6px; padding: 6px; border-radius: 28px; background: rgba(0,0,0,.35); pointer-events: auto; transform-origin: 100% 100%; }
#tmenu button { position: static; width: 46px; height: 46px; font-size: 20px; }
/* Низкий экран телефона (альбомная ориентация) — ужимаем кластер */
@media (max-height: 430px) { #tbtns { transform: scale(.85); } #tmenu { transform: scale(.85); right: calc(2vw + 170px); } #stick { width: 124px; height: 124px; } #stick i { width: 50px; height: 50px; margin: -25px; } }
#voicehud { position: absolute; left: 14px; top: 34px; font-size: 13px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; z-index: 6; }
#voicehud div { background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 4px; color: #bfffbf; width: max-content; }
#voicehud .v-me { color: #ffd27a; } #voicehud .v-me.on { color: #7dff7d; }
body.mobile #hotbar { bottom: auto; top: 8px; transform: translateX(-50%) scale(.8); } body.mobile #vitals { left: auto; right: 2vw; bottom: auto; top: 90px; width: 150px; }
body.mobile #minimap, body.mobile #chat { display: none; } body.mobile #ammo { bottom: auto; top: 270px; }
