:root {
  color-scheme: light;
  --text: #2f261a;
  --muted: #7a6b5b;
  --panel: rgba(255, 250, 230, 0.9);
  --panel-dark: rgba(44, 34, 24, 0.88);
  --line: rgba(65, 46, 28, 0.18);
  --green: #3dbb64;
  --gold: #f3ba38;
  --orange: #f18a3b;
  --red: #df4e4e;
  --blue: #42a8e8;
  --purple: #956ce8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #9bdcf1;
}

button {
  font: inherit;
}

.game {
  min-height: 100vh;
  padding: 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 244, 216, 0.12)),
    url("./assets/arena.png") center / cover fixed;
}

.topbar,
.panel,
.combatbar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 48px rgba(42, 28, 15, 0.18);
  backdrop-filter: blur(14px);
}

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid #7b5528;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--gold), var(--orange));
  color: #4d270f;
  font-size: 24px;
  font-weight: 950;
}

.brand strong {
  display: block;
  font-size: 19px;
  font-weight: 950;
}

.brand small,
.resources,
.fighter small,
.market-card small,
.craft small {
  color: var(--muted);
}

.resources {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.resources span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  border-radius: 12px;
  white-space: nowrap;
}

.resources b {
  color: #168047;
}

.primary {
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #53d879, #219d50);
  color: white;
  font-weight: 950;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.17);
}

.layout {
  display: grid;
  grid-template-columns: 270px minmax(560px, 1fr) 285px;
  gap: 14px;
  min-height: calc(100vh - 100px);
  margin-top: 14px;
}

.panel {
  padding: 14px;
  border-radius: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title span {
  font-weight: 950;
}

.panel-title b {
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
}

.fighter {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 9px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
  border-radius: 14px;
}

.fighter i {
  color: #1d8b4d;
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
}

.portrait {
  width: 44px;
  height: 44px;
  display: block;
  border: 2px solid rgba(58, 39, 22, 0.2);
  border-radius: 13px;
}

.portrait--blade {
  background: linear-gradient(135deg, #ffe28a, #ef6845);
}

.portrait--rune {
  background: linear-gradient(135deg, #8fe9ff, #8a68e6);
}

.portrait--beast {
  background: linear-gradient(135deg, #7be08e, #8b5d35);
}

.market-card,
.craft {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(243, 186, 56, 0.36);
  background: rgba(243, 186, 56, 0.16);
  border-radius: 16px;
}

.market-card strong,
.market-card span,
.craft strong,
.craft span {
  display: block;
}

.market-card strong,
.craft strong {
  margin: 4px 0;
  font-size: 23px;
}

.arena {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}

.arena-map {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 251, 220, 0.12)),
    url("./assets/arena.png") center / cover;
}

.tile-grid {
  position: absolute;
  inset: 8%;
  transform: rotateX(58deg) rotateZ(45deg);
  transform-origin: center;
  opacity: 0.62;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.55) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.55) 1px, transparent 1px);
  background-size: 46px 46px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.12));
}

.unit,
.loot-egg {
  position: absolute;
  display: block;
}

.unit {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.18), 0 10px 20px rgba(0, 0, 0, 0.18);
}

.ally {
  background: var(--green);
}

.enemy {
  background: var(--red);
}

.ally--one {
  left: 32%;
  top: 48%;
}

.ally--two {
  left: 42%;
  top: 57%;
}

.ally--three {
  left: 48%;
  top: 43%;
}

.enemy--one {
  right: 31%;
  top: 37%;
}

.enemy--two {
  right: 26%;
  top: 51%;
}

.loot-egg {
  width: 32px;
  height: 42px;
  border: 3px solid rgba(119, 74, 36, 0.28);
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 35% 28%, #fff 0 11%, transparent 12%), linear-gradient(145deg, #ffe15b, #ff7aa2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.loot-egg--one {
  left: 57%;
  top: 61%;
}

.loot-egg--two {
  left: 28%;
  top: 35%;
  background: radial-gradient(circle at 35% 28%, #fff 0 11%, transparent 12%), linear-gradient(145deg, #6de7ff, #9368ff);
}

.combatbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
}

.combatbar button {
  min-height: 66px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.combatbar b {
  color: #168047;
}

.combatbar span {
  color: var(--muted);
  font-size: 12px;
}

.turns {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.turns li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 10px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
  border-radius: 12px;
  font-weight: 850;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot--green {
  background: var(--green);
}

.dot--purple {
  background: var(--purple);
}

.dot--red {
  background: var(--red);
}

.dot--blue {
  background: var(--blue);
}

.inventory {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.slot {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.slot--egg {
  background: radial-gradient(circle at 40% 30%, #fff 0 13%, transparent 14%), linear-gradient(135deg, var(--gold), var(--orange));
}

.slot--gem {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  clip-path: polygon(50% 8%, 86% 32%, 72% 88%, 28% 88%, 14% 32%);
}

.slot--scroll {
  background: linear-gradient(90deg, #fff2c6, #d8a85b);
}

.slot--hammer {
  background: linear-gradient(135deg, #6e5744, #cfa760);
}

.slot--fish {
  background: linear-gradient(135deg, #83eaff, #3389c9);
  border-radius: 50% 12px 50% 12px;
}

.slot--key {
  background: radial-gradient(circle at 34% 42%, transparent 0 13%, var(--gold) 14% 25%, transparent 26%), linear-gradient(90deg, var(--gold), #b97920);
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .game {
    padding: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .resources {
    padding-bottom: 2px;
  }

  .arena-map {
    min-height: 520px;
  }

  .combatbar {
    grid-template-columns: repeat(2, 1fr);
  }
}
