:root {
  --bg: #0d1014;
  --surface: #161b22;
  --surface-2: #1d2430;
  --surface-3: #273142;
  --surface-soft: rgba(255, 255, 255, 0.035);
  --text: #f3f5f2;
  --muted: #a5afbb;
  --faint: #758293;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --gold: #e2b864;
  --green: #68c28f;
  --red: #e36f6f;
  --blue: #6fa9dc;
  --violet: #a98be8;
  --orange: #e58d58;
  --rarity-common: #8793a2;
  --rarity-uncommon: #68c28f;
  --rarity-rare: #6fa9dc;
  --rarity-mystic: #a98be8;
  --rarity-legendary: #f0bc62;
  --rarity-cursed: #d45a91;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 7px 22px rgba(0, 0, 0, 0.22);
  --radius: 8px;
  --bar-height: 168px;
  --telegram-footer-height: 0px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -16%, rgba(226, 184, 100, 0.15), transparent 28rem),
    linear-gradient(180deg, #121821 0%, #0d1014 58%, #090b0e 100%);
  color: var(--text);
  font: 14px/1.42 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
  opacity: 0.48;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 10px calc(var(--bar-height) + var(--telegram-footer-height) + max(16px, env(safe-area-inset-bottom)));
  overflow-x: hidden;
}

body[data-section="hero"] {
  --section-accent: var(--blue);
}

body[data-section="city"] {
  --section-accent: var(--violet);
}

body[data-section="combat"] {
  --section-accent: var(--red);
}

body[data-section="progress"] {
  --section-accent: var(--green);
}

body[data-view="inventory"],
body[data-view="professions"] {
  --section-accent: var(--blue);
}

body[data-view="city"],
body[data-view="crafting"] {
  --section-accent: var(--violet);
}

body[data-view="market"],
body[data-view="auction"],
body[data-view="collections"],
body[data-view="mail"] {
  --section-accent: var(--gold);
}

body[data-view="arena"],
body[data-view="dungeons"],
body[data-view="worldBoss"],
body[data-view="locations"] {
  --section-accent: var(--red);
}

body[data-view="tower"],
body[data-view="expeditions"],
body[data-view="quests"],
body[data-view="leaderboards"] {
  --section-accent: var(--green);
}

body[data-hp-state="low"] {
  --hp-accent: var(--orange);
}

body[data-hp-state="critical"] {
  --hp-accent: var(--red);
}

body.keyboard-compact {
  --bar-height: 74px;
}

body.keyboard-medium {
  --bar-height: 118px;
}

.setup-mode .top-panel,
.setup-mode .tabs,
.setup-mode .view,
.setup-mode .status-line {
  display: none;
}

.setup-panel {
  display: none;
  min-height: calc(100vh - 20px);
  align-content: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-mode .setup-panel {
  display: grid;
}

.development-mode .tabs,
.development-mode .primary-nav,
.development-mode .view {
  display: none;
}

.development-placeholder {
  display: none;
  min-height: calc(100svh - 280px);
  align-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.development-mode .development-placeholder {
  display: grid;
}

.development-placeholder strong {
  font-size: 24px;
}

.development-placeholder span {
  color: var(--muted);
}

.auth-error-mode .top-panel {
  grid-template-columns: 1fr;
  min-height: 92px;
  align-content: center;
}

.auth-error-mode .location-art,
.auth-error-mode .meters {
  display: none;
}

.auth-error-mode .hero-copy {
  align-content: center;
}

.auth-error-mode #locationName {
  color: var(--red);
}

.top-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  min-height: 104px;
  padding: 8px;
  border: 1px solid var(--hp-accent, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(226, 184, 100, 0.08), transparent 38%),
    rgba(20, 25, 32, 0.96);
  box-shadow: inset 0 2px 0 var(--section-accent, var(--gold)), var(--shadow-soft);
}

.location-art {
  width: 82px;
  height: 88px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.hero-copy {
  min-width: 0;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.eyebrow {
  margin: 1px 0 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.hero-status {
  justify-self: start;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid rgba(121, 185, 238, 0.24);
  border-radius: 999px;
  background: rgba(121, 185, 238, 0.1);
  color: #d8e9ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.meters div {
  position: relative;
  min-width: 0;
  padding: 7px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(29, 36, 48, 0.92);
  overflow: hidden;
}

.meters div::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  width: var(--meter-value, 100%);
  height: 2px;
  background: var(--line-strong);
  transition: width 0.2s ease;
}

.meters div:nth-child(1) {
  border-color: rgba(104, 194, 143, 0.24);
}

.meters div:nth-child(1)::after {
  background: var(--hp-accent, var(--green));
}

.meters div:nth-child(2) {
  border-color: rgba(226, 184, 100, 0.28);
}

.meters div:nth-child(2)::after {
  background: var(--gold);
}

.meters div:nth-child(3) {
  border-color: rgba(111, 169, 220, 0.26);
}

.meters div:nth-child(3)::after {
  background: var(--blue);
}

.meters span,
.stat span,
.tower-panel span,
.item-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.meters strong,
.stat strong,
.tower-panel strong {
  display: block;
  margin-top: 1px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.change-flash {
  --change-color: var(--green);
  animation: change-flash 1.35s ease-out both;
}

.change-flash[data-change-tone="down"] {
  --change-color: var(--red);
}

.meters div.change-flash,
.stat.change-flash,
.item-row.change-flash {
  border-color: color-mix(in srgb, var(--change-color) 58%, var(--line));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--change-color) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.meters div.change-flash {
  padding-right: 42px;
}

.stat.change-flash,
.item-row.change-flash {
  padding-right: 54px;
}

.meters div.change-flash::before,
.stat.change-flash::after,
.item-row.change-flash::after {
  content: attr(data-change-delta);
  position: absolute;
  top: 5px;
  right: 6px;
  z-index: 2;
  max-width: 48px;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--change-color) 48%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--change-color) 18%, rgba(10, 14, 20, 0.94));
  color: color-mix(in srgb, var(--change-color) 72%, white);
  font-size: 10px;
  font-weight: 860;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

@keyframes change-flash {
  0% {
    background-color: color-mix(in srgb, var(--change-color) 18%, transparent);
  }
  100% {
    background-color: transparent;
  }
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  animation: view-in 0.14s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.city-pane,
.overview-pane {
  display: none;
}

.city-pane.active,
.overview-pane.active {
  display: grid;
  gap: 9px;
}

.route-hidden,
.route-scoped-hidden {
  display: none !important;
}

.section-title,
.field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 16px 2px 1px;
  color: #91a0b2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.section-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  min-width: 24px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent);
}

.field-label {
  margin-top: 4px;
}

.route-prompt {
  grid-template-columns: 1fr;
  gap: 4px;
  min-height: 0;
  border-color: rgba(226, 184, 100, 0.28);
  background: linear-gradient(180deg, rgba(226, 184, 100, 0.1), rgba(29, 36, 48, 0.96));
}

.route-prompt strong {
  order: -1;
  max-width: none;
  color: #ffe2a3;
  text-align: left;
}

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

.stat,
.tower-panel,
.item-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-soft), transparent),
    rgba(22, 27, 34, 0.96);
}

.stat {
  min-height: 66px;
  padding: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.stat strong {
  font-size: 18px;
}

.tower-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.tower-panel strong {
  max-width: 220px;
  text-align: right;
}

.tower-panel:has(#selectedTitle) {
  grid-template-columns: auto minmax(0, 1fr);
}

.tower-panel:has(#selectedTitle) span {
  white-space: nowrap;
}

#selectedTitle {
  max-width: none;
  text-align: left;
  overflow-wrap: normal;
  word-break: normal;
}

#titleList .item-row {
  grid-template-columns: minmax(0, 1fr) minmax(88px, auto);
  align-items: center;
}

#titleList .item-row button {
  width: auto;
  min-width: 88px;
}

.list {
  display: grid;
  gap: 8px;
}

.item-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-height: 52px;
  padding: 11px 12px 11px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.item-row.has-thumb {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
}

.item-row.has-thumb .button-strip,
.item-row.has-thumb > button {
  grid-column: 1 / -1;
}

.item-thumb {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.item-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--surface-3);
}

.item-row[data-tone="ready"]::before {
  background: var(--green);
}

.item-row[data-tone="reward"]::before {
  background: var(--gold);
}

.item-row[data-tone="danger"]::before {
  background: var(--red);
}

.item-row[data-tone="muted"]::before {
  background: var(--faint);
}

.item-row[data-item-type="consumable"]::before {
  background: var(--green);
}

.item-row[data-item-type="weapon"]::before {
  background: var(--red);
}

.item-row[data-item-type="armor"]::before {
  background: var(--blue);
}

.item-row[data-item-type="jewelry"]::before {
  background: var(--violet);
}

.item-row[data-item-type="key"]::before {
  background: var(--gold);
}

.item-row[data-item-type="resource"]::before {
  background: var(--orange);
}

.rarity-badge {
  justify-self: start;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 1px 0 0;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--rarity-common) 48%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--rarity-common) 13%, transparent);
  color: #dbe2ea;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.rarity-badge[data-rarity="uncommon"],
.item-row[data-rarity="uncommon"],
.reward-chip[data-rarity="uncommon"] {
  --rarity-current: var(--rarity-uncommon);
}

.rarity-badge[data-rarity="rare"],
.item-row[data-rarity="rare"],
.reward-chip[data-rarity="rare"] {
  --rarity-current: var(--rarity-rare);
}

.rarity-badge[data-rarity="mystic"],
.item-row[data-rarity="mystic"],
.reward-chip[data-rarity="mystic"] {
  --rarity-current: var(--rarity-mystic);
}

.rarity-badge[data-rarity="legendary"],
.item-row[data-rarity="legendary"],
.reward-chip[data-rarity="legendary"] {
  --rarity-current: var(--rarity-legendary);
}

.rarity-badge[data-rarity="cursed"],
.item-row[data-rarity="cursed"],
.reward-chip[data-rarity="cursed"] {
  --rarity-current: var(--rarity-cursed);
}

.rarity-badge:not([data-rarity="common"]) {
  border-color: color-mix(in srgb, var(--rarity-current) 55%, transparent);
  background: color-mix(in srgb, var(--rarity-current) 14%, transparent);
  color: color-mix(in srgb, var(--rarity-current) 78%, white);
}

.item-row[data-rarity]:not([data-rarity="common"]) {
  border-color: color-mix(in srgb, var(--rarity-current) 42%, rgba(224, 233, 241, 0.1));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--rarity-current) 10%, transparent), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    rgba(15, 21, 29, 0.96);
}

.item-row[data-rarity]:not([data-rarity="common"])::before {
  background: var(--rarity-current);
}

.item-card,
.location-card,
.monster-card,
.reward-card,
.mail-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.monster-card {
  min-height: 92px;
  border-color: rgba(227, 111, 111, 0.34);
}

.monster-card.has-thumb {
  grid-template-columns: 58px minmax(0, 1fr);
}

.monster-card .monster-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
}

.reward-card {
  border-color: rgba(240, 188, 98, 0.32);
}

.reward-screen {
  min-height: 96px;
  background:
    linear-gradient(135deg, rgba(226, 184, 100, 0.12), rgba(111, 169, 220, 0.055)),
    rgba(18, 23, 32, 0.98);
}

.tower-log-row {
  min-height: 42px;
  border-color: rgba(111, 169, 220, 0.22);
  background:
    linear-gradient(135deg, rgba(111, 169, 220, 0.07), transparent 54%),
    rgba(11, 24, 39, 0.92);
}

.tower-log-row::before {
  background: var(--blue);
}

.tower-log-row[data-log-kind="critical"] {
  border-color: rgba(240, 188, 98, 0.45);
}

.tower-log-row[data-log-kind="critical"]::before {
  background: var(--gold);
}

.tower-log-row[data-log-kind="dodge"],
.tower-log-row[data-log-kind="transition"] {
  border-color: rgba(169, 139, 232, 0.38);
}

.tower-log-row[data-log-kind="dodge"]::before,
.tower-log-row[data-log-kind="transition"]::before {
  background: var(--violet);
}

.tower-log-row[data-log-kind="heal"],
.tower-log-row[data-log-kind="potion"] {
  border-color: rgba(104, 194, 143, 0.42);
}

.tower-log-row[data-log-kind="heal"]::before,
.tower-log-row[data-log-kind="potion"]::before {
  background: var(--green);
}

.tower-log-row[data-log-kind="defeat"] {
  border-color: rgba(227, 111, 111, 0.42);
}

.tower-log-row[data-log-kind="defeat"]::before {
  background: var(--red);
}

.reward-chip-grid {
  display: flex !important;
  flex-wrap: wrap;
  gap: 5px;
}

.reward-chip {
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--rarity-current, rgba(255, 255, 255, 0.09));
  border-radius: 999px;
  background: color-mix(in srgb, var(--rarity-current, #6fa9dc) 16%, transparent);
  color: var(--text);
  font-size: 11px;
  font-style: normal;
  font-weight: 780;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.reward-chip[data-rarity="common"] {
  color: var(--muted);
}

.tower-loot-card {
  min-height: 78px;
}

.tower-loot-card .item-main {
  gap: 7px;
}

.tower-loot-note {
  color: #c8d4df !important;
  font-size: 11px;
}

.tower-loot-card[data-tone="reward"] {
  border-color: rgba(240, 188, 98, 0.36);
  background:
    linear-gradient(135deg, rgba(240, 188, 98, 0.12), transparent 54%),
    rgba(15, 25, 36, 0.96);
}

.tower-loot-card[data-tone="ready"] {
  border-color: rgba(104, 194, 143, 0.34);
  background:
    linear-gradient(135deg, rgba(104, 194, 143, 0.1), transparent 54%),
    rgba(13, 27, 36, 0.96);
}

.dungeon-reward-card {
  min-height: 82px;
  border-color: rgba(240, 188, 98, 0.34);
  background:
    linear-gradient(135deg, rgba(240, 188, 98, 0.12), transparent 52%),
    rgba(15, 25, 36, 0.96);
}

.dungeon-reward-card .item-main {
  gap: 7px;
}

.dungeon-member-card {
  min-height: 68px;
}

.dungeon-member-card.is-leader::before {
  background: var(--gold);
}

.dungeon-member-card.is-current {
  border-color: rgba(104, 194, 143, 0.42);
}

.auction-detail-card {
  min-height: 92px;
  border-color: rgba(226, 184, 100, 0.34);
  background:
    linear-gradient(135deg, rgba(226, 184, 100, 0.11), transparent 54%),
    rgba(15, 25, 36, 0.96);
}

.auction-detail-card .item-main {
  gap: 7px;
}

.auction-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: -2px;
}

.mail-card[data-tone="reward"] {
  border-color: rgba(111, 169, 220, 0.36);
}

.item-row[data-powered="1"] {
  border-color: rgba(226, 184, 100, 0.26);
  background:
    linear-gradient(180deg, rgba(226, 184, 100, 0.055), transparent),
    rgba(22, 27, 34, 0.96);
}

.item-row.is-current,
.item-row.is-equipped {
  border-color: rgba(111, 169, 220, 0.42);
  background:
    linear-gradient(180deg, rgba(111, 169, 220, 0.08), transparent),
    rgba(22, 27, 34, 0.96);
}

.item-row.is-current::before,
.item-row.is-equipped::before {
  width: 4px;
  background: var(--blue);
}

.item-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.item-row > div,
.item-row strong {
  min-width: 0;
}

.item-row strong {
  font-size: 14px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.equipment-title-row .item-main strong {
  overflow-wrap: break-word;
  word-break: normal;
}

.item-count {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 6px;
  border: 1px solid rgba(226, 184, 100, 0.22);
  border-radius: 99px;
  background: rgba(226, 184, 100, 0.08);
  color: #ffe2a3;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  vertical-align: 1px;
}

.item-row em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.34;
  white-space: pre-line;
}

.item-row span {
  color: var(--muted);
  line-height: 1.34;
}

.meta-chips {
  display: flex !important;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 1px;
}

.meta-chips i {
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-row.is-empty {
  min-height: 64px;
  align-content: center;
  border-style: dashed;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.006)),
    rgba(12, 17, 24, 0.82);
}

.item-row.is-empty::before {
  width: 0;
}

.item-row.is-empty .item-main,
.item-row.is-empty > div:first-child {
  justify-items: center;
}

.skeleton-row {
  min-height: 54px;
  pointer-events: none;
}

.skeleton-row strong,
.skeleton-row span {
  display: block;
  width: 70%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.13), rgba(255,255,255,0.06));
  background-size: 220% 100%;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}

.skeleton-row span {
  width: 46%;
  height: 10px;
}

@keyframes skeleton-pulse {
  to {
    background-position: -220% 0;
  }
}

.item-row.is-empty.has-thumb {
  grid-template-columns: 30px minmax(0, auto);
  justify-content: center;
}

.item-row.is-empty.has-thumb .item-thumb {
  opacity: 0.62;
}

.item-row.is-empty strong {
  color: var(--muted);
}

.item-row.is-empty em:empty {
  display: none;
}

.item-row.is-passive {
  min-height: 50px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.item-row.is-passive .item-main,
.item-row.is-passive > div:first-child {
  gap: 4px;
}

.profession-row > div {
  width: 100%;
}

.profession-row[role="button"] {
  cursor: pointer;
}

#professions .hub-card,
#professions .item-row {
  border-color: var(--mca-border);
}

#professions .hub-card::before,
#professions .item-row::before,
#professions .item-row[data-tone]::before {
  background: var(--section-accent, var(--blue));
}

.progress {
  width: 100%;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--gold));
}

.mini-bar {
  width: 100%;
  height: 8px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-bar i {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.18s ease;
}

.mini-bar[data-tone="danger"] i {
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.mini-bar[data-tone="warning"] i {
  background: linear-gradient(90deg, var(--orange), var(--gold));
}

.mini-bar[data-tone="ready"] i {
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.text-input,
.mini-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 16, 22, 0.96);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.text-input {
  padding: 0 12px;
}

.mini-input {
  min-height: 38px;
  padding: 0 8px;
}

.button-strip .mini-input {
  min-width: 0;
  min-height: 38px;
  text-align: center;
  font-weight: 760;
}

.button-strip .mini-input::placeholder {
  text-align: center;
}

.auction-sale-preview {
  grid-column: 1 / -1;
  min-height: 24px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
  line-height: 1.25;
  text-align: center;
}

.text-input::placeholder,
.mini-input::placeholder {
  color: rgba(154, 164, 175, 0.72);
}

.text-input:focus,
.mini-input:focus {
  border-color: rgba(226, 184, 100, 0.74);
  box-shadow: 0 0 0 3px rgba(226, 184, 100, 0.1);
  background: #111720;
}

.list-filter {
  position: sticky;
  top: 118px;
  z-index: 8;
  margin: 0 0 2px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.inventory-toolbar {
  position: sticky;
  top: 70px;
  z-index: 9;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  background: rgba(14, 19, 27, 0.96);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-select {
  min-height: 38px;
  padding: 0 10px;
}

.segmented,
.action-grid,
.tower-actions,
.button-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.button-strip {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 7px;
}

.compose-grid input:nth-child(4) {
  grid-column: 1 / -1;
}

.primary-action,
.segmented button,
.action-card,
.tower-actions button,
.compose-grid button,
.item-row button {
  min-width: 0;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #263041, #1b222e);
  color: var(--text);
  font-weight: 760;
  line-height: 1.18;
  overflow-wrap: anywhere;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.action-card,
.tower-actions button,
.compose-grid button {
  min-height: 44px;
}

button[data-intent="primary"] {
  border-color: rgba(111, 169, 220, 0.36);
}

button[data-intent="reward"] {
  border-color: rgba(226, 184, 100, 0.48);
  color: #ffe2a3;
}

button[data-intent="danger"] {
  border-color: rgba(227, 111, 111, 0.42);
}

button[data-intent="warning"] {
  border-color: rgba(229, 141, 88, 0.44);
}

button[data-intent="secondary"] {
  color: var(--muted);
}

.primary-action,
.segmented button.active {
  border-color: rgba(226, 184, 100, 0.72);
  background: linear-gradient(180deg, #413621, #31291d);
  color: #ffe2a3;
}

.item-row button {
  width: 100%;
}

.button-strip button:last-child:nth-child(odd),
.tower-actions button:last-child:nth-child(odd),
.action-grid button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

.tabs {
  position: fixed;
  left: 50%;
  bottom: calc(var(--telegram-footer-height) + env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 7px;
  width: min(calc(100vw - 16px), 720px);
  height: var(--bar-height);
  max-height: var(--bar-height);
  margin: 0;
  padding: 12px 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 16, 21, 0.97);
  box-shadow: inset 0 2px 0 var(--section-accent, var(--gold)), 0 -12px 38px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  scrollbar-width: none;
}

.tabs.is-empty {
  display: none;
}

.tabs.is-dense {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  --dense-tab-height: 34px;
}

.tabs.is-compact {
  height: 74px;
  max-height: 74px;
  align-content: start;
}

.tabs.is-medium {
  height: 118px;
  max-height: 118px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  min-height: var(--dense-tab-height, 38px);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), #1b222d);
  color: var(--text);
  font-weight: 780;
  line-height: 1.12;
  white-space: normal;
  overflow-wrap: anywhere;
}

.tab-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-bottom: 1px;
}

.tab-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tabs.is-dense .tab {
  font-size: 12px;
}

.tabs.is-dense .tab::before {
  width: 13px;
  margin-bottom: 3px;
}

.tab::before {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto 5px;
  border-radius: 99px;
  background: var(--faint);
  opacity: 0.82;
}

.tab[data-section="home"]::before {
  background: var(--gold);
}

.tab[data-section="hero"]::before {
  background: var(--blue);
}

.tab[data-section="city"]::before {
  background: var(--violet);
}

.tab[data-section="combat"]::before {
  background: var(--red);
}

.tab[data-section="progress"]::before {
  background: var(--green);
}

.tab[data-wide] {
  grid-column: span 2;
}

.tab[data-wide]:only-child {
  grid-column: 1 / -1;
}

.tab.active {
  border-color: rgba(226, 184, 100, 0.64);
  background: linear-gradient(180deg, #413621, #31291d);
  color: #ffe2a3;
  box-shadow: inset 0 1px 0 rgba(255, 226, 163, 0.1), 0 0 0 1px rgba(226, 184, 100, 0.08);
}

.status-line {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-height) + var(--telegram-footer-height) + max(8px, env(safe-area-inset-bottom)));
  z-index: 21;
  width: max-content;
  max-width: calc(100% - 24px);
  min-height: 24px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(13, 16, 21, 0.92);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
}

.status-line:empty {
  display: none;
}

body.is-busy .status-line:not(:empty)::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border: 2px solid rgba(226, 184, 100, 0.26);
  border-top-color: var(--gold);
  border-radius: 99px;
  vertical-align: -1px;
  animation: spin 0.72s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (hover: hover) {
  button:not(:disabled):hover {
    border-color: var(--line-strong);
    background: var(--surface-3);
  }

  .item-row:hover,
  .tower-panel:hover,
  .stat:hover {
    border-color: var(--line-strong);
  }
}

@media (min-width: 680px) {
  .view.active {
    gap: 11px;
  }

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

  .item-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .item-row.has-thumb {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .item-row.has-thumb .button-strip,
  .item-row.has-thumb > button {
    grid-column: auto;
  }

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

  .tabs.is-dense {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .item-row .button-strip {
    min-width: 244px;
  }
}

@media (max-width: 430px) {
  body {
    font-size: 13px;
  }

  .app-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .top-panel {
    grid-template-columns: 72px minmax(0, 1fr);
    min-height: 96px;
    gap: 8px;
  }

  .location-art {
    width: 72px;
    height: 80px;
  }

  h1 {
    font-size: 20px;
  }

  .meters div {
    padding: 6px 5px;
  }

  .list-filter {
    top: 108px;
  }

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

  .auction-filter-bar {
    grid-template-columns: 1fr;
  }

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

  .stat {
    min-height: 58px;
    padding: 9px;
  }

  .stat strong {
    font-size: 16px;
  }

  .compose-grid input:nth-child(4) {
    grid-column: auto;
  }

  .tower-panel {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .tower-panel strong {
    max-width: none;
    text-align: left;
  }

  .tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100vw - 12px);
    height: var(--bar-height);
    max-height: var(--bar-height);
    padding: 12px 9px;
    bottom: calc(var(--telegram-footer-height) + env(safe-area-inset-bottom));
  }

  .tabs.is-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab[data-wide] {
    grid-column: 1 / -1;
  }

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

/* 2026 UI refresh: app-like shell, compact game surfaces, contextual action dock. */
:root {
  --bg: #090d12;
  --surface: #121922;
  --surface-2: #182230;
  --surface-3: #223044;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --text: #f6f1e7;
  --muted: #aeb8c4;
  --faint: #738194;
  --line: rgba(209, 224, 238, 0.11);
  --line-strong: rgba(224, 233, 241, 0.22);
  --gold: #f0bc62;
  --green: #6fd19a;
  --red: #ee766f;
  --blue: #79b9ee;
  --violet: #b48af0;
  --orange: #ee985f;
  --ink: rgba(7, 10, 14, 0.86);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.24);
  --radius: 8px;
  --bar-height: 138px;
}

body {
  background:
    linear-gradient(180deg, rgba(121, 185, 238, 0.1), transparent 210px),
    linear-gradient(135deg, #0c1219 0%, #080c11 52%, #100e12 100%);
}

.app-shell {
  width: min(100%, 760px);
  padding: max(8px, env(safe-area-inset-top)) 10px calc(var(--bar-height) + var(--telegram-footer-height) + max(16px, env(safe-area-inset-bottom)));
}

body.keyboard-empty,
body.keyboard-empty .app-shell {
  --bar-height: 0px;
  padding-bottom: calc(var(--telegram-footer-height) + max(16px, env(safe-area-inset-bottom)));
}

.setup-mode .primary-nav,
.setup-mode .top-panel,
.setup-mode .tabs,
.setup-mode .view,
.setup-mode .status-line {
  display: none;
}

body[data-route="battleRoot"] .top-panel,
body[data-route="battleRoot"] .primary-nav,
body.location-battle-active[data-view="locations"] .top-panel,
body.location-battle-active[data-view="locations"] .primary-nav {
  display: none;
}

body.location-battle-active[data-view="locations"] .route-prompt {
  display: none;
}

body[data-route="equipmentRoot"] #inventoryToolbar,
body[data-route^="equipmentSlot:"] #inventoryToolbar,
body[data-route^="equipmentItem:"] #inventoryToolbar,
body[data-route^="inventory"] #inventoryToolbar,
body[data-route="titleRoot"] #inventoryToolbar {
  display: none !important;
}

.top-panel {
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 98px;
  border-color: rgba(121, 185, 238, 0.18);
  background:
    linear-gradient(135deg, rgba(121, 185, 238, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(28, 39, 52, 0.98), rgba(13, 18, 25, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-soft);
}

.location-art {
  width: 76px;
  height: 82px;
  border-color: rgba(240, 188, 98, 0.28);
}

.eyebrow {
  color: var(--blue);
}

h1 {
  font-size: 22px;
}

.meters {
  gap: 7px;
}

.meters div {
  min-height: 45px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 17, 0.54);
}

.primary-nav {
  position: sticky;
  top: 112px;
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 4px;
  padding: 6px;
  border: 1px solid rgba(121, 185, 238, 0.16);
  border-radius: var(--radius);
  background: rgba(9, 13, 18, 0.9);
  box-shadow: var(--shadow-soft);
}

.primary-nav button {
  min-width: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 820;
  line-height: 1.1;
}

.primary-nav button.active {
  border-color: rgba(240, 188, 98, 0.44);
  background: linear-gradient(180deg, rgba(240, 188, 98, 0.17), rgba(240, 188, 98, 0.07));
  color: #ffe0a4;
}

.view.active {
  gap: 12px;
  padding-top: 8px;
}

.route-prompt {
  min-height: 48px;
  border-color: rgba(121, 185, 238, 0.18);
  background: linear-gradient(180deg, rgba(121, 185, 238, 0.08), rgba(18, 25, 34, 0.9));
}

.route-prompt strong {
  color: var(--text);
}

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

.hub-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 74px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(224, 233, 241, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    rgba(15, 21, 29, 0.94);
  color: var(--text);
  text-align: left;
}

.hub-card.no-icon {
  grid-template-columns: minmax(0, 1fr);
}

.hub-card.recommended-card {
  grid-column: 1 / -1;
  min-height: 76px;
  border-color: rgba(240, 188, 98, 0.42);
  background:
    linear-gradient(135deg, rgba(240, 188, 98, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(121, 185, 238, 0.09), rgba(255, 255, 255, 0.012)),
    rgba(18, 24, 34, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 30px rgba(0, 0, 0, 0.22);
}

.hub-card.recommended-card strong {
  overflow-wrap: break-word;
  word-break: normal;
}

.hub-card.recommended-card em {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hub-card.recommended-card::after {
  content: attr(data-badge);
  position: absolute;
  inset: 9px 9px auto auto;
  padding: 2px 7px;
  border: 1px solid rgba(240, 188, 98, 0.35);
  border-radius: 999px;
  background: rgba(240, 188, 98, 0.12);
  color: #ffe0a4;
  font-size: 10px;
  font-weight: 800;
}

.hub-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--blue);
}

.hub-card[data-tone="reward"]::before {
  background: var(--gold);
}

.hub-card[data-tone="ready"]::before {
  background: var(--green);
}

.hub-card[data-tone="danger"]::before {
  background: var(--red);
}

.hub-card.active {
  border-color: rgba(240, 188, 98, 0.56);
  background:
    linear-gradient(180deg, rgba(240, 188, 98, 0.11), rgba(255, 255, 255, 0.01)),
    rgba(15, 21, 29, 0.96);
}

.hub-card.active::after {
  content: "";
  position: absolute;
  inset: 8px 8px auto auto;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 188, 98, 0.12);
}

.hub-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.hub-card span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.hub-card strong {
  font-size: 14px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.hub-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

body[data-route="profile"] .app-shell {
  width: min(100%, 1120px);
}

body[data-route="profile"] .profile-hub {
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 10px;
}

body[data-route="profile"] .profile-hub .hub-card {
  min-height: 92px;
  padding: 14px;
  border-color: rgba(111, 169, 220, 0.2);
  background:
    linear-gradient(135deg, rgba(111, 169, 220, 0.12), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.01)),
    rgba(13, 27, 45, 0.96);
}

body[data-route="profile"] .profile-hub .hub-icon {
  width: 44px;
  height: 44px;
}

body[data-route="profile"] .profile-hub .hub-card strong {
  font-size: 16px;
}

body[data-route="profile"] .profile-hub .hub-card em {
  font-size: 13px;
}

body[data-route="profile"] #statsGrid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

body[data-route="profile"] .stat {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 84px;
  padding: 13px;
  border-color: rgba(111, 169, 220, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(111, 169, 220, 0.11), transparent 56%),
    rgba(13, 27, 45, 0.96);
}

body[data-route="profile"] .stat-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22));
}

body[data-route="profile"] .stat strong {
  font-size: 18px;
  line-height: 1.2;
}

body[data-route="profile"] #activeBuffList .item-row.is-empty {
  min-height: 72px;
  border-color: rgba(111, 169, 220, 0.2);
  background: rgba(8, 22, 38, 0.62);
}

body[data-route="profile"] .action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body[data-route="profile"] .action-card {
  min-height: 54px;
  border-color: rgba(111, 169, 220, 0.28);
  background: linear-gradient(180deg, rgba(32, 112, 215, 0.78), rgba(22, 76, 152, 0.88));
  color: #eef6ff;
  font-size: 15px;
}

body[data-route="profile"] .action-card[data-action="close"] {
  border-color: rgba(169, 139, 232, 0.34);
  background: linear-gradient(180deg, rgba(127, 76, 211, 0.78), rgba(68, 45, 132, 0.92));
}

.section-title {
  margin-top: 14px;
  color: #bcc7d4;
  letter-spacing: 0.02em;
}

.route-control-strip {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 2px 0 0;
  min-width: 0;
}

.route-control-strip button {
  min-height: 34px;
  min-width: 92px;
  padding: 0 13px;
  border: 1px solid rgba(224, 233, 241, 0.13);
  border-radius: 7px;
  color: var(--text);
  background: linear-gradient(180deg, #1d2938, #141c27);
  font: inherit;
  font-weight: 820;
}

.route-context-label {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-grid {
  gap: 7px;
}

.stat,
.tower-panel,
.item-row {
  border-color: rgba(224, 233, 241, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    rgba(15, 21, 29, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.stat {
  min-height: 62px;
  padding: 10px;
}

.stat strong {
  font-size: 17px;
}

.stat {
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--faint);
}

.stat[data-stat="danger"]::before {
  background: var(--red);
}

.stat[data-stat="ready"]::before {
  background: var(--green);
}

.stat[data-stat="reward"]::before {
  background: var(--gold);
}

.stat[data-stat="focus"]::before {
  background: var(--blue);
}

.stat[data-stat="orange"]::before {
  background: var(--orange);
}

.stat[data-stat="blue"]::before,
.stat[data-stat="status-resting"]::before {
  background: var(--blue);
}

.stat[data-stat="green"]::before,
.stat[data-stat="status-free"]::before {
  background: var(--green);
}

.stat[data-stat="violet"]::before {
  background: var(--violet);
}

.stat[data-stat="yellow"]::before {
  background: var(--gold);
}

.stat[data-stat="status-busy"]::before {
  background: var(--red);
}

.tower-panel {
  min-height: 54px;
  padding: 11px 12px;
}

.list {
  gap: 7px;
}

.item-row {
  min-height: 56px;
  padding: 11px 12px 11px 15px;
}

.item-row strong {
  font-size: 14px;
}

.item-thumb {
  width: 32px;
  height: 32px;
  background: rgba(121, 185, 238, 0.08);
}

.meta-chips i {
  border-radius: 6px;
  background: rgba(121, 185, 238, 0.07);
}

.item-row.is-current,
.item-row.is-equipped {
  border-color: rgba(121, 185, 238, 0.45);
  background:
    linear-gradient(180deg, rgba(121, 185, 238, 0.1), rgba(255, 255, 255, 0.01)),
    rgba(15, 21, 29, 0.96);
}

.item-row.is-actionable {
  cursor: pointer;
}

.item-row.is-actionable:hover {
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 48%, rgba(224, 233, 241, 0.14));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--section-accent, var(--blue)) 10%, transparent), rgba(255, 255, 255, 0.01)),
    rgba(17, 25, 35, 0.98);
}

.item-row.is-actionable:active {
  transform: translateY(1px);
}

.item-row.is-current strong::after {
  content: "Текущий";
  display: inline-flex;
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 5px;
  color: #09111b;
  background: rgba(121, 185, 238, 0.9);
  font-size: 10px;
  line-height: 1;
  vertical-align: 2px;
}

.item-row.is-equipped strong::after {
  content: "Надето";
  display: inline-flex;
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 5px;
  color: #09111b;
  background: rgba(121, 185, 238, 0.9);
  font-size: 10px;
  line-height: 1;
  vertical-align: 2px;
}

body[data-route="equipmentRoot"] .item-row.is-current strong::after,
body[data-route="equipmentRoot"] .item-row.is-equipped strong::after,
body[data-route^="equipmentSlot:"] .item-row.is-current strong::after,
body[data-route^="equipmentSlot:"] .item-row.is-equipped strong::after,
body[data-route^="equipmentItem:"] .item-row.is-current strong::after,
body[data-route^="equipmentItem:"] .item-row.is-equipped strong::after,
body[data-route="titleRoot"] .item-row.is-current strong::after,
body[data-route="titleRoot"] .item-row.is-equipped strong::after {
  content: none;
  display: none;
}

.item-row[data-powered="1"] {
  border-color: rgba(240, 188, 98, 0.34);
  background:
    linear-gradient(180deg, rgba(240, 188, 98, 0.08), rgba(255, 255, 255, 0.01)),
    rgba(15, 21, 29, 0.96);
}

body[data-route="equipmentRoot"] #equipmentSlotList {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row {
  min-height: 118px;
  align-content: space-between;
  grid-template-columns: minmax(0, 1fr);
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row.has-thumb {
  grid-template-columns: 34px minmax(0, 1fr);
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row.has-thumb .button-strip,
body[data-route="equipmentRoot"] #equipmentSlotList .item-row.has-thumb > button {
  grid-column: 1 / -1;
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row button {
  min-height: 34px;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equipment-title-row {
  grid-column: 1 / -1;
  min-height: 76px;
  cursor: pointer;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equipment-title-row:focus-visible {
  outline: 2px solid rgba(121, 185, 238, 0.72);
  outline-offset: 2px;
}

body[data-route^="equipmentSlot:"] #equipmentSlotList .item-row:first-child,
body[data-route^="equipmentItem:"] #equipmentSlotList .item-row:first-child {
  min-height: 82px;
}

body[data-route^="craftingRecipe:"] #craftingAvailableList,
body[data-route^="collectionDetail:"] #collectionBaseList,
body[data-route^="marketBuyItem:"] #marketBuyList,
body[data-route^="marketSellItemConfirm:"] #marketSellItemList,
body[data-route^="marketSellResourceConfirm:"] #marketSellResourceList,
body[data-route^="marketSalvageItem:"] #marketSalvageList,
body[data-route^="cityAlchemistItem:"] #alchemistList,
body[data-route^="towerOffer:"] #towerMerchant,
body[data-route^="enchantingItem:"] #enchantingItemList,
body[data-route^="mailComposeItem:"] #mailAttachItemList,
body[data-route^="mailComposeResource:"] #mailAttachResourceList,
body[data-route^="auctionBuyListing:"] #auctionActiveList,
body[data-route^="auctionCancelListing:"] #auctionMineList,
body[data-route^="mailOpen:"] #mailInboxList {
  max-width: 760px;
  margin: 0 auto;
}

body[data-route^="craftingRecipe:"] #craftingAvailableList .item-row,
body[data-route^="collectionDetail:"] #collectionBaseList .item-row,
body[data-route^="marketBuyItem:"] #marketBuyList .item-row,
body[data-route^="marketSellItemConfirm:"] #marketSellItemList .item-row,
body[data-route^="marketSellResourceConfirm:"] #marketSellResourceList .item-row,
body[data-route^="marketSalvageItem:"] #marketSalvageList .item-row,
body[data-route^="cityAlchemistItem:"] #alchemistList .item-row,
body[data-route^="towerOffer:"] #towerMerchant .item-row,
body[data-route^="enchantingItem:"] #enchantingItemList .item-row,
body[data-route^="mailComposeItem:"] #mailAttachItemList .item-row,
body[data-route^="mailComposeResource:"] #mailAttachResourceList .item-row,
body[data-route^="auctionBuyListing:"] #auctionActiveList .item-row,
body[data-route^="auctionCancelListing:"] #auctionMineList .item-row,
body[data-route^="mailOpen:"] #mailInboxList .item-row {
  min-height: 96px;
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 58%, rgba(224, 233, 241, 0.15));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 18%, transparent), transparent 48%),
    linear-gradient(180deg, rgba(30, 42, 57, 0.98), rgba(16, 23, 32, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

body[data-route^="inventory"] #inventoryList .item-row,
body[data-route^="equipmentSlot:"] #equipmentSlotList .item-row,
body[data-route^="equipmentItem:"] #equipmentSlotList .item-row {
  border-radius: 7px;
}

body[data-route="inventoryRoot"] .inventory-hub {
  margin-bottom: 2px;
}

body[data-route="battleRoot"] #exploreResultList .item-row:first-child,
body[data-route="chestRoot"] #exploreResultList .item-row:first-child,
body[data-route="explore"] #exploreResultList .item-row:first-child {
  min-height: 86px;
  border-color: rgba(238, 118, 111, 0.28);
  background:
    linear-gradient(135deg, rgba(238, 118, 111, 0.09), transparent 44%),
    rgba(15, 21, 29, 0.96);
}

body[data-route="chestRoot"] #exploreResultList .item-row:first-child {
  border-color: rgba(240, 188, 98, 0.34);
  background:
    linear-gradient(135deg, rgba(240, 188, 98, 0.11), transparent 44%),
    rgba(15, 21, 29, 0.96);
}

.text-input,
.mini-input {
  border-color: rgba(224, 233, 241, 0.12);
  background: rgba(6, 9, 13, 0.88);
}

.list-filter {
  top: 164px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.primary-action,
.segmented button,
.action-card,
.route-control-strip button,
.tower-actions button,
.compose-grid button,
.item-row button {
  border-color: rgba(224, 233, 241, 0.13);
  border-radius: 7px;
  background: linear-gradient(180deg, #243244, #182230);
  font-weight: 820;
}

.item-row button {
  min-height: 38px;
}

.tabs {
  gap: 8px;
  height: var(--bar-height);
  padding: 10px;
  border-color: rgba(121, 185, 238, 0.2);
  background: rgba(7, 10, 14, 0.96);
  box-shadow: inset 0 2px 0 var(--section-accent, var(--blue)), 0 -14px 40px rgba(0, 0, 0, 0.45);
}

.tab {
  min-height: var(--dense-tab-height, 40px);
  border-radius: 7px;
  border-color: rgba(224, 233, 241, 0.12);
  background: linear-gradient(180deg, #1d2938, #141c27);
}

.tab::before {
  width: 16px;
  height: 2px;
  margin-bottom: 4px;
}

.tab.active {
  border-color: rgba(240, 188, 98, 0.62);
  background: linear-gradient(180deg, rgba(240, 188, 98, 0.2), rgba(240, 188, 98, 0.08));
}

.status-line {
  border-color: rgba(121, 185, 238, 0.22);
  background: rgba(7, 10, 14, 0.92);
}

@media (min-width: 680px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .view.active {
    gap: 12px;
  }

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

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

  body[data-route="equipmentRoot"] #equipmentSlotList {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  :root {
    --bar-height: 132px;
  }

  .top-panel {
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 88px;
  }

  .location-art {
    width: 64px;
    height: 72px;
  }

  h1 {
    font-size: 19px;
  }

  .primary-nav {
    top: 100px;
    gap: 4px;
    padding: 5px;
  }

  .primary-nav button {
    min-height: 34px;
    padding: 0 3px;
    font-size: 12px;
  }

  .list-filter {
    top: 146px;
  }

  body[data-route="equipmentRoot"] #equipmentSlotList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-route="equipmentRoot"] #equipmentSlotList .item-row {
    min-height: 108px;
  }
}

/* Unified MythCoreArena theme layer */
:root {
  --mca-bg-0: #06101b;
  --mca-bg-1: #091827;
  --mca-bg-2: #0e2238;
  --mca-card: rgba(12, 27, 45, 0.94);
  --mca-card-strong: rgba(15, 34, 56, 0.98);
  --mca-card-soft: rgba(111, 169, 220, 0.075);
  --mca-border: rgba(111, 169, 220, 0.18);
  --mca-border-strong: rgba(111, 169, 220, 0.34);
  --mca-glow: 0 16px 38px rgba(0, 0, 0, 0.3);
  --mca-inner: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body {
  background:
    radial-gradient(circle at 50% -8%, color-mix(in srgb, var(--section-accent, var(--blue)) 24%, transparent), transparent 30rem),
    radial-gradient(circle at 100% 18%, rgba(169, 139, 232, 0.11), transparent 24rem),
    linear-gradient(180deg, #0b1b2c 0%, var(--mca-bg-0) 56%, #050911 100%);
}

.app-shell {
  width: min(100%, 1120px);
}

.top-panel,
.primary-nav,
.view.active,
.setup-panel,
.development-placeholder,
.status-line {
  border-color: var(--mca-border);
}

.top-panel {
  background:
    radial-gradient(circle at 86% 6%, color-mix(in srgb, var(--section-accent, var(--blue)) 20%, transparent), transparent 26%),
    linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 12%, transparent), transparent 54%),
    var(--mca-card-strong);
  box-shadow: var(--mca-inner), var(--mca-glow);
}

.location-art,
.item-thumb,
.hub-icon,
.stat-icon {
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.26));
}

.primary-nav {
  border: 1px solid var(--mca-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.006)),
    rgba(7, 18, 31, 0.82);
  box-shadow: var(--mca-inner);
}

.primary-nav button {
  color: #93a6ba;
}

.primary-nav button.active {
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 58%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--section-accent, var(--blue)) 28%, transparent), rgba(255, 255, 255, 0.02)),
    rgba(13, 34, 59, 0.95);
  color: #eef6ff;
}

.section-title {
  display: grid;
  grid-template-columns: auto minmax(28px, 1fr);
  align-items: center;
  gap: 10px;
  color: #eef4fb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-title::after {
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--section-accent, var(--blue)) 42%, transparent), transparent);
}

.hub-card,
.stat,
.tower-panel,
.item-row,
.route-prompt,
.inventory-toolbar,
.text-input,
.mini-input,
.compose-grid input {
  border-color: var(--mca-border);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 10%, transparent), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008)),
    var(--mca-card);
  box-shadow: var(--mca-inner);
}

.hub-card,
.item-row,
.stat,
.tower-panel {
  border-radius: 8px;
}

.hub-card::before,
.item-row::before,
.stat::before {
  background: var(--section-accent, var(--blue));
}

.hub-card[data-tone="reward"]::before,
.item-row[data-tone="reward"]::before,
.stat[data-stat="reward"]::before {
  background: var(--gold);
}

.hub-card[data-tone="ready"]::before,
.item-row[data-tone="ready"]::before,
.stat[data-stat="ready"]::before {
  background: var(--green);
}

.hub-card[data-tone="danger"]::before,
.item-row[data-tone="danger"]::before,
.stat[data-stat="danger"]::before {
  background: var(--red);
}

.hub-card.active,
.item-row.is-current,
.item-row.is-equipped {
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 55%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 18%, transparent), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.01)),
    var(--mca-card-strong);
}

.hub-card strong,
.item-row strong,
.tower-panel strong,
.stat strong {
  color: #f7fbff;
}

.hub-card em,
.item-row em,
.item-row span,
.tower-panel span,
.stat span,
.meters span {
  color: #9eb0c3;
}

.meta-chips i,
.rarity-badge,
.hero-status {
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 28%, transparent);
  background: color-mix(in srgb, var(--section-accent, var(--blue)) 12%, transparent);
}

.primary-action,
.segmented button,
.action-card,
.route-control-strip button,
.tower-actions button,
.compose-grid button,
.item-row button,
.button-strip button {
  border-color: rgba(111, 169, 220, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.012)),
    linear-gradient(180deg, color-mix(in srgb, var(--section-accent, var(--blue)) 26%, #1a2635), #162131);
  color: #eef6ff;
  box-shadow: var(--mca-inner);
}

button[data-intent="reward"],
.action-card[data-action="close"] {
  border-color: rgba(226, 184, 100, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    linear-gradient(180deg, rgba(126, 84, 205, 0.78), rgba(59, 45, 122, 0.95));
  color: #fff0ff;
}

button[data-intent="danger"] {
  border-color: rgba(227, 111, 111, 0.46);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(122, 49, 57, 0.92), rgba(63, 31, 38, 0.98));
}

button[data-intent="secondary"] {
  background: linear-gradient(180deg, #1c2a3b, #111b28);
  color: #aebdcb;
}

.text-input:focus,
.mini-input:focus {
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 66%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--section-accent, var(--blue)) 14%, transparent);
}

.item-row.is-empty,
.skeleton-row {
  border-color: rgba(111, 169, 220, 0.17);
  background:
    linear-gradient(135deg, rgba(111, 169, 220, 0.06), transparent 52%),
    rgba(7, 19, 32, 0.74);
}

.tabs,
.status-line {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.006)),
    rgba(5, 12, 21, 0.96);
}

.tab {
  border-color: rgba(111, 169, 220, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(15, 30, 48, 0.94);
}

.tab.active {
  border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 58%, rgba(226, 184, 100, 0.28));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--section-accent, var(--blue)) 24%, transparent), rgba(255, 255, 255, 0.012)),
    rgba(17, 39, 64, 0.96);
  color: #f6fbff;
}

@media (hover: hover) {
  .hub-card:hover,
  .item-row:hover,
  .tower-panel:hover,
  .stat:hover {
    border-color: color-mix(in srgb, var(--section-accent, var(--blue)) 46%, rgba(224, 233, 241, 0.14));
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 14%, transparent), transparent 56%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.01)),
      var(--mca-card-strong);
  }
}

@media (max-width: 430px) {
  .app-shell {
    width: 100%;
  }

  body[data-route="profile"] .profile-hub,
  body[data-route="profile"] #statsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Header consistency: one chrome for every route. */
.top-panel {
  position: sticky;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  min-height: 104px;
  padding: 8px;
}

.location-art {
  width: 82px;
  height: 88px;
  border-radius: 7px;
}

body[data-route="profile"] .profile-hub .hub-card,
body[data-route^="inventory"] .inventory-hub .hub-card,
body[data-route="changeLocation"] .path-hub .hub-card,
body[data-route="changeLocationRegions"] .path-hub .hub-card,
body[data-route="explore"] .path-hub .hub-card {
  min-height: 74px;
  padding: 10px;
}

body[data-route="profile"] .profile-hub .hub-icon,
body[data-route^="inventory"] .inventory-hub .hub-icon,
body[data-route="changeLocation"] .path-hub .hub-icon,
body[data-route="changeLocationRegions"] .path-hub .hub-icon,
body[data-route="explore"] .path-hub .hub-icon {
  width: 32px;
  height: 32px;
}

body[data-route="profile"] .profile-hub .hub-card strong,
body[data-route^="inventory"] .inventory-hub .hub-card strong,
body[data-route="changeLocation"] .path-hub .hub-card strong,
body[data-route="changeLocationRegions"] .path-hub .hub-card strong,
body[data-route="explore"] .path-hub .hub-card strong {
  font-size: 14px;
}

body[data-route="profile"] .profile-hub .hub-card em,
body[data-route^="inventory"] .inventory-hub .hub-card em,
body[data-route="changeLocation"] .path-hub .hub-card em,
body[data-route="changeLocationRegions"] .path-hub .hub-card em,
body[data-route="explore"] .path-hub .hub-card em {
  font-size: 11px;
}

@media (min-width: 680px) {
  .top-panel {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 14px;
    min-height: 174px;
    padding: 14px;
  }

  .location-art {
    width: 118px;
    height: 146px;
  }

  body[data-route="profile"] .profile-hub .hub-card {
    min-height: 92px;
    padding: 14px;
  }

  body[data-route="profile"] .profile-hub .hub-icon {
    width: 44px;
    height: 44px;
  }

  body[data-route="profile"] .profile-hub .hub-card strong {
    font-size: 16px;
  }

  body[data-route="profile"] .profile-hub .hub-card em {
    font-size: 13px;
  }
}

/* Main tab card unification: hero, equipment, bag and path use the same rhythm. */
body[data-route="equipmentRoot"] #equipmentSlotList {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row,
body[data-route="profile"] .profile-hub .hub-card,
body[data-route^="inventory"] .inventory-hub .hub-card,
body[data-route="changeLocation"] .path-hub .hub-card,
body[data-route="changeLocationRegions"] .path-hub .hub-card,
body[data-route="explore"] .path-hub .hub-card {
  min-height: 74px;
  padding: 10px;
  border-color: var(--mca-border);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 10%, transparent), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008)),
    var(--mca-card);
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row.has-thumb {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  align-content: center;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equip-slot-card {
  cursor: pointer;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equipment-title-row {
  grid-column: 1 / -1;
  min-height: 74px;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equipment-title-row.has-thumb {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equipment-title-row > button {
  grid-column: 1 / -1;
  width: 100%;
}

body[data-route="equipmentRoot"] #equipmentSlotList .equipment-title-row .title-thumb {
  display: block;
  background:
    linear-gradient(135deg, rgba(121, 185, 238, 0.14), rgba(121, 185, 238, 0.04)),
    rgba(121, 185, 238, 0.08);
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-main {
  justify-items: start;
  text-align: left;
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row strong {
  font-size: 14px;
  line-height: 1.18;
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-row em {
  display: -webkit-box;
  max-height: 32px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

body[data-route="equipmentRoot"] #equipmentSlotList .item-thumb,
body[data-route="profile"] .profile-hub .hub-icon,
body[data-route^="inventory"] .inventory-hub .hub-icon,
body[data-route="changeLocation"] .path-hub .hub-icon,
body[data-route="changeLocationRegions"] .path-hub .hub-icon,
body[data-route="explore"] .path-hub .hub-icon {
  width: 32px;
  height: 32px;
}

body[data-route="equipmentRoot"] #equipmentSlotList .meta-chips {
  display: none !important;
}

@media (min-width: 680px) {
  body[data-route="equipmentRoot"] #equipmentSlotList,
  body[data-route="profile"] .profile-hub,
  body[data-route^="inventory"] .inventory-hub,
  body[data-route="changeLocation"] .path-hub,
  body[data-route="changeLocationRegions"] .path-hub,
  body[data-route="explore"] .path-hub {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body[data-route="equipmentRoot"] #equipmentSlotList .item-row,
  body[data-route="profile"] .profile-hub .hub-card {
    min-height: 92px;
    padding: 14px;
  }

  body[data-route="equipmentRoot"] #equipmentSlotList .item-thumb,
  body[data-route="profile"] .profile-hub .hub-icon {
    width: 44px;
    height: 44px;
  }
}

.profile-stats-title {
  display: none;
}

body[data-route="profile"] .profile-stats-title,
body[data-route="main"] .profile-stats-title {
  display: grid;
}

/* Profile stats are a readable list, not dashboard tiles. */
body[data-route="profile"] #statsGrid,
body[data-route="main"] #statsGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

body[data-route="profile"] #statsGrid .stat,
body[data-route="main"] #statsGrid .stat {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 10px;
  border-radius: 7px;
}

body[data-route="profile"] #statsGrid .stat::before,
body[data-route="main"] #statsGrid .stat::before {
  width: 2px;
}

#statsGrid .stat {
  border-color: var(--mca-border) !important;
  border-left-color: var(--stat-accent, var(--mca-border)) !important;
}

#statsGrid .stat::before {
  background: var(--stat-accent, var(--section-accent, var(--blue))) !important;
}

body[data-route="profile"] #statsGrid .stat[data-stat="orange"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="orange"]::before {
  background: var(--orange);
}

body[data-route="profile"] #statsGrid .stat[data-stat="orange"],
body[data-route="main"] #statsGrid .stat[data-stat="orange"] {
  border-left-color: var(--orange) !important;
}

body[data-route="profile"] #statsGrid .stat[data-stat="blue"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="blue"]::before,
body[data-route="profile"] #statsGrid .stat[data-stat="status-resting"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="status-resting"]::before {
  background: var(--blue);
}

body[data-route="profile"] #statsGrid .stat[data-stat="blue"],
body[data-route="main"] #statsGrid .stat[data-stat="blue"],
body[data-route="profile"] #statsGrid .stat[data-stat="status-resting"],
body[data-route="main"] #statsGrid .stat[data-stat="status-resting"] {
  border-left-color: var(--blue) !important;
}

body[data-route="profile"] #statsGrid .stat[data-stat="green"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="green"]::before,
body[data-route="profile"] #statsGrid .stat[data-stat="status-free"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="status-free"]::before {
  background: var(--green);
}

body[data-route="profile"] #statsGrid .stat[data-stat="green"],
body[data-route="main"] #statsGrid .stat[data-stat="green"],
body[data-route="profile"] #statsGrid .stat[data-stat="status-free"],
body[data-route="main"] #statsGrid .stat[data-stat="status-free"] {
  border-left-color: var(--green) !important;
}

body[data-route="profile"] #statsGrid .stat[data-stat="violet"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="violet"]::before {
  background: var(--violet);
}

body[data-route="profile"] #statsGrid .stat[data-stat="violet"],
body[data-route="main"] #statsGrid .stat[data-stat="violet"] {
  border-left-color: var(--violet) !important;
}

body[data-route="profile"] #statsGrid .stat[data-stat="yellow"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="yellow"]::before {
  background: var(--gold);
}

body[data-route="profile"] #statsGrid .stat[data-stat="yellow"],
body[data-route="main"] #statsGrid .stat[data-stat="yellow"] {
  border-color: var(--mca-border) !important;
  border-left-color: var(--orange) !important;
}

body[data-route="profile"] #statsGrid .stat:nth-child(6),
body[data-route="main"] #statsGrid .stat:nth-child(6) {
  border-color: var(--mca-border) !important;
  border-left-color: var(--orange) !important;
}

body[data-route="profile"] #statsGrid .stat:nth-child(6)::before,
body[data-route="main"] #statsGrid .stat:nth-child(6)::before {
  background: var(--orange) !important;
}

body[data-route="profile"] #statsGrid .stat[data-stat="status-busy"]::before,
body[data-route="main"] #statsGrid .stat[data-stat="status-busy"]::before {
  background: var(--red);
}

body[data-route="profile"] #statsGrid .stat[data-stat="status-busy"],
body[data-route="main"] #statsGrid .stat[data-stat="status-busy"] {
  border-left-color: var(--red) !important;
}

body[data-route="profile"] #statsGrid .stat-icon,
body[data-route="main"] #statsGrid .stat-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

body[data-route="profile"] #statsGrid .stat > div,
body[data-route="main"] #statsGrid .stat > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

body[data-route="profile"] #statsGrid .stat span,
body[data-route="main"] #statsGrid .stat span {
  font-size: 11px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-route="profile"] #statsGrid .stat strong,
body[data-route="main"] #statsGrid .stat strong {
  margin-top: 0;
  font-size: 16px;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

@media (min-width: 680px) {
  body[data-route="profile"] #statsGrid,
  body[data-route="main"] #statsGrid {
    grid-template-columns: 1fr;
  }
}

/* UX polish: global recommended action and fast return-to-top. */
.quick-action {
  display: none !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--section-accent, var(--blue)) 52%, rgba(224, 233, 241, 0.2));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--section-accent, var(--blue)) 16%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    rgba(10, 21, 34, 0.95);
  box-shadow: var(--mca-inner), 0 10px 24px rgba(0, 0, 0, 0.2);
}

.quick-action-main {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.quick-action-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: 0.95;
}

.quick-action-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.quick-action-copy span {
  color: #a5b8ca;
  font-size: 10px;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.quick-action-copy strong {
  color: #f7fbff;
  font-size: 14px;
  line-height: 1.16;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-action-copy em {
  color: #9ab0c4;
  font-size: 11px;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#quickActionButton {
  min-width: 98px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 7px;
}

.scroll-top-fab {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(var(--bar-height) + var(--telegram-footer-height) + max(58px, env(safe-area-inset-bottom)));
  z-index: 22;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--section-accent, var(--blue)) 46%, rgba(224, 233, 241, 0.2));
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 17, 28, 0.94);
  color: #e9f3ff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.scroll-top-fab.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (max-width: 430px) {
  .quick-action {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 9px;
  }

  #quickActionButton {
    width: 100%;
  }

  .scroll-top-fab {
    width: 40px;
    height: 40px;
    font-size: 17px;
    right: max(10px, env(safe-area-inset-right));
  }
}

/* Tactical HUD: instrument-stack header, rail nav, flat bottom control deck */
:root {
  --hud-primary-sticky-top: 106px;
  --hud-filter-sticky-top: 156px;
  --bar-height: 128px;
}

@media (max-width: 430px) {
  :root {
    --hud-primary-sticky-top: 98px;
    --hud-filter-sticky-top: 144px;
  }
}

.top-panel {
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  min-height: 88px;
  padding: 6px;
  border-radius: 6px;
}

.location-art {
  width: 70px;
  height: 76px;
  border-radius: 5px;
}

.hero-copy {
  gap: 5px;
}

h1 {
  font-size: 20px;
  line-height: 1.1;
}

.hero-status {
  padding: 2px 7px;
  font-size: 10px;
}

.meters {
  gap: 5px;
}

.meters div {
  min-height: 38px;
  padding: 5px 6px 6px;
  border-radius: 5px;
}

.meters strong,
.stat strong,
.item-row strong {
  font-variant-numeric: tabular-nums;
}

.primary-nav {
  top: var(--hud-primary-sticky-top);
  margin: 6px 0 3px;
  padding: 3px 4px;
  gap: 2px;
  border-radius: 6px;
  background: rgba(5, 11, 18, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.primary-nav button {
  min-height: 32px;
  padding: 0 2px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #8b9aac;
}

.primary-nav button.active {
  border: none;
  background: color-mix(in srgb, var(--section-accent, var(--blue)) 10%, transparent);
  color: #f3f8ff;
  box-shadow: inset 0 -2px 0 rgba(240, 188, 98, 0.92);
}

.list-filter {
  top: var(--hud-filter-sticky-top);
}

.item-row {
  gap: 6px;
  min-height: 51px;
  padding: 9px 11px 9px 13px;
}

.hub-card {
  min-height: 70px;
  padding: 9px;
  gap: 8px;
}

.tabs.bot-keyboard {
  gap: 5px;
  padding: 8px 8px 10px;
  border-radius: 8px 8px 0 0;
  border: 1px solid rgba(111, 169, 220, 0.14);
  border-bottom: none;
  box-shadow:
    inset 0 1px 0 rgba(121, 185, 238, 0.18),
    0 -10px 32px rgba(0, 0, 0, 0.38);
}

.tabs.bot-keyboard .tab {
  position: relative;
  min-height: 34px;
  padding: 5px 6px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(10, 18, 30, 0.88);
  font-weight: 780;
  box-shadow: none;
}

.tabs.bot-keyboard .tab::before {
  position: absolute;
  left: 12%;
  right: 12%;
  top: auto;
  bottom: 5px;
  width: auto;
  height: 2px;
  margin: 0;
  border-radius: 99px;
  opacity: 0;
  background: var(--gold);
}

.tabs.bot-keyboard .tab[data-section="home"]::before {
  background: var(--gold);
}

.tabs.bot-keyboard .tab[data-section="hero"]::before {
  background: var(--blue);
}

.tabs.bot-keyboard .tab[data-section="city"]::before {
  background: var(--violet);
}

.tabs.bot-keyboard .tab[data-section="combat"]::before {
  background: var(--red);
}

.tabs.bot-keyboard .tab[data-section="progress"]::before {
  background: var(--green);
}

.tabs.bot-keyboard .tab:not(.active)::before {
  opacity: 0.2;
}

.tabs.bot-keyboard .tab.active::before {
  opacity: 1;
  height: 2px;
}

.tabs.bot-keyboard .tab.active {
  border-color: rgba(111, 169, 220, 0.12);
  background: rgba(14, 28, 46, 0.95);
  color: #f6fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tabs.bot-keyboard .tab-icon {
  width: 17px;
  height: 17px;
}

.monster-card.has-thumb {
  grid-template-columns: 1fr;
}

.monster-card.has-thumb .button-strip {
  grid-column: 1;
}

.monster-card .battle-potion-panel,
.monster-card .battle-potion-empty {
  grid-column: 1;
}

.battle-potion-empty {
  padding: 8px 10px;
  border: 1px dashed rgba(111, 169, 220, 0.2);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}

.monster-card .monster-image-frame {
  display: grid;
  justify-items: center;
  align-items: center;
  width: 100%;
  min-height: clamp(180px, 54vw, 280px);
}

.monster-card .monster-thumb {
  width: 100%;
  max-width: 100%;
  max-height: clamp(180px, 54vw, 280px);
  height: auto;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(238, 118, 111, 0.24);
  border-radius: 7px;
  background: rgba(5, 11, 18, 0.72);
}

@media (max-width: 430px) {
  .top-panel {
    grid-template-columns: 62px minmax(0, 1fr);
    min-height: 82px;
    padding: 5px;
  }

  .location-art {
    width: 62px;
    height: 70px;
  }

  h1 {
    font-size: 18px;
  }

  .primary-nav button {
    min-height: 30px;
    font-size: 11px;
  }

  .tabs.bot-keyboard {
    padding: 7px 6px 9px;
  }
}
