:root {
  color-scheme: dark;
  --text: #f7eddc;
  --muted: #b8acc8;
  --panel: rgba(12, 13, 22, 0.86);
  --line: rgba(255, 255, 255, 0.15);
  --gold: #d9ad5b;
  --teal: #35dfb7;
  --violet: #9b61ff;
  --red: #df515e;
  --blue: #4b98ff;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

.duel {
  min-height: 100vh;
  padding: 14px;
  background:
    linear-gradient(rgba(7, 8, 14, 0.04), rgba(7, 8, 14, 0.22)),
    url("./assets/duel-arena.png") center / cover fixed;
}

.topbar,
.panel,
.hand {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
}

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

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

.brand__card {
  width: 42px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(217, 173, 91, 0.72);
  background: linear-gradient(145deg, #101525, #2d184d);
  color: var(--gold);
  font-weight: 950;
}

.brand strong,
.panel-title span {
  display: block;
  font-weight: 950;
}

.brand small,
.status,
.booster small,
.craft small {
  color: var(--muted);
}

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

.status 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.06);
  white-space: nowrap;
}

.status b {
  color: var(--gold);
}

.primary {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  background: linear-gradient(180deg, var(--teal), #168d76);
  color: #031510;
  font-weight: 950;
  cursor: pointer;
}

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

.panel {
  padding: 14px;
}

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

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

.avatar {
  position: relative;
  min-height: 260px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 40%, rgba(155, 97, 255, 0.32), rgba(255, 255, 255, 0.04));
}

.helm,
.face,
.robe {
  position: absolute;
  display: block;
  left: 50%;
  transform: translateX(-50%);
}

.helm {
  top: 42px;
  width: 82px;
  height: 54px;
  background: linear-gradient(135deg, var(--gold), #513015);
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
}

.face {
  top: 82px;
  width: 58px;
  height: 58px;
  background: #d9a37f;
  border-radius: 50%;
}

.robe {
  top: 138px;
  width: 96px;
  height: 92px;
  background: linear-gradient(180deg, var(--violet), #25134a);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.meter {
  margin-top: 12px;
}

.meter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 7px;
}

.meter i {
  display: block;
  height: 8px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.booster,
.craft {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(217, 173, 91, 0.34);
  background: rgba(217, 173, 91, 0.1);
}

.booster strong,
.booster span,
.craft strong,
.craft span {
  display: block;
}

.booster strong,
.craft strong {
  margin: 5px 0;
  font-size: 22px;
}

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

.board {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(7, 8, 14, 0.02), rgba(7, 8, 14, 0.12)),
    url("./assets/duel-arena.png") center / cover;
}

.summon,
.spell,
.chain {
  position: absolute;
}

.summon {
  width: 86px;
  height: 124px;
  display: grid;
  place-items: end center;
  padding-bottom: 8px;
  border: 2px solid rgba(217, 173, 91, 0.8);
  background: linear-gradient(180deg, rgba(53, 223, 183, 0.28), rgba(14, 21, 34, 0.86));
  color: var(--gold);
  font-weight: 950;
  box-shadow: 0 0 24px rgba(53, 223, 183, 0.24);
}

.summon--ally {
  left: 42%;
  bottom: 25%;
}

.summon--enemy {
  right: 42%;
  top: 25%;
  background: linear-gradient(180deg, rgba(155, 97, 255, 0.28), rgba(14, 21, 34, 0.86));
  box-shadow: 0 0 24px rgba(155, 97, 255, 0.24);
}

.spell {
  width: 62px;
  height: 88px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.spell--one {
  left: 30%;
  bottom: 29%;
}

.spell--two {
  right: 30%;
  top: 31%;
}

.chain {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid rgba(53, 223, 183, 0.45);
  background: rgba(2, 12, 15, 0.78);
  color: var(--teal);
  font-weight: 950;
}

.hand {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px;
}

.card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 10px;
  border: 2px solid rgba(217, 173, 91, 0.55);
  background: linear-gradient(180deg, #2e1921, #120d13);
  color: var(--text);
  cursor: pointer;
}

.card b,
.card span {
  display: block;
}

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

.card--spell {
  background: linear-gradient(180deg, #123e38, #0b1417);
}

.card--trap {
  background: linear-gradient(180deg, #3b1747, #110c18);
}

.deck-stack {
  position: relative;
  height: 150px;
  margin-bottom: 16px;
}

.deck-stack span {
  position: absolute;
  width: 96px;
  height: 136px;
  left: 50%;
  top: 0;
  transform: translateX(-50%) rotate(var(--r, 0deg));
  border: 2px solid rgba(217, 173, 91, 0.62);
  background: linear-gradient(135deg, #101525, #2c174e);
}

.deck-stack span:nth-child(1) {
  --r: -7deg;
}

.deck-stack span:nth-child(2) {
  --r: 0deg;
  top: 7px;
}

.deck-stack span:nth-child(3) {
  --r: 7deg;
  top: 14px;
}

.market-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.market-row strong {
  color: var(--gold);
}

.craft .primary {
  width: 100%;
  margin-top: 12px;
}

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

@media (max-width: 760px) {
  .duel {
    padding: 10px;
  }

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

  .board {
    min-height: 520px;
  }

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