:root {
  color-scheme: dark;
  --bg: #11100e;
  --panel: #191713;
  --panel-2: #211d18;
  --panel-3: #2a251f;
  --text: #f2eadf;
  --muted: #b8ab9c;
  --faint: #7d7469;
  --line: #3b332b;
  --iron: #9ca6ad;
  --free: #42b6a4;
  --rust: #d0763c;
  --herald: #b885e8;
  --spark: #e0b447;
  --neutral: #a7b078;
  --danger: #d9574d;
  --good: #78c56f;
  --blue: #5da9d6;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --radius: 8px;
  --fast: 160ms ease;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(208, 118, 60, 0.22), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(66, 182, 164, 0.14), transparent 30%),
    linear-gradient(135deg, #11100e 0%, #17120f 48%, #0f1311 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--spark);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 420px);
  gap: 24px;
  padding: 28px;
  align-items: stretch;
}

.auth-lore {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  padding: 44px;
  border: 1px solid rgba(224, 180, 71, 0.22);
  background:
    linear-gradient(rgba(17, 16, 14, 0.18), rgba(17, 16, 14, 0.9)),
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 22px),
    linear-gradient(145deg, rgba(114, 59, 33, 0.65), rgba(21, 57, 52, 0.48) 52%, rgba(21, 18, 15, 0.88));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-lore::after {
  content: "";
  position: absolute;
  right: -8%;
  bottom: -12%;
  width: 54%;
  aspect-ratio: 1;
  border: 2px solid rgba(224, 180, 71, 0.26);
  transform: rotate(45deg);
  background:
    linear-gradient(45deg, transparent 48%, rgba(224, 180, 71, 0.32) 49% 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(66, 182, 164, 0.22) 49% 51%, transparent 52%);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #1d160f;
  background: var(--spark);
  border-radius: var(--radius);
  font-weight: 900;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--spark);
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-lore h1 {
  max-width: 850px;
  margin: 0;
  font-size: 6.2rem;
  line-height: 0.92;
}

.lead {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 28px 0 0;
  color: #f5ede0;
  font-size: 1.16rem;
  line-height: 1.65;
}

.lore-grid {
  position: absolute;
  z-index: 1;
  left: 44px;
  right: 44px;
  bottom: 44px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lore-grid article,
.auth-card,
.player-sidebar,
.content-panel,
.mini-card,
.street-card,
.faction-card,
.quest-card,
.inventory-item,
.chat-panel,
.clan-box,
.combatant-card,
.battle-center,
.dungeon-side,
.modal-box {
  border: 1px solid var(--line);
  background: rgba(25, 23, 19, 0.92);
  border-radius: var(--radius);
}

.lore-grid article {
  padding: 16px;
  min-height: 150px;
}

.lore-grid span {
  display: inline-flex;
  min-width: 36px;
  height: 26px;
  align-items: center;
  justify-content: center;
  color: #1d160f;
  background: var(--spark);
  border-radius: 5px;
  font-weight: 900;
  margin-bottom: 14px;
}

.lore-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.lore-grid p,
.mini-card p,
.street-card p,
.faction-card p,
.quest-card p,
.clan-box p,
.dungeon-side p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-card {
  align-self: center;
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tab,
.tab-button,
.nav-button,
.ghost-button,
.secondary-action,
.zone-button,
.slot,
.tile,
.chat-tab,
.small-action,
.quality-filter {
  color: var(--text);
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), opacity var(--fast);
}

.auth-tab,
.tab-button,
.nav-button,
.ghost-button,
.secondary-action,
.small-action,
.quality-filter {
  min-height: 40px;
  padding: 10px 12px;
}

.auth-tab:hover,
.tab-button:hover,
.nav-button:hover,
.ghost-button:hover,
.secondary-action:hover,
.zone-button:hover,
.slot:hover,
.chat-tab:hover,
.small-action:hover,
.quality-filter:hover {
  border-color: rgba(224, 180, 71, 0.66);
  transform: translateY(-1px);
}

.auth-tab.is-active,
.tab-button.is-active,
.nav-button.is-active,
.chat-tab.is-active,
.zone-button.is-active,
.quality-filter.is-active {
  color: #1d160f;
  background: var(--spark);
  border-color: var(--spark);
  font-weight: 800;
}

.auth-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12100e;
  padding: 11px 12px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.primary-action {
  min-height: 46px;
  padding: 11px 16px;
  color: #1d160f;
  background: var(--spark);
  border-radius: 6px;
  font-weight: 900;
  cursor: pointer;
  transition: transform var(--fast), filter var(--fast);
}

.primary-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.primary-action:disabled,
.small-action:disabled,
.zone-button:disabled,
.tile:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.secondary-action {
  width: 100%;
  margin-top: 12px;
}

.form-message {
  min-height: 24px;
  color: var(--danger);
  margin: 14px 0 0;
}

.game-screen {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(170px, 230px) 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 16, 14, 0.94);
  backdrop-filter: blur(12px);
}

.topbar h2 {
  margin: 0;
  font-size: 1.2rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.nav-button {
  white-space: nowrap;
  min-width: 86px;
}

.ghost-button {
  background: transparent;
}

.game-layout {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.player-sidebar,
.content-panel {
  min-height: calc(100vh - 114px);
  padding: 16px;
  box-shadow: var(--shadow);
}

.player-sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h3,
.panel-title {
  margin: 0;
  font-size: 1.55rem;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 820px;
  line-height: 1.45;
}

.avatar {
  width: 132px;
  height: 156px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border: 1px solid rgba(224, 180, 71, 0.42);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(224, 180, 71, 0.12), transparent 64%),
    radial-gradient(circle at center 26%, rgba(245, 237, 224, 0.16), transparent 16%),
    linear-gradient(145deg, rgba(66, 182, 164, 0.18), rgba(208, 118, 60, 0.12));
}

.avatar-figure {
  width: 64px;
  height: 116px;
  position: relative;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.38));
}

.avatar-figure::before,
.avatar-figure::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #d9c7b5;
}

.avatar-figure::before {
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(224, 180, 71, 0.12);
}

.avatar-figure::after {
  top: 42px;
  width: 54px;
  height: 72px;
  border-radius: 22px 22px 9px 9px;
  background:
    linear-gradient(90deg, transparent 0 16%, #d9c7b5 16% 84%, transparent 84%),
    linear-gradient(180deg, #d9c7b5, #8d8172);
}

.player-name {
  margin: 12px 0 4px;
  text-align: center;
  font-size: 1.35rem;
}

.badge-row,
.stats-grid,
.resource-row,
.button-row,
.chat-tabs,
.loot-row,
.effect-row,
.zone-grid,
.damage-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: #18130e;
  background: var(--neutral);
  font-size: 0.78rem;
  font-weight: 900;
}

.badge.iron { background: var(--iron); }
.badge.free { background: var(--free); }
.badge.rust { background: var(--rust); }
.badge.herald { background: var(--herald); }
.badge.spark { background: var(--spark); }
.badge.danger { background: var(--danger); color: #fff; }
.badge.good { background: var(--good); }
.badge.blue { background: var(--blue); }

.meter {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #0d0c0b;
  border: 1px solid var(--line);
}

.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--spark), var(--free));
}

.stat-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(59, 51, 43, 0.72);
  color: var(--muted);
}

.stat-line strong {
  color: var(--text);
}

.resource-line {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(59, 51, 43, 0.72);
  color: var(--muted);
}

.resource-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.42));
}

.resource-line strong {
  color: var(--text);
}

.mini-card {
  padding: 12px;
  margin-top: 12px;
}

.mini-card h4,
.street-card h4,
.faction-card h4,
.quest-card h4,
.inventory-item h4,
.combatant-card h4,
.dungeon-side h4,
.modal-box h3 {
  margin: 0 0 8px;
}

.grid-2,
.grid-3,
.city-grid,
.faction-grid,
.quest-grid,
.inventory-grid,
.dungeon-layout,
.battle-layout,
.character-layout {
  display: grid;
  gap: 14px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.city-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.faction-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.quest-grid { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.inventory-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.character-layout { grid-template-columns: minmax(310px, 420px) minmax(0, 1fr); align-items: start; }
.battle-layout { grid-template-columns: minmax(210px, 1fr) minmax(340px, 1.1fr) minmax(210px, 1fr); align-items: stretch; }
.dungeon-layout { grid-template-columns: minmax(760px, 1fr) 310px; align-items: start; }

.street-card,
.faction-card,
.quest-card,
.inventory-item,
.combatant-card,
.battle-center,
.dungeon-side,
.chat-panel,
.clan-box {
  padding: 14px;
}

.street-card {
  position: relative;
  min-height: 220px;
  overflow: hidden;
}

.street-card::before,
.faction-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--neutral);
}

.street-card.iron::before,
.faction-card.iron::before { background: var(--iron); }
.street-card.free::before,
.faction-card.free::before { background: var(--free); }
.street-card.rust::before,
.faction-card.rust::before { background: var(--rust); }
.street-card.herald::before,
.faction-card.herald::before { background: var(--herald); }
.street-card.spark::before,
.faction-card.spark::before { background: var(--spark); }

.street-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.small-action {
  color: var(--text);
}

.small-action.primary {
  color: #1d160f;
  background: var(--spark);
  border-color: var(--spark);
  font-weight: 800;
}

.small-action.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.small-action.good {
  color: #11210f;
  background: var(--good);
  border-color: var(--good);
  font-weight: 800;
}

.map-wrap {
  position: relative;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(224, 180, 71, 0.09), transparent 32%),
    linear-gradient(40deg, rgba(66, 182, 164, 0.08), transparent 48%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 42px),
    #15130f;
  overflow: hidden;
}

.map-node {
  position: absolute;
  width: min(210px, 34%);
  min-height: 86px;
  padding: 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(33, 29, 24, 0.94);
  text-align: left;
  cursor: pointer;
}

.map-node strong {
  display: block;
  margin-bottom: 6px;
}

.map-node span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.map-node.portal {
  border-color: rgba(184, 133, 232, 0.72);
  box-shadow: 0 0 24px rgba(184, 133, 232, 0.18);
}

.equipment-card {
  display: grid;
  grid-template-columns: 116px 184px 116px;
  justify-content: center;
  gap: 12px;
  align-items: center;
}

.equipment-column {
  display: grid;
  gap: 10px;
}

.slot {
  width: 116px;
  min-height: 82px;
  padding: 7px;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
  text-align: center;
  overflow: visible;
}

.slot-art-wrap,
.compact-slot-art-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
}

.slot-img {
  width: 54px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
}

.slot small {
  display: block;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.05;
}

.slot strong {
  display: none;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.slot-empty-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px dashed rgba(245, 237, 224, 0.18);
  border-radius: 6px;
  color: rgba(245, 237, 224, 0.32);
  font-weight: 900;
}

.slot-static {
  cursor: default;
}

.slot-static:hover {
  border-color: var(--line);
  transform: none;
}

.combatant-card .equipment-card {
  grid-template-columns: 62px minmax(106px, 1fr) 62px;
  gap: 6px;
  margin-top: 10px;
}

.combatant-card .equipment-column {
  gap: 8px;
}

.combatant-card .slot {
  width: 100%;
  min-height: 70px;
  padding: 6px;
  font-size: 0.72rem;
}

.combatant-card .slot-img {
  width: 44px;
  height: 38px;
}

.combatant-card .avatar {
  width: 100%;
  max-width: 146px;
  height: 304px;
}

.inventory-item {
  min-height: 178px;
  position: relative;
  overflow: visible;
}

.item-art {
  width: 72px;
  height: 72px;
  object-fit: contain;
  float: right;
  margin: 0 0 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #12100e;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.38));
}

.faction-portrait {
  width: 112px;
  height: 146px;
  object-fit: contain;
  float: right;
  margin: 0 0 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12100e;
}

.npc-portrait {
  width: 90px;
  height: 110px;
  object-fit: contain;
  float: right;
  margin: 0 0 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12100e;
}

.npc-row {
  display: flow-root;
  min-height: 92px;
}

.loot-item-line {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.loot-item-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12100e;
}

.quality-common { border-color: #817a70; }
.quality-uncommon { border-color: #78c56f; }
.quality-rare { border-color: #5da9d6; }
.quality-epic { border-color: #b885e8; }
.quality-legendary { border-color: #e0b447; }
.quality-mythic { border-color: #f46b62; box-shadow: 0 0 22px rgba(244, 107, 98, 0.12); }

.quality-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #817a70;
}

.quality-dot.uncommon { background: var(--good); }
.quality-dot.rare { background: var(--blue); }
.quality-dot.epic { background: var(--herald); }
.quality-dot.legendary { background: var(--spark); }
.quality-dot.mythic { background: #f46b62; }

.body-sketch {
  display: grid;
  gap: 8px;
  width: min(100%, 190px);
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.body-silhouette {
  position: relative;
  width: 168px;
  height: 260px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    #11100e;
}

.body-silhouette::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 20px;
  width: 96px;
  height: 220px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 12%, rgba(232, 213, 189, 0.95) 0 16px, transparent 17px),
    linear-gradient(90deg, transparent 0 20px, rgba(232, 213, 189, 0.86) 21px 75px, transparent 76px),
    linear-gradient(90deg, transparent 0 30px, rgba(232, 213, 189, 0.72) 31px 65px, transparent 66px);
  clip-path: polygon(39% 0, 61% 0, 70% 15%, 78% 39%, 67% 42%, 62% 31%, 60% 56%, 74% 100%, 57% 100%, 50% 67%, 43% 100%, 26% 100%, 40% 56%, 38% 31%, 33% 42%, 22% 39%, 30% 15%);
  opacity: 0.38;
  pointer-events: none;
}

.silhouette-zone {
  position: absolute;
  left: 50%;
  border: 1px solid rgba(224, 180, 71, 0.2);
  background: rgba(224, 180, 71, 0.08);
  transform: translateX(-50%);
  cursor: pointer;
}

.silhouette-zone:hover,
.silhouette-zone.is-selected {
  border-color: var(--spark);
  background: rgba(224, 180, 71, 0.38);
}

.block-silhouette .silhouette-zone.is-selected {
  border-color: var(--blue);
  background: rgba(93, 169, 214, 0.36);
}

.silhouette-head {
  top: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.silhouette-chest {
  top: 67px;
  width: 78px;
  height: 64px;
  border-radius: 26px 26px 12px 12px;
}

.silhouette-belt {
  top: 137px;
  width: 66px;
  height: 44px;
  border-radius: 12px;
}

.silhouette-legs {
  top: 187px;
  width: 84px;
  height: 58px;
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 62% 100%, 50% 32%, 38% 100%, 0 100%);
}

.zone-button {
  min-height: 44px;
  padding: 8px;
  text-align: center;
}

.zone-button.is-blocked {
  background: rgba(93, 169, 214, 0.2);
  border-color: var(--blue);
}

.battle-center {
  display: grid;
  gap: 14px;
  align-content: start;
}

.compact-equipment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.compact-slot {
  min-height: 82px;
  padding: 8px;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12100e;
  overflow: visible;
}

.compact-slot-img {
  width: 56px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.42));
}

.compact-slot small {
  display: block;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.05;
}

.compact-slot strong {
  display: none;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.item-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 80;
  display: grid;
  gap: 5px;
  min-width: 220px;
  max-width: 280px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  line-height: 1.3;
  background: rgba(15, 13, 11, 0.98);
  border: 1px solid rgba(224, 180, 71, 0.54);
  border-radius: 6px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.52);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity var(--fast), transform var(--fast);
}

.item-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  background: rgba(15, 13, 11, 0.98);
  border-right: 1px solid rgba(224, 180, 71, 0.54);
  border-bottom: 1px solid rgba(224, 180, 71, 0.54);
  transform: translate(-50%, -5px) rotate(45deg);
}

.item-tooltip strong {
  display: block;
  color: #fff7df;
  font-size: 0.95rem;
}

.item-tooltip span,
.item-tooltip i {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.compare-lines {
  display: grid !important;
  gap: 3px;
}

.compare-lines span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.compare-lines b {
  font-weight: 700;
  color: var(--text);
}

.compare-lines em {
  font-style: normal;
  font-weight: 900;
}

.compare-lines em.good { color: #6ed0a9; }
.compare-lines em.bad { color: #e56d67; }
.compare-lines em.same { color: var(--muted); }

.slot:hover .item-tooltip,
.slot:focus-visible .item-tooltip,
.compact-slot:hover .item-tooltip,
.inventory-item:hover .item-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.inventory-item .item-tooltip {
  left: auto;
  right: 14px;
  bottom: calc(100% - 10px);
  transform: translateY(6px);
}

.inventory-item:hover .item-tooltip {
  transform: translateY(0);
}

.timer-box {
  display: grid;
  place-items: center;
  min-height: 84px;
  border-radius: var(--radius);
  border: 1px solid rgba(224, 180, 71, 0.42);
  background: #12100e;
}

.timer-box strong {
  display: block;
  font-size: 2.3rem;
}

.battle-log {
  height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11100e;
}

.battle-log p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.35;
}

.battle-log p:first-child {
  color: var(--text);
}

.damage-row {
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid rgba(59, 51, 43, 0.72);
}

.dungeon-board-wrap {
  position: relative;
  min-height: 780px;
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(66, 182, 164, 0.10), transparent 40%),
    linear-gradient(20deg, rgba(208, 118, 60, 0.09), transparent 55%),
    #12100e;
}

.dungeon-board {
  position: relative;
  width: 1000px;
  height: 660px;
  margin: 6px auto 18px;
  cursor: pointer;
}

.limb66-board {
  background:
    linear-gradient(120deg, rgba(14, 29, 24, 0.18), transparent 38%),
    url("assets/art-limb66-arena.png") top center / 100% auto no-repeat;
}

.limb66-board .tile-floor {
  opacity: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.limb66-board .tile-hit:hover .tile-floor,
.limb66-board .tile.reachable .tile-floor {
  opacity: 1;
  border: 1px solid rgba(224, 180, 71, 0.64);
  background: rgba(224, 180, 71, 0.10);
  box-shadow: inset 0 0 0 2px rgba(224, 180, 71, 0.18);
}

.limb66-board .tile.player .tile-floor,
.limb66-board .tile.enemy .tile-floor,
.limb66-board .tile.crate .tile-floor,
.limb66-board .tile.prop .tile-floor,
.limb66-board .tile.exit .tile-floor,
.limb66-board .tile.merc .tile-floor {
  background: transparent;
}

.limb77-board {
  background:
    radial-gradient(circle at center, rgba(66, 182, 164, 0.08), transparent 48%),
    url("assets/art-limb77-arena.png") 0 0 / 1180px 1040px no-repeat,
    #11100e;
}

.limb77-board .tile-floor {
  opacity: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.limb77-board .tile-hit:hover .tile-floor,
.limb77-board .tile.reachable .tile-floor {
  opacity: 1;
  border: 1px solid rgba(224, 180, 71, 0.64);
  background: rgba(224, 180, 71, 0.10);
  box-shadow: inset 0 0 0 2px rgba(224, 180, 71, 0.18);
}

.limb77-board .tile.player .tile-floor,
.limb77-board .tile.enemy .tile-floor,
.limb77-board .tile.crate .tile-floor,
.limb77-board .tile.prop .tile-floor,
.limb77-board .tile.exit .tile-floor,
.limb77-board .tile.merc .tile-floor {
  background: transparent;
}

.lab-board {
  --lab-cell: 64px;
  display: grid;
  grid-template-columns: repeat(var(--lab-size), var(--lab-cell));
  grid-template-rows: repeat(var(--lab-size), var(--lab-cell));
  width: calc(var(--lab-size) * var(--lab-cell));
  height: calc(var(--lab-size) * var(--lab-cell));
  margin: 18px auto 20px;
  padding: 0;
  border: 2px solid rgba(92, 113, 119, 0.55);
  background: #07090a;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.48), inset 0 0 70px rgba(54, 194, 191, 0.08);
  cursor: pointer;
}

.lab-cell {
  position: relative;
  width: var(--lab-cell);
  height: var(--lab-cell);
  box-sizing: border-box;
  overflow: visible;
  border: 1px solid rgba(11, 17, 18, 0.64);
  background: #161817;
}

.lab-cell.wall {
  border: 0;
  background: transparent;
}

.lab-cell.reachable {
  outline: 2px solid rgba(224, 180, 71, 0.5);
  outline-offset: -3px;
}

.lab-floor-img,
.lab-object-img,
.lab-unit-img {
  position: absolute;
  left: 50%;
  top: 50%;
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.44));
}

.lab-floor-img {
  inset: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
  filter: none;
  opacity: 0.96;
}

.lab-wall-img {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  object-fit: cover;
  transform: none;
  filter: drop-shadow(0 7px 7px rgba(0, 0, 0, 0.42));
}

.lab-wall-vertical {
  width: 100%;
  height: 100%;
}

.lab-wall-horizontal {
  width: 100%;
  height: 100%;
}

.lab-wall-corner-nw,
.lab-wall-corner-ne,
.lab-wall-corner-sw,
.lab-wall-corner-se {
  width: 100%;
  height: 100%;
}

.lab-wall-corner-nw {
  transform: none;
}

.lab-wall-corner-ne {
  transform: scaleX(-1);
}

.lab-wall-corner-sw {
  transform: scaleY(-1);
}

.lab-wall-corner-se {
  transform: scale(-1, -1);
}

.lab-obstacle-img {
  width: 62px;
  height: 62px;
  z-index: 5;
}

.lab-crate-img {
  width: 52px;
  height: 52px;
  z-index: 5;
}

.lab-exit-img {
  width: 40px;
  height: 40px;
  z-index: 3;
}

.lab-unit-img {
  width: 58px;
  height: 58px;
  z-index: 8;
}

.lab-doctor-img {
  filter: drop-shadow(0 0 10px rgba(80, 224, 213, 0.26)) drop-shadow(0 8px 8px rgba(0, 0, 0, 0.42));
}

.lab-hp {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  overflow: hidden;
  z-index: 10;
}

.lab-hp > i {
  display: block;
  height: 100%;
  background: var(--danger);
}

.dungeon-perimeter-wall {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.perimeter-wall-img {
  position: absolute;
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.46));
  opacity: 1;
  transition: opacity 160ms ease;
}

.perimeter-wall-near-player {
  opacity: 0.58;
}

.perimeter-straight-img {
  clip-path: inset(2px 4px 0 4px);
}

.perimeter-side-east-south,
.perimeter-side-west-south {
  clip-path: inset(0 2px 0 2px);
}

.tile {
  position: absolute;
  width: 124px;
  height: 132px;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
  transform: none;
  pointer-events: none;
}

.tile-hit {
  position: absolute;
  left: 10px;
  top: 34px;
  width: 104px;
  height: 60px;
  padding: 0;
  border: 0;
  background: transparent;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  pointer-events: auto;
}

.tile-floor {
  position: absolute;
  inset: 0;
  border: 1px solid #4b4035;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 42%),
    #25211b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), 0 7px 16px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.tile-hit:hover .tile-floor {
  border-color: rgba(224, 180, 71, 0.72);
  background:
    linear-gradient(135deg, rgba(224, 180, 71, 0.12), transparent 42%),
    #2b261f;
}

.tile-label {
  position: absolute;
  left: 50%;
  top: 28px;
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(17, 16, 14, 0.78);
  font-weight: 900;
  font-size: 0.68rem;
  color: var(--text);
  transform: translateX(-50%);
  z-index: 7;
}

.tile-token {
  position: absolute;
  pointer-events: none;
}

.tile-img {
  position: absolute;
  left: 50%;
  top: 64px;
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 9px 7px rgba(0, 0, 0, 0.42));
}

.unit-img {
  width: 72px;
  height: 94px;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  z-index: 6;
}

.crate-img {
  width: 56px;
  height: 56px;
  z-index: 5;
}

.prop-img {
  width: 62px;
  height: 58px;
  z-index: 5;
}

.wall-img {
  width: 78px;
  height: 88px;
  z-index: 5;
}

.limb-wall-img {
  width: 164px;
  height: 166px;
  z-index: 7;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.46));
}

.limb-wall-corner-img {
  width: 170px;
  height: 172px;
  object-fit: contain;
  z-index: 8;
}

.wall-orient-corner-east,
.wall-orient-corner-west {
  width: 204px;
  height: 218px;
}

.tile.wall-near .wall-img {
  opacity: 0.48;
}

.exit-img {
  width: 54px;
  height: 54px;
  z-index: 4;
}

.unit-token {
  left: 50%;
  bottom: 34px;
  width: 34px;
  height: 42px;
  transform: translateX(-50%);
  z-index: 6;
}

.unit-token::before,
.unit-token::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.unit-token::before {
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e6d6c6;
  border: 2px solid rgba(17, 16, 14, 0.7);
}

.unit-token::after {
  bottom: 0;
  width: 32px;
  height: 28px;
  border-radius: 12px 12px 7px 7px;
  background: var(--free);
  border: 2px solid rgba(17, 16, 14, 0.7);
}

.unit-token.enemy-token::after {
  background: var(--danger);
}

.unit-token.merc-token::after {
  background: var(--blue);
}

.crate-token {
  width: 34px;
  height: 30px;
  left: 50%;
  top: 46px;
  transform: translate(-50%, -50%);
  border: 2px solid #5b4229;
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 44%, rgba(28, 22, 16, 0.55) 45% 55%, transparent 56%),
    linear-gradient(0deg, transparent 44%, rgba(28, 22, 16, 0.55) 45% 55%, transparent 56%),
    #a57943;
  z-index: 5;
}

.wall-token {
  left: 50%;
  top: 15px;
  width: 48px;
  height: 52px;
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 45%),
    repeating-linear-gradient(0deg, #4b463c 0 10px, #39352f 10px 13px),
    #3f3b34;
  border: 1px solid #62594e;
  box-shadow: 0 11px 0 #27241f, 0 16px 18px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%) skewY(-6deg);
  z-index: 5;
}

.exit-token {
  width: 34px;
  height: 34px;
  left: 50%;
  top: 46px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--spark);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(224, 180, 71, 0.42), inset 0 0 14px rgba(224, 180, 71, 0.22);
  z-index: 4;
}

.tile-hp {
  position: absolute;
  left: 21px;
  right: 21px;
  top: -16px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 8;
}

.tile-hp > i {
  display: block;
  height: 100%;
  background: var(--danger);
}

.tile.exit .tile-floor { background: rgba(224, 180, 71, 0.34); }
.tile.reachable .tile-floor { border-color: var(--spark); box-shadow: inset 0 0 0 2px rgba(224, 180, 71, 0.28), 0 7px 16px rgba(0, 0, 0, 0.2); }
.tile.enemy .tile-floor { background: rgba(217, 87, 77, 0.22); }
.tile.crate .tile-floor { background: rgba(120, 197, 111, 0.16); }
.tile.prop .tile-floor { background: rgba(146, 126, 104, 0.22); }
.tile.player .tile-floor { background: rgba(66, 182, 164, 0.26); }
.tile.merc .tile-floor { border-color: var(--blue); }
.tile.wall {
  cursor: not-allowed;
}

.tile.wall .tile-floor {
  background: #151411;
  border-color: #5a5146;
}

.tile.wall-covered .tile-floor {
  opacity: 0;
}

.dungeon-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 14px auto 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.dungeon-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.legend-unit {
  width: 14px;
  height: 14px;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--neutral);
}

.legend-unit.player { background: var(--free); }
.legend-unit.enemy { background: var(--danger); }
.legend-unit.crate { background: #a57943; }
.legend-unit.wall { background: #4b463c; }
.legend-unit.prop { background: #927e68; }
.legend-unit.doctor { background: #62d7cf; }
.legend-unit.exit { border-radius: 50%; background: var(--spark); }

.energy-bar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin: 10px 0;
}

.energy-cell {
  height: 18px;
  border: 1px solid var(--line);
  background: #11100e;
  border-radius: 3px;
}

.energy-cell.is-full {
  background: var(--free);
  border-color: var(--free);
}

.chat-panel {
  display: grid;
  gap: 12px;
}

.chat-feed {
  height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #11100e;
  border-radius: var(--radius);
  padding: 12px;
}

.chat-message {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.38;
}

.chat-message strong {
  color: var(--text);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr auto;
  gap: 8px;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.modal-box {
  width: min(620px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  padding: 18px;
}

@media (max-width: 1180px) {
  .auth-screen,
  .game-layout,
  .character-layout,
  .battle-layout,
  .dungeon-layout {
    grid-template-columns: 1fr;
  }

  .player-sidebar {
    position: static;
    min-height: auto;
  }

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

  .main-nav {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 780px) {
  .auth-screen,
  .game-layout {
    padding: 12px;
  }

  .auth-lore {
    min-height: auto;
    padding: 24px;
  }

  .auth-lore h1 {
    font-size: 3rem;
  }

  .lore-grid {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    grid-template-columns: 1fr;
    margin-top: 28px;
  }

  .topbar {
    padding: 12px;
  }

  .section-head {
    display: grid;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

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

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

  .slot {
    width: 100%;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .map-node {
    position: static;
    width: auto;
    margin: 12px;
  }
}
