:root {
  --realm-bg: #050716;
  --realm-panel: rgba(10, 16, 40, 0.88);
  --realm-panel-strong: rgba(16, 24, 58, 0.96);
  --realm-line: rgba(126, 167, 255, 0.24);
  --realm-blue: #2f73ff;
  --realm-cyan: #16e7ff;
  --realm-violet: #8e42ff;
  --realm-gold: #ffca3a;
  --realm-pink: #ff43c7;
  --realm-green: #54ff9f;
  --realm-red: #ff456a;
  --rarity-common: #9fb0d0;
  --rarity-rare: #3ea7ff;
  --rarity-epic: #a34cff;
  --rarity-legendary: #ffbd31;
  --rarity-mythic: #ff4fcf;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: #ffffff;
  background:
    radial-gradient(circle at 12% 12%, rgba(47, 115, 255, 0.28), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(142, 66, 255, 0.3), transparent 25%),
    radial-gradient(circle at 52% 92%, rgba(22, 231, 255, 0.15), transparent 28%),
    var(--realm-bg);
}

.realm-app {
  min-height: 100vh;
  padding: 12px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.realm-shell {
  min-height: calc(100vh - 24px);
  max-width: 1500px;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid rgba(118, 152, 255, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 14%),
    rgba(3, 7, 25, 0.76);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.44), inset 0 0 44px rgba(47, 115, 255, 0.08);
}

.realm-topbar {
  display: grid;
  grid-template-columns: minmax(210px, 0.95fr) minmax(300px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(22, 231, 255, 0.12), rgba(142, 66, 255, 0.18));
  border: 1px solid var(--realm-line);
}

.realm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-decoration: none;
}

.realm-crest {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 42%, #77f7ff 0 24%, #2f73ff 25% 48%, transparent 49%),
    linear-gradient(135deg, #ffca3a, #8e42ff 48%, #16e7ff);
  box-shadow: 0 0 28px rgba(22, 231, 255, 0.38);
}

.realm-brand strong,
.realm-brand em {
  display: block;
  font-style: normal;
}

.realm-brand strong {
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
}

.realm-brand em {
  margin-top: 3px;
  color: var(--realm-cyan);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.realm-tabs,
.realm-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.realm-tabs {
  justify-content: center;
}

.realm-tabs button,
.realm-wallet span,
.realm-primary,
.realm-egg,
.realm-reset {
  border-radius: 8px;
  font-family: inherit;
  font-weight: 900;
}

.realm-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
}

.realm-tabs button.is-active {
  color: #06111f;
  background: linear-gradient(135deg, var(--realm-cyan), var(--realm-gold));
}

.realm-wallet {
  justify-content: flex-end;
}

.realm-wallet span {
  padding: 8px 12px;
  color: #dbe6ff;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.realm-wallet strong {
  color: var(--realm-gold);
}

.realm-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(480px, 1.45fr) minmax(270px, 0.85fr);
  gap: 12px;
  min-height: calc(100vh - 116px);
  margin-top: 12px;
}

.realm-card {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--realm-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    var(--realm-panel);
  box-shadow: inset 0 0 32px rgba(47, 115, 255, 0.09), 0 18px 50px rgba(0, 0, 0, 0.26);
}

.realm-hatch,
.realm-side {
  padding: 12px;
}

.realm-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: #ffffff;
}

.realm-panel-title span {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.realm-panel-title strong {
  padding: 5px 9px;
  border-radius: 999px;
  color: #06111f;
  background: var(--realm-gold);
  font-size: 12px;
}

.realm-panel-title.compact {
  margin-top: 12px;
}

.realm-egg-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 202, 58, 0.22), transparent 30%),
    radial-gradient(circle at 50% 58%, rgba(22, 231, 255, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(11, 23, 63, 0.86), rgba(3, 7, 25, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.realm-egg {
  position: relative;
  width: 142px;
  height: 184px;
  border: 0;
  cursor: pointer;
  background: transparent;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.42));
}

.egg-core,
.egg-glow {
  position: absolute;
  inset: 0;
  border-radius: 54% 46% 49% 51% / 64% 63% 37% 36%;
}

.egg-core {
  z-index: 2;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.96), transparent 13%),
    linear-gradient(135deg, #fff7c8 0%, #ffca3a 22%, #9c5cff 54%, #16e7ff 100%);
  border: 3px solid rgba(255, 255, 255, 0.72);
  box-shadow: inset -14px -22px 34px rgba(36, 8, 96, 0.38), inset 10px 16px 24px rgba(255, 255, 255, 0.28);
  animation: eggPulse 1.4s ease-in-out infinite alternate;
}

.egg-core::before,
.egg-core::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(4, 9, 28, 0.28);
}

.egg-core::before {
  width: 86px;
  height: 14px;
  left: 24px;
  top: 70px;
  rotate: -14deg;
}

.egg-core::after {
  width: 62px;
  height: 12px;
  right: 16px;
  bottom: 52px;
  rotate: 18deg;
}

.egg-glow {
  scale: 1.12;
  background: rgba(22, 231, 255, 0.24);
  filter: blur(18px);
}

.realm-hatch-copy {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  text-align: center;
}

.realm-hatch-copy strong,
.realm-hatch-copy span {
  display: block;
}

.realm-hatch-copy span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  line-height: 1.4;
}

.realm-reveal {
  margin-top: 10px;
}

.mint-card {
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mint-card strong,
.mint-card span {
  display: block;
}

.mint-card strong {
  font-size: 19px;
}

.mint-card span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.rarity-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #06111f;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--rarity);
}

.realm-trait-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.trait-chip {
  min-height: 42px;
  padding: 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trait-chip span,
.trait-chip strong {
  display: block;
}

.trait-chip span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  text-transform: uppercase;
}

.trait-chip strong {
  margin-top: 2px;
  font-size: 12px;
}

.realm-lobby-panel {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.realm-lobby-panel strong,
.realm-lobby-panel span {
  display: block;
}

.realm-lobby-panel span {
  min-height: 34px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.4;
}

.realm-lobby-panel.is-searching {
  border-color: rgba(22, 231, 255, 0.42);
  box-shadow: inset 0 0 28px rgba(22, 231, 255, 0.1);
}

.realm-lobby-panel.is-found {
  border-color: rgba(255, 202, 58, 0.52);
  box-shadow: inset 0 0 28px rgba(255, 202, 58, 0.1);
}

.realm-battle {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto auto;
  padding: 12px;
}

.realm-battle-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.realm-turn-pill {
  padding: 8px 12px;
  border-radius: 999px;
  color: #06111f;
  background: linear-gradient(135deg, var(--realm-cyan), var(--realm-gold));
  font-size: 13px;
  font-weight: 900;
}

.realm-status {
  padding: 9px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.realm-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.realm-status strong {
  font-size: 14px;
}

.realm-status em {
  color: var(--realm-gold);
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.realm-meter {
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.realm-meter i {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--realm-green), var(--realm-cyan));
}

.realm-status-sub {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.realm-arena {
  position: relative;
  overflow: hidden;
  min-height: 410px;
  border-radius: 12px;
  border: 1px solid rgba(126, 167, 255, 0.26);
  background: #09132d;
  box-shadow: inset 0 0 50px rgba(22, 231, 255, 0.08);
}

.arena-sky,
.arena-depth,
.arena-floor {
  position: absolute;
  inset: 0;
}

.arena-sky {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.2), transparent 3%),
    radial-gradient(circle at 62% 28%, rgba(22, 231, 255, 0.18), transparent 16%),
    linear-gradient(180deg, #122859 0%, #0a1533 60%, #071023 100%);
}

.arena-depth {
  background:
    linear-gradient(115deg, transparent 0 36%, rgba(84, 255, 159, 0.14) 36% 39%, transparent 39%),
    linear-gradient(65deg, transparent 0 58%, rgba(142, 66, 255, 0.16) 58% 61%, transparent 61%),
    radial-gradient(ellipse at 50% 72%, rgba(22, 231, 255, 0.18), transparent 36%);
}

.arena-floor {
  top: auto;
  height: 42%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(92, 244, 255, 0.36), transparent 48%),
    linear-gradient(180deg, rgba(36, 120, 170, 0.22), rgba(0, 0, 0, 0.4));
  clip-path: polygon(8% 36%, 92% 30%, 100% 100%, 0 100%);
}

.realm-arena-label {
  position: absolute;
  left: 14px;
  top: 12px;
  z-index: 8;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.realm-beast-slot {
  position: absolute;
  z-index: 5;
  width: 178px;
  height: 156px;
  filter: drop-shadow(0 24px 24px rgba(0, 0, 0, 0.42));
  animation: beastIdle 1.45s ease-in-out infinite alternate;
}

.realm-beast-slot.player {
  left: 13%;
  bottom: 70px;
}

.realm-beast-slot.opponent {
  right: 13%;
  bottom: 128px;
  transform: scaleX(-1);
}

.realm-beast-slot.is-dashing.player {
  animation: playerDash 0.74s ease-in-out;
}

.realm-beast-slot.is-dashing.opponent {
  animation: opponentDash 0.74s ease-in-out;
}

.realm-beast-slot.is-hit {
  animation: hitReact 0.34s ease-in-out;
  filter: brightness(1.7) drop-shadow(0 24px 24px rgba(0, 0, 0, 0.42));
}

.layered-beast {
  position: relative;
  width: 100%;
  height: 100%;
  --primary: #4f8cff;
  --secondary: #d7f7ff;
  --accent: #ffe86a;
  --aura: rgba(22, 231, 255, 0.48);
}

.beast-layer {
  position: absolute;
  pointer-events: none;
}

.beast-aura {
  inset: -20px -18px -12px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--aura), transparent 62%);
  filter: blur(10px);
  opacity: 0.75;
  animation: auraPulse 1.5s ease-in-out infinite alternate;
}

.beast-tail {
  width: 74px;
  height: 34px;
  right: 118px;
  bottom: 42px;
  border-radius: 999px 30px 30px 999px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transform-origin: right center;
  rotate: -18deg;
}

.beast-wing {
  width: 84px;
  height: 70px;
  left: 66px;
  top: 12px;
  border-radius: 70% 10% 70% 18%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), var(--secondary));
  clip-path: polygon(0 72%, 28% 8%, 100% 0, 72% 50%, 100% 100%, 42% 84%);
  opacity: 0.86;
}

.beast-body {
  left: 34px;
  bottom: 22px;
  width: 104px;
  height: 86px;
  border-radius: var(--body-radius, 48% 52% 44% 56%);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.7), transparent 13%),
    linear-gradient(135deg, var(--primary), var(--secondary) 62%, var(--accent));
  border: 2px solid rgba(255, 255, 255, 0.68);
  box-shadow: inset -14px -18px 22px rgba(0, 0, 0, 0.18), inset 10px 12px 16px rgba(255, 255, 255, 0.18);
}

.beast-belly {
  left: 62px;
  bottom: 32px;
  width: 48px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

.beast-head {
  left: 92px;
  bottom: 82px;
  width: 64px;
  height: 58px;
  border-radius: 48% 52% 45% 55%;
  background:
    radial-gradient(circle at 67% 42%, #050716 0 4px, transparent 5px),
    radial-gradient(circle at 42% 38%, #050716 0 4px, transparent 5px),
    linear-gradient(135deg, var(--primary), var(--secondary));
  border: 2px solid rgba(255, 255, 255, 0.68);
}

.beast-horn {
  width: 18px;
  height: 38px;
  left: 102px;
  bottom: 132px;
  border-radius: 70% 70% 20% 20%;
  background: linear-gradient(180deg, #fff7c8, var(--accent));
  rotate: -24deg;
  transform-origin: bottom center;
}

.beast-horn.second {
  left: 134px;
  rotate: 24deg;
}

.beast-marking {
  left: 56px;
  bottom: 78px;
  width: 72px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.8;
  rotate: -10deg;
  box-shadow: 0 22px 0 rgba(255, 255, 255, 0.22);
}

.realm-player-bar {
  margin: 10px 0;
}

.realm-abilities {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
}

.realm-ability {
  min-height: 82px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.realm-ability:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.realm-ability strong,
.realm-ability span {
  display: block;
}

.realm-ability strong {
  font-size: 13px;
}

.realm-ability span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.realm-collection {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 312px;
  overflow: auto;
  padding-right: 3px;
}

.collection-card {
  position: relative;
  min-height: 132px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.26);
  cursor: pointer;
  text-align: left;
}

.collection-card.is-selected {
  border-color: var(--realm-gold);
  box-shadow: 0 0 0 2px rgba(255, 202, 58, 0.2);
}

.collection-card.is-resting {
  opacity: 0.62;
}

.collection-card.is-resting::after {
  content: "Resting";
  position: absolute;
  right: 7px;
  top: 7px;
  padding: 4px 7px;
  border-radius: 999px;
  color: #06111f;
  background: var(--realm-cyan);
  font-size: 10px;
  font-weight: 900;
}

.collection-art {
  position: relative;
  height: 74px;
  overflow: hidden;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.18), transparent 48%);
}

.collection-art .layered-beast {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: 104px;
  transform: translate(-50%, -48%) scale(0.58);
}

.collection-card strong,
.collection-card span {
  display: block;
}

.collection-card strong {
  margin-top: 6px;
  font-size: 12px;
}

.collection-card span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
}

.realm-log {
  min-height: 152px;
  max-height: 190px;
  overflow: auto;
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  line-height: 1.45;
}

.realm-log p {
  margin: 0 0 8px;
}

.realm-primary {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 0;
  color: #06111f;
  background: linear-gradient(135deg, var(--realm-gold), #ff8f2f);
  cursor: pointer;
}

.realm-vfx {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 48%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.realm-vfx.is-active {
  opacity: 0.9;
  border: 2px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 0 52px var(--vfx), inset 0 0 44px var(--vfx);
  animation: vfxBurst 0.86s ease-out forwards;
}

.realm-number {
  position: absolute;
  z-index: 10;
  top: 34%;
  color: #ffdf6b;
  font-size: 34px;
  font-weight: 900;
  opacity: 0;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.75);
}

.realm-number.is-player-target {
  left: 25%;
}

.realm-number.is-opponent-target {
  right: 27%;
}

.realm-number.is-heal {
  color: #85ffad;
}

.realm-number.is-active {
  animation: numberFloat 0.9s ease-out forwards;
}

@keyframes eggPulse {
  from {
    transform: translateY(0) scale(1);
  }

  to {
    transform: translateY(-8px) scale(1.035);
  }
}

@keyframes beastIdle {
  from {
    translate: 0 0;
  }

  to {
    translate: 0 -8px;
  }
}

@keyframes auraPulse {
  from {
    opacity: 0.42;
    scale: 0.95;
  }

  to {
    opacity: 0.86;
    scale: 1.08;
  }
}

@keyframes playerDash {
  0%,
  100% {
    translate: 0 0;
  }

  48% {
    translate: 260% -20px;
  }
}

@keyframes opponentDash {
  0%,
  100% {
    translate: 0 0;
  }

  48% {
    translate: -260% 20px;
  }
}

@keyframes hitReact {
  0%,
  100% {
    translate: 0 0;
  }

  35% {
    translate: -14px 0;
  }

  70% {
    translate: 14px 0;
  }
}

@keyframes vfxBurst {
  from {
    transform: translate(-50%, -50%) scale(0.45);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

@keyframes numberFloat {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-44px);
  }
}

@media (max-width: 1120px) {
  .realm-topbar,
  .realm-layout {
    grid-template-columns: 1fr;
  }

  .realm-tabs,
  .realm-wallet {
    justify-content: flex-start;
  }

  .realm-layout {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .realm-app {
    padding: 0;
  }

  .realm-shell {
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .realm-battle {
    grid-template-rows: auto minmax(300px, 1fr) auto auto;
  }

  .realm-arena {
    min-height: 320px;
  }

  .realm-beast-slot {
    width: 140px;
    height: 122px;
  }

  .realm-beast-slot.player {
    left: 6%;
  }

  .realm-beast-slot.opponent {
    right: 6%;
  }

  .realm-abilities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
