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

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit
}

html,
body {
  height: 100%
}

body {
  background: #20143a;
  color: #eceaf6;
  font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif
}

.game {
  height: 100%;
  min-height: 400px;
  display: flex;
  flex-direction: column
}

/* ===== СЦЕНА ===== */
.scene {
  position: relative;
  flex: 1;
  min-height: 240px;
  overflow: hidden
}

.bg {
  position: absolute;
  inset: 0
}

.bg svg {
  width: 100%;
  height: 100%;
  display: block
}

.side {
  position: absolute;
  inset: 0;
  pointer-events: none
}

.unit {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 200px
}

.unit.minion {
  width: 150px
}

.sprite {
  width: clamp(90px, 17vh, 160px);
  height: clamp(90px, 17vh, 160px);
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .28))
}

.unit.minion .sprite {
  width: clamp(62px, 11vh, 104px);
  height: clamp(62px, 11vh, 104px)
}

.sprite svg,
.sprite img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain
}

.row {
  display: flex;
  align-items: center;
  gap: 6px
}

.bars {
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 3px
}

.unit.minion .bars {
  width: 110px
}

.bar {
  position: relative;
  height: 15px;
  border-radius: 3px;
  overflow: hidden;
  background: #5a5f66
}

.bar .fill {
  height: 100%;
  width: 0;
  background: #9aa0a6;
  transition: width .25s
}

.bar.hp {
  background: #6e1414
}

.bar.hp .fill {
  background: #e33b3b
}

.bar span {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 10.5px;
  line-height: 15px;
  color: #fff;
  text-shadow: 0 1px 2px #000
}

.badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: radial-gradient(circle at 35% 30%, #ffb066, #f07f2d 70%);
  border: 2px solid #b35315;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35)
}

.cname {
  font-size: 10.5px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  min-height: 13px
}

.status {
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  min-height: 14px
}

.intent {
  font-size: 12px;
  color: #fff8e0;
  background: rgba(20, 14, 8, .5);
  padding: 2px 10px;
  border-radius: 999px;
  text-shadow: 0 1px 2px #000;
  margin-top: 1px
}

.log {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 14, 8, .55);
  color: #ffe9c9;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  max-width: 60%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.hudpill {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(20, 14, 8, .55);
  color: #ffe9c9;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px
}

.artifacts {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(28, 28, 33, .85);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 104px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3)
}

.art-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px
}

.art-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 16px;
  min-height: 20px
}

/* ===== АНИМАЦИИ ===== */
.unit.spawn {
  animation: pop .35s
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(.3)
  }
}

.unit.dying {
  animation: die .4s forwards
}

@keyframes die {
  to {
    opacity: 0;
    transform: scale(.6) translateY(12px)
  }
}

.unit.atk-r {
  animation: lungeR .34s
}

@keyframes lungeR {
  45% {
    transform: translateX(30px)
  }
}

.unit.atk-l {
  animation: lungeL .34s
}

@keyframes lungeL {
  45% {
    transform: translateX(-30px)
  }
}

.unit.hit {
  animation: shake .32s
}

@keyframes shake {
  20% {
    transform: translateX(-7px)
  }

  45% {
    transform: translateX(6px)
  }

  70% {
    transform: translateX(-4px)
  }

  90% {
    transform: translateX(2px)
  }
}

.fdmg {
  position: absolute;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  z-index: 5;
  font-weight: 800;
  font-size: 20px;
  color: #ff5b5b;
  text-shadow: 0 1px 3px #000;
  animation: rise .85s forwards;
  pointer-events: none
}

.fdmg.heal {
  color: #7dffa0
}

.fdmg.blk {
  color: #cfd4da
}

@keyframes rise {
  to {
    transform: translate(-50%, -52px);
    opacity: 0
  }
}

.card.played {
  animation: cardplay .22s forwards
}

@keyframes cardplay {
  to {
    transform: translateY(-46px) scale(.75);
    opacity: 0
  }
}

/* ===== СТОЛ ===== */
.table {
  background: linear-gradient(#8a6a44, #6f5233);
  padding: 8px 10px 10px
}

.handzone {
  background: #cbb493;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: 176px
}

.pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto
}

.pilecard {
  width: 74px;
  height: 110px;
  border-radius: 6px;
  border: 2px solid #4a3a2a;
  overflow: hidden;
  background: #e8d7c3
}

.pilecard svg {
  width: 100%;
  height: 100%;
  display: block
}

.pilecard.gray {
  background: #b9bdbf
}

.pile span {
  font-size: 13px;
  color: #4a3a2a;
  font-weight: 700
}

.mana {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  padding: 0 2px
}

.mgem {
  width: 15px;
  height: 15px;
  transform: rotate(45deg);
  border-radius: 3px;
  background: linear-gradient(135deg, #9fe0ff, #4fc3f7);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3)
}

.mgem.empty {
  background: #9aa0a6;
  opacity: .45;
  border-color: #d5d9dc
}

.hand {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  min-height: 150px
}

.card {
  position: relative;
  width: 106px;
  height: 150px;
  flex: 0 0 auto;
  background: linear-gradient(#7b5aa0, #5d4180);
  border: 2px solid #43306b;
  border-radius: 8px;
  padding: 8px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform .12s;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .3)
}

.card:hover:not(:disabled) {
  transform: translateY(-8px)
}

.card:disabled {
  opacity: .5;
  cursor: not-allowed
}

.plate {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #8fe3d7;
  border: 1px solid #3f8f85;
  color: #10353a;
  padding: 1px 9px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis
}

.art {
  width: 72px;
  height: 86px;
  background: #f4f1ea;
  border: 1px solid #b9b2a6;
  border-radius: 50%;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden
}

.art svg {
  width: 82%;
  height: 82%
}

.cdesc {
  font-size: 9.5px;
  color: #e8def5;
  text-align: center;
  line-height: 1.15;
  min-height: 22px;
  padding: 0 2px
}

.gem {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 25px;
  height: 25px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #9fe0ff, #4fc3f7);
  border: 2px solid #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35)
}

.gem b {
  transform: rotate(-45deg);
  font-size: 12px;
  color: #083a52
}

/* ===== СТАТУС-БАР ===== */
.statusbar {
  background: #0c1512;
  color: #dfe8e4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 7px 10px;
  font-size: 13.5px;
  font-weight: 600;
  flex-wrap: wrap
}

.btn {
  background: #5b3fa8;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  color: #fff
}

.btn:hover {
  background: #6d4ec4
}

.btn.small {
  padding: 6px 14px;
  font-size: 13px
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 18, .78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20
}

.overlay.hidden {
  display: none
}

.modal {
  width: min(100%, 460px);
  background: #221a3e;
  border: 1px solid rgba(201, 184, 255, .4);
  border-radius: 16px;
  padding: 20px;
  text-align: center
}

.modal h2 {
  margin-bottom: 8px;
  color: #c9b8ff
}

.modal p {
  font-size: 14px;
  color: #bdb6d8;
  margin-bottom: 14px
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.choices .btn {
  width: 100%
}

/* ===== площадки призыва ===== */
.sprite {
  position: relative;
  z-index: 1
}

.pad {
  width: 112px;
  height: 32px;
  margin-top: -16px;
  position: relative;
  z-index: 0
}

.unit.minion .pad {
  width: 92px;
  height: 27px;
  margin-top: -13px
}

.pad svg {
  width: 100%;
  height: 100%;
  display: block
}

.slot {
  position: absolute;
  display: flex;
  justify-content: center;
  pointer-events: none
}

.slot .pad {
  margin-top: 0
}

/* ===== GoldGames: крошечная подсказка для гостей ===== */
.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, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #d9d4ec;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

@media (max-width:760px) {
  .hand {
    gap: 8px
  }

  .card {
    width: 86px;
    height: 130px
  }

  .cdesc {
    display: none
  }

  .art {
    width: 56px;
    height: 66px
  }

  .pilecard {
    width: 56px;
    height: 84px
  }

  .bars {
    width: 100px
  }

  .unit {
    width: 140px
  }

  .unit.minion {
    width: 110px
  }

  .log {
    max-width: 44%
  }
}