:root {
  --bg: #0b0f12;
  --panel: rgba(12, 18, 22, 0.78);
  --ink: #f2f0e7;
  --muted: #9ba99f;
  --line: rgba(242, 240, 231, 0.14);
  --gold: #d8a840;
  --green: #57c47a;
  --red: #e25d54;
  --blue: #55a7e7;
  --purple: #a36be8;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

.panel {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: min(860px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(229, 183, 85, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(20, 28, 32, 0.95), rgba(8, 12, 15, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.home-screen {
  inset: 0;
  left: 0;
  top: 0;
  width: auto;
  min-height: 100vh;
  transform: none;
  display: grid;
  grid-template-columns: minmax(300px, 540px) minmax(540px, 1fr);
  align-content: end;
  align-items: end;
  justify-content: start;
  gap: 30px;
  padding: max(34px, 7vh) max(24px, 6vw);
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(5, 7, 9, 0.74), rgba(5, 7, 9, 0.18) 52%, rgba(5, 7, 9, 0.7));
  box-shadow: none;
  overflow: hidden;
}

.black-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.black-sky::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 72% 38%, rgba(121, 69, 155, 0.26), transparent 24%),
    radial-gradient(circle at 78% 42%, rgba(240, 90, 122, 0.22), transparent 13%),
    linear-gradient(115deg, #07100c 0%, #0b0d12 38%, #1a0d1e 68%, #050607 100%);
  animation: skyBreathe 8s ease-in-out infinite;
}

.black-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(5, 7, 9, 0.78), transparent 34%),
    repeating-linear-gradient(100deg, rgba(242, 240, 231, 0.04) 0 1px, transparent 1px 76px);
}

.rift-ring,
.rift-core,
.void-spire,
.chest-signal {
  position: absolute;
}

.rift-ring {
  right: 7vw;
  top: 13vh;
  width: min(58vw, 760px);
  aspect-ratio: 1;
  border: 2px solid rgba(179, 119, 255, 0.24);
  border-radius: 50%;
  box-shadow: inset 0 0 80px rgba(179, 119, 255, 0.1), 0 0 80px rgba(240, 90, 122, 0.08);
  animation: riftTurn 18s linear infinite;
}

.ring-two {
  right: 13vw;
  top: 21vh;
  width: min(42vw, 560px);
  border-color: rgba(240, 90, 122, 0.3);
  animation-duration: 13s;
  animation-direction: reverse;
}

.ring-three {
  right: 20vw;
  top: 30vh;
  width: min(26vw, 340px);
  border-color: rgba(229, 183, 85, 0.2);
  animation-duration: 9s;
}

.rift-core {
  right: 24vw;
  top: 37vh;
  width: min(17vw, 210px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(240, 90, 122, 0.38), rgba(179, 119, 255, 0.2) 42%, transparent 68%);
  filter: blur(1px);
  animation: corePulse 3.4s ease-in-out infinite;
}

.void-spire {
  bottom: -5vh;
  width: 12vw;
  height: 56vh;
  background: linear-gradient(180deg, transparent, rgba(5, 7, 9, 0.92) 42%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  opacity: 0.86;
}

.spire-a { right: 7vw; height: 68vh; }
.spire-b { right: 25vw; width: 9vw; height: 50vh; opacity: 0.68; }
.spire-c { right: 43vw; width: 7vw; height: 38vh; opacity: 0.48; }

.chest-signal {
  right: 17vw;
  bottom: 25vh;
  width: 16px;
  height: 16px;
  border: 2px solid #e5b755;
  transform: rotate(45deg);
  box-shadow: 0 0 0 18px rgba(229, 183, 85, 0.08), 0 0 42px rgba(229, 183, 85, 0.55);
  animation: signalDrop 2.2s ease-in-out infinite;
}

.main-menu {
  position: relative;
  z-index: 1;
}

.main-menu {
  width: min(540px, 100%);
  padding: 30px 32px;
  border: 1px solid rgba(242, 240, 231, 0.12);
  border-left: 4px solid rgba(240, 90, 122, 0.8);
  border-radius: 8px;
  background: linear-gradient(115deg, rgba(8, 12, 15, 0.84), rgba(8, 12, 15, 0.38));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.menu-kicker,
.home-kicker {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-screen h1,
.class-select h1 {
  margin: 0;
  font-size: clamp(64px, 12vw, 142px);
  line-height: 0.9;
  letter-spacing: 0;
}

.home-screen p,
.class-select p {
  max-width: 560px;
  margin: 14px 0 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
}

.menu-name {
  display: grid;
  gap: 7px;
  width: min(300px, 100%);
  margin: 0 0 18px;
}

.menu-name span {
  color: rgba(242, 240, 231, 0.72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.menu-name input {
  height: 48px;
  border: 1px solid rgba(242, 240, 231, 0.18);
  border-radius: 6px;
  padding: 0 13px;
  background: rgba(8, 12, 15, 0.58);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  outline: none;
}

.menu-name input:focus {
  border-color: rgba(229, 183, 85, 0.78);
  box-shadow: 0 0 0 3px rgba(229, 183, 85, 0.12);
}

.menu-rule {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.menu-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.primary-action,
.ghost-action {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  min-width: 136px;
  height: 52px;
  padding: 0 20px;
  border-color: rgba(229, 183, 85, 0.74);
  background: linear-gradient(180deg, rgba(229, 183, 85, 0.32), rgba(229, 183, 85, 0.14));
}

.primary-action:hover,
.ghost-action:hover {
  background: rgba(216, 168, 64, 0.13);
}

.ghost-action {
  position: absolute;
  right: 18px;
  top: 18px;
  height: 34px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.045);
}

@keyframes skyBreathe {
  0%, 100% { transform: scale(1); filter: brightness(0.92); }
  50% { transform: scale(1.04); filter: brightness(1.14); }
}

@keyframes riftTurn {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
  to { transform: rotate(360deg) scale(1); }
}

@keyframes corePulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 0.95; transform: scale(1.12); }
}

@keyframes signalDrop {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.55; }
  50% { transform: rotate(45deg) translateY(-14px); opacity: 1; }
}

.class-select {
  width: min(1120px, calc(100vw - 32px));
  padding: 26px;
  background:
    linear-gradient(120deg, rgba(240, 90, 122, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(19, 26, 30, 0.96), rgba(8, 12, 15, 0.98));
}

.class-head {
  margin-bottom: 14px;
}

.name-field {
  display: grid;
  gap: 6px;
  max-width: 260px;
  margin-bottom: 18px;
}

.name-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.name-field input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.name-field input:focus {
  border-color: rgba(216, 168, 64, 0.72);
  box-shadow: 0 0 0 3px rgba(216, 168, 64, 0.12);
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.home-screen .class-grid {
  position: relative;
  z-index: 1;
  align-self: end;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 12px;
}

.class-grid button {
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.home-screen .class-grid button {
  min-height: 258px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.026)),
    rgba(8, 12, 15, 0.66);
  backdrop-filter: blur(10px);
}

.class-grid button[data-class="knight"] {
  color: #ef6d59;
}

.class-grid button[data-class="ranger"] {
  color: #57c47a;
}

.class-grid button[data-class="mage"] {
  color: #55a7e7;
}

.class-grid button[data-class="duelist"] {
  color: #e5b755;
}

.class-grid button[data-class="occultist"] {
  color: #b377ff;
}

.class-grid button > span,
.class-grid button > strong {
  color: var(--ink);
}

.class-grid button .class-meta {
  display: grid;
  gap: 6px;
}

.class-grid button .class-role {
  color: currentColor;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.class-grid button .class-kit {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.class-grid button::after {
  content: "";
  position: absolute;
  inset: auto 14px 14px auto;
  width: 78px;
  height: 78px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.2;
}

.class-grid button:hover {
  border-color: rgba(216, 168, 64, 0.65);
  background: rgba(216, 168, 64, 0.09);
}

.class-grid button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.class-grid strong {
  display: block;
  margin-bottom: 12px;
  font-size: 28px;
  line-height: 1;
}

.class-grid span {
  color: var(--muted);
  line-height: 1.35;
  font-size: 12px;
}

@media (max-width: 860px) {
  .home-screen {
    grid-template-columns: 1fr;
    align-content: start;
    overflow-y: auto;
  }

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

  .home-screen .class-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-screen .class-grid button {
    min-height: 190px;
  }

  .class-head {
    display: block;
  }

  .class-summary {
    justify-content: flex-start;
    margin-top: 12px;
  }
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.topbar,
.bottombar {
  position: fixed;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  top: 14px;
}

.bottombar {
  bottom: 14px;
  align-items: flex-end;
}

.zone-name {
  font-size: 24px;
  font-weight: 800;
}

.zone-rule {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.statline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.statline span,
.ability,
.slot,
.feed-line {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.statline span {
  min-width: 74px;
  padding: 9px 11px;
  text-align: center;
  font-weight: 700;
}

.bars {
  width: min(330px, 28vw);
  min-width: 190px;
  display: grid;
  gap: 7px;
}

.bar {
  height: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
}

.bar span {
  display: block;
  height: 100%;
  width: 100%;
  transition: width 120ms linear;
}

.hp span {
  background: linear-gradient(90deg, #b73335, #ef6d59);
}

.xp span {
  background: linear-gradient(90deg, #4168c8, #70c1ff);
}

.abilities,
.inventory {
  display: flex;
  gap: 8px;
}

.abilities,
.inventory {
  pointer-events: auto;
}

.ability,
.slot {
  width: 62px;
  height: 62px;
  position: relative;
  padding: 7px;
  overflow: hidden;
  color: var(--ink);
  font: inherit;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.ability strong,
.slot strong {
  display: block;
  font-size: 14px;
}

.ability span,
.slot span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.ability em,
.slot em {
  display: block;
  margin-top: 3px;
  color: rgba(242, 240, 231, 0.58);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.cooldown {
  position: absolute;
  inset: auto 0 0;
  height: 0%;
  background: rgba(0, 0, 0, 0.58);
}

.feed {
  position: fixed;
  left: 16px;
  top: 88px;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 6px;
}

.feed-line,
.coach,
.multiplayer {
  padding: 8px 10px;
  color: var(--ink);
  font-size: 13px;
}

.coach,
.multiplayer {
  position: fixed;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.coach {
  left: 16px;
  top: 258px;
  width: min(360px, calc(100vw - 32px));
}

.coach strong,
.multiplayer strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--gold);
}

.coach span,
.multiplayer span {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.multiplayer {
  right: 16px;
  top: 184px;
  min-width: 178px;
  text-align: right;
}

.chat-panel {
  position: fixed;
  left: 16px;
  bottom: 96px;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(9, 13, 16, 0.76);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  overflow: hidden;
}

.chat-messages {
  max-height: 132px;
  overflow: hidden;
  padding: 8px 10px 4px;
  display: grid;
  gap: 4px;
}

.chat-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.chat-line strong {
  color: var(--gold);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  border-top: 1px solid var(--line);
}

.chat-form input,
.chat-form button {
  border: 0;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  font: inherit;
}

.chat-form input {
  min-width: 0;
  padding: 9px 10px;
  outline: none;
}

.chat-form button {
  padding: 0 11px;
  font-weight: 800;
  cursor: pointer;
}

.loot-panel {
  position: fixed;
  right: 16px;
  bottom: 96px;
  width: min(330px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 13, 16, 0.9);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.item-panel {
  right: auto;
  left: 16px;
  bottom: 96px;
}

.sanctuary-panel {
  right: auto;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
}

.loot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.loot-head button,
.loot-all {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.loot-head button {
  padding: 5px 8px;
}

.loot-items {
  display: grid;
  gap: 7px;
}

.loot-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.loot-item:hover,
.loot-all:hover {
  background: rgba(216, 168, 64, 0.11);
}

.loot-item strong,
.loot-item span {
  display: block;
}

.loot-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.loot-all {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
}

.item-detail {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.loadout-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.loadout-slot {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.045);
}

.loadout-slot strong,
.loadout-slot span,
.loadout-slot em {
  display: block;
}

.loadout-slot strong {
  font-size: 13px;
}

.loadout-slot span {
  margin-top: 4px;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.1;
}

.loadout-slot em {
  margin-top: 3px;
  color: rgba(242, 240, 231, 0.55);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.item-actions {
  display: grid;
  gap: 7px;
}

.item-actions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.item-actions button:hover {
  background: rgba(216, 168, 64, 0.11);
}

@media (max-width: 760px) {
  .panel {
    padding: 20px;
  }

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

  .bottombar {
    flex-wrap: wrap;
  }

  .bars {
    width: 100%;
  }

  .ability,
  .slot {
    width: 52px;
    height: 52px;
  }
}
