@font-face { font-family: "Friz Quadrata"; src: url("data/fonts/FRIZQT.ttf") format("truetype"); font-display: swap; }

:root {
  /* Шрифт интерфейса Warcraft III (Friz Quadrata). В нём нет кириллицы, русские буквы берутся из близкой антиквы. */
  --wc-font: "Friz Quadrata", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --bg: #12080a;
  --panel: rgba(24, 14, 18, .88);
  --panel-line: rgba(255, 140, 60, .35);
  --text: #f3e6dc;
  --muted: #a8968a;
  --accent: #ff8a2a;
  --accent-2: #ffb347;
  --danger: #ff5a4a;
  --ok: #6fd36f;
  --gold: #ffd25a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--wc-font);
  user-select: none;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
}

[hidden] { display: none !important; }

h1, h2 { margin: 0; font-weight: 800; letter-spacing: .04em; }
h1 {
  font-size: 40px;
  text-align: center;
  background: linear-gradient(#ffe29a, #ff7a1a 60%, #c2330d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(255, 90, 20, .5));
}
h2 { font-size: 22px; }

.sub, .muted { color: var(--muted); }
.sub { text-align: center; margin: 4px 0 18px; }
.center { text-align: center; }

/* --- панели --- */
.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, .6), 0 0 40px rgba(255, 90, 20, .12);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5;
}
.panel.narrow { width: min(400px, calc(100vw - 32px)); }
.panel.wide-panel { width: min(1040px, calc(100vw - 32px)); }

/* --- формы --- */
input, select, button {
  font: inherit;
  color: var(--text);
}
input, select {
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  user-select: text;
}
input:focus, select:focus { border-color: var(--accent); }
#code { width: 100px; text-align: center; text-transform: uppercase; letter-spacing: .25em; font-weight: 700; }

button {
  cursor: pointer;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  padding: 9px 16px;
  transition: background .15s, transform .05s, border-color .15s;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.primary {
  background: linear-gradient(#ff9a3a, #e5530f);
  border-color: #ffb36b;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
button.primary:hover:not(:disabled) { background: linear-gradient(#ffac55, #f06418); }
button.wide { width: 100%; padding: 12px; font-size: 16px; }
button.mini { padding: 3px 10px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.field input { color: var(--text); font-size: 15px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; min-width: 0; }
.row.between { justify-content: space-between; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .12); }
.err { color: var(--danger); min-height: 1.4em; margin: 0; text-align: center; }

.help { color: var(--muted); font-size: 13px; }
.help summary { cursor: pointer; }
.help ul { margin: 8px 0 0; padding-left: 18px; }
.help b { color: var(--text); }

/* --- списки игроков --- */
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .05);
  border-radius: 8px;
}
.plist li .grow { flex: 1; }
.plist li.off { opacity: .45; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .12); color: var(--muted); }
.tag.host { background: rgba(255, 180, 70, .2); color: var(--accent-2); }
.x { padding: 0 8px; line-height: 1.5; }

/* --- верхний левый угол --- */
#topLeft {
  position: fixed;
  left: 12px;
  top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, .45);
  border-radius: 8px;
  font-size: 13px;
  z-index: 3;
}
#topLeft b { letter-spacing: .2em; color: var(--accent-2); }
#ping { color: var(--muted); min-width: 48px; }

/* --- табло --- */
#board {
  position: fixed;
  right: 12px;
  top: 10px;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  min-width: 190px;
  background: rgba(0, 0, 0, .45);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
  font-size: 13px;
}
#board li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 6px 8px; }
#board li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
#board li .wins { color: var(--gold); font-weight: 700; }
#board li .hpbar { grid-column: 2 / 4; height: 4px; background: rgba(255, 255, 255, .12); border-radius: 2px; overflow: hidden; }
#board li .hpbar i { display: block; height: 100%; background: var(--ok); transition: width .1s; }
#board li .dp { grid-column: 2 / 4; font-size: 11px; color: var(--muted); min-height: 13px; }
#board li.dead { opacity: .4; }
#board li.me .nm { font-weight: 700; }

/* --- центр экрана --- */
#roundLabel {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .15em;
  text-transform: uppercase;
  z-index: 2;
}
#banner {
  position: fixed;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: 900;
  letter-spacing: .05em;
  text-align: center;
  text-shadow: 0 4px 24px rgba(255, 90, 20, .8), 0 2px 0 rgba(0, 0, 0, .6);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}
#banner.small { font-size: 38px; }
#note {
  position: fixed;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 14px;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
  z-index: 2;
}

/* --- панель заклинаний --- */
#spellbar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}
.slot {
  position: relative;
  width: 78px;
  height: 84px;
  padding: 6px 4px 4px;
  background: rgba(10, 6, 8, .78);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  cursor: pointer;
}
.slot .k { display: block; font-size: 22px; font-weight: 800; color: var(--accent-2); }
.slot .nm { display: block; font-size: 11px; line-height: 1.15; color: var(--text); }
.slot .lv { position: absolute; right: 5px; bottom: 3px; font-size: 10px; color: var(--gold); }
.slot .cdo { position: absolute; inset: 0; background: rgba(0, 0, 0, .68); transform-origin: bottom; transform: scaleY(0); }
.slot .cdt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 700; text-shadow: 0 1px 4px #000; }
/* кнопка с иконкой: квадрат в рамке, буква клавиши в углу, как на командной панели */
.slot.has-icon { width: 64px; height: 64px; padding: 0; border: 2px solid #8a7440; border-radius: 4px; background: #000; }
.slot .ico { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.slot.has-icon .k { position: absolute; left: 4px; top: 1px; font-size: 15px; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 5px #000; }
.slot.has-icon .nm { display: none; }
.slot.has-icon .lv { text-shadow: 0 0 3px #000, 0 0 3px #000; }
.slot.ready-flash { animation: flash .35s; }
.slot.off { opacity: .45; }
@keyframes flash { from { border-color: #fff; box-shadow: 0 0 18px var(--accent); } to { border-color: rgba(255, 255, 255, .2); box-shadow: none; } }

#conn {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(160, 30, 20, .9);
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 9;
}

/* --- магазин --- */
.shop-info { display: flex; gap: 18px; align-items: baseline; }
.gold { color: var(--gold); font-weight: 800; font-size: 20px; }
.timer { color: var(--muted); font-variant-numeric: tabular-nums; }
#shopGrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.col-block { grid-column: span 12; min-width: 0; }
.col-block.span3 { grid-column: span 3; }
.col-block.span6 { grid-column: span 6; }
.col-block.span9 { grid-column: span 9; }
.col-block.span12 { grid-column: span 12; }
.col-block h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: .04em; color: var(--accent-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.card .note { font-size: 11px; color: var(--accent-2); min-height: 14px; }
.card.dim { opacity: .45; }
.card .mini { align-self: flex-start; }
.small { font-size: 12px; margin: 0 0 6px; }
@media (max-width: 900px) { .col-block.span3, .col-block.span6, .col-block.span9 { grid-column: span 12; } }
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
}
.card.owned { border-color: rgba(255, 170, 70, .5); background: rgba(255, 140, 40, .08); }
.card .head { display: flex; align-items: center; gap: 8px; }
.card .ico { width: 44px; height: 44px; flex: none; border: 2px solid #8a7440; border-radius: 4px; object-fit: cover; }
.card .key { background: rgba(255, 255, 255, .12); border-radius: 5px; padding: 0 7px; font-weight: 800; color: var(--accent-2); }
.card .title { font-weight: 700; flex: 1; }
.card .pips { display: flex; gap: 3px; }
.card .pips i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.card .pips i.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.card .desc { font-size: 12px; color: var(--muted); min-height: 48px; }
.card .stats { font-size: 12px; display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; }
.card .stats span:nth-child(odd) { color: var(--muted); }
.card .stats em { color: var(--ok); font-style: normal; }
.card button { margin-top: auto; padding: 7px; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { display: flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 13px; border-radius: 99px; background: rgba(255, 255, 255, .06); }
.chips li.ready { background: rgba(111, 211, 111, .18); }

@media (max-width: 760px) {
  #banner { font-size: 40px; }
  .slot { width: 60px; height: 70px; }
  .slot .nm { display: none; }
  #board { min-width: 150px; }
}

/* --- экран загрузки и строка сборки --- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #2a0f08 0%, #0b0403 70%);
  transition: opacity .5s;
}
#boot.done { opacity: 0; pointer-events: none; }
#boot .bar { width: min(420px, 80vw); height: 6px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
#boot .bar i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #ffb347, #ff6a1a); transition: width .15s; }
#boot p { margin: 0; }
#boot .muted { font-size: 12px; }
#buildInfo { position: fixed; left: 12px; bottom: 6px; z-index: 4; font-size: 11px; color: rgba(255, 255, 255, .35); pointer-events: none; }

/* --- компактный магазин: иконки, подробности в подсказке --- */
.cards { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important; }
.card { align-items: center; text-align: center; padding: 8px; gap: 4px; }
.card .desc, .card .stats, .card .note { display: none; }
.card .head { flex-direction: column; gap: 4px; }
.card .head .title, .card .head .key { display: none; }
.card.noicon .head .title { display: block; font-size: 12px; }
.card .ico { width: 56px; height: 56px; }
.card button:not(.mini) { width: 100%; padding: 4px; font-size: 12px; }
#tip { position: fixed; z-index: 60; max-width: 290px; padding: 10px 12px; background: rgba(12, 6, 8, .96); border: 1px solid var(--panel-line); border-radius: 8px; font-size: 12px; pointer-events: none; display: flex; flex-direction: column; gap: 4px; }
#tip[hidden] { display: none; }
#tip b { color: var(--accent-2); font-size: 14px; }
#tip .d { color: var(--muted); }
#tip .n { color: var(--accent-2); }
#tip .c { color: var(--gold); font-weight: 700; }
#tip .stats { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; }
#tip .stats span:nth-child(odd) { color: var(--muted); }
#tip .stats em { color: var(--ok); font-style: normal; }

.slot .alt { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 9px; font-weight: 700; color: #ffd36a; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.slot.alt-on { box-shadow: 0 0 0 2px #ffd36a inset, 0 0 8px rgba(255, 211, 106, .7); }
.slot.armed { border-color: #7cfc5a; box-shadow: 0 0 10px rgba(124, 252, 90, .85); transform: translateY(-3px); }

/* ---- меню в стиле Warcraft III ---- */
#gameMenu { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, .55); }
#gameMenu[hidden] { display: none; }
.wc-frame {
  width: min(420px, calc(100vw - 32px));
  padding: 22px 26px 24px;
  background: linear-gradient(180deg, #2b2218 0%, #1a130d 100%);
  border: 4px ridge #8a6d2f;
  border-radius: 6px;
  box-shadow: 0 0 0 2px #0b0704, 0 12px 40px rgba(0, 0, 0, .8), inset 0 0 40px rgba(0, 0, 0, .6);
  font-family: var(--wc-font);
}
.wc-title { margin: 0 0 14px; text-align: center; font-size: 26px; letter-spacing: 2px; color: #ffd36a; text-shadow: 0 2px 0 #000, 0 0 12px rgba(255, 190, 70, .45); text-transform: uppercase; }
.wc-section { margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 1px solid #6d5522; color: #e8c872; font-size: 15px; text-transform: uppercase; letter-spacing: 1px; }
.wc-row { display: grid; grid-template-columns: 1fr 140px 38px; align-items: center; gap: 10px; margin: 7px 0; color: #e6d5b0; font-size: 14px; }
.wc-row b { color: #ffd36a; font-weight: 600; text-align: right; }
.wc-row.check { grid-template-columns: 22px 1fr; }
.wc-row input[type=range] { width: 100%; accent-color: #d9a441; }
.wc-row input[type=checkbox] { width: 18px; height: 18px; accent-color: #d9a441; }
.wc-hint { margin: 8px 0 14px; color: #a89674; font-size: 12px; font-style: italic; }
.wc-btn {
  width: 100%; padding: 10px 14px; cursor: pointer;
  font: 700 16px var(--wc-font); letter-spacing: 1px; color: #ffe9a8; text-transform: uppercase;
  background: linear-gradient(180deg, #6b4f1d 0%, #3a2a0e 100%);
  border: 2px outset #b8902f; border-radius: 4px; text-shadow: 0 1px 0 #000;
}
.wc-btn:hover { background: linear-gradient(180deg, #86641f 0%, #4a3510 100%); color: #fff; }
.wc-btn:active { border-style: inset; }

/* вкладки магазина и ряды заклинаний */
.shop-tabs { display: flex; gap: 8px; margin: 0 0 12px; }
.tabbtn { padding: 7px 18px; cursor: pointer; font: 700 14px var(--wc-font); color: #cdbb94; background: linear-gradient(180deg, #2b2218, #1a130d); border: 2px solid #5a4620; border-radius: 4px; }
.tabbtn.on { color: #ffe9a8; border-color: #d9a441; background: linear-gradient(180deg, #5b4318, #33250c); box-shadow: 0 0 8px rgba(217, 164, 65, .45); }
#shopGrid[data-tab="spells"] .tab-items, #shopGrid[data-tab="items"] .tab-spells { display: none; }
.shop-row { grid-column: span 12; display: flex; align-items: center; gap: 14px; padding: 8px 10px; border: 1px solid rgba(255, 190, 90, .18); border-radius: 8px; background: rgba(255, 255, 255, .025); }
.shop-row .row-label { flex: 0 0 52px; display: flex; align-items: center; gap: 10px; }
.keybadge { width: 44px; height: 44px; display: grid; place-items: center; font: 800 24px var(--wc-font); color: #ffe9a8; background: linear-gradient(180deg, #5b4318, #2c1f09); border: 2px solid #d9a441; border-radius: 6px; text-shadow: 0 2px 0 #000; }
.row-title { font-size: 12px; line-height: 1.2; color: var(--accent-2); }
.shop-row .cards { flex: 1; display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 700px) { .shop-row { flex-direction: column; align-items: flex-start; } }

/* ---- инвентарь справа, как в Warcraft III: 2 столбца по 3 ряда ---- */
#invPanel {
  position: fixed; right: 14px; bottom: 14px; z-index: 3; padding: 8px 9px 10px;
  background: linear-gradient(180deg, #2b2218, #17100a); border: 3px ridge #8a6d2f; border-radius: 6px;
  box-shadow: 0 0 0 2px #0b0704, 0 6px 18px rgba(0, 0, 0, .7), inset 0 0 18px rgba(0, 0, 0, .6);
}
.inv-title { margin: 0 0 6px; text-align: center; font: 700 11px var(--wc-font); letter-spacing: 1.5px; text-transform: uppercase; color: #e8c872; text-shadow: 0 1px 0 #000; }
#invGrid { display: grid; grid-template-columns: repeat(2, 56px); grid-template-rows: repeat(3, 56px); gap: 4px; }
.inv-slot { position: relative; width: 56px; height: 56px; background: #0b0704; border: 2px inset #4a3a1a; border-radius: 3px; display: grid; place-items: center; }
.inv-slot.full { border: 2px outset #b8902f; background: #000; }
.inv-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-slot .tier { position: absolute; right: 3px; bottom: 1px; font: 700 11px var(--wc-font); color: #ffd36a; text-shadow: 0 0 3px #000, 0 0 3px #000; }

.wc-btn + .wc-btn { margin-top: 10px; }
.wc-btn-danger { background: linear-gradient(180deg, #5b2118 0%, #321008 100%); border-color: #a84a30; color: #ffd9c8; }
.wc-btn-danger:hover { background: linear-gradient(180deg, #7a2b1e 0%, #44160b 100%); }
.wc-btn-danger.sure { animation: wcpulse .7s ease-in-out infinite alternate; }
@keyframes wcpulse { from { box-shadow: 0 0 0 rgba(255, 90, 60, 0); } to { box-shadow: 0 0 14px rgba(255, 90, 60, .8); } }

/* ---- главное меню отдельным экраном: пергаментная карта Warcraft III и золотые кнопки ---- */
#menu.menu-screen {
  position: fixed; inset: 0; z-index: 20; width: auto; max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  background: #120a06 url(data/ui/menu_bg.jpg) center / cover no-repeat;
  display: grid; grid-template-columns: 1fr minmax(320px, 440px); align-items: center; gap: 24px; padding: 4vh 6vw;
  overflow: auto;
}
#menu.menu-screen[hidden] { display: none; }
.menu-title { align-self: start; padding-top: 4vh; color: #fff3c4; text-shadow: 0 3px 0 #000, 0 0 24px rgba(0, 0, 0, .9); }
.menu-title h1 { margin: 0; font: 800 clamp(40px, 7vw, 92px) var(--wc-font); letter-spacing: .08em; color: #ffd36a;
  text-shadow: 0 4px 0 #3a2208, 0 0 30px rgba(255, 150, 40, .6), 0 8px 24px #000; }
.menu-title .sub { margin: 6px 0 0; font: italic 600 clamp(14px, 1.6vw, 20px) var(--wc-font); color: #ffe9b8; }
.menu-panel {
  padding: 22px 26px 24px; background: rgba(62, 44, 22, .86); border: 4px ridge #8a6d2f; border-radius: 6px;
  box-shadow: 0 0 0 2px #0b0704, 0 14px 40px rgba(0, 0, 0, .75), inset 0 0 40px rgba(0, 0, 0, .55);
  font-family: var(--wc-font); color: #f0dcae;
}
.menu-panel .wc-title.small { font-size: 22px; margin-bottom: 14px; }
.menu-panel label.field { color: #e8c872; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.menu-panel input { background: rgba(10, 6, 3, .75); border: 2px inset #6d5522; border-radius: 3px; color: #fff3c4; font: 600 16px var(--wc-font); padding: 8px 10px; }
.menu-panel input:focus { outline: none; border-color: #d9a441; box-shadow: 0 0 8px rgba(217, 164, 65, .6); }
.menu-panel .or { color: #b8a070; }
.menu-panel .or span { background: transparent; }
.menu-panel .row { display: flex; gap: 10px; align-items: stretch; }
.menu-panel .row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.wc-btn.small { width: auto; padding: 8px 18px; margin-top: 0; }
.menu-panel .wc-btn { margin-top: 12px; }
.menu-panel .help { color: #d9c697; margin-top: 12px; }
.menu-panel .err { color: #ff9a80; min-height: 18px; }
.menu-foot { position: fixed; left: 0; right: 0; bottom: 10px; text-align: center; font: italic 12px var(--wc-font); color: rgba(255, 233, 184, .75); text-shadow: 0 1px 2px #000; pointer-events: none; }
@media (max-width: 760px) { #menu.menu-screen { grid-template-columns: 1fr; } .menu-title { text-align: center; padding-top: 0; } }

/* заголовок над блоком меню */
.menu-right { grid-column: 2; display: flex; flex-direction: column; gap: 14px; }
.menu-title { align-self: auto; padding-top: 0; text-align: center; }
.menu-title h1 { font-size: clamp(38px, 5.5vw, 68px); }
@media (max-width: 760px) { .menu-right { grid-column: 1; } }

/* ---- таблица игроков в стиле Warcraft III ---- */
#scoreTable { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, .35); pointer-events: none; }
#scoreTable[hidden] { display: none; }
.score-frame { width: min(760px, calc(100vw - 24px)); pointer-events: auto; }
.score-frame table { width: 100%; border-collapse: collapse; font-size: 14px; color: #f0dcae; }
.score-frame th { padding: 6px 8px; text-align: right; font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: #e8c872; border-bottom: 2px solid #6d5522; }
.score-frame th.l, .score-frame td.l { text-align: left; }
.score-frame td { padding: 7px 8px; text-align: right; border-bottom: 1px solid rgba(138, 109, 47, .28); font-variant-numeric: tabular-nums; }
.score-frame tr.me td { background: rgba(217, 164, 65, .12); }
.score-frame tr.dead td.l { opacity: .55; text-decoration: line-through; }
.score-frame td.l { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.score-frame .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
.score-frame .win { color: #ffd36a; font-weight: 800; }
.score-frame td .star { color: #ffd36a; }

/* ---- верхние панели в стиле Warcraft III ---- */
#topLeft, #board {
  background: linear-gradient(180deg, rgba(48, 36, 22, .94) 0%, rgba(24, 16, 10, .94) 100%);
  border: 3px ridge #8a6d2f;
  border-radius: 5px;
  box-shadow: 0 0 0 2px #0b0704, 0 5px 14px rgba(0, 0, 0, .65), inset 0 0 16px rgba(0, 0, 0, .55);
  color: #ecd9a6;
  text-shadow: 0 1px 0 #000;
}
#topLeft { padding: 6px 10px; gap: 10px; font-size: 13px; letter-spacing: .3px; }
#topLeft b { color: #ffd36a; letter-spacing: .24em; text-shadow: 0 1px 0 #000, 0 0 8px rgba(255, 190, 70, .45); }
#ping { color: #a8946a; min-width: 48px; font-size: 12px; }
#topLeft button.mini {
  padding: 3px 11px; font: 700 11px var(--wc-font); letter-spacing: .6px; text-transform: uppercase; color: #ffe9a8;
  background: linear-gradient(180deg, #6b4f1d 0%, #3a2a0e 100%);
  border: 2px outset #b8902f; border-radius: 3px; text-shadow: 0 1px 0 #000;
}
#topLeft button.mini:hover:not(:disabled) { background: linear-gradient(180deg, #86641f 0%, #4a3510 100%); color: #fff; }
#topLeft button.mini:active:not(:disabled) { border-style: inset; transform: none; }

#board { min-width: 220px; padding: 9px 12px 11px; gap: 9px; }
#board li { grid-template-columns: 14px 1fr auto; gap: 3px 9px; }
#board li .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #000; box-shadow: 0 0 6px currentColor, inset 0 0 3px rgba(255, 255, 255, .45); }
#board li .nm { font-weight: 700; font-size: 14px; color: #f3e2b4; max-width: 150px; }
#board li.me .nm { color: #ffd36a; }
#board li .wins { color: #ffd36a; font-weight: 800; text-shadow: 0 1px 0 #000, 0 0 6px rgba(255, 190, 70, .4); }
#board li .hpbar {
  height: 11px; background: #0b0704; border: 2px inset #4a3a1a; border-radius: 2px; overflow: hidden;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, .9);
}
#board li .hpbar i {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .3) 100%);
  box-shadow: 0 0 6px rgba(120, 255, 120, .25);
}
#board li .dp { font-size: 11px; font-style: italic; color: #b9a577; text-shadow: 0 1px 0 #000; }
#board li.dead .nm { text-decoration: line-through; }

/* весь текст интерфейса — шрифтом Warcraft III: кнопки, поля и списки не наследуют его сами */
button, input, select, textarea, summary, option, table, th, td, kbd, code { font-family: var(--wc-font); }

/* подсказки (магазин и бой) в стиле Warcraft III */
#tip {
  background: linear-gradient(180deg, rgba(48, 36, 22, .97) 0%, rgba(20, 13, 8, .97) 100%);
  border: 3px ridge #8a6d2f; border-radius: 5px;
  box-shadow: 0 0 0 2px #0b0704, 0 8px 22px rgba(0, 0, 0, .75), inset 0 0 14px rgba(0, 0, 0, .5);
  color: #ecd9a6; text-shadow: 0 1px 0 #000;
}
#tip b { color: #ffd36a; font-size: 15px; letter-spacing: .3px; }
#tip .d { color: #cdb98b; }
#tip .n { color: #e8c872; }
#tip .c { color: #ffd36a; }
#tip .stats span:nth-child(odd) { color: #a8946a; }

#gameMenu.pre #menuExit { display: none; }

/* шестерёнка настроек */
.gear { display: inline-grid; place-items: center; padding: 3px 8px !important; line-height: 0; }
.gear svg { display: block; }
.gear-main {
  position: fixed; top: 14px; right: 16px; z-index: 22; width: 42px; height: 42px; padding: 0 !important; border-radius: 6px;
  color: #ffe9a8; background: linear-gradient(180deg, rgba(107, 79, 29, .95) 0%, rgba(58, 42, 14, .95) 100%);
  border: 2px outset #b8902f; box-shadow: 0 3px 10px rgba(0, 0, 0, .6);
}
.gear-main:hover { color: #fff; background: linear-gradient(180deg, #86641f 0%, #4a3510 100%); }
.gear-main svg { width: 24px; height: 24px; transition: transform .35s; }
.gear-main:hover svg, #topLeft .gear:hover svg { transform: rotate(60deg); }

/* ---- справка ---- */
.gear.help-main, #topLeft .gear#btnHelp { font: 700 16px var(--wc-font); line-height: 1; }
.help-main { right: 62px; }
#helpDlg { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; background: rgba(0, 0, 0, .6); }
#helpDlg[hidden] { display: none; }
.help-frame { width: min(820px, calc(100vw - 24px)); max-height: calc(100vh - 28px); display: flex; flex-direction: column; }
.help-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.help-tab { flex: 1; padding: 8px 6px; cursor: pointer; font: 700 14px var(--wc-font); letter-spacing: 1px; text-transform: uppercase; color: #cdb98b; background: #2a1f10; border: 2px outset #6d5522; border-radius: 4px; }
.help-tab.on { color: #ffe9a8; background: linear-gradient(180deg, #6b4f1d 0%, #3a2a0e 100%); border-color: #b8902f; }
.help-body { overflow-y: auto; padding-right: 6px; margin-bottom: 12px; min-height: 120px; }
.help-card { margin: 0 0 10px; padding: 9px 12px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(138, 109, 47, .45); border-radius: 4px; color: #e6d5b0; font-size: 14px; line-height: 1.45; }
.help-card h3 { margin: 0 0 4px; font-size: 16px; color: #ffd36a; display: flex; align-items: center; gap: 8px; }
.help-card p { margin: 3px 0; }
.help-card ul { margin: 3px 0; padding-left: 18px; }
.help-card b { color: #e8c872; }
.help-card .why { color: #cdb98b; }
.help-card .hk { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border: 2px ridge #8a6d2f; background: #1a130d; color: #ffe9a8; border-radius: 4px; font-size: 14px; }
.help-note { color: #a89674; font-size: 12px; font-style: italic; margin: 4px 2px; }

.help-card .hi { width: 40px; height: 40px; flex: none; border: 2px ridge #8a6d2f; border-radius: 4px; background: #000; image-rendering: auto; }
.help-card .hi.sm { width: 28px; height: 28px; border-width: 1px; }
.help-card ul { list-style: none; padding-left: 0; }
.help-card li.tier { display: flex; align-items: center; gap: 8px; margin: 4px 0; }

/* ---- режим тренировки ---- */
.train-btn { margin-top: 8px; opacity: .92; }
.train-bar { position: fixed; top: 62px; left: 10px; z-index: 22; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: min(440px, calc(100vw - 24px));
  padding: 6px 8px; background: linear-gradient(180deg, rgba(48, 36, 22, .94) 0%, rgba(24, 16, 10, .94) 100%); border: 3px ridge #8a6d2f; border-radius: 5px; box-shadow: 0 5px 14px rgba(0, 0, 0, .65); }
.train-bar[hidden] { display: none; }
.train-title { color: #ffd36a; font: 700 13px var(--wc-font); letter-spacing: 1px; text-transform: uppercase; margin-right: 4px; }

/* ---- мастерства: отдельный блок справа в рамке магазина ---- */
.shop-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 14px; align-items: start; }
.shop-main { min-width: 0; }
.shop-side { position: sticky; top: 0; padding: 10px; background: rgba(0, 0, 0, .28); border: 2px ridge #8a6d2f; border-radius: 6px; }
.shop-side .cards { grid-template-columns: 1fr !important; }
.shop-side .card .head { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.shop-side .card .head .title { display: block; font-size: 12px; flex: 0 1 auto; }
.shop-side .card .head .pips { flex: 1 0 100%; justify-content: center; }
.shop-side .card .head .title { max-width: 118px; text-align: left; }
.shop-side .muted.small { font-size: 11px; }
@media (max-width: 900px) { .shop-body { grid-template-columns: 1fr; } .shop-side { position: static; } }

.shop-row.half { grid-column: span 6; }
@media (max-width: 900px) { .shop-row.half { grid-column: span 12; } }

/* ---- аккаунт, вход, профиль ---- */
.acct { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.acct-row { display: flex; gap: 8px; }
.acct-row .wc-btn { flex: 1; }
.acct-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: #ffd36a; font-family: var(--wc-font); }
.acct-name b { font-size: 17px; }
.acct-name span { font-size: 12px; color: #cdb98b; }
.leaders-btn { opacity: .9; }
.overlay { position: fixed; inset: 0; z-index: 56; display: grid; place-items: center; background: rgba(0, 0, 0, .6); }
.overlay[hidden] { display: none; }
.auth-frame { width: min(380px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 6px; }
.auth-frame .field { display: flex; flex-direction: column; gap: 4px; color: #e6d5b0; font-size: 13px; }
.link-btn { background: none; border: 0; color: #e8c872; text-decoration: underline; cursor: pointer; font: 13px var(--wc-font); padding: 4px; }
.profile-frame { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 28px); display: flex; flex-direction: column; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; color: #f0dcae; }
.stat-table td, .stat-table th { padding: 6px 8px; border-bottom: 1px solid rgba(138, 109, 47, .3); text-align: left; }
.stat-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: #ffd36a; }
.stat-table.board td:last-child { text-align: left; color: inherit; }
.stat-table th { color: #e8c872; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.stat-table.board td:nth-child(n+3), .stat-table.board th:nth-child(n+3) { text-align: right; }
.stat-table tr.me td { background: rgba(217, 164, 65, .14); }
.tag.rate { color: #ffd36a; }
.tag.rate.up { color: #7be07b; }
.tag.rate.down { color: #ff8a7a; }

/* ---- выравнивание главного меню: одинаковые отступы, кнопки в рядах на одной линии ---- */
.menu-panel .acct { gap: 10px; margin-bottom: 0; }
.menu-panel .acct .wc-btn, .menu-panel .row .wc-btn { margin-top: 0; }
.menu-panel .acct-row { gap: 10px; }
.menu-panel .acct-name { margin-bottom: 0; padding: 0 2px; }
.menu-panel .row { align-items: stretch; }
.menu-panel .row .wc-btn.small { align-self: stretch; display: grid; place-items: center; }
.menu-panel .or { margin: 14px 0 10px; }
.acct-in { display: flex; flex-direction: column; gap: 10px; }
.acct-in[hidden], #acctOut[hidden] { display: none; }
.menu-panel .wc-btn, .menu-panel .row input { min-height: 46px; box-sizing: border-box; }
.menu-panel .row .wc-btn.small { height: auto; }
.menu-panel .row input { height: 46px; padding-top: 0; padding-bottom: 0; }

/* ---- блок рейтинга и звания ---- */
.rating-block { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: rgba(0, 0, 0, .32); border: 2px ridge #8a6d2f; border-radius: 5px; }
.rank-icon { width: 60px; height: 60px; flex: none; border: 2px ridge #b8902f; border-radius: 5px; background: #000; box-shadow: 0 0 10px rgba(255, 200, 90, .35); }
.rating-block[hidden] { display: none; }
.rank-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-family: var(--wc-font); }
.rank-name { color: #ffd36a; font-size: 18px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; text-shadow: 0 1px 0 #000; }
.rank-rating { display: flex; align-items: baseline; gap: 8px; color: #e6d5b0; }
.rank-rating b { font-size: 22px; color: #fff3c4; font-variant-numeric: tabular-nums; }
.rank-rating span { font-size: 11px; color: #a89674; }
.rank-bar { height: 7px; background: rgba(0, 0, 0, .55); border: 1px solid #6d5522; border-radius: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, #b8791a, #ffd36a); }
.rank-next { font-size: 11px; color: #cdb98b; }
.rank-img { vertical-align: middle; margin-right: 5px; border: 1px solid #8a6d2f; border-radius: 3px; background: #000; }
.profile-head { margin-bottom: 8px; }
.profile-rank { display: flex; align-items: center; gap: 12px; color: #e6d5b0; font-family: var(--wc-font); }
.profile-rank .rank-img { width: 48px; height: 48px; border-width: 2px; margin: 0; }
.profile-rank b { color: #ffd36a; font-size: 18px; text-transform: uppercase; letter-spacing: 1px; }
.stat-table td.ico { padding: 3px 4px; width: 34px; text-align: center; }
.stat-table td.ico .rank-img { margin: 0; }
.ranks-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.ranks-list li { display: flex; align-items: center; gap: 8px; }
.stat-table.board td:nth-child(3), .stat-table.board th:nth-child(3) { text-align: left; color: inherit; }
.stat-table.board td:nth-child(2) { text-align: center; }

.menu-panel .logout-btn { width: 100%; margin-top: 14px; opacity: .85; }
.menu-panel .logout-btn[hidden] { display: none; }
/* единый вертикальный шаг 12px между блоками и кнопками меню (у .wc-btn был лишний нижний отступ 6px) */
.menu-panel .acct, .menu-panel .acct-in, .menu-panel .acct-row { gap: 12px; }
.menu-panel .acct .wc-btn, .menu-panel .row .wc-btn, .menu-panel .logout-btn { margin-bottom: 0; }
.menu-panel .acct .wc-btn, .menu-panel .row .wc-btn { margin-top: 0; }
.menu-panel .logout-btn { margin-top: 12px; }
.menu-panel .acct { margin-bottom: 0; }
