* { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a12; font-family: 'Courier New', monospace; }
  /* Пиксельный апскейл: рендер в низком разрешении, растягиваем nearest-neighbor */
  #game {
    display: block;
    width: 100vw;
    height: 100vh;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    cursor: none;
  }
  #ui {
    position: fixed; inset: 0; pointer-events: none; z-index: 10;
    color: #e8ffe8; text-shadow: 2px 2px 0 #000;
  }
  /* Прицел */
  #crosshair {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 22px; height: 22px;
  }
  #crosshair::before, #crosshair::after {
    content: ''; position: absolute; background: #aef5b0; box-shadow: 1px 1px 0 #000;
  }
  #crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
  #crosshair::after  { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }
  #hud {
    position: fixed; left: 20px; bottom: 18px; font-size: 18px; line-height: 1.6;
  }
  #hud b { color: #ffe066; }
  #score {
    position: fixed; right: 22px; top: 16px; font-size: 22px; text-align: right;
  }
  #score b { color: #ffd54a; font-size: 30px; }
  #hitmarker {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(45deg);
    font-size: 30px; color: #ff5555; opacity: 0; font-weight: bold;
  }
  #damage { position: fixed; inset: 0; box-shadow: inset 0 0 120px rgba(255,0,0,0); transition: box-shadow .15s; }
  /* ===== ГЛАВНОЕ МЕНЮ ===== */
  #overlay {
    position: fixed; inset: 0; z-index: 20;
    background: radial-gradient(130% 100% at 28% 18%, #1b2b26 0%, #0a0f12 55%, #05080b 100%);
    color: #e8ffe8; pointer-events: auto; font-family: 'Courier New', monospace;
    align-items: stretch;
  }
  #menuRoot { flex: 1; display: flex; align-items: stretch; }
  #menuLeft { width: 40%; max-width: 560px; position: relative;
    display: flex; align-items: center; justify-content: center;
    -webkit-mask-image: linear-gradient(90deg,#000 70%,transparent); mask-image: linear-gradient(90deg,#000 72%,transparent); }
  .charframe { position: relative; width: 360px; height: 600px; max-height: 88vh; }
  #menuCharCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
  .charinfo { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; pointer-events: none; }
  .cname { font-size: 28px; letter-spacing: 4px; color: #fff; text-shadow: 2px 2px 0 #000; }
  .clvl { font-size: 13px; color: #8fd28f; margin-top: 5px; letter-spacing: 2px; }
  #menuRight { flex: 1; display: flex; flex-direction: column; justify-content: center;
    padding: 0 7% 0 30px; gap: 22px; max-width: 760px; }
  .brand { font-size: 58px; font-weight: bold; letter-spacing: 6px; color: #fff; line-height: 1;
    text-shadow: 4px 4px 0 #000, 0 0 34px rgba(174,245,176,.25); }
  .brand span { color: #aef5b0; }
  .brand small { display:block; font-size:15px; letter-spacing:8px; color:#7e927e; margin-top:8px; font-weight:normal; }
  .tabs { display: flex; gap: 2px; border-bottom: 2px solid rgba(174,245,176,.22); }
  .tab { background: none; border: none; color: #80937f; font: inherit; font-size: 17px;
    letter-spacing: 2px; padding: 12px 24px; cursor: pointer; position: relative; text-transform: uppercase; }
  .tab:hover { color: #cfe; }
  .tab.active { color: #aef5b0; }
  .tab.active::after { content:''; position:absolute; left:0; right:0; bottom:-2px; height:3px;
    background:#aef5b0; box-shadow:0 0 10px #aef5b0; }
  .tabwrap { min-height: 220px; }
  .tabpane.hidden { display: none; }
  .tabpane { animation: mfade .22s ease; }
  @keyframes mfade { from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;} }
  .playbtn { display:inline-flex; align-items:center; gap:10px; padding: 16px 50px; border:none;
    background: linear-gradient(90deg,#8fe682,#aef5b0); color:#0a140a; font: inherit; font-size: 24px;
    font-weight: bold; letter-spacing: 3px; cursor: pointer; border-radius: 4px;
    box-shadow: 4px 4px 0 #000, 0 0 26px rgba(174,245,176,.35); }
  .playbtn:hover { filter: brightness(1.08); transform: translateY(-1px); }
  .playsub { color:#9fb89f; font-size:13px; margin-top:14px; letter-spacing:1px; }
  .controls-line { margin-top: 16px; font-size: 13px; line-height: 2.1; opacity:.85; }
  .srv { display:flex; align-items:center; gap:14px; padding: 12px 16px; margin-bottom: 8px;
    background: rgba(20,28,20,.5); border:1px solid rgba(174,245,176,.16); border-radius:4px; }
  .srv:hover { border-color: rgba(174,245,176,.5); background: rgba(30,40,28,.6); }
  .srv .sname { flex:1; font-size:16px; color:#e8ffe8; }
  .srv .smode { color:#8fcf8f; font-size:12px; margin-top:3px; }
  .srv .splayers { width: 78px; text-align:right; color:#cfe; font-size:13px; }
  .srv .sping { width:58px; text-align:right; font-size:13px; }
  .srv .sjoin { padding:8px 18px; background:#aef5b0; color:#0a140a; border:none; font:inherit;
    font-weight:bold; cursor:pointer; border-radius:3px; letter-spacing:1px; }
  .srv .sjoin:hover { filter:brightness(1.1); }
  .ping-good{color:#6ee86e}.ping-mid{color:#ffd54a}.ping-bad{color:#ff7a6e}
  .setrow { display:flex; align-items:center; gap:16px; margin-bottom:18px; max-width:480px; }
  .setrow label { width: 190px; font-size:14px; letter-spacing:1px; color:#cfe; }
  .setrow input[type=range]{ flex:1; accent-color:#aef5b0; height:4px; }
  .setrow .sval { width: 56px; text-align:right; color:#aef5b0; font-size:14px; }
  .exitbtn { padding:14px 38px; background:#3a1414; border:2px solid #ff7a6e; color:#ffd0c8;
    font:inherit; font-size:18px; letter-spacing:2px; cursor:pointer; border-radius:4px; }
  .exitbtn:hover { background:#4a1a1a; }
  .menufoot { position:fixed; bottom:12px; left:0; right:0; text-align:center; font-size:12px;
    color:#6e7e6e; letter-spacing:1px; z-index: 21; pointer-events:none; }
  .menufoot span{ color:#8fcf8f; }
  .key { display:inline-block; min-width: 24px; padding: 2px 7px; border: 1px solid #5e7a5e;
    border-radius: 4px; font-weight: bold; color:#aef5b0; margin: 0 2px; font-size:12px; }

  /* ===== МЕНЮ ПАУЗЫ (на сервере, прозрачный фон поверх игры) ===== */
  #pauseMenu { position: fixed; inset: 0; z-index: 22; display: none;
    align-items: center; justify-content: center;
    background: rgba(4,7,10,.34); pointer-events: auto; font-family: 'Courier New', monospace; }
  .pausecard { background: rgba(12,18,14,.82); border: 3px solid #4a7a4a; box-shadow: 6px 6px 0 #000;
    padding: 26px 34px; min-width: 420px; display: flex; flex-direction: column; gap: 14px; }
  .pausetitle { font-size: 30px; letter-spacing: 6px; color: #aef5b0; text-align: center; text-shadow: 2px 2px 0 #000; }
  .pauseinfo { text-align: center; color: #bcd; font-size: 13px; margin-bottom: 6px; }
  .pauseinfo b { color: #aef5b0; }
  .pausebtns { display: flex; flex-direction: column; gap: 10px; }
  .pausebtn { padding: 12px 20px; background: rgba(30,40,28,.7); border: 2px solid #4a7a4a; color: #cfe;
    font: inherit; font-size: 16px; letter-spacing: 1px; cursor: pointer; border-radius: 4px; text-align: center; }
  .pausebtn:hover { border-color: #aef5b0; color: #eaffea; }
  #pauseSettings { margin-top: 8px; border-top: 1px solid rgba(174,245,176,.2); padding-top: 14px; }
  #pauseSettings.hidden { display: none; }
  #loader { position: fixed; inset:0; z-index: 9999; display:flex; flex-direction:column; align-items:center; justify-content:center;
    background:radial-gradient(circle at 50% 38%,#15211b,#080d0a 72%); font-family:monospace; transition:opacity .6s ease; }
  #loader.hide { opacity:0; pointer-events:none; }
  #loader .ll { font:800 44px/1 monospace; letter-spacing:7px; color:#e6f2ea; margin-bottom:8px; text-shadow:0 0 18px rgba(110,232,122,.25); }
  #loader .ll span { color:#6ee87a; }
  #loader .ls { font:11px monospace; letter-spacing:4px; color:#5d7d68; margin-bottom:30px; }
  #loader .lbar { width:300px; height:7px; background:#16231c; border-radius:5px; overflow:hidden; box-shadow:0 0 0 1px #29463a inset; }
  #loader .lfill { height:100%; width:0; background:linear-gradient(90deg,#2a7a4a,#7ee87a); border-radius:5px; transition:width .25s ease; }
  #loader .lpct { margin-top:11px; color:#9fe3b4; font:13px monospace; }
  #loader .ltip { margin-top:5px; color:#46604f; font:10px monospace; }

  /* --- Экран авторизации --- */
  #authScreen { position:fixed; inset:0; z-index:9990; display:flex; align-items:center; justify-content:center;
    background:radial-gradient(circle at 50% 35%,#16241c,#070b09 75%); font-family:monospace; transition:opacity .4s ease; }
  #authScreen.hide { opacity:0; pointer-events:none; }
  #authScreen.checking .atabs, #authScreen.checking .apane, #authScreen.checking .ahint { display:none; }
  #authScreen .abox { width:340px; max-width:90vw; padding:30px 28px 22px; background:rgba(16,26,20,.92);
    border:1px solid #244536; border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(110,232,122,.06) inset; text-align:center; }
  #authScreen .alogo { font:800 32px/1 monospace; letter-spacing:5px; color:#e6f2ea; }
  #authScreen .alogo span { color:#6ee87a; }
  #authScreen .asub { font:10px monospace; letter-spacing:4px; color:#557; margin:6px 0 22px; }
  #authScreen .atabs { display:flex; gap:6px; margin-bottom:16px; }
  #authScreen .atab { flex:1; padding:9px 0; background:#101a14; color:#7e9a89; border:1px solid #244536;
    border-radius:8px; cursor:pointer; font:12px monospace; transition:.15s; }
  #authScreen .atab.active { background:#1c3527; color:#aef5b0; border-color:#3a6; }
  #authScreen .apane.hidden { display:none; }
  #authScreen .ainp { display:block; width:100%; box-sizing:border-box; margin:8px 0; padding:11px 12px;
    background:#0d150f; border:1px solid #2a4a39; border-radius:8px; color:#dfeee4; font:13px monospace; outline:none; transition:.15s; }
  #authScreen .ainp:focus { border-color:#5cc77a; box-shadow:0 0 0 2px rgba(92,199,122,.18); }
  #authScreen .ainp::placeholder { color:#4f6a59; }
  #authScreen .abtn { width:100%; margin-top:12px; padding:12px 0; background:linear-gradient(90deg,#2a7a4a,#46c46e); color:#04120a;
    border:none; border-radius:8px; font:700 13px monospace; letter-spacing:2px; cursor:pointer; transition:.15s; }
  #authScreen .abtn:hover { filter:brightness(1.1); }
  #authScreen .abtn:disabled { opacity:.55; cursor:default; filter:none; }
  #authScreen .amsg { min-height:18px; margin-top:14px; font:12px monospace; color:#ff6e6e; }
  #authScreen .ahint { margin-top:8px; font:10px monospace; color:#3f5a4a; }
  .charinfo .clogout { margin-top:7px; font:10px monospace; color:#5e7a68; cursor:pointer; transition:.15s; }
  .charinfo .clogout:hover { color:#9fd; }

  /* --- Хотбар / слоты / инвентарь --- */
  .slot {
    width: 52px; height: 52px; border: 2px solid #4a7a4a;
    background: rgba(18,28,18,.7); position: relative;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; line-height: 1; user-select: none;
  }
  .slot.sel { border-color: #ffd54a; box-shadow: 0 0 10px #ffd54a; background: rgba(40,40,18,.7); }
  .slot.drop { border-color: #aef5b0; }
  .slot .cnt { position: absolute; right: 3px; bottom: 1px; font-size: 12px;
    color: #fff; text-shadow: 1px 1px 0 #000; font-family: 'Courier New', monospace; }
  .slot .kn { position: absolute; left: 3px; top: 0; font-size: 11px; color: #aef5b0; }
  .slot[draggable=true] { cursor: grab; }

  #hotbar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 6px; z-index: 27; pointer-events: auto; }

  #prompt { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
    color: #fff; background: rgba(0,0,0,.55); padding: 8px 18px; border: 2px solid #aef5b0;
    font-size: 16px; display: none; z-index: 12; text-shadow: 1px 1px 0 #000; }
  #prompt b { color: #ffd54a; }

  #lootUI { position: fixed; inset: 0; z-index: 25; display: none;
    align-items: center; justify-content: center; gap: 36px;
    background: rgba(4,7,10,.42); pointer-events: auto; cursor: default; }
  .panel { background: rgba(14,20,15,.96); border: 3px solid #4a7a4a;
    padding: 16px 18px; box-shadow: 4px 4px 0 #000; }
  .panel h2 { color: #aef5b0; margin-bottom: 12px; font-size: 18px; letter-spacing: 1px; text-shadow: 2px 2px 0 #000; }
  .grid { display: grid; grid-template-columns: repeat(4, 52px); gap: 6px; }
  #lootHint { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    color: #cfe; font-size: 13px; opacity: .8; z-index: 26; }

  /* SVG-иконка предмета внутри слота */
  .slot .ic { width: 78%; height: 78%; display: flex; align-items: center; justify-content: center;
    pointer-events: none; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.6)); }
  .slot .ic svg { width: 100%; height: 100%; }

  /* Инвентарь игрока */
  #playerUI { position: fixed; inset: 0; z-index: 25; display: none;
    align-items: center; justify-content: center; gap: 34px;
    background: rgba(4,7,10,.42); pointer-events: auto; cursor: default; }
  .pwrap { display: flex; gap: 12px; align-items: stretch; }
  .equipcol { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
  .equipcol .eslot { display: flex; flex-direction: column; align-items: center; gap: 3px; }
  .equipcol .eslot span { font-size: 11px; color: #9fb89f; letter-spacing: 1px; }
  #charPanel { width: 300px; height: 460px; position: relative;
    background: linear-gradient(160deg, #1a241a, #0e140e);
    border: 3px solid #4a7a4a; box-shadow: 4px 4px 0 #000; }
  #charPanel .ptitle { position: absolute; top: 10px; left: 0; right: 0; text-align: center;
    color: #aef5b0; font-size: 18px; letter-spacing: 3px; text-shadow: 2px 2px 0 #000; z-index: 2; }
  #charCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
  #charPanel .phint { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center;
    font-size: 11px; color: #7e8c7e; }

/* --- Чат + уведомления (js/chat.js) --- */
#chat { position:fixed; left:14px; bottom:92px; width:340px; max-width:42vw; z-index:24; font-family:monospace; pointer-events:none; }
#chat .chat-msgs { display:flex; flex-direction:column; gap:3px; max-height:230px; overflow:hidden; margin-bottom:6px; }
#chat .chatmsg { align-self:flex-start; max-width:100%; padding:4px 9px; border-radius:7px; border-left:2px solid #3a6;
  background:rgba(8,14,10,.55); color:#dfeee4; font:12px/1.35 monospace; word-break:break-word; transition:opacity .8s ease; }
#chat .chatmsg b { color:#7ee87a; }
#chat .chatmsg.sys { font-style:italic; color:#9fd5b6; border-left-color:#5a7; background:rgba(8,14,10,.42); }
#chat .chatmsg.sys.leave { color:#e2a08a; border-left-color:#a56; }
#chat .chatmsg.faded { opacity:0; }
#chat.open .chatmsg { opacity:1; }
#chat.open .chat-msgs { max-height:300px; overflow-y:auto; pointer-events:auto; }
#chat .chat-input { pointer-events:auto; width:100%; box-sizing:border-box; padding:9px 11px; border-radius:8px;
  background:rgba(8,14,10,.92); border:1px solid #3a6; color:#dfeee4; font:13px monospace; outline:none; }
#chat .chat-input:focus { border-color:#6ee87a; box-shadow:0 0 0 2px rgba(110,232,122,.18); }

/* --- Крафт / стройка в инвентаре (js: renderCraft) --- */
#craftList { display:flex; flex-direction:column; gap:6px; }
.craftbtn { display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px; cursor:pointer;
  background:rgba(20,30,22,.8); border:1px solid #2c4a38; color:#dfeee4; font:13px monospace; text-align:left; transition:.15s; }
.craftbtn:hover { background:#1c3527; border-color:#3a6; }
.craftbtn .cn { font-weight:bold; color:#aef5b0; min-width:56px; }
.craftbtn .ch { flex:1; color:#7e9a89; font-size:11px; }
.craftbtn .cc { color:#d8a830; font-size:12px; white-space:nowrap; }

/* --- Заголовки групп в крафте (модульная стройка) --- */
.craftgrp { margin:8px 0 3px; font:bold 11px monospace; letter-spacing:1px; color:#6ee87a; opacity:.8; }
.craftgrp:first-child { margin-top:0; }
#craftList .craftbtn { padding:7px 12px; }

/* --- Меню стройки на топор (ПКМ) — превью моделей --- */
#buildMenu { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; align-items:center; justify-content:center;
  background:rgba(8,12,10,.62); }
.bmtitle { font:bold 18px monospace; letter-spacing:2px; color:#aef5b0; margin-bottom:16px; text-shadow:0 2px 6px #000; }
.bmtitle span { font-weight:normal; font-size:12px; color:#9bb; letter-spacing:0; }
#bmGrid { display:grid; grid-template-columns:repeat(6,108px); gap:10px; max-width:760px; }
.bmgrp { grid-column:1/-1; font:bold 11px monospace; letter-spacing:1px; color:#6ee87a; opacity:.85; margin-top:4px; }
.bmcell { background:rgba(20,30,22,.9); border:2px solid #2c4a38; border-radius:10px; cursor:pointer; padding:6px 4px; text-align:center; transition:transform .1s,border-color .1s,background .1s; }
.bmcell:hover { background:#1c3527; border-color:#6ee87a; transform:translateY(-2px); }
.bmcell img { width:92px; height:72px; display:block; margin:0 auto 3px; }
.bmcell .bmn { font:11px monospace; color:#dfeee4; }
