:root {
  color-scheme: dark;
  --bg: #1e1a24;
  --bg-mid: #2a2233;
  --panel: rgba(22, 18, 32, 0.88);
  --panel-edge: rgba(255, 213, 120, 0.22);
  --bar-green: #66bb6a;
  --bar-green-dark: #2e7d32;
  --bar-green-bright: #c5e1a5;
  --buy-orange: #e65100;
  --buy-orange-light: #ffab40;
  --text: #fffef7;
  --muted: #b0a8c4;
  --timer-bg: rgba(20, 16, 28, 0.92);
  --rail-size: 44px;
  --card-bg: linear-gradient(165deg, rgba(45, 38, 58, 0.95) 0%, rgba(25, 20, 35, 0.98) 100%);
  --font-ui: "Fredoka", "Arial Black", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

html, body {
  overflow: hidden;
  max-height: 100%;
  max-height: 100dvh;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  height: 100%;
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: #0f0c14;
  position: relative;
}

/* Фон: закат, звёзды, полоски как в idle-играх, горизонт, город */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient__dusk {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 100% 60% at 50% -15%, rgba(255, 183, 200, 0.5) 0%, transparent 42%),
    radial-gradient(ellipse 80% 45% at 15% 20%, rgba(186, 104, 200, 0.35) 0%, transparent 45%),
    radial-gradient(ellipse 70% 50% at 85% 15%, rgba(255, 138, 128, 0.2) 0%, transparent 40%),
    linear-gradient(180deg, #8b7cb3 0%, #5c4d78 22%, #3d3350 45%, #1e1a28 72%, #12101a 100%);
}

.ambient__stars {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255, 255, 255, 0.9) 50%, transparent 50%),
    radial-gradient(1px 1px at 30% 8%, rgba(255, 255, 255, 0.75) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 55% 22%, rgba(255, 255, 255, 0.85) 50%, transparent 50%),
    radial-gradient(1px 1px at 72% 12%, rgba(255, 255, 255, 0.6) 50%, transparent 50%),
    radial-gradient(1px 1px at 88% 28%, rgba(255, 255, 255, 0.7) 50%, transparent 50%),
    radial-gradient(1px 1px at 18% 35%, rgba(255, 255, 255, 0.5) 50%, transparent 50%),
    radial-gradient(1px 1px at 42% 6%, rgba(255, 255, 255, 0.65) 50%, transparent 50%),
    radial-gradient(1px 1px at 65% 38%, rgba(255, 255, 255, 0.55) 50%, transparent 50%);
  background-size: 100% 100%;
  animation: twinkle 7s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.4; }
  to { opacity: 0.7; }
}

.ambient__pinstripe {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.5) 3px,
    rgba(0, 0, 0, 0.5) 5px
  );
}

.ambient__horizon {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: min(36vh, 200px);
  height: 80px;
  background: radial-gradient(ellipse 70% 40% at 50% 100%, rgba(255, 138, 80, 0.35) 0%, transparent 70%);
  filter: blur(4px);
}

.ambient__city {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(36vh, 210px);
  background: url("assets/skyline.svg") repeat-x center bottom;
  background-size: 480px auto;
  opacity: 0.95;
}

.ambient__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 30%, rgba(5, 3, 10, 0.55) 100%);
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  /* Ровно экран: иначе колонка растягивается, body с overflow:hidden обрезает низ и нет scroll в списке */
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  max-height: -webkit-fill-available;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* --- Header --- */
.game-header {
  flex-shrink: 0;
  padding: 8px 10px 8px;
  padding-top: calc(8px + env(safe-area-inset-top, 0));
  margin: 6px 8px 0;
  background: linear-gradient(180deg, rgba(35, 30, 48, 0.92) 0%, rgba(20, 16, 30, 0.88) 100%);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.header-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.avatar-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

a.avatar-btn {
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.avatar-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe082, #ff8f00);
  display: grid;
  place-items: center;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.35);
  border: 2px solid #fff8e1;
}

.avatar-face {
  font-size: 24px;
  line-height: 1;
}

.avatar-ring .avatar-tg-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.header-money-block {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.money-main {
  font-size: clamp(1rem, 4.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fffef0;
  text-shadow:
    0 0 12px rgba(255, 213, 120, 0.35),
    0 2px 0 #3e2723,
    0 3px 4px rgba(0, 0, 0, 0.6);
  line-height: 1.1;
  word-break: break-word;
}

/* $/с и ангелы — одна строка под балансом, без «коробки» */
.header-inline-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin: 5px 0 0;
  padding: 0;
  border: none;
  background: none;
  font-size: clamp(0.78rem, 3.2vw, 0.92rem);
  line-height: 1.3;
}

.header-inline-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.header-inline-lbl {
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: clamp(0.68rem, 2.75vw, 0.8rem);
  color: rgba(200, 210, 222, 0.95);
}

.header-inline-val {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.88rem, 3.8vw, 1.06rem);
  color: #fff8e1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.header-inline-dot {
  font-size: clamp(0.85rem, 3.2vw, 1rem);
  opacity: 0.5;
  color: rgba(255, 224, 178, 0.7);
  user-select: none;
}

@keyframes header-progress-shine {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes header-progress-ready-pulse {
  0%,
  100% {
    box-shadow: 0 0 6px rgba(129, 199, 132, 0.35);
  }
  50% {
    box-shadow: 0 0 14px rgba(255, 213, 79, 0.55);
  }
}

.header-progress-wrap {
  margin-top: 5px;
  width: 100%;
}

.header-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.header-progress-title {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 213, 120, 0.75);
}

.header-progress-hint {
  font-size: 0.56rem;
  font-weight: 700;
  color: rgba(187, 222, 251, 0.95);
  text-align: right;
  line-height: 1.2;
  max-width: 62%;
}

.header-progress-wrap--ready .header-progress-hint {
  color: #c8e6c9;
  text-shadow: 0 0 8px rgba(129, 199, 132, 0.45);
}

.header-progress-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 213, 120, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.header-progress-wrap--ready .header-progress-track {
  animation: header-progress-ready-pulse 2.2s ease-in-out infinite;
  border-color: rgba(129, 199, 132, 0.35);
}

.header-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8f00 0%, #ffca28 40%, #fff59d 100%);
  box-shadow:
    0 0 10px rgba(255, 193, 7, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: width 0.45s cubic-bezier(0.33, 1, 0.68, 1);
  position: relative;
  overflow: hidden;
}

.header-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 45%,
    transparent 70%
  );
  animation: header-progress-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}

.header-progress-fill--hot {
  background: linear-gradient(90deg, #ff6f00 0%, #ffd54f 55%, #fffde7 100%);
  box-shadow:
    0 0 14px rgba(255, 152, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.header-progress-fill--ready {
  background: linear-gradient(90deg, #43a047 0%, #ffca28 100%);
  box-shadow:
    0 0 12px rgba(67, 160, 71, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.header-progress-wrap--level {
  margin-top: 4px;
}

.header-progress-wrap--level .header-progress-title {
  color: rgba(206, 147, 255, 0.92);
}

.header-progress-wrap--level .header-progress-hint {
  color: rgba(225, 190, 255, 0.95);
}

.header-progress-wrap--level.header-progress-wrap--ready .header-progress-hint {
  color: #e1bee7;
  text-shadow: 0 0 8px rgba(186, 104, 200, 0.5);
}

.header-progress-track--level {
  border-color: rgba(186, 104, 200, 0.25);
}

.header-progress-fill--level {
  background: linear-gradient(90deg, #5e35b1 0%, #ab47bc 42%, #e1bee7 100%);
  box-shadow:
    0 0 10px rgba(171, 71, 188, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.header-progress-fill--level.header-progress-fill--hot {
  background: linear-gradient(90deg, #4527a0 0%, #ce93d8 50%, #faf5ff 100%);
  box-shadow:
    0 0 14px rgba(186, 104, 200, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.header-progress-fill--level.header-progress-fill--ready {
  background: linear-gradient(90deg, #43a047 0%, #ba68c8 100%);
  box-shadow:
    0 0 12px rgba(67, 160, 71, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .header-progress-fill::after {
    animation: none;
  }

  .header-progress-wrap--ready .header-progress-track {
    animation: none;
  }
}

.header-tagline {
  margin-top: 3px;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 224, 178, 0.65);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.buy-mode-tag {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  padding: 6px 8px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffb74d 0%, var(--buy-orange) 55%, #bf360c 100%);
  color: #fffef5;
  font-weight: 800;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  box-shadow:
    0 3px 0 #5d2800,
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  max-width: 92px;
  line-height: 1.2;
}

.buy-mode-tag:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #8d3800;
}

/* --- Main + list --- */
.main-stage {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  min-width: 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.scroll-area {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 12px 8px 24px 10px;
  padding-right: calc(var(--rail-size) + 12px);
  background: linear-gradient(180deg, rgba(15, 12, 22, 0.35) 0%, rgba(10, 8, 16, 0.55) 100%);
  border-radius: 12px 12px 0 0;
  margin: 6px 8px 0;
}

.business-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.biz-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 82px;
  padding: 10px 10px 10px 8px;
  background: linear-gradient(165deg, rgba(55, 48, 68, 0.92) 0%, rgba(32, 28, 42, 0.96) 100%);
  border: 2px solid rgba(40, 35, 55, 0.95);
  border-radius: 14px;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: box-shadow 0.2s ease;
}

.biz-row--cycle {
  box-shadow:
    0 0 0 2px rgba(129, 199, 132, 0.35),
    0 3px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.biz-row--afford {
  box-shadow:
    0 0 0 2px rgba(255, 152, 0, 0.45),
    0 3px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.biz-icon-col {
  flex-shrink: 0;
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.biz-run-hit {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font: inherit;
  color: inherit;
}

.biz-run-hit:disabled {
  cursor: not-allowed;
}

.biz-run-hit:focus-visible {
  outline: 2px solid rgba(129, 199, 132, 0.8);
  outline-offset: 2px;
  border-radius: 8px;
}

.biz-icon-circle {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  transition: filter 0.2s ease;
}

.biz-icon-circle .biz-svg {
  width: 56px;
  height: 56px;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.biz-icon-circle--hot {
  filter: drop-shadow(0 0 10px rgba(255, 152, 0, 0.9));
}

.biz-fallback {
  font-size: 1.5rem;
  opacity: 0.6;
}

.biz-milestone-pill {
  position: relative;
  width: 100%;
  max-width: 56px;
  height: 14px;
  border-radius: 10px;
  background: #2a2a35;
  border: 2px solid #1e1e28;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.biz-milestone-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(180deg, #9ccc65 0%, #66bb6a 50%, #2e7d32 100%);
  border-radius: 8px 0 0 8px;
  transition: width 0.15s ease-out;
}

.biz-milestone-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  z-index: 1;
  pointer-events: none;
}

.biz-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.biz-green-wrap {
  position: relative;
  height: 30px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}

.biz-green-bar {
  position: absolute;
  inset: 0;
  background: #3a3a42;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
  border-radius: 4px 0 0 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid #25252a;
  padding: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

.biz-green-bar--inactive {
  background: #35353d;
}

.biz-green-bar--inactive .biz-green-fill {
  opacity: 0.35;
}

.biz-green-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(180deg, #d4e157 0%, var(--bar-green) 40%, #1b5e20 100%);
  transition: width 0.08s linear;
  z-index: 0;
  overflow: hidden;
}

.biz-green-bar--striped .biz-green-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(0, 0, 0, 0.14) 5px,
    rgba(0, 0, 0, 0.14) 10px
  );
  pointer-events: none;
}

.biz-green-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 5px;
  min-height: 100%;
}

.note-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}

.biz-rate-text {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.biz-buy-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 2px solid #5d2800;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  min-height: 40px;
  padding: 5px 10px;
  width: 100%;
  background: linear-gradient(180deg, #ffcc80 0%, #ff9800 45%, #e65100 100%);
  box-shadow:
    0 3px 0 #5d2800,
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.biz-buy-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #5d2800;
}

.biz-buy-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.buy-line1 {
  font-size: 0.68rem;
  font-weight: 800;
  color: #3e2723;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.buy-line2 {
  font-size: 0.78rem;
  font-weight: 800;
  color: #2d1b00;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.biz-timer {
  flex-shrink: 0;
  min-width: 48px;
  max-width: 56px;
  align-self: center;
  background: linear-gradient(180deg, #424250 0%, #2e2e38 100%);
  border-radius: 8px;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: #eceff1;
  padding: 8px 4px;
  line-height: 1.25;
  border: 2px solid #1a1a22;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Side rail */
.side-rail {
  position: absolute;
  right: 2px;
  top: 0;
  bottom: 0;
  width: var(--rail-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 12px;
  pointer-events: auto;
  z-index: 2;
  filter: drop-shadow(-2px 0 8px rgba(0, 0, 0, 0.35));
}

.rail-btn {
  position: relative;
  width: var(--rail-size);
  height: var(--rail-size);
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 220, 0.45);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.rail-event { background: linear-gradient(145deg, #7e57c2, #4527a0); }
.rail-warp { background: linear-gradient(145deg, #9575cd, #5e35b1); }
.rail-free { background: linear-gradient(145deg, #66bb6a, #2e7d32); }
.rail-boost { background: linear-gradient(145deg, #42a5f5, #1565c0); }
.rail-deal { background: linear-gradient(145deg, #ef5350, #c62828); }
.rail-connect { background: linear-gradient(145deg, #29b6f6, #0277bd); }

.rail-timer {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

.rail-timer.small {
  bottom: -12px;
  font-size: 0.5rem;
}

.rail-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #f44336;
  color: #fff;
  font-size: 0.45rem;
  font-weight: 900;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid #fff;
}

.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;
}

/* Bottom bar — всегда у нижнего края экрана */
.bottom-bar {
  flex: 0 0 auto;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(180deg, #2a2438 0%, #16121f 55%, #0c0a12 100%);
  border-top: 2px solid rgba(255, 200, 100, 0.15);
  box-shadow:
    0 -6px 20px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.bottom-bar--four {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
}

.bottom-bar--four .bottom-shop {
  justify-self: center;
}

.bottom-bar--four .bottom-wallet {
  justify-self: center;
}

.bottom-bar--four .bottom-menu--center {
  justify-self: center;
}

.bottom-bar--four .bottom-profile {
  justify-self: center;
}

/* Единый стиль нижнего ряда: тёмные «плитки» + SVG (кроме жёлтого магазина) */
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #eceff1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-width: 0;
}

a.bottom-nav-item {
  text-decoration: none;
}

.bottom-nav-tile {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.bottom-nav-tile--sq {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(165deg, #3f3a52 0%, #252030 48%, #151018 100%);
  border: 1px solid rgba(255, 213, 127, 0.22);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35);
}

.bottom-nav-tile--round {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(155deg, #4a4260 0%, #2a2438 45%, #161018 100%);
  border: 2px solid rgba(255, 236, 179, 0.55);
  box-shadow:
    0 2px 9px rgba(0, 0, 0, 0.45),
    inset 0 2px 6px rgba(255, 255, 255, 0.12),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4);
}

.bottom-nav-tile--menu {
  padding: 0;
}

.bottom-svg {
  width: 28px;
  height: 28px;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.bottom-svg--wallet {
  width: 30px;
  height: 30px;
}

.bottom-svg--profile {
  width: 30px;
  height: 30px;
}

.bottom-nav-caption {
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #cfd8dc;
  max-width: 76px;
  text-align: center;
  line-height: 1.1;
  min-height: 0.62rem;
}

.bottom-nav-caption--phantom {
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

.bottom-shop {
  align-self: end;
}

.bottom-nav-tile--shop {
  border-color: rgba(255, 202, 40, 0.45);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35);
}

.bottom-svg--shop {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 1px 3px rgba(255, 193, 7, 0.2));
}

.bottom-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  cursor: pointer;
  font-weight: 900;
  font-size: 1.1rem;
}

.bottom-gold {
  background: linear-gradient(145deg, #42a5f5, #1565c0);
  color: #fff;
}

.bottom-menu {
  position: relative;
}

.bottom-menu--center {
  min-width: 48px;
}

.bottom-nav-tile--sq:active,
.bottom-nav-tile--round:active {
  transform: scale(0.97);
  transition: transform 0.08s ease;
}

.bottom-shop:active {
  transform: none;
}

.menu-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  background: linear-gradient(180deg, #ffb74d, #f57c00);
  border-radius: 50%;
  border: 2px solid #1e1a24;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 2;
}

.bottom-alert {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #78909c;
  background: #37474f;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  cursor: pointer;
}

.bottom-ad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
}

.bottom-ad--wide {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #546e7a, #37474f);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 0 #263238;
  text-align: left;
  min-height: 44px;
}

.ad-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.15;
}

.ad-line1 {
  font-size: 0.58rem;
  font-weight: 800;
  color: #eceff1;
}

.ad-line2 {
  font-size: 0.72rem;
  font-weight: 900;
  color: #ffee58;
}

.ad-ico {
  font-size: 1.2rem;
}

.toast-msg {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.75);
  color: #eee;
  font-size: 0.75rem;
  border-radius: 8px;
  pointer-events: none;
  z-index: 50;
  text-align: center;
}

.toast-msg:empty {
  display: none;
}

/* Overlays — класс перебивает [hidden], без этого оба окна «висят» поверх игры */
.overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: auto;
}

/* Порядок окон: магазин поверх остальных */
#hubOverlay:not([hidden]) {
  z-index: 10050;
}

#treasuryOverlay:not([hidden]) {
  z-index: 10052;
}

#upgradesOverlay:not([hidden]) {
  z-index: 10054;
}

#managersOverlay:not([hidden]) {
  z-index: 10056;
}

#profileOverlay:not([hidden]) {
  z-index: 10058;
}

#leaderboardOverlay:not([hidden]) {
  z-index: 10059;
}

.overlay-panel {
  width: min(100%, 400px);
  max-height: min(85vh, 640px);
  background: #2c2f38;
  border-radius: 12px;
  border: 2px solid #555;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #1e2128;
  border-bottom: 1px solid #444;
}

.overlay-head h2 {
  font-size: 1rem;
}

.overlay-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.overlay-body {
  padding: 12px;
  overflow-y: auto;
}

.menu-section {
  margin-bottom: 16px;
}

.menu-section h3 {
  font-size: 0.85rem;
  color: #9e9e9e;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.menu-line {
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.menu-line .muted {
  color: #9e9e9e;
  font-size: 0.85rem;
}

.leaderboard-panel {
  max-height: min(88vh, 680px);
}

.leaderboard-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.lb-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.lb-tab {
  padding: 8px 4px;
  border: 1px solid #555;
  border-radius: 8px;
  background: #1e2128;
  color: #b0bec5;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lb-tab--active {
  background: linear-gradient(180deg, #5c6bc0, #3949ab);
  color: #fff;
  border-color: #7986cb;
}

.lb-hint {
  font-size: 0.72rem;
  color: #90a4ae;
  margin: 0;
  line-height: 1.35;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  max-height: 42vh;
  padding-right: 2px;
}

.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #1e2128;
  border-radius: 8px;
  font-size: 0.78rem;
}

.lb-row--player {
  outline: 2px solid #7e57c2;
  background: linear-gradient(90deg, #2a1f3d, #1e2128);
}

.lb-rank {
  font-weight: 800;
  color: #78909c;
  font-variant-numeric: tabular-nums;
}

.lb-row--player .lb-rank {
  color: #ce93d8;
}

.lb-name {
  font-weight: 700;
  color: #eceff1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-val {
  font-weight: 800;
  color: #ffb74d;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.lb-footnote {
  font-size: 0.65rem;
  color: #78909c;
  margin: 0;
  line-height: 1.35;
}

.profile-lb-btn {
  margin-top: 10px;
}

.wallet-panel {
  max-height: min(88vh, 640px);
}

.wallet-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0 12px;
  margin-top: 4px;
  border-bottom: 1px solid #444;
  background: #1e2128;
}

.wallet-tab {
  padding: 10px 8px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #90a4ae;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: var(--font-ui);
  cursor: pointer;
  margin-bottom: -1px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.wallet-tab--active {
  color: #ffe082;
  border-bottom-color: #ffb300;
}

.wallet-body {
  padding-top: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.wallet-section {
  background: rgba(23, 20, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.wallet-section:last-child {
  margin-bottom: 0;
}

.wallet-section-title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: #ffe082;
}

.wallet-pane[hidden] {
  display: none !important;
}

.wallet-pane--active {
  display: block;
}

.wallet-topup-balance {
  font-size: 0.88rem;
  margin: 0 0 10px;
  color: #eceff1;
}

.wallet-topup-balance strong {
  color: #ffd54f;
}

.wallet-topup-lead {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #b0bec5;
  margin: 0 0 12px;
}

.wallet-crypto-placeholder {
  text-align: center;
  padding: 16px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 2px dashed rgba(255, 213, 79, 0.35);
  background: rgba(30, 33, 40, 0.9);
}

.wallet-crypto-ico {
  font-size: 1.75rem;
  display: block;
  margin-bottom: 8px;
}

.wallet-crypto-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff8e1;
  margin: 0 0 8px;
}

.wallet-crypto-hint {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #90a4ae;
  margin: 0;
}

.wallet-crypto-btn {
  margin-bottom: 8px;
  background: linear-gradient(180deg, #7e57c2, #5e35b1) !important;
  box-shadow: 0 2px 0 #311b92 !important;
}

.wallet-topup-foot {
  margin-bottom: 0;
}

.wallet-history-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.wallet-history-tab {
  border: 1px solid #4e5a66;
  border-radius: 8px;
  background: #1b1f27;
  color: #9fb0bf;
  padding: 8px 6px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
}

.wallet-history-tab--active {
  color: #fff8e1;
  border-color: #ffb300;
  background: linear-gradient(180deg, #5b3a8f, #3f2b63);
}

.wallet-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 72px;
}

.wallet-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: #161a20;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
}

.wallet-history-title,
.wallet-history-meta,
.wallet-history-amount,
.wallet-history-empty {
  margin: 0;
}

.wallet-history-title {
  color: #eceff1;
  font-size: 0.75rem;
  font-weight: 700;
}

.wallet-history-meta {
  color: #90a4ae;
  font-size: 0.66rem;
  margin-top: 2px;
}

.wallet-history-amount {
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.wallet-history-amount--incoming {
  color: #81c784;
}

.wallet-history-amount--outgoing {
  color: #ef9a9a;
}

.wallet-history-empty {
  color: #90a4ae;
  font-size: 0.72rem;
  padding: 8px 2px;
}

.menu-action {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  background: #455a64;
  color: #fff;
}

.menu-action.warn {
  background: linear-gradient(180deg, #ffb74d, #e65100);
}

.menu-action.danger {
  background: linear-gradient(180deg, #ef5350, #b71c1c);
}

.upgrade-list:not(.upgrade-list--screen) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manager-row {
  background: #1e2128;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #444;
}

.manager-row button {
  margin-top: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
  background: #4caf50;
  color: #fff;
}

.manager-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.up-meta {
  font-size: 0.78rem;
  color: #9e9e9e;
  margin-top: 4px;
}

/* --- Hub main menu (skewed buttons) --- */
.overlay--hub {
  place-items: center;
  align-content: center;
  padding: 24px 16px 80px;
}

.hub-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(100%, 320px);
}

.hub-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffef8 0%, #f0ebe4 100%);
  color: #263238;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.35);
  transform: skewY(-2deg);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.hub-btn:hover {
  filter: brightness(1.03);
}

.hub-btn:active {
  transform: skewY(-2deg) scale(0.98);
}

.hub-btn--accent .hub-label {
  color: #e65100;
}

.hub-btn--locked {
  opacity: 0.55;
  cursor: not-allowed;
}

a.hub-btn--external {
  text-decoration: none;
}

.hub-dot {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #90a4ae;
  border: 2px solid #cfd8dc;
}

.hub-dot--accent {
  background: #ff9800;
  border-color: #ffe0b2;
}

.hub-label {
  flex: 1;
}

.hub-lock {
  font-size: 0.85rem;
  opacity: 0.9;
}

.hub-close-x {
  margin-top: 16px;
  align-self: center;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #e0e0e0 100%);
  color: #424242;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.hub-close-x:active {
  transform: scale(0.96);
}

/* --- Managers full screen --- */
.overlay--managers {
  place-items: stretch;
  padding: 0;
  background: rgba(30, 35, 48, 0.55);
}

.managers-shell {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100%;
  min-height: 100dvh;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.02) 0,
      rgba(0, 0, 0, 0.02) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(180deg, #f5f7fa 0%, #eceff1 100%);
  color: #263238;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.managers-top {
  position: relative;
  padding: calc(10px + env(safe-area-inset-top, 0)) 12px 8px;
}

.managers-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 40px 10px 16px;
  margin: 0 4px;
  background: linear-gradient(180deg, #81d4fa, #4fc3f7);
  border-radius: 8px;
  border: 2px solid #0288d1;
  box-shadow: 0 3px 0 #01579b;
}

.managers-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  letter-spacing: 0.02em;
}

.managers-spark {
  color: #01579b;
  font-size: 0.9rem;
}

.managers-close-pill {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0));
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #bcaaa4;
  background: linear-gradient(180deg, #efebe9, #d7ccc8);
  color: #424242;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.managers-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px 6px;
}

.mgr-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid #b0bec5;
  background: #fff;
  color: #546e7a;
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
}

.mgr-tab--active {
  border-color: #43a047;
  background: linear-gradient(180deg, #e8f5e9, #c8e6c9);
  color: #1b5e20;
}

.mgr-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.managers-balance-line {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #37474f;
  padding: 4px 12px 8px;
}

.managers-intro {
  padding: 0 16px 12px;
}

.managers-intro-lead {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1565c0;
  margin-bottom: 6px;
}

.managers-intro-lead--upgrades {
  color: #e65100;
}

.managers-banner--upgrades {
  background: linear-gradient(180deg, #ffb74d, #ff9800);
  border-color: #e65100;
  box-shadow: 0 3px 0 #bf360c;
}

.managers-banner--upgrades .managers-spark {
  color: #bf360c;
}

.managers-banner--profile {
  background: linear-gradient(180deg, #ba68c8, #7b1fa2);
  border-color: #4a148c;
  box-shadow: 0 3px 0 #311b92;
}

.managers-banner--profile .managers-spark {
  color: #4a148c;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 8px;
  margin: 0 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e1bee7;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
}

.profile-avatar-big {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e1bee7, #ce93d8);
  display: grid;
  place-items: center;
  font-size: 2rem;
  flex-shrink: 0;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(74, 20, 140, 0.25);
}

.profile-hero-text {
  min-width: 0;
}

.profile-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #4a148c;
  margin-bottom: 4px;
}

.profile-level-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: #6a1b9a;
}

.profile-level-badge strong {
  font-size: 1.1rem;
  color: #311b92;
}

.profile-scroll {
  padding: 8px 12px 20px;
}

.profile-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #cfd8dc;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}

.profile-card-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7b1fa2;
  margin-bottom: 10px;
}

.profile-stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.8rem;
  color: #546e7a;
  padding: 6px 0;
  border-bottom: 1px solid #eceff1;
}

.profile-stat-list li:last-child {
  border-bottom: none;
}

.profile-stat-list strong {
  font-size: 0.82rem;
  color: #263238;
  text-align: right;
  word-break: break-word;
}

.profile-card--prestige .profile-prestige-line {
  font-size: 0.88rem;
  color: #37474f;
  margin-bottom: 6px;
}

.profile-card-hint {
  font-size: 0.72rem;
  color: #78909c;
  line-height: 1.35;
  margin-bottom: 10px;
}

.profile-muted {
  color: #90a4ae;
  font-size: 0.85rem;
}

.profile-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.profile-btn:last-child {
  margin-bottom: 0;
}

.profile-btn--save {
  background: linear-gradient(180deg, #78909c, #546e7a);
  color: #fff;
}

.profile-btn--prestige {
  background: linear-gradient(180deg, #ffb74d, #ef6c00);
  color: #3e2723;
}

.profile-btn--prestige:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.profile-prestige-meta {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.profile-prestige-meta li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
  color: #546e7a;
  padding: 5px 0;
  border-bottom: 1px solid #eceff1;
}

.profile-prestige-meta li:last-child {
  border-bottom: none;
}

.profile-prestige-meta strong {
  color: #6a1b9a;
  font-size: 0.8rem;
}

.profile-btn--danger {
  background: linear-gradient(180deg, #ef5350, #c62828);
  color: #fff;
}

.profile-btn--ghost {
  background: #eceff1;
  color: #546e7a;
  box-shadow: none;
  border: 1px solid #cfd8dc;
}

.profile-card--referral .profile-ref-text {
  font-size: 0.78rem;
  line-height: 1.4;
  color: #455a64;
  margin-bottom: 10px;
}

.profile-ref-box {
  font-size: 0.72rem;
  color: #78909c;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  word-break: break-all;
  border: 1px dashed #bdbdbd;
}

.menu-line--hint {
  font-size: 0.75rem;
  color: #9e9e9e;
  margin-top: 8px;
}

.upgrade-list--screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upgrade-screen-card .manager-name {
  color: #e65100;
}

.managers-intro-text {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #37474f;
}

.managers-list-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.managers-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.managers-angel-placeholder {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #546e7a;
}

.manager-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #cfd8dc;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
}

.manager-card--hired {
  opacity: 0.85;
}

.manager-avatar {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(145deg, #eceff1, #cfd8dc);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  border: 2px solid #b0bec5;
}

.manager-info {
  min-width: 0;
}

.manager-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1565c0;
  line-height: 1.2;
}

.manager-manages {
  font-size: 0.72rem;
  color: #455a64;
  margin-top: 2px;
}

.manager-cost {
  font-size: 0.78rem;
  font-weight: 800;
  color: #263238;
  margin-top: 4px;
}

.manager-hire-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  background: linear-gradient(180deg, #616161, #424242);
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 0 #212121;
}

.manager-hire-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.manager-hire-btn--done {
  background: linear-gradient(180deg, #66bb6a, #2e7d32);
  box-shadow: 0 2px 0 #1b5e20;
}

/* Standalone wallet page */
.wallet-page {
  min-height: 100vh;
}

.wallet-standalone {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 12px calc(20px + env(safe-area-inset-bottom, 0));
  position: relative;
  z-index: 2;
}

.wallet-panel--standalone {
  width: min(100%, 440px);
  max-height: min(90vh, 700px);
}

.wallet-back-link {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 800;
  color: #eceff1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.wallet-page-msg {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(20, 18, 26, 0.92);
  color: #ffe082;
  border: 1px solid rgba(255, 202, 40, 0.35);
  font-size: 0.76rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.wallet-page-msg--show {
  opacity: 1;
}


/* === Подстраницы TMA (было pages.css; встроено для Telegram WebView — один CSS) === */
:root {
  --tma-page-bg: radial-gradient(120% 80% at 50% -10%, rgba(124, 77, 255, 0.35) 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 100%, rgba(255, 152, 0, 0.12) 0%, transparent 45%),
    #0c0814;
  --tma-gold: #ffe082;
  --tma-gold-hot: #ffca28;
  --tma-magenta: #e040fb;
  --tma-card-bg: linear-gradient(165deg, rgba(38, 32, 58, 0.96) 0%, rgba(18, 14, 28, 0.98) 100%);
  --tma-card-border: rgba(255, 213, 127, 0.28);
  --tma-card-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --tma-text-muted: #90a4ae;
  --tma-font-display: "Fredoka", system-ui, sans-serif;
}

.tma-subpage {
  min-height: 100vh;
  background: var(--tma-page-bg);
  color: #eceff1;
  font-family: var(--tma-font-display);
}

.tma-subpage .ambient {
  opacity: 0.85;
}

.tma-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0)) 12px calc(20px + env(safe-area-inset-bottom, 0));
  box-sizing: border-box;
}

.tma-topbar {
  width: min(100%, 480px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tma-back {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff8e1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.25));
  border: 1px solid rgba(255, 213, 127, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.tma-back:active {
  transform: scale(0.97);
}

.tma-title-block {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.tma-eyebrow {
  margin: 0 0 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 224, 130, 0.75);
  text-shadow: 0 0 12px rgba(255, 193, 7, 0.35);
}

.tma-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fffde7 0%, var(--tma-gold-hot) 55%, #ff6f00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(255, 152, 0, 0.35));
}

.tma-spacer {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.tma-stack {
  width: min(100%, 480px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tma-card {
  background: var(--tma-card-bg);
  border: 1px solid var(--tma-card-border);
  border-radius: 16px;
  box-shadow: var(--tma-card-shadow);
  padding: 14px 14px 16px;
  position: relative;
  overflow: hidden;
}

.tma-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 120% at 10% 0%, rgba(224, 64, 251, 0.12) 0%, transparent 45%);
  pointer-events: none;
}

.tma-card > * {
  position: relative;
  z-index: 1;
}

.tma-card-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tma-gold);
  text-shadow: 0 0 18px rgba(255, 193, 7, 0.25);
}

.tma-pill-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.tma-pill-tabs--2 {
  grid-template-columns: 1fr 1fr;
}

.tma-pill {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 9px 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b0bec5;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-family: inherit;
}

.tma-pill--active {
  color: #1a1024;
  border-color: transparent;
  background: linear-gradient(180deg, #ffe082 0%, #ffb300 100%);
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.45);
}

.tma-hint {
  margin: 0 0 10px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--tma-text-muted);
}

.tma-footnote {
  margin: 10px 0 0;
  font-size: 0.65rem;
  line-height: 1.35;
  color: #78909c;
}

.tma-card--referrals .tma-ref-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 213, 79, 0.08);
  border: 1px solid rgba(255, 213, 79, 0.22);
}

.tma-ref-open-btn {
  margin-top: 12px;
  width: 100%;
  border: 3px solid #3e2723;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff8e1 0%, #fef3c7 100%);
  color: #3e2723;
  font-weight: 800;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
}

.tma-ref-open-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
}

.tma-ref-open-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 84px;
  justify-content: center;
  border: 3px solid #3e2723;
  border-radius: 999px;
  padding: 4px 10px;
  color: #fff8e1;
  background: linear-gradient(180deg, #ff8a3c 0%, #ff5f1f 100%);
}

.tma-ref-page .tma-ref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 10, 22, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tma-ref-page .tma-ref-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 224, 130, 0.45);
  background: linear-gradient(145deg, rgba(255, 224, 130, 0.35), rgba(255, 143, 0, 0.25));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff8e1;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tma-ref-page .tma-ref-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tma-ref-page .tma-ref-meta {
  min-width: 0;
}

.tma-ref-page .tma-ref-name {
  margin: 0;
  font-size: 0.88rem;
  color: #eceff1;
  font-weight: 800;
}

.tma-ref-page .tma-ref-sub {
  margin: 2px 0 0;
  font-size: 0.7rem;
  color: var(--tma-text-muted);
}

.tma-ref-invite-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--tma-text-muted);
  width: 100%;
}

.tma-ref-invite-url {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 0.65rem;
  line-height: 1.35;
  word-break: break-all;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff8e1;
}

.tma-ref-copy-btn {
  flex: 0 0 auto;
  width: auto !important;
  padding: 8px 14px !important;
}

.tma-ref-tables {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.tma-ref-table-wrap {
  border-radius: 12px;
  border: 2px solid rgba(62, 39, 35, 0.55);
  background: linear-gradient(180deg, rgba(255, 248, 225, 0.12) 0%, rgba(255, 236, 179, 0.06) 100%);
  overflow: hidden;
}

.tma-ref-table-title {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, #ff8f00 0%, #e65100 100%);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.tma-ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 10px;
  padding: 10px 12px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #4e342e;
}

@media (max-width: 360px) {
  .tma-ref-grid {
    grid-template-columns: repeat(2, 1fr);
    font-size: 0.64rem;
  }
}

/* Рефералы: экран «Мои друзья» (в стиле TMA: золото, фиолет, тёмные карточки) */
.ref-screen .tma-stack.ref-stack {
  gap: 14px;
}

.tma-card.ref-card--link {
  box-shadow: var(--tma-card-shadow), 0 0 32px rgba(255, 193, 7, 0.06);
}

.ref-link-box {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 213, 127, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ref-link-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 4px 0;
  font-size: 0.62rem;
  line-height: 1.45;
  word-break: break-all;
  color: #fff8e1;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.ref-link-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 213, 127, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(0, 0, 0, 0.28) 100%);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: #fff8e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ref-icon-btn:active {
  transform: scale(0.96);
}

.ref-btn-share {
  margin-top: 2px;
}

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

@media (max-width: 420px) {
  .ref-earn-grid {
    grid-template-columns: 1fr;
  }
}

.ref-earn-item {
  border-radius: 12px;
  padding: 10px 10px 11px;
  border: 1px solid rgba(255, 213, 127, 0.18);
  background: rgba(0, 0, 0, 0.28);
}

.ref-earn-item__label {
  margin: 0 0 6px;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tma-text-muted);
  font-weight: 700;
}

.ref-earn-item__value {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.2;
  font-weight: 900;
  color: #ffe082;
  text-shadow: 0 0 12px rgba(255, 193, 7, 0.24);
}

.ref-earn-note {
  margin: 9px 2px 0;
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--tma-text-muted);
}

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

.ref-friends-head .tma-card-title.ref-friends-head__title {
  margin: 0;
}

.ref-pill-count {
  flex: 0 0 auto;
  min-width: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  color: #1a1024;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #ffe082 0%, #ffb300 100%);
  box-shadow: 0 0 18px rgba(255, 193, 7, 0.35);
}

.ref-friends-hint {
  margin: 0 0 10px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--tma-text-muted);
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 48px;
}

.tma-card.ref-details {
  padding-bottom: 14px;
}

.ref-details__summary {
  cursor: pointer;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ref-details__summary::-webkit-details-marker {
  display: none;
}

.ref-details__summary-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ref-details__summary-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ref-details__summary-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tma-gold);
  text-shadow: 0 0 14px rgba(255, 193, 7, 0.2);
  line-height: 1.25;
}

.ref-details__summary-hint {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(176, 190, 203, 0.95);
  line-height: 1.35;
}

.ref-details__hint-open {
  display: none;
}

.ref-details[open] .ref-details__hint-open {
  display: inline;
  color: var(--tma-gold-hot);
}

.ref-details[open] .ref-details__hint-closed {
  display: none;
}

.ref-details__chevron {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 213, 127, 0.45);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.14) 0%, rgba(0, 0, 0, 0.22) 100%);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.22s ease, box-shadow 0.2s ease;
}

.ref-details__chevron::before {
  content: "";
  display: block;
  width: 11px;
  height: 11px;
  margin-left: -3px;
  border-right: 3px solid var(--tma-gold-hot);
  border-bottom: 3px solid var(--tma-gold-hot);
  transform: rotate(-45deg);
}

.ref-details[open] .ref-details__chevron {
  transform: rotate(90deg);
  box-shadow:
    0 2px 14px rgba(255, 193, 7, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.ref-details__summary:active .ref-details__chevron {
  transform: scale(0.94);
}

.ref-details[open] .ref-details__summary:active .ref-details__chevron {
  transform: rotate(90deg) scale(0.94);
}

.ref-details__summary:focus-visible {
  outline: 2px solid rgba(255, 213, 127, 0.55);
  outline-offset: 3px;
  border-radius: 12px;
}

.ref-details__note {
  margin: 10px 0 12px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--tma-text-muted);
}

.ref-tables-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 400px) {
  .ref-tables-compact {
    grid-template-columns: 1fr;
  }
}

.ref-mini-table {
  border-radius: 12px;
  padding: 10px 10px 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.ref-mini-table__cap {
  margin: 0 0 8px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--tma-gold-hot);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ref-mini-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.7rem;
}

.ref-mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #eceff1;
}

.ref-mini-list li:last-child {
  border-bottom: none;
}

.ref-mini-list span:first-child {
  color: var(--tma-text-muted);
  font-weight: 600;
}

.ref-mini-list span:last-child {
  color: #ffb74d;
  font-weight: 800;
}

.tma-btn-primary {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  color: #1b0e2e;
  background: linear-gradient(180deg, #ffd54f 0%, #ff8f00 100%);
  box-shadow: 0 4px 0 #b45309, 0 10px 24px rgba(255, 152, 0, 0.35);
}

.tma-btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b45309, 0 6px 16px rgba(255, 152, 0, 0.3);
}

.tma-btn-ghost {
  display: block;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #cfd8dc;
  background: rgba(255, 255, 255, 0.06);
}

/* Кошелёк: история */
.tma-tx-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 8, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tma-tx-title {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  color: #eceff1;
}

.tma-tx-meta {
  margin: 3px 0 0;
  font-size: 0.65rem;
  color: #78909c;
}

.tma-tx-amt-in {
  font-size: 0.78rem;
  font-weight: 900;
  color: #69f0ae;
  text-shadow: 0 0 12px rgba(105, 240, 174, 0.35);
}

.tma-tx-amt-out {
  font-size: 0.78rem;
  font-weight: 900;
  color: #ff8a80;
  text-shadow: 0 0 12px rgba(255, 138, 128, 0.3);
}

.tma-empty {
  margin: 0;
  padding: 12px 4px;
  font-size: 0.74rem;
  color: #90a4ae;
  text-align: center;
}

/* Лидерборд */
.tma-lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 2px;
}

.tma-lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12, 10, 22, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.tma-lb-row--me {
  border-color: rgba(224, 64, 251, 0.55);
  box-shadow: 0 0 22px rgba(224, 64, 251, 0.2);
  background: linear-gradient(90deg, rgba(74, 20, 140, 0.45) 0%, rgba(12, 10, 22, 0.85) 100%);
}

.tma-lb-rank {
  font-weight: 900;
  font-size: 0.85rem;
  color: #b0bec5;
  text-align: center;
}

.tma-lb-row:nth-child(1) .tma-lb-rank {
  color: #ffd54f;
  text-shadow: 0 0 10px rgba(255, 213, 79, 0.6);
}

.tma-lb-row:nth-child(2) .tma-lb-rank {
  color: #cfd8dc;
}

.tma-lb-row:nth-child(3) .tma-lb-rank {
  color: #ffab91;
}

.tma-lb-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #eceff1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tma-lb-val {
  font-size: 0.72rem;
  font-weight: 900;
  color: #ffb74d;
  white-space: nowrap;
}

/* Профиль */
.tma-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.tma-hero-avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: linear-gradient(145deg, #7e57c2, #311b92);
  border: 2px solid rgba(255, 236, 179, 0.45);
  box-shadow: 0 0 24px rgba(126, 87, 194, 0.45);
  overflow: hidden;
}

.tma-hero-avatar .tma-tg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tma-hero-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.tma-hero-level {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--tma-text-muted);
}

.tma-hero-level strong {
  color: var(--tma-gold);
}

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

.tma-stat {
  padding: 10px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tma-stat-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #78909c;
  margin-bottom: 4px;
}

.tma-stat-value {
  font-size: 0.88rem;
  font-weight: 900;
  color: #fff8e1;
}

.tma-prestige-meta {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.tma-prestige-meta li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.72rem;
  color: #90a4ae;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tma-prestige-meta strong {
  color: #e1bee7;
  font-size: 0.76rem;
}

.tma-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(18, 12, 28, 0.95);
  border: 1px solid rgba(255, 213, 79, 0.35);
  color: #ffe082;
  font-size: 0.76rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.tma-toast--show {
  opacity: 1;
}

/* Подстраницы: в игре задано html,body{overflow:hidden} — для кошелька/профиля нужна прокрутка */
html:has(body.tma-subpage) {
  overflow: auto;
  max-height: none;
  height: auto;
}
body.tma-subpage {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: none;
  height: auto;
  min-height: 100dvh;
}

/* Экраны профиль / кошелёк / магазин / лидерборд внутри index.html (#profile, #wallet, #shop, #leaderboard) */
.tma-inline-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

body.tma-inline-open {
  overflow: auto !important;
}

body.tma-inline-open .shell {
  display: none !important;
}

html:has(body.tma-inline-open) {
  overflow: auto !important;
  max-height: none !important;
  height: auto !important;
}

/* Магазин (shop.html и #shop в index) */
.tma-card--shop-hero .shop-balance-line {
  margin: 8px 0 0;
  font-size: 1rem;
}

.tma-card--shop-boosts .shop-boost-hint {
  margin-bottom: 6px;
}

.tma-card--shop-boosts {
  overflow: visible;
}

/* Без второй рамки/подложки: сетка сидит прямо в .tma-card (одно «окно»). */
.shop-boost-stage {
  margin-top: 4px;
  padding: 4px 0 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
}

.shop-boost-stage .shop-boost-grid {
  margin-top: 0;
  position: relative;
  z-index: 1;
}

.shop-boost-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* Большой зазор между рядами: кнопка свисает вниз, иконка — вверх, иначе «заплыв» на нижние карты */
  row-gap: 52px;
  column-gap: 12px;
  margin-top: 8px;
  padding-top: 18px;
  padding-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  position: relative;
  z-index: 2;
}

/* Карточка: кремовый билет, толстый «контур», иконка и кнопка вынесены за края */
.shop-boost-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 34px 10px 12px;
  margin: 0;
  border: 3px solid #3d2918;
  border-radius: 16px;
  overflow: visible;
  text-align: center;
  font: inherit;
  color: #3e2723;
  background: linear-gradient(175deg, #fdf6e8 0%, #f3e9d4 42%, #e8dcc6 100%);
  box-shadow:
    0 4px 0 rgba(45, 32, 18, 0.22),
    0 8px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  min-height: 0;
  width: 100%;
  max-width: 100%;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.shop-boost-card:hover {
  box-shadow:
    0 4px 0 rgba(45, 32, 18, 0.28),
    0 10px 26px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.shop-boost-card__art {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -44%);
  width: 42%;
  max-width: 76px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  line-height: 0;
  font-size: 0;
  user-select: none;
  border-radius: 50%;
  border: 3px solid #2d1f12;
  background: radial-gradient(circle at 50% 40%, #fffef9 0%, #f7ecd8 55%, #ead9bc 100%);
  box-shadow:
    0 3px 0 rgba(45, 32, 18, 0.35),
    0 0 0 2px rgba(255, 255, 255, 0.55),
    0 6px 14px rgba(0, 0, 0, 0.2);
}

.shop-boost-card__art .shop-boost-svg {
  width: 54%;
  max-width: 44px;
  height: auto;
  aspect-ratio: 1;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.shop-boost-card__body {
  flex: 0 1 auto;
  /* Минимум под золотую кнопку (absolute у нижнего края карточки), без лишней «полки» */
  padding: 0 4px 28px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 2px;
  text-align: center;
  background: transparent;
}

.shop-boost-card__title {
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.2;
  color: #8d3d2e;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.shop-boost-card__blurb {
  font-size: 0.62rem;
  line-height: 1.35;
  font-weight: 500;
  color: #5d5348;
  max-width: 100%;
  padding: 0 2px;
}

.shop-boost-card__yield {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 800;
  color: #1b5e20;
  margin: 2px 0 0;
  padding: 0 2px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Золотая кнопка с толстым контуром, частично за нижним краем карточки */
.shop-boost-card__buy {
  position: absolute;
  bottom: 0;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, 38%);
  width: 66%;
  max-width: 132px;
  margin: 0;
  padding: 8px 10px;
  min-height: 36px;
  box-sizing: border-box;
  border: 3px solid #2d1f12;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  font-size: 0.76rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  cursor: pointer;
  color: #3e2723;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  background: linear-gradient(180deg, #ffe9a0 0%, #ffca28 38%, #f9a825 72%, #ef6c00 100%);
  box-shadow:
    0 3px 0 #2d1f12,
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.shop-boost-card__buy:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translate(-50%, calc(38% - 2px));
}

.shop-boost-card__buy:active:not(:disabled) {
  transform: translate(-50%, 38%);
  filter: brightness(0.96);
}

.shop-boost-card__buy:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: translate(-50%, 38%);
  filter: saturate(0.65);
  box-shadow:
    0 2px 0 #4e342e,
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ====== Welcome-back overlay ====== */
.wb-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 5, 15, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
  animation: wbFadeIn 0.35s ease-out;
}
.wb-overlay[hidden] { display: none; }

@keyframes wbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.wb-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  border-radius: 24px;
  padding: 36px 24px 28px;
  text-align: center;
  overflow: hidden;
  background:
    linear-gradient(170deg,
      rgba(30, 22, 55, 0.96) 0%,
      rgba(18, 14, 32, 0.98) 50%,
      rgba(10, 28, 36, 0.97) 100%);
  border: 1.5px solid rgba(255, 213, 120, 0.18);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(102, 187, 106, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: wbCardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wbCardPop {
  from { transform: scale(0.85) translateY(30px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.wb-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 72% 12%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 40% 35%, rgba(255,213,120,0.45), transparent),
    radial-gradient(1px 1px at 85% 45%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 28% 70%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 60% 80%, rgba(102,187,106,0.35), transparent);
}

.wb-title {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fffef7;
  text-shadow: 0 2px 12px rgba(102, 187, 106, 0.3);
  margin-bottom: 6px;
}

.wb-away {
  font-size: 0.88rem;
  font-weight: 500;
  color: #b0a8c4;
  margin-bottom: 18px;
}

.wb-earned-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 213, 120, 0.14);
  border-radius: 16px;
  padding: 16px 14px 14px;
  margin-bottom: 22px;
}

.wb-earned-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b0a8c4;
  margin-bottom: 4px;
}

.wb-earned-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  color: #66bb6a;
  text-shadow: 0 0 18px rgba(102, 187, 106, 0.4);
  margin-bottom: 4px;
}

.wb-earned-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8a8098;
}

.wb-collect-btn {
  display: inline-block;
  min-width: 180px;
  padding: 14px 28px;
  border: none;
  border-radius: 14px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 50%, #2e7d32 100%);
  box-shadow:
    0 4px 0 #1b5e20,
    0 6px 20px rgba(102, 187, 106, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.12s, filter 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.wb-collect-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.wb-collect-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
  box-shadow:
    0 2px 0 #1b5e20,
    0 3px 10px rgba(102, 187, 106, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
