* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #f6f8ff;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: radial-gradient(120% 130% at 50% 38%, #14101f, #05060a);
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

#stage {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #0b0d16;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.65), 0 0 0 4px #05060a;
  font-size: 16px;
}

canvas#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== HUD оверлеем ===== */
.hud {
  position: absolute;
  top: 0.9em;
  z-index: 5;
  pointer-events: none;
  text-shadow: 0 0.12em 0 rgba(0, 0, 0, 0.7);
}

.hud.tl {
  left: 1em;
}

.hud.tr {
  right: 1em;
}

.hname {
  font-size: 1.2em;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.hpbar {
  width: 13em;
  height: 1em;
  margin-top: 0.25em;
  border-radius: 0.5em;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.hpbar > div {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #ff6b5e, #b81f14);
  transition: width 0.15s ease;
}

.hpsub {
  margin-top: 0.2em;
  font-size: 0.85em;
  color: rgba(246, 248, 255, 0.8);
}

.enbar {
  width: 13em;
  height: 0.65em;
  margin-top: 0.25em;
  border-radius: 0.4em;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.enbar > div {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #7dd3fc, #2563eb);
}

.abilities {
  display: flex;
  gap: 0.4em;
  margin-top: 0.4em;
}

.ab {
  width: 2.6em;
  height: 2.6em;
  display: grid;
  place-items: center;
  border-radius: 0.5em;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 900;
  position: relative;
}

.ab span {
  position: absolute;
  bottom: 0.1em;
  right: 0.25em;
  font-size: 0.7em;
  color: #fbbf24;
}

.ab.cool {
  opacity: 0.45;
}

.xpbar {
  width: 13em;
  height: 0.5em;
  margin-top: 0.35em;
  border-radius: 0.3em;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.xpbar > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #c4b5fd, #7c5cf0);
}

.statrows {
  display: grid;
  gap: 0.4em;
}

.statrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6em;
  font-size: 0.9em;
  color: #d9d4ec;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5em;
  padding: 0.4em 0.6em;
}

.plus {
  flex: none;
  width: 2em;
  height: 2em;
  font-weight: 900;
  cursor: pointer;
  color: #0b1226;
  background: #fbbf24;
  border: 2px solid #0a0712;
  border-radius: 0.4em;
}

.plus:disabled {
  opacity: 0.35;
  cursor: default;
}

.pillbtn {
  pointer-events: auto;
  cursor: pointer;
  font-family: inherit;
  color: #f6f8ff;
}

#lvlPill {
  pointer-events: auto;
  cursor: pointer;
}

#lvlPill.lit {
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px #fbbf24, 0 0 14px rgba(251, 191, 36, 0.5);
  color: #fbbf24;
}

.lvl-toast {
  position: absolute;
  right: 1em;
  top: 4.2em;
  z-index: 8;
  max-width: 16em;
  font-size: 0.95em;
  font-weight: 800;
  background: rgba(10, 7, 18, 0.92);
  border: 1px solid #fbbf24;
  border-radius: 0.6em;
  padding: 0.5em 0.8em;
  color: #fbbf24;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.lvl-toast.hidden {
  display: none;
}

.panel-box.wide {
  width: min(94%, 34em);
}

.inv-cols {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8em;
  text-align: left;
}

.inv-sub {
  font-size: 0.85em;
  font-weight: 800;
  color: #b9b3cc;
  margin-bottom: 0.4em;
  letter-spacing: 0.06em;
}

.equip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35em;
}

.eslot, .invgrid .slot {
  width: 2.9em;
  height: 2.9em;
  display: grid;
  place-items: center;
  font-size: 1.15em;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5em;
  cursor: pointer;
  position: relative;
}

.invgrid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35em;
}

.eslot.sel, .invgrid .slot.sel {
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px #fbbf24;
}

.eslot .ghost {
  font-size: 0.42em;
  color: rgba(246, 248, 255, 0.35);
  font-weight: 800;
}

.invgrid .slot em {
  position: absolute;
  right: 0.15em;
  bottom: 0.05em;
  font-size: 0.55em;
  font-style: normal;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 0 #000;
}

.detail {
  min-height: 5.5em;
  text-align: left;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5em;
  padding: 0.6em 0.8em;
  display: grid;
  gap: 0.15em;
}

.detail .dim {
  color: #8d869e;
}

.tt-name {
  font-weight: 900;
  font-size: 1.05em;
}

.tt-sub {
  color: #b9b3cc;
  font-size: 0.85em;
}

.tt-req {
  color: #fb7185;
}

.tt-price {
  color: #fbbf24;
}

.tt-worn {
  margin-top: 0.3em;
  color: #8d869e;
  font-size: 0.85em;
}

.up {
  color: #7dff6a;
}

.down {
  color: #fb7185;
}

.abtns {
  display: flex;
  gap: 0.5em;
  margin-top: 0.4em;
}

.abtns button {
  flex: 1;
  font-size: 0.9em;
  font-weight: 800;
  padding: 0.4em;
  cursor: pointer;
  color: #fff;
  background: #3b2d5e;
  border: 2px solid #0a0712;
  border-radius: 0.4em;
}

.abtns button:active {
  transform: translateY(2px);
}

.invtip {
  position: absolute;
  z-index: 30;
  right: 1em;
  top: 1em;
  max-width: 16em;
  font-size: 0.85em;
  background: rgba(10, 7, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5em;
  padding: 0.6em 0.8em;
  display: grid;
  gap: 0.15em;
  pointer-events: none;
}

.invtip.hidden {
  display: none;
}

.shopgold {
  font-size: 1.1em;
  font-weight: 900;
  color: #fbbf24;
}

.shopbody {
  display: grid;
  gap: 0.35em;
  max-height: 16em;
  overflow-y: auto;
  text-align: left;
}

.shopbody .shoprow {
  padding: 0.5em 0.6em;
}

.shopbody .shoprow .sicon {
  font-size: 1.6em;
}

#shopOv .panel-box h2 {
  font-size: 2.2em;
}

#shopOv .ov-text {
  font-size: 1em;
  color: #d9d4ec;
}

.shoprow {
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5em;
  padding: 0.35em 0.5em;
  font-size: 0.9em;
}

.shoprow .sicon {
  font-size: 1.3em;
}

.shoprow .sname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shoprow .sprice {
  color: #fbbf24;
  font-weight: 800;
  white-space: nowrap;
}

.shoprow button {
  flex: none;
  font-size: 0.85em;
  font-weight: 800;
  padding: 0.35em 0.8em;
  cursor: pointer;
  color: #0b1226;
  background: #fbbf24;
  border: 2px solid #0a0712;
  border-radius: 0.4em;
}

.shoprow button:active {
  transform: translateY(2px);
}

.pill {
  font-size: 1.1em;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.6em;
  padding: 0.25em 0.7em;
}

/* ===== меню ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 14, 0.72);
}

.overlay.hidden {
  display: none;
}

.panel-box {
  width: min(88%, 22em);
  padding: 1.6em 1.8em;
  text-align: center;
  background: #1d1626;
  border: 4px solid #0a0712;
  box-shadow: 0.6em 0.6em 0 rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 0.9em;
}

.panel-box h2 {
  font-size: 2em;
  color: #c4b5fd;
  letter-spacing: 0.06em;
}

.panel-box.slim {
  width: auto;
  min-width: 16em;
}

.fld {
  display: grid;
  gap: 0.4em;
  font-size: 0.9em;
  color: #b9b3cc;
  text-align: left;
}

.fld input {
  font: inherit;
  padding: 0.5em 0.7em;
  color: #f6f8ff;
  background: #100b1a;
  border: 2px solid #3b2d5e;
  border-radius: 0.5em;
  outline: none;
}

.fld input:focus {
  border-color: #7c5cf0;
}

.btn {
  font-size: 1.05em;
  font-weight: 800;
  padding: 0.55em 1.5em;
  border: 3px solid #0a0712;
  cursor: pointer;
  background: #2c2540;
  color: #fff;
  box-shadow: 0 0.3em 0 #0a0712;
}

.btn:active {
  transform: translateY(0.16em);
  box-shadow: 0 0.08em 0 #0a0712;
}

.btn-primary {
  background: #7c5cf0;
  color: #fff;
}

.hint {
  font-size: 0.8em;
  color: #8d869e;
}

.hintbar {
  position: absolute;
  left: 50%;
  bottom: 0.6em;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 92%;
  font-size: 0.78em;
  color: rgba(246, 248, 255, 0.65);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.6em;
  padding: 0.3em 0.8em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.bossbar {
  position: absolute;
  top: 0.9em;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(60%, 24em);
  text-align: center;
  pointer-events: none;
}

.bossbar.hidden {
  display: none;
}

.bossname {
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 1em;
  color: #ffb43c;
  text-shadow: 0 0.12em 0 rgba(0, 0, 0, 0.7);
  margin-bottom: 0.25em;
}

.bossouter {
  height: 0.9em;
  border-radius: 0.45em;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.bossouter > div {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #ff6b5e, #8f1710);
  transition: width 0.15s ease;
}

.gg-guest {
  position: fixed;
  right: 8px;
  bottom: 6px;
  z-index: 50;
  max-width: 70%;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(10, 6, 24, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d9d4ec;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
