:root {
  --bg-dark: #1a130e;
  --bg-deep: #25170f;
  --gold: #f8dc8f;
  --gold-strong: #ffbd54;
  --gold-dim: #c48a38;
  --wood: rgba(66, 35, 17, 0.9);
  --wood-edge: rgba(155, 96, 34, 0.95);
  --panel-fill: rgba(32, 18, 11, 0.88);
  --text-main: #fff4d2;
  --text-soft: rgba(255, 238, 198, 0.78);
  --shadow-heavy: 0 18px 42px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 206, 112, 0.12), transparent 30%),
    linear-gradient(180deg, #443125 0%, #1d130d 100%);
  color: var(--text-main);
  font-family: "Cinzel", serif;
}

button,
input {
  font: inherit;
}

.landing-screen {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.bg-image,
.bg-vignette {
  position: absolute;
  inset: 0;
}

.bg-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  object-position: center;
}

.bg-vignette {
  background:
    linear-gradient(180deg, rgba(7, 5, 4, 0.35), rgba(7, 5, 4, 0.1) 25%, rgba(7, 5, 4, 0.5)),
    radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.25) 100%);
  pointer-events: none;
}

.center-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 24px;
}

.start-button {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 20px 30px;
  background: transparent;
  color: #ffe7a9;
  font-family: "MedievalSharp", cursive;
  font-size: clamp(1.8rem, 3.6vw, 3.1rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 180ms ease, opacity 280ms ease, filter 180ms ease;
  animation: start-float 3.2s ease-in-out infinite;
}

.start-button:hover,
.start-button:focus-visible {
  transform: translate(-50%, calc(-50% - 4px)) scale(1.04);
  filter: brightness(1.08);
  outline: none;
}

.start-button.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.start-button__label {
  position: relative;
  z-index: 1;
  display: block;
  white-space: nowrap;
  text-shadow:
    0 0 10px rgba(255, 215, 130, 0.82),
    0 0 22px rgba(255, 167, 73, 0.6),
    0 6px 16px rgba(0, 0, 0, 0.56);
}

.start-particles {
  position: absolute;
  inset: -36px -60px;
  pointer-events: none;
}

.start-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 245, 214, 0.95) 0%, rgba(255, 188, 85, 0.72) 58%, rgba(255, 188, 85, 0) 100%);
  box-shadow: 0 0 12px rgba(255, 191, 88, 0.65);
  opacity: 0.85;
  animation: particle-drift 3.4s ease-in-out infinite;
}

.start-particle-1 { left: 10%; top: 58%; animation-delay: 0s; }
.start-particle-2 { left: 23%; top: 14%; width: 6px; height: 6px; animation-delay: 0.8s; }
.start-particle-3 { left: 49%; top: 4%; width: 10px; height: 10px; animation-delay: 1.5s; }
.start-particle-4 { right: 22%; top: 18%; width: 7px; height: 7px; animation-delay: 0.4s; }
.start-particle-5 { right: 8%; top: 54%; animation-delay: 2s; }
.start-particle-6 { left: 58%; bottom: 8%; width: 6px; height: 6px; animation-delay: 1.1s; }

.auth-panel,
.class-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: min(420px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(116, 73, 32, 0.34), rgba(23, 11, 6, 0.9)),
    var(--panel-fill);
  border: 1px solid rgba(244, 205, 125, 0.35);
  box-shadow:
    inset 0 0 0 2px rgba(255, 226, 161, 0.12),
    var(--shadow-heavy);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 20px)) scale(0.96);
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease;
}

.auth-panel.is-visible,
.class-panel.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.class-panel {
  width: min(920px, calc(100vw - 32px));
}

.class-panel__title {
  margin: 2px 4px 14px;
  color: var(--text-main);
  font-family: Cinzel, serif;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

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

.class-card {
  display: grid;
  gap: 8px;
  min-height: 220px;
  padding: 14px 12px;
  border: 1px solid rgba(247, 215, 137, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(63, 34, 19, 0.88), rgba(18, 11, 8, 0.92));
  color: var(--text-main);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 186, 0.08), 0 14px 28px rgba(0, 0, 0, 0.24);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.class-card:hover,
.class-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 211, 110, 0.7);
  outline: none;
}

.class-card__sprite {
  position: relative;
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto;
  overflow: hidden;
  image-rendering: pixelated;
}

.class-card__sprite img {
  position: absolute;
  left: -96px;
  top: 0;
  width: 288px;
  height: 384px;
  max-width: none;
  transform: none;
  transform-origin: top left;
  image-rendering: pixelated;
}

.class-card--shaman .class-card__sprite img {
  width: 1152px;
  height: 768px;
}

.class-card__name {
  font-family: Cinzel, serif;
  font-weight: 800;
  font-size: 1rem;
}

.class-card__stats {
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

.landing-screen.is-playing .bg-image,
.landing-screen.is-playing .bg-vignette,
.landing-screen.is-playing .center-stage {
  opacity: 0;
  pointer-events: none;
}

.landing-screen.is-playing .game-screen {
  opacity: 1;
  pointer-events: auto;
}

.panel-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-tab {
  border: 1px solid rgba(247, 215, 137, 0.22);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(47, 25, 13, 0.72);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.panel-tab.is-active {
  background: linear-gradient(180deg, rgba(160, 88, 31, 0.9), rgba(94, 45, 14, 0.95));
  color: var(--text-main);
  transform: translateY(-1px);
}

.auth-form {
  display: none;
  gap: 10px;
}

.auth-form.is-active {
  display: grid;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  padding-left: 4px;
  color: var(--text-soft);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid rgba(244, 208, 124, 0.26);
  border-radius: 14px;
  padding: 13px 14px;
  background: rgba(19, 11, 8, 0.74);
  color: var(--text-main);
}

.field input::placeholder {
  color: rgba(255, 236, 196, 0.35);
}

.field input:focus,
.field select:focus,
.chat-input:focus {
  outline: none;
  border-color: rgba(255, 211, 110, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.18);
  background: rgba(24, 14, 9, 0.9);
}

.remember-login {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 4px;
  color: var(--text-soft);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
}

.remember-login input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #d99a34;
  cursor: pointer;
}

.remember-login span {
  line-height: 1.3;
}

.auth-message {
  min-height: 18px;
  margin: 8px 4px 0;
  color: #ffcf75;
  font-size: 0.78rem;
}

.auth-message.is-error {
  color: #ff8a7a;
}

.submit-button,
.buy-button,
.close-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 15px;
  background: linear-gradient(180deg, #e4b04a 0%, #bc7d22 100%);
  color: #2c1608;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 242, 201, 0.5), 0 10px 20px rgba(0, 0, 0, 0.18);
}

.submit-button {
  margin-top: 4px;
}

.game-screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
  z-index: 3;
  background: #1f3e1d;
}

.game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.minimap-canvas {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 180px;
  height: 180px;
  border-radius: 20px;
  border: 1px solid rgba(244, 205, 125, 0.28);
  background: rgba(17, 12, 8, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 232, 186, 0.08),
    0 12px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.network-status {
  position: absolute;
  right: 18px;
  top: 208px;
  z-index: 6;
  padding: 6px 9px;
  border: 1px solid rgba(255, 224, 168, 0.3);
  border-radius: 6px;
  background: rgba(20, 13, 8, 0.82);
  color: #ffb3a1;
  font: 700 11px Cinzel, serif;
  letter-spacing: 0;
  pointer-events: none;
}

.network-status.is-online {
  color: #a8f0c4;
}

.status-panel {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(244, 205, 125, 0.3);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(97, 55, 27, 0.78), rgba(23, 12, 8, 0.82));
  color: var(--text-main);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 219, 143, 0.15),
    0 12px 28px rgba(0, 0, 0, 0.22);
}

.orb-frame {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(247, 215, 137, 0.34);
  background: radial-gradient(circle at 30% 30%, rgba(255, 241, 210, 0.22), rgba(44, 19, 12, 0.9));
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.5),
    0 8px 18px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.orb-fill {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
}

.orb-fill-hp {
  background: radial-gradient(circle at 35% 30%, #ffb0a6 0%, #d2442e 48%, #5d0e10 100%);
}

.bars-panel {
  min-width: 210px;
  display: grid;
  gap: 10px;
}

.resource-row {
  display: grid;
  gap: 5px;
}

.resource-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.76rem;
}

.resource-track {
  height: 14px;
  border-radius: 999px;
  padding: 2px;
  background: rgba(16, 9, 7, 0.8);
  border: 1px solid rgba(250, 222, 161, 0.18);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

.resource-fill {
  height: 100%;
  border-radius: inherit;
}

.resource-fill-hp {
  width: 100%;
  background: linear-gradient(90deg, #8b1115 0%, #df4129 55%, #ff9c68 100%);
}

.resource-fill-mp {
  width: 100%;
  background: linear-gradient(90deg, #11308f 0%, #2f6be2 55%, #84c1ff 100%);
}

.resource-fill-xp {
  width: 0;
  background: linear-gradient(90deg, #6e4a10 0%, #d6a231 60%, #ffe49a 100%);
}

.gold-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(23, 13, 8, 0.56);
  border: 1px solid rgba(244, 205, 125, 0.18);
}

.gold-widget img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}

.gold-widget__copy {
  display: grid;
  gap: 2px;
}

.backpack-panel,
.equipment-panel,
.stats-panel,
.skills-panel,
.spellbook-panel,
.vendor-panel,
.upgrade-panel,
.teleporter-panel,
.map-editor-panel {
  position: absolute;
  display: none;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(244, 205, 125, 0.24);
  background:
    linear-gradient(180deg, rgba(87, 54, 30, 0.82), rgba(19, 11, 8, 0.88));
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 181, 0.08),
    0 12px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 4;
}

.backpack-panel.is-open,
.equipment-panel.is-open,
.stats-panel.is-open,
.skills-panel.is-open,
.spellbook-panel.is-open,
.vendor-panel.is-open,
.upgrade-panel.is-open,
.teleporter-panel.is-open,
.map-editor-panel.is-open {
  display: grid;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-main);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: grab;
  touch-action: none;
}

.window-key {
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  text-align: center;
  background: rgba(255, 222, 164, 0.1);
  border: 1px solid rgba(244, 205, 125, 0.16);
}

.backpack-grid {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 10px;
}

.backpack-panel,
.equipment-panel {
  width: max-content;
  max-width: calc(100vw - 32px);
  align-content: start;
}

.equipment-layout {
  display: grid;
  grid-template-columns: repeat(5, 64px);
  gap: 10px;
}

.stats-panel {
  width: min(300px, calc(100vw - 32px));
  align-content: start;
}

.skills-panel {
  width: min(300px, calc(100vw - 32px));
  align-content: start;
}

.spellbook-panel {
  width: min(340px, calc(100vw - 32px));
  align-content: start;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-row,
.resistance-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(246, 213, 136, 0.18);
  background: rgba(29, 15, 10, 0.52);
  color: rgba(255, 238, 198, 0.72);
  font-size: 0.72rem;
}

.stat-row strong,
.resistance-chip strong {
  color: var(--text-main);
  font-size: 0.78rem;
}

.stats-section-title {
  margin-top: 2px;
  color: rgba(255, 238, 198, 0.72);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.resistances-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.skills-grid {
  display: grid;
  gap: 10px;
}

.skill-progress-row {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(246, 213, 136, 0.18);
  background: rgba(29, 15, 10, 0.52);
}

.skill-progress-row__header,
.skill-progress-row__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.skill-progress-row__header {
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 900;
}

.skill-progress-row__header strong {
  min-width: 34px;
  text-align: right;
  color: #ffe39a;
}

.skill-progress-row__meta {
  color: rgba(255, 238, 198, 0.68);
  font-size: 0.68rem;
}

.skill-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(6, 4, 3, 0.56);
  border: 1px solid rgba(244, 205, 125, 0.14);
}

.skill-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff174d, #ffe39a);
}

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

.spellbook-slot,
.spellbook-entry {
  border: 1px solid rgba(246, 213, 136, 0.18);
  background: rgba(29, 15, 10, 0.52);
  color: rgba(255, 238, 198, 0.78);
  cursor: pointer;
}

.spellbook-slot {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 8px;
  border-radius: 10px;
}

.spellbook-slot span {
  color: rgba(255, 238, 198, 0.62);
  font-size: 0.68rem;
}

.spellbook-slot strong {
  color: var(--text-main);
  font-size: 0.72rem;
}

.spellbook-slot.is-selected {
  border-color: rgba(255, 32, 78, 0.62);
  background: rgba(110, 0, 28, 0.64);
}

.spellbook-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.spellbook-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
}

.spellbook-entry strong,
.spellbook-entry span span {
  display: block;
}

.spellbook-entry strong {
  color: var(--text-main);
  font-size: 0.78rem;
}

.spellbook-entry span span {
  margin-top: 3px;
  color: rgba(255, 238, 198, 0.62);
  font-size: 0.66rem;
}

.spellbook-entry > span:last-child {
  color: #ffe39a;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.spellbook-entry.is-active {
  border-color: rgba(255, 227, 154, 0.42);
}

.inventory-slot,
.hotbar-slot,
.equipment-slot,
.sell-slot {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(128, 78, 39, 0.88), rgba(48, 27, 17, 0.9));
  border: 1px solid rgba(246, 213, 136, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 233, 184, 0.08),
    0 10px 22px rgba(0, 0, 0, 0.18);
}

.inventory-slot,
.hotbar-slot {
  width: 64px;
  height: 64px;
}

.inventory-slot::after,
.hotbar-slot::after,
.equipment-slot::after,
.sell-slot::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 228, 174, 0.16);
  pointer-events: none;
}

.equipment-slot {
  width: 64px;
  height: 64px;
  display: block;
  overflow: hidden;
}

.equipment-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--slot-icon);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 44px;
  opacity: 0.16;
  filter: grayscale(1) brightness(0);
}

.equipment-slot.has-item::before {
  opacity: 0;
}

.item-chip {
  position: relative;
  z-index: 1;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  padding: 6px;
  background: transparent;
  cursor: grab;
  border-radius: 14px;
}

.item-chip__rarity {
  position: absolute;
  left: 6px;
  bottom: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(14, 8, 6, 0.72);
  color: #fff4d2;
  font-size: 0.56rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.item-chip img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.item-chip img.item-icon--outfit,
.vendor-list__item img.item-icon--outfit,
.vendor-detail__hero img.item-icon--outfit,
.drag-ghost img.item-icon--outfit {
  object-fit: contain;
}

.sell-slot {
  min-height: 84px;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(126, 50, 27, 0.92), rgba(62, 22, 12, 0.95));
}

.sell-slot__title {
  display: block;
  font-size: 1rem;
  font-weight: 800;
}

.sell-slot__hint {
  display: block;
  color: rgba(255, 238, 198, 0.72);
  font-size: 0.72rem;
}

.vendor-detail-wrap {
  display: grid;
  gap: 12px;
  align-content: start;
}

.upgrade-panel {
  width: min(520px, calc(100vw - 32px));
}

.map-editor-panel {
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  align-content: start;
}

.editor-toolbar,
.editor-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-layer-group {
  display: flex;
  gap: 6px;
}

.editor-layer-group[aria-label="Tilesets"] {
  flex-wrap: wrap;
  max-height: 122px;
  overflow-y: auto;
}

.editor-layer-button,
.editor-mode-button,
.editor-tileset-button,
.editor-save-button {
  border: 1px solid rgba(247, 215, 137, 0.22);
  border-radius: 10px;
  background: rgba(47, 25, 13, 0.7);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.editor-layer-button {
  width: 34px;
  height: 32px;
}

.editor-mode-button {
  min-height: 32px;
  padding: 0 10px;
}

.editor-tileset-button {
  flex: 1 0 calc(50% - 6px);
  min-height: 32px;
  padding: 0 8px;
  line-height: 1.1;
}

.editor-layer-button.is-active,
.editor-mode-button.is-active,
.editor-tileset-button.is-active {
  background: linear-gradient(180deg, rgba(160, 88, 31, 0.94), rgba(94, 45, 14, 0.98));
  color: var(--text-main);
  border-color: rgba(247, 215, 137, 0.52);
}

.editor-save-button {
  min-height: 32px;
  padding: 0 12px;
}

.editor-save-button:active,
.editor-layer-button:active,
.editor-mode-button:active,
.editor-tileset-button:active {
  transform: translateY(1px);
}

.editor-meta {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(18, 10, 7, 0.44);
  border: 1px solid rgba(244, 205, 125, 0.16);
  color: rgba(255, 238, 198, 0.78);
  font-size: 0.74rem;
}

.tileset-scroll {
  height: min(430px, calc(100vh - 230px));
  overflow: auto;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(244, 205, 125, 0.2);
  background: rgba(16, 10, 7, 0.58);
}

.tileset-canvas {
  display: block;
  width: auto;
  height: auto;
  min-width: 256px;
  min-height: 256px;
  image-rendering: pixelated;
  cursor: crosshair;
}

.game-canvas.is-map-editor-open {
  cursor: crosshair;
}

.upgrade-layout {
  display: grid;
  grid-template-columns: 64px minmax(120px, 160px) 64px;
  gap: 26px;
  align-items: center;
  justify-content: center;
  justify-items: center;
  padding: 0 28px;
}

.upgrade-slot {
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(108, 108, 108, 0.6), rgba(58, 58, 58, 0.72));
  border: 1px solid rgba(246, 213, 136, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 233, 184, 0.08),
    0 10px 22px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}

.upgrade-slot-target {
  cursor: copy;
}

.upgrade-slot.has-item {
  border-color: rgba(255, 220, 146, 0.45);
}

.upgrade-slot__hint {
  color: rgba(255, 238, 198, 0.68);
  max-width: 54px;
  font-size: 0.62rem;
  line-height: 1.15;
}

.upgrade-preview-item {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 6px;
  display: grid;
  justify-items: center;
  align-items: center;
  overflow: hidden;
}

.upgrade-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.upgrade-preview-item span {
  display: none;
}

.upgrade-center {
  display: grid;
  gap: 8px;
  justify-items: center;
  width: 100%;
  align-items: center;
}

.upgrade-center__chance {
  min-width: 120px;
  padding: 16px 12px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 214, 139, 0.32), rgba(68, 30, 14, 0.94));
  border: 1px solid rgba(255, 220, 146, 0.34);
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  justify-self: center;
  margin: 0 auto;
}

.upgrade-outcome,
.upgrade-info {
  padding: 12px;
  border-radius: 16px;
  background: rgba(18, 10, 7, 0.44);
  border: 1px solid rgba(244, 205, 125, 0.16);
}

.upgrade-outcome {
  color: #ffd98f;
  font-size: 0.84rem;
}

.upgrade-info {
  display: grid;
  gap: 8px;
  font-size: 0.8rem;
}

.upgrade-info strong,
.upgrade-info span,
.upgrade-info p {
  margin: 0;
}

.upgrade-info ul {
  margin: 0;
  padding-left: 18px;
}

.vendor-panel {
  width: min(680px, calc(100vw - 32px));
}

.teleporter-panel {
  width: min(420px, calc(100vw - 32px));
}

.vendor-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(240px, 1fr);
  gap: 12px;
}

.vendor-list,
.vendor-detail {
  padding: 12px;
  border-radius: 16px;
  background: rgba(18, 10, 7, 0.44);
  border: 1px solid rgba(244, 205, 125, 0.16);
}

.vendor-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}

.vendor-list__item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(246, 213, 136, 0.18);
  border-radius: 14px;
  padding: 9px;
  background: rgba(79, 45, 24, 0.62);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.vendor-list__item.is-active {
  background: rgba(129, 74, 31, 0.9);
  border-color: rgba(255, 214, 128, 0.46);
}

.teleporter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 440px;
  overflow-y: auto;
}

.teleporter-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid rgba(247, 215, 137, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(31, 18, 12, 0.72);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.teleporter-option:hover,
.teleporter-option:focus-visible {
  outline: none;
  border-color: rgba(255, 211, 110, 0.62);
  background: rgba(86, 48, 20, 0.84);
}

.teleporter-option strong,
.teleporter-option span {
  display: block;
}

.teleporter-option span {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.vendor-list__item img,
.vendor-detail__hero img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
}

.vendor-list__item div,
.vendor-detail__hero div {
  display: grid;
  gap: 4px;
}

.vendor-list__item span,
.vendor-detail__hero span,
.vendor-detail__prices span {
  color: var(--text-soft);
  font-size: 0.76rem;
}

.vendor-detail {
  display: grid;
  gap: 12px;
  align-content: start;
}

.vendor-detail__hero {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}

.vendor-detail__hero img {
  width: 72px;
  height: 72px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(95, 55, 29, 0.76);
}

.item-chip.rarity-rare,
.item-chip.rarity-epic,
.item-chip.rarity-legendary,
.drag-ghost.rarity-rare,
.drag-ghost.rarity-epic,
.drag-ghost.rarity-legendary {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.item-chip.rarity-rare {
  border: 1px solid rgba(98, 182, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(98, 182, 255, 0.2), 0 0 12px rgba(66, 143, 255, 0.2);
}

.item-chip.rarity-epic {
  border: 1px solid rgba(192, 109, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(192, 109, 255, 0.2), 0 0 12px rgba(166, 76, 255, 0.22);
}

.item-chip.rarity-legendary {
  border: 1px solid rgba(255, 190, 84, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 190, 84, 0.25), 0 0 14px rgba(255, 158, 35, 0.24);
}

.item-chip.rarity-rare img,
.upgrade-preview-item.rarity-rare img {
  filter: drop-shadow(0 0 10px rgba(83, 170, 255, 0.72));
}

.item-chip.rarity-epic img,
.upgrade-preview-item.rarity-epic img {
  filter: drop-shadow(0 0 12px rgba(174, 92, 255, 0.76));
}

.item-chip.rarity-legendary img,
.upgrade-preview-item.rarity-legendary img {
  filter: drop-shadow(0 0 12px rgba(255, 177, 69, 0.84));
}

.vendor-detail h3,
.vendor-detail p,
.chat-messages p {
  margin: 0;
}

.vendor-detail__stats {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.vendor-detail__prices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hotbar-panel {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 20px;
  background: rgba(20, 12, 8, 0.5);
  border: 1px solid rgba(244, 205, 125, 0.18);
  backdrop-filter: blur(8px);
}

.hotbar-slot {
  display: grid;
  place-items: center;
  padding: 8px 6px 6px;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
}

.hotbar-slot:disabled {
  cursor: default;
  opacity: 0.42;
}

.hotbar-slot:not(:disabled):hover,
.hotbar-slot:not(:disabled):focus-visible {
  outline: none;
  border-color: rgba(255, 211, 110, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(255, 233, 184, 0.14),
    0 0 0 3px rgba(255, 179, 71, 0.14);
}

.skill-name {
  max-width: 52px;
  color: #ffe9b7;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.skill-cost {
  color: rgba(180, 220, 255, 0.9);
  font-size: 0.58rem;
  font-weight: 700;
}

.skill-cooldown {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  border-radius: inherit;
  background: rgba(5, 2, 1, 0.68);
  color: #ffe9b7;
  font-weight: 900;
  z-index: 2;
}

.hotbar-slot.is-cooling .skill-cooldown {
  display: grid;
}

.chat-panel {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: min(340px, calc(100vw - 220px));
  height: 170px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 18px;
  border: 1px solid rgba(244, 205, 125, 0.22);
  background:
    linear-gradient(180deg, rgba(87, 54, 30, 0.72), rgba(19, 11, 8, 0.82));
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 181, 0.08),
    0 12px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.chat-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 10px 8px;
  background: rgba(255, 220, 162, 0.06);
  border-bottom: 1px solid rgba(244, 205, 125, 0.14);
}

.chat-tab {
  border: 1px solid rgba(247, 215, 137, 0.18);
  border-radius: 10px;
  padding: 6px 10px;
  background: rgba(47, 25, 13, 0.62);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  line-height: 1;
}

.chat-tab.is-active {
  background: linear-gradient(180deg, rgba(160, 88, 31, 0.9), rgba(94, 45, 14, 0.95));
  color: var(--text-main);
  border-color: rgba(247, 215, 137, 0.4);
}

.chat-messages {
  padding: 10px 14px;
  display: grid;
  align-content: start;
  gap: 8px;
  color: rgba(255, 240, 210, 0.86);
  font-size: 0.78rem;
  overflow-y: auto;
  padding-right: 10px;
}

.chat-messages span {
  color: #ffcf75;
}

.vendor-list::-webkit-scrollbar,
.teleporter-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 10px;
}

.vendor-list::-webkit-scrollbar-track,
.teleporter-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: rgba(20, 10, 6, 0.42);
  border-radius: 999px;
}

.vendor-list::-webkit-scrollbar-thumb,
.teleporter-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(198, 136, 63, 0.9), rgba(117, 62, 23, 0.95));
  border-radius: 999px;
  border: 2px solid rgba(20, 10, 6, 0.42);
}

.vendor-list,
.teleporter-list,
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 136, 63, 0.9) rgba(20, 10, 6, 0.42);
}

.chat-input-row {
  padding: 10px;
  border-top: 1px solid rgba(244, 205, 125, 0.14);
  background: rgba(13, 8, 6, 0.36);
}

.chat-input {
  width: 100%;
  border: 1px solid rgba(244, 205, 125, 0.24);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(20, 12, 8, 0.72);
  color: var(--text-main);
}

.hotkey-label {
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 1;
  font-size: 0.76rem;
  color: rgba(255, 237, 205, 0.88);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.item-tooltip {
  position: fixed;
  z-index: 20;
  width: 210px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(18, 10, 7, 0.94);
  border: 1px solid rgba(244, 205, 125, 0.24);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.item-tooltip strong,
.item-tooltip span,
.item-tooltip p,
.item-tooltip ul,
.item-tooltip small {
  display: block;
}

.item-tooltip span,
.item-tooltip small {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.item-tooltip p {
  margin: 8px 0;
  font-size: 0.76rem;
}

.item-tooltip ul {
  margin: 0 0 8px;
  padding-left: 16px;
  font-size: 0.74rem;
}

.drag-ghost {
  position: fixed;
  z-index: 30;
  width: 56px;
  height: 56px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(31, 17, 11, 0.92);
  border: 1px solid rgba(244, 205, 125, 0.28);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.is-dragging-item,
.is-dragging-item * {
  cursor: grabbing !important;
}

@keyframes start-float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-12px); }
}

@keyframes particle-drift {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(0.9);
    opacity: 0.3;
  }
  50% {
    transform: translate3d(0, -18px, 0) scale(1.2);
    opacity: 0.95;
  }
}

@media (max-width: 900px) {
  .class-panel {
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

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

  .class-card {
    min-height: 132px;
    grid-template-columns: 96px 1fr;
    align-items: center;
    text-align: left;
  }

  .class-card__sprite {
    grid-row: span 2;
  }

  .status-panel {
    right: 128px;
    min-width: 0;
  }

  .bars-panel {
    min-width: 0;
  }

  .gold-widget {
    display: none;
  }

  .vendor-panel {
    width: min(94vw, 680px);
  }

  .stats-panel,
  .skills-panel,
  .spellbook-panel,
  .upgrade-panel,
  .teleporter-panel {
    width: min(94vw, 520px);
  }

  .map-editor-panel {
    width: min(94vw, 340px);
  }

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

@media (max-width: 640px) {
  .center-stage {
    padding: 18px 14px 20px;
  }

  .start-button {
    font-size: 1.45rem;
    letter-spacing: 0.12em;
    padding: 16px 20px;
  }

  .start-particles {
    inset: -24px -28px;
  }

  .auth-panel {
    border-radius: 22px;
    padding: 12px;
  }

  .status-panel {
    left: 10px;
    top: 10px;
    right: 96px;
    gap: 8px;
    padding: 8px 10px;
  }

  .orb-frame {
    width: 48px;
    height: 48px;
  }

  .backpack-panel,
  .equipment-panel,
  .vendor-panel,
  .upgrade-panel,
  .teleporter-panel,
  .map-editor-panel {
    width: min(95vw, 420px);
    padding: 10px;
  }

  .tileset-scroll {
    height: min(360px, calc(100vh - 210px));
  }

  .upgrade-layout {
    grid-template-columns: 64px minmax(110px, 1fr) 64px;
    gap: 18px;
    padding: 0;
  }

  .backpack-grid {
    grid-template-columns: repeat(4, 48px);
    gap: 8px;
  }

  .inventory-slot,
  .hotbar-slot {
    width: 48px;
    height: 48px;
  }

  .equipment-layout {
    grid-template-columns: repeat(5, 48px);
  }

  .equipment-slot {
    width: 48px;
    height: 48px;
  }

  .hotbar-panel {
    left: 50%;
    bottom: 10px;
    gap: 6px;
    padding: 8px;
    width: calc(100vw - 20px);
    justify-content: center;
    overflow-x: auto;
  }

  .chat-panel {
    left: 10px;
    bottom: 74px;
    width: min(260px, calc(100vw - 120px));
    height: 180px;
  }

  .minimap-canvas {
    right: 10px;
    top: 10px;
    width: 110px;
    height: 110px;
  }
}

/* Inferum theme overlay for the imported online systems. */
:root {
  --bg-dark: #050000;
  --bg-deep: #120003;
  --gold: #ff174d;
  --gold-strong: #ff003c;
  --gold-dim: #7a001c;
  --wood: rgba(18, 0, 4, 0.92);
  --wood-edge: rgba(255, 0, 60, 0.55);
  --panel-fill: rgba(14, 0, 4, 0.9);
  --text-main: #ffe8ed;
  --text-soft: rgba(255, 175, 190, 0.78);
}

body {
  background:
    radial-gradient(circle at top, rgba(255, 0, 60, 0.2), transparent 30%),
    linear-gradient(180deg, #120003 0%, #030000 100%);
}

.bg-vignette {
  background:
    linear-gradient(180deg, rgba(5, 0, 1, 0.58), rgba(18, 0, 4, 0.14) 25%, rgba(5, 0, 1, 0.72)),
    radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.3) 100%);
}

.start-button {
  color: #ff174d;
}

.start-button__label {
  text-shadow:
    0 0 10px rgba(255, 0, 60, 0.9),
    0 0 24px rgba(255, 23, 77, 0.76),
    0 6px 16px rgba(0, 0, 0, 0.56);
}

.start-particle {
  background:
    radial-gradient(circle, rgba(255, 235, 240, 0.95) 0%, rgba(255, 0, 60, 0.78) 58%, rgba(255, 0, 60, 0) 100%);
  box-shadow: 0 0 12px rgba(255, 0, 60, 0.78);
}

.auth-panel,
.status-panel,
.backpack-panel,
.equipment-panel,
.vendor-panel,
.upgrade-panel,
.teleporter-panel,
.map-editor-panel,
.chat-panel,
.hotbar-panel {
  border-color: rgba(255, 0, 60, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 0, 60, 0.12), rgba(18, 0, 4, 0.08)),
    linear-gradient(180deg, rgba(24, 0, 6, 0.94), rgba(5, 0, 1, 0.96));
}

.panel-tab,
.editor-layer-button,
.editor-mode-button,
.editor-tileset-button,
.editor-save-button {
  border-color: rgba(255, 0, 60, 0.24);
  background: rgba(20, 0, 5, 0.78);
}

.panel-tab.is-active,
.editor-layer-button.is-active,
.editor-mode-button.is-active,
.editor-tileset-button.is-active,
.submit-button,
.buy-button,
.close-button {
  background: linear-gradient(180deg, rgba(168, 0, 38, 0.96), rgba(52, 0, 12, 0.98));
  color: #ffe8ed;
  border-color: rgba(255, 32, 78, 0.48);
}

.network-status,
.minimap-canvas,
.resource-track,
.inventory-slot,
.hotbar-slot,
.equipment-slot,
.sell-slot,
.upgrade-slot,
.tileset-scroll,
.editor-meta {
  border-color: rgba(255, 0, 60, 0.24);
}

.device-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: min(420px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid rgba(255, 0, 60, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 0, 60, 0.14), rgba(18, 0, 4, 0.08)),
    linear-gradient(180deg, rgba(24, 0, 6, 0.96), rgba(5, 0, 1, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 50, 86, 0.14),
    0 22px 44px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 20px)) scale(0.96);
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease;
}

.device-panel.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.device-panel__title {
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.device-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.device-option {
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 0, 60, 0.24);
  background: rgba(20, 0, 5, 0.78);
  color: var(--text-main);
  cursor: pointer;
}

.device-option:is(:hover, :focus-visible),
.device-option.is-suggested {
  outline: none;
  border-color: rgba(255, 32, 78, 0.58);
  background: linear-gradient(180deg, rgba(168, 0, 38, 0.96), rgba(52, 0, 12, 0.98));
}

.device-option__icon {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
}

.device-icon-pc::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 38px;
  height: 25px;
  border: 2px solid currentColor;
  box-shadow: inset 0 -5px 0 rgba(255, 255, 255, 0.14);
}

.device-icon-pc::after {
  content: "";
  position: absolute;
  left: 13px;
  bottom: 5px;
  width: 18px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.device-icon-mobile::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 2px;
  width: 20px;
  height: 38px;
  border: 2px solid currentColor;
  border-radius: 7px;
}

.device-icon-mobile::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.mobile-controls,
.mobile-tabs,
.portrait-lock {
  display: none;
}

body.is-mobile-mode {
  touch-action: none;
  overscroll-behavior: none;
}

body.is-mobile-mode .game-screen {
  background: #070001;
}

body.is-mobile-mode .mobile-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 12;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 max(18px, env(safe-area-inset-left)) 0 max(18px, env(safe-area-inset-right));
  pointer-events: none;
}

.mobile-joystick,
.mobile-action-button,
.mobile-tab-button {
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.mobile-joystick {
  position: relative;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  border: 1px solid rgba(255, 0, 60, 0.36);
  background:
    radial-gradient(circle at center, rgba(255, 0, 60, 0.16), rgba(8, 0, 2, 0.62) 62%),
    rgba(8, 0, 2, 0.45);
  box-shadow:
    inset 0 0 0 1px rgba(255, 180, 194, 0.08),
    0 14px 28px rgba(0, 0, 0, 0.34);
}

.mobile-joystick::before,
.mobile-joystick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 190, 203, 0.18);
  transform: translate(-50%, -50%);
}

.mobile-joystick::before {
  width: 72px;
  height: 1px;
}

.mobile-joystick::after {
  width: 1px;
  height: 72px;
}

.mobile-joystick__knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 210, 220, 0.42);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 235, 240, 0.7), rgba(255, 0, 60, 0.64) 42%, rgba(55, 0, 14, 0.92));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
  transform: translate(-50%, -50%);
}

.mobile-action-button {
  min-width: 96px;
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 0, 60, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 235, 240, 0.32), rgba(168, 0, 38, 0.95) 46%, rgba(45, 0, 10, 0.98));
  color: #ffe8ed;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow:
    inset 0 0 0 1px rgba(255, 210, 220, 0.16),
    0 14px 28px rgba(0, 0, 0, 0.34);
}

.mobile-action-icon {
  position: relative;
  width: 30px;
  height: 30px;
  display: block;
}

.mobile-action-icon::before,
.mobile-action-icon::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 2px;
  width: 4px;
  height: 26px;
  border-radius: 3px;
  background: currentColor;
  transform: rotate(45deg);
}

.mobile-action-icon::after {
  transform: rotate(-45deg);
}

body.is-mobile-mode .mobile-tabs {
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  top: max(8px, env(safe-area-inset-top));
  z-index: 12;
  display: flex;
  gap: 4px;
  max-width: calc(100vw - 270px);
  padding: 5px;
  border: 1px solid rgba(255, 0, 60, 0.3);
  background: rgba(8, 0, 2, 0.72);
  backdrop-filter: blur(10px);
}

.mobile-tab-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 0, 60, 0.24);
  background: rgba(20, 0, 5, 0.78);
  color: rgba(255, 215, 224, 0.72);
}

.mobile-tab-button.is-active {
  color: #ffe8ed;
  border-color: rgba(255, 32, 78, 0.56);
  background: linear-gradient(180deg, rgba(168, 0, 38, 0.96), rgba(52, 0, 12, 0.98));
}

.mobile-tab-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
}

.mobile-icon-bag::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 18px;
  height: 13px;
  border: 2px solid currentColor;
}

.mobile-icon-bag::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.mobile-icon-shield::before {
  content: "";
  position: absolute;
  inset: 2px 4px 1px;
  border: 2px solid currentColor;
  clip-path: polygon(50% 0, 100% 15%, 88% 68%, 50% 100%, 12% 68%, 0 15%);
}

.mobile-icon-stats::before,
.mobile-icon-stats::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  border-top: 2px solid currentColor;
  box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
}

.mobile-icon-stats::before {
  top: 5px;
}

.mobile-icon-stats::after {
  top: 3px;
  left: 14px;
  width: 4px;
  height: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: -8px 7px 0 -1px currentColor, 0 14px 0 -1px currentColor;
}

.mobile-icon-skills::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 14px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.mobile-icon-skills::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  width: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.mobile-icon-spellbook::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 14px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 2px 8px 8px 2px;
}

.mobile-icon-spellbook::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -3px 5px 0 currentColor, 3px 5px 0 currentColor;
}

.mobile-icon-map::before,
.mobile-icon-map::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid currentColor;
}

.mobile-icon-map::after {
  inset: 7px 11px;
  border-top: 0;
  border-bottom: 0;
}

.mobile-icon-upgrade::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  width: 12px;
  height: 16px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
}

.mobile-icon-upgrade::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 1px;
  width: 2px;
  height: 22px;
  background: currentColor;
}

.mobile-icon-chat::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 19px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.mobile-icon-chat::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 2px;
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-35deg);
}

body.is-mobile-mode .status-panel {
  left: max(10px, env(safe-area-inset-left));
  top: max(58px, calc(env(safe-area-inset-top) + 52px));
  right: auto;
  max-width: min(360px, calc(100vw - 144px));
  transform-origin: top left;
  scale: 0.78;
}

body.is-mobile-mode .minimap-canvas {
  right: max(10px, env(safe-area-inset-right));
  top: max(8px, env(safe-area-inset-top));
  width: 92px;
  height: 92px;
  border-radius: 10px;
}

body.is-mobile-mode .hotbar-panel {
  display: none;
}

body.is-mobile-mode .backpack-panel,
body.is-mobile-mode .equipment-panel,
body.is-mobile-mode .stats-panel,
body.is-mobile-mode .skills-panel,
body.is-mobile-mode .spellbook-panel,
body.is-mobile-mode .vendor-panel,
body.is-mobile-mode .upgrade-panel,
body.is-mobile-mode .teleporter-panel,
body.is-mobile-mode .map-editor-panel,
body.is-mobile-mode .chat-panel {
  left: max(132px, calc(env(safe-area-inset-left) + 124px)) !important;
  right: max(112px, calc(env(safe-area-inset-right) + 104px)) !important;
  top: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: auto;
  max-height: calc(100vh - 86px);
  overflow: auto;
  z-index: 13;
}

body.is-mobile-mode .chat-panel {
  display: none;
}

body.is-mobile-mode .chat-panel.is-open {
  display: grid;
  height: min(48vh, 260px);
}

body.is-mobile-mode .backpack-grid {
  grid-template-columns: repeat(4, 52px);
  gap: 8px;
}

body.is-mobile-mode .equipment-layout {
  grid-template-columns: repeat(5, 44px);
  gap: 8px;
}

body.is-mobile-mode .inventory-slot,
body.is-mobile-mode .hotbar-slot,
body.is-mobile-mode .equipment-slot {
  width: 52px;
  height: 52px;
}

body.is-mobile-mode .equipment-slot {
  width: 44px;
  height: 44px;
}

body.is-mobile-mode .backpack-panel,
body.is-mobile-mode .equipment-panel {
  right: auto !important;
  width: max-content;
  max-width: calc(100vw - max(132px, calc(env(safe-area-inset-left) + 124px)) - 16px);
}

body.is-mobile-mode .vendor-grid {
  grid-template-columns: 1fr;
}

body.is-mobile-mode .map-editor-panel {
  bottom: max(12px, env(safe-area-inset-bottom));
  max-height: calc(100vh - 86px);
}

body.is-mobile-mode.is-portrait-mobile .portrait-lock {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(5, 0, 1, 0.92);
  color: #ffe8ed;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (orientation: portrait) {
  body.is-mobile-mode .mobile-controls,
  body.is-mobile-mode .mobile-tabs {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  body.is-mobile-mode .mobile-joystick {
    width: 106px;
    height: 106px;
  }

  body.is-mobile-mode .mobile-action-button {
    min-width: 84px;
    min-height: 84px;
  }

  body.is-mobile-mode .status-panel {
    scale: 0.68;
  }

  body.is-mobile-mode .mobile-tab-button {
    width: 34px;
    height: 34px;
  }

  body.is-mobile-mode .backpack-panel,
  body.is-mobile-mode .equipment-panel,
  body.is-mobile-mode .stats-panel,
  body.is-mobile-mode .skills-panel,
  body.is-mobile-mode .spellbook-panel,
  body.is-mobile-mode .vendor-panel,
  body.is-mobile-mode .upgrade-panel,
  body.is-mobile-mode .teleporter-panel,
  body.is-mobile-mode .map-editor-panel,
  body.is-mobile-mode .chat-panel {
    max-height: calc(100vh - 64px);
  }
}

@media (max-width: 420px) {
  body.is-mobile-mode .mobile-joystick {
    width: 108px;
    height: 108px;
  }

  body.is-mobile-mode .mobile-action-button {
    min-width: 84px;
    min-height: 84px;
  }

  body.is-mobile-mode .mobile-tab-button {
    width: 34px;
    height: 34px;
  }

  body.is-mobile-mode .status-panel {
    scale: 0.82;
  }
}
