@font-face {
  font-family: 'GameFont';
  src: local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100%);
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: none;
  -ms-scroll-chaining: none;
  font-family: 'GameFont', sans-serif;
  background: #1a1a2e;
  color: #fff;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  touch-action: none;
  display: block;
}

#ui-root {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  pointer-events: none;
  z-index: 10;
}

/* === Экраны === */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Геймплейный оверлей — пропускает клики к canvas */
.screen.gameplay-overlay {
  pointer-events: none !important;
}

.screen.gameplay-overlay > * {
  pointer-events: auto;
}

/* === Кнопки === */
button, .btn {
  min-width: 48px;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-family: 'GameFont', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

button:active, .btn:active {
  transform: scale(0.95);
}

button:disabled, .btn:disabled, .btn-disabled {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
  padding: 12px 24px;
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.btn-primary:active {
  background: linear-gradient(135deg, #e67e22, #d35400);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 12px 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-bid {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  padding: 14px 20px;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-bid:active {
  background: linear-gradient(135deg, #219a52, #27ae60);
}

.btn-pass {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  padding: 14px 20px;
  font-size: 18px;
}

/* === Прокручиваемые контейнеры === */
.scrollable-container {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollable-container::-webkit-scrollbar {
  display: none;
}

/* Нативный скроллбар скрыт на всех контейнерах (включая .scrollable-visible) —
   видимую полосу прокрутки рисует кастомный оверлей (.scroll-thumb, см. Scroller.js),
   который надёжно работает и на iOS Safari, где нативный ::-webkit-scrollbar не виден. */
.scrollable-container {
  padding-right: 10px;
}

/* Кастомный ползунок прокрутки — позиционируется через JS относительно .screen */
.scroll-thumb {
  position: absolute;
  width: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f1c40f, #e67e22);
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  touch-action: none;
  transition: opacity 0.2s ease;
}

.scroll-thumb:active {
  background: linear-gradient(180deg, #ffd633, #f39c12);
  width: 8px;
}

/* === Деньги === */
.money-display {
  font-size: 22px;
  font-weight: 700;
  color: #f1c40f;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* === Таймер === */
.timer-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #f1c40f);
  border-radius: 3px;
  transition: width 0.1s linear;
}

.timer-bar-fill.urgent {
  background: linear-gradient(90deg, #e74c3c, #f39c12);
}

/* === Редкость === */
.rarity-junk { color: #888; }
.rarity-common { color: #fff; }
.rarity-uncommon { color: #4CAF50; }
.rarity-rare { color: #2196F3; }
.rarity-epic { color: #9C27B0; }
.rarity-legendary { color: #FF9800; }

/* === Аватары ботов === */
.bot-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  border: 3px solid rgba(255, 255, 255, 0.2);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
  overflow: hidden;
}

/* Портрет занимает круг целиком */
.bot-avatar.has-portrait {
  padding: 0;
}

.bot-avatar svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bot-avatar.bidding {
  border-color: #f1c40f;
  animation: pulse 0.5s ease;
}

.bot-name {
  color: #ccc;
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.2;
}

.bot-money {
  color: #fff;
  font-size: 11px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}

/* --- Мимика: по умолчанию спокойное лицо --- */
.bot-face .mouth-bid,
.bot-face .mouth-out,
.bot-face .eyes-shut {
  display: none;
}

.bot-wrapper.is-bidding .bot-face .mouth-idle { display: none; }
.bot-wrapper.is-bidding .bot-face .mouth-bid { display: block; }

.bot-wrapper.bot-out .bot-face .mouth-idle { display: none; }
.bot-wrapper.bot-out .bot-face .mouth-out { display: block; }
.bot-wrapper.bot-out .bot-face .eyes-open { display: none; }
.bot-wrapper.bot-out .bot-face .eyes-shut { display: block; }

/* --- Лидер торгов --- */
.bot-wrapper.is-leading .bot-avatar {
  border-color: #f1c40f;
  box-shadow: 0 0 14px rgba(241, 196, 15, 0.55);
}

.bot-wrapper.is-leading .bot-name {
  color: #f1c40f;
}

/* --- Тот, кто вот-вот сделает ход --- */
.bot-wrapper.next-actor .bot-avatar {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.5);
}

.bot-think {
  position: absolute;
  top: -6px;
  right: -10px;
  display: none;
  gap: 3px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 10px;
  pointer-events: none;
}

.bot-wrapper.next-actor .bot-think {
  display: flex;
}

.bot-wrapper.bot-out .bot-think,
.bot-wrapper.is-bidding .bot-think {
  display: none;
}

.bot-think span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f1c40f;
  animation: thinkDot 0.9s ease-in-out infinite;
}

.bot-think span:nth-child(2) { animation-delay: 0.15s; }
.bot-think span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkDot {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.bot-avatar.passed {
  opacity: 0.4;
}

/* Слот аватарки — якорь для штампа «ПАС» */
.bot-avatar-slot {
  position: relative;
  display: inline-block;
}

/* Штамп «вышел из торгов» — состояние должно читаться мгновенно */
.bot-out-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg) scale(0.7);
  padding: 1px 8px;
  border: 2px solid #e74c3c;
  border-radius: 4px;
  color: #e74c3c;
  background: rgba(20, 6, 4, 0.75);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
}

.bot-wrapper.bot-out .bot-out-label {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(-12deg) scale(1);
}

.bot-wrapper.bot-out {
  filter: grayscale(0.75);
  opacity: 0.55;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* === Тост === */
.toast {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 20px));
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* === Модальное окно === */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  /* #ui-root отключает pointer-events; оверлей обязан их вернуть, иначе клики
     проваливаются сквозь него к экрану под ним */
  pointer-events: auto;
}

.modal {
  background: linear-gradient(145deg, #1e2a3a, #16213e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  max-width: 90%;
  max-height: 80%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* === Выбор языка === */
.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  min-height: 48px;
  position: relative;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lang-option:active {
  transform: scale(0.97);
}

.lang-option--active {
  border-color: #f1c40f;
  background: rgba(241, 196, 15, 0.12);
}

.lang-code {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.5px;
  color: #f1c40f;
  background: rgba(241, 196, 15, 0.14);
  border-radius: 6px;
  padding: 5px 5px;
  min-width: 30px;
  text-align: center;
}

/* Выбранный язык: залитый бейдж — чёткий индикатор без отдельной галочки,
   которая отъедала ширину и обрезала длинные названия (Português, Русский) */
.lang-option--active .lang-code {
  background: #f1c40f;
  color: #16213e;
}

.lang-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* На узких экранах (телефоны в портрете) — одна колонка во всю ширину,
   чтобы названия гарантированно влезали для всех языков */
@media (max-width: 384px) {
  .lang-grid {
    grid-template-columns: 1fr;
  }
}

/* === Ландшафт на мобильных — отступ от сайдбара Яндекса === */
@media (orientation: landscape) and (max-height: 500px) {
  .hud-top {
    padding-left: 68px;
  }
  .hud-bottom {
    padding-left: 68px;
  }
}

/* === Загрузочный экран === */
.loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity 0.5s ease;
}

.loading-screen h1 {
  font-size: 28px;
  color: #f1c40f;
  margin-bottom: 24px;
  text-align: center;
}

.loading-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: #f1c40f;
  border-radius: 2px;
  transition: width 0.3s;
}

/* === Речевой пузырь бота === */
.bot-speech {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.25;
  /* Реплики короткие, но переносить лучше, чем обрезать многоточием.
     Ширина не больше ячейки соперника — иначе на узком экране пузырь
     крайнего бота уезжает за границу. */
  white-space: normal;
  width: max-content;
  max-width: min(140px, 42vw);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 20;
}

.bot-speech.show {
  opacity: 1;
  z-index: 25;
}

.bot-speech::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(0, 0, 0, 0.85);
}

/* === Поштучное раскрытие === */
.reveal-item-card {
  position: absolute;
  top: auto;
  bottom: max(40px, env(safe-area-inset-bottom, 40px));
  left: 50%;
  transform: translate(-50%, 30px) scale(0.85);
  background: linear-gradient(145deg, rgba(30, 42, 58, 0.95), rgba(22, 33, 62, 0.95));
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 18px 28px;
  text-align: center;
  opacity: 0;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 30;
  min-width: 240px;
}

.reveal-item-card.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.reveal-item-card .item-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.reveal-item-card .item-rarity {
  font-size: 13px;
  margin-bottom: 8px;
}

.reveal-item-card .item-value {
  font-size: 28px;
  font-weight: 700;
  color: #f1c40f;
  text-shadow: 0 2px 12px rgba(241, 196, 15, 0.4);
}

.reveal-item-card .item-counter {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
}

/* Редкость — рамки карточки */
.reveal-item-card.rarity-junk { border-color: #888; }
.reveal-item-card.rarity-common { border-color: #fff; }
.reveal-item-card.rarity-uncommon { border-color: #4CAF50; box-shadow: 0 0 20px rgba(76, 175, 80, 0.3); }
.reveal-item-card.rarity-rare { border-color: #2196F3; box-shadow: 0 0 25px rgba(33, 150, 243, 0.4); }
.reveal-item-card.rarity-epic { border-color: #9C27B0; box-shadow: 0 0 30px rgba(156, 39, 176, 0.5); }
.reveal-item-card.rarity-legendary { border-color: #FF9800; box-shadow: 0 0 40px rgba(255, 152, 0, 0.6); animation: legendaryGlow 1.5s ease infinite; }

@keyframes legendaryGlow {
  0%, 100% { box-shadow: 0 0 40px rgba(255, 152, 0, 0.6); }
  50% { box-shadow: 0 0 60px rgba(255, 152, 0, 0.9), 0 0 100px rgba(255, 152, 0, 0.3); }
}

/* === Кнопка x2 (rewarded double) — привлекающая внимание === */
.btn-x2 {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 12px 14px;
  border: 2px solid rgba(255, 217, 102, 0.85);
  border-radius: 14px;
  background: linear-gradient(135deg, #ff8c1a 0%, #f1c40f 45%, #ffb84d 100%);
  color: #2a1500;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    0 0 0 4px rgba(241, 196, 15, 0.18),
    0 6px 18px rgba(241, 196, 15, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transform: translateZ(0);
  animation: x2Pulse 1.6s ease-in-out infinite;
  transition: transform 0.12s ease;
}

.btn-x2:hover { transform: scale(1.04); }
.btn-x2:active { transform: scale(0.97); }

.btn-x2-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25), 0 2px 6px rgba(231, 76, 60, 0.55);
  letter-spacing: -0.5px;
}

.btn-x2-label { white-space: nowrap; }

.btn-x2-shine {
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%
  );
  transform: skewX(-22deg);
  animation: x2Shine 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes x2Pulse {
  0%, 100% {
    box-shadow:
      0 0 0 4px rgba(241, 196, 15, 0.18),
      0 6px 18px rgba(241, 196, 15, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }
  50% {
    box-shadow:
      0 0 0 7px rgba(241, 196, 15, 0.10),
      0 8px 28px rgba(255, 165, 0, 0.75),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }
}

@keyframes x2Shine {
  0%   { left: -60%; }
  55%  { left: 110%; }
  100% { left: 110%; }
}

/* === Подсказка контейнера === */
.container-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #aaa;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-style: italic;
  opacity: 0;
  animation: hintFade 3s ease forwards;
  pointer-events: none;
}

@keyframes hintFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* === Рынок === */
.market-category {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border-left: 3px solid #555;
}

.market-category.up {
  border-left-color: #2ecc71;
}

.market-category.down {
  border-left-color: #e74c3c;
}

/* === Специальный контейнер === */
.special-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  animation: specialPulse 2s ease infinite;
}

.special-badge.golden {
  background: linear-gradient(135deg, #f39c12, #f1c40f);
  color: #000;
}

.special-badge.mystery {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  color: #fff;
}

.special-badge.confiscated {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

@keyframes specialPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* === Серия аукционов === */
.series-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 8px 0;
}

.series-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.3s;
}

.series-dot.won {
  background: #2ecc71;
}

.series-dot.lost {
  background: #e74c3c;
}

.series-dot.current {
  background: #f1c40f;
  animation: pulse 1s ease infinite;
}

/* ================================================
   ГЛАВНОЕ МЕНЮ
   ================================================ */

.menu-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  /* Раньше блок был height:100% + justify-content:center без прокрутки:
     на низких экранах (ландшафт телефона) обрезалось всё, включая «Играть» */
  justify-content: safe center;
}

.menu-top-icons {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Языковая «пилюля» в шапке меню: та же высота, что у круглых иконок,
   но шире — внутри код текущего языка (EN, RU, ...). Флаги-эмодзи не используем:
   на Windows они деградируют до кодов стран. */
.icon-btn--lang {
  width: auto;
  min-width: 42px;
  border-radius: 21px;
  padding: 0 12px;
  gap: 5px;
  font-size: 16px;
}

.icon-btn-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #f1c40f;
}

.menu-title {
  font-size: clamp(24px, 7vw, 34px);
  color: #f1c40f;
  text-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
  text-align: center;
  line-height: 1.1;
}

.menu-prestige {
  color: #f39c12;
  font-size: 14px;
  letter-spacing: 2px;
}

.menu-level {
  color: #aaa;
  font-size: 13px;
}

.menu-xp {
  width: 190px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.menu-xp-fill {
  height: 100%;
  background: #f1c40f;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Видимая цель на несколько аукционов вперёд */
.menu-next {
  color: #7fb3d5;
  font-size: 12px;
  background: rgba(41, 128, 185, 0.14);
  border: 1px solid rgba(41, 128, 185, 0.3);
  border-radius: 20px;
  padding: 3px 12px;
}

.menu-play {
  width: min(280px, 82vw);
  font-size: 20px;
  padding: 15px 32px;
  margin-top: 4px;
}

.menu-series {
  width: min(280px, 82vw);
}

/* Второстепенные разделы — сеткой 2x2 и разными цветами по смыслу */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(280px, 82vw);
}

.menu-grid .btn {
  font-size: 14px;
  padding: 11px 8px;
  min-height: 46px;
  position: relative;
}

.btn-market {
  background: linear-gradient(135deg, #2e86c1, #21618c);
  color: #fff;
}

.btn-office {
  background: linear-gradient(135deg, #7d5fc4, #5b3fa0);
  color: #fff;
}

.btn-profile {
  background: linear-gradient(135deg, #40505f, #2c3a47);
  color: #fff;
}

.btn-skills {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}

.btn-skills.has-points {
  border-color: rgba(241, 196, 15, 0.75);
  color: #f1c40f;
}

.menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 10px;
  background: #f1c40f;
  color: #2a1f00;
  font-size: 12px;
  font-weight: 800;
}

/* Подарок — не зелёный: рядом стоит зелёная «Серия», два одинаковых
   акцента подряд смазывают иерархию */
.btn-free {
  width: min(280px, 82vw);
  background: linear-gradient(135deg, #ffd76a, #efa72a);
  color: #3a2600;
  font-weight: 800;
  font-size: 15px;
  min-height: 46px;
  animation: freePulse 1.8s ease-in-out infinite;
}

@keyframes freePulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(239, 167, 42, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(255, 215, 106, 0.16), 0 6px 18px rgba(255, 215, 106, 0.55); }
}

/* Низкие экраны: меню сжимается, но ничего не обрезается */
@media (max-height: 560px) {
  .menu-wrap { gap: 7px; }
  .menu-title { font-size: 22px; }
  .menu-play { padding: 11px 24px; font-size: 17px; min-height: 44px; }
  .menu-series, .btn-free { min-height: 40px; padding: 9px 16px; font-size: 14px; }
  .menu-grid .btn { min-height: 40px; font-size: 13px; padding: 8px 6px; }
  .menu-xp { height: 3px; }
}

/* Ландшафт телефона: меню должно помещаться целиком, без прокрутки */
@media (orientation: landscape) and (max-height: 440px) {
  .menu-wrap { gap: 5px; padding-top: 8px; padding-bottom: 8px; }
  .menu-title { font-size: 19px; }
  .menu-prestige { display: none; }
  .money-display { font-size: 17px !important; }
  .menu-level { font-size: 11px; }
  .menu-next { font-size: 11px; padding: 2px 10px; }
  .menu-play { min-height: 40px; padding: 8px 22px; font-size: 16px; }
  .menu-series, .btn-free { min-height: 36px; padding: 7px 14px; font-size: 13px; }
  .menu-grid { gap: 6px; }
  .menu-grid .btn { min-height: 36px; font-size: 12px; padding: 6px 4px; }
  .icon-btn { width: 36px; height: 36px; min-width: 36px; min-height: 36px; font-size: 15px; }
  .icon-btn--lang { width: auto; min-width: 36px; padding: 0 10px; border-radius: 18px; font-size: 14px; }
  .icon-btn-code { font-size: 11px; }
}

/* === «Последний шанс» на экране поражения === */
.last-chance {
  position: absolute;
  bottom: max(64px, calc(env(safe-area-inset-bottom, 20px) + 44px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: calc(100% - 24px);
}

.last-chance-btn {
  font-size: 14px !important;
  padding: 10px 18px 10px 12px !important;
}

.last-chance-hint {
  color: #9aa4ad;
  font-size: 10.5px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Когда есть кнопка перехвата — сводка по лоту поднимается, чтобы не перекрыть */
.has-chance .loss-summary {
  bottom: max(152px, calc(env(safe-area-inset-bottom, 24px) + 128px)) !important;
}

@media (max-height: 520px) {
  .last-chance { bottom: max(50px, calc(env(safe-area-inset-bottom, 12px) + 38px)); }
  .last-chance-hint { display: none; }
}

/* ================================================
   ЭКРАН ОЦЕНКИ
   ================================================ */

.appraisal-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  height: 100%;
  padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.75);
  text-align: center;
}

/* Блоки не сжимаются: в flex-колонке с прокруткой список находок ужимался
   до нулевой высоты (в ландшафте игрок вообще не видел, что ему досталось) */
.appraisal-wrap > * {
  flex-shrink: 0;
}

.appraisal-items {
  width: 100%;
  max-width: 400px;
  max-height: 200px;
  margin-top: 16px;
  padding: 0 8px;
}

/* На высоких экранах место есть — показываем весь список находок сразу */
@media (min-height: 720px) {
  .appraisal-items { max-height: 320px; }
}

.appr-title { color: #f1c40f; font-size: 24px; margin-bottom: 4px; }
.appr-total { font-size: 44px; font-weight: 700; color: #fff; }
.appr-paid { font-size: 14px; color: #888; margin-top: 4px; }
.appr-discount { font-size: 13px; color: #3498db; margin-top: 2px; }
.appr-profit { font-size: 22px; font-weight: 600; margin-top: 8px; }
.appr-comment { font-size: 16px; color: #aaa; margin-top: 4px; }
.appr-xp { font-size: 12px; color: #888; margin-top: 4px; }
.appr-x2 { margin-top: 18px; }
.appr-money { margin-top: 12px; }

.appr-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* На низких экранах список находок короче, но прокручивается целиком */
@media (max-height: 560px) {
  .appr-title { font-size: 19px; }
  .appraisal-wrap .btn { min-height: 40px; padding: 8px 18px; font-size: 14px; }
  .appraisal-items { max-height: 132px; margin-top: 8px; }
}

/* Ландшафт телефона: без сжатия «шапки» итог сделки уезжает за экран
   и кнопки «дальше» приходится искать прокруткой */
@media (max-height: 480px) {
  .appr-title { font-size: 16px; margin-bottom: 2px; }
  .appr-total { font-size: 26px; }
  .appr-paid { font-size: 12px; margin-top: 2px; }
  .appr-discount { font-size: 11px; }
  .appr-profit { font-size: 17px; margin-top: 4px; }
  .appr-comment { font-size: 13px; margin-top: 2px; }
  .appr-xp { font-size: 11px; margin-top: 2px; }
  .appraisal-items { max-height: 62px; margin-top: 6px; }
  .appraisal-wrap .btn { min-height: 36px; padding: 6px 16px; font-size: 13px; }
  .appr-x2 { margin-top: 6px; padding: 8px 16px; font-size: 13px; }
  .appr-actions { margin-top: 6px; }
  .appr-money { margin-top: 4px; font-size: 17px; }
  .appraisal-wrap { padding-top: 8px; padding-bottom: 8px; }
}

/* ================================================
   ТУТОРИАЛ
   ================================================ */

.tut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  height: 100%;
  padding: max(20px, env(safe-area-inset-top)) 24px max(20px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.88);
}

.tut-card {
  flex-shrink: 0;
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  border: 2px solid rgba(241, 196, 15, 0.4);
  border-radius: 20px;
  background: linear-gradient(145deg, #1e2a3a, #16213e);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.tut-icon { font-size: 64px; line-height: 1; margin-bottom: 12px; }
.tut-title { color: #f1c40f; font-size: 22px; margin-bottom: 12px; }
.tut-desc { color: #ccc; font-size: 15px; line-height: 1.5; margin-bottom: 20px; }

.tut-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}

.tut-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  transition: width 0.2s, background 0.2s;
}

.tut-dot.active { width: 24px; background: #f1c40f; }

.tut-actions { display: flex; gap: 10px; justify-content: center; }
.tut-actions .btn { min-height: 42px; padding: 10px 22px; font-size: 14px; }
.tut-actions .btn-primary { padding: 10px 28px; font-size: 15px; }

/* Ландшафт телефона: в полный рост карточка не влезала — резались и иконка,
   и кнопки. Поджимаем всё по вертикали и даём карточке расшириться вширь. */
@media (max-height: 480px) {
  .tut-wrap { padding: 10px 16px; }
  .tut-card { max-width: 520px; padding: 14px 20px; border-radius: 16px; }
  .tut-icon { font-size: 32px; margin-bottom: 4px; }
  .tut-title { font-size: 18px; margin-bottom: 6px; }
  .tut-desc { font-size: 13px; line-height: 1.35; margin-bottom: 10px; }
  .tut-dots { margin-bottom: 10px; }
  .tut-actions .btn { min-height: 38px; padding: 8px 18px; font-size: 13px; }
}

/* ================================================
   ЦЕЛИ И СЕРИЯ
   ================================================ */

.goal-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-card {
  background: linear-gradient(135deg, rgba(241, 196, 15, 0.12), rgba(241, 196, 15, 0.04));
  border: 1px solid rgba(241, 196, 15, 0.28);
  border-radius: 10px;
  padding: 10px 12px;
}

.goal-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.goal-progress {
  margin-top: 5px;
  font-size: 11px;
  color: #bba;
  font-variant-numeric: tabular-nums;
}

.ach-group {
  margin-bottom: 14px;
}

.ach-group-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  color: #f1c40f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(241, 196, 15, 0.25);
  margin-bottom: 4px;
}

.ach-group-title span {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0;
}

.series-goal {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  max-width: 340px;
}

.series-goal-main {
  color: #eafaf1;
  font-size: 14px;
  line-height: 1.4;
}

.series-goal-sub {
  margin-top: 6px;
  color: #2ecc71;
  font-size: 12px;
}

.series-line {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  color: #aaa;
  font-size: 12px;
}

.series-line .series-progress {
  margin: 0;
}

.series-line .series-sum {
  color: #2ecc71;
}

.series-line.compact {
  margin-bottom: 4px;
}

/* ================================================
   ПОДТВЕРЖДЕНИЕ ДЕЙСТВИЯ
   ================================================ */

.confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  pointer-events: auto;
  padding: 20px;
}

.confirm-box {
  background: linear-gradient(145deg, #1e2a3a, #16213e);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 22px 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.confirm-text {
  color: #eee;
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-actions .btn {
  min-height: 44px;
  padding: 10px 24px;
  font-size: 15px;
}

/* ================================================
   ВЫБОР ЛОТА
   ================================================ */

.lot-info {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 420px);
  text-align: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.32));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px 12px 10px;
  backdrop-filter: blur(2px);
}

/* Информационная карточка не должна мешать вращать сцену пальцем */
.screen.gameplay-overlay .lot-info {
  pointer-events: none;
}

.lot-counter {
  color: #8e99a4;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lot-name {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  margin-top: 1px;
}

.lot-bid {
  color: #f1c40f;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.lot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-top: 7px;
}

.lot-tag {
  font-size: 11px;
  line-height: 1.3;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cfd6dc;
  white-space: nowrap;
}

/* Приметы читаются цветом: износ — тёплый, замки — холодный, ярлыки — золото */
.lot-tag.trait-wear-rusty { background: rgba(160, 82, 30, 0.22); border-color: rgba(160, 82, 30, 0.5); color: #e0a878; }
.lot-tag.trait-wear-water { background: rgba(70, 110, 80, 0.22); border-color: rgba(70, 110, 80, 0.5); color: #9ec9a8; }
.lot-tag.trait-wear-pristine { background: rgba(52, 152, 219, 0.16); border-color: rgba(52, 152, 219, 0.4); color: #9ed0f0; }
.lot-tag.trait-lock-heavy { background: rgba(155, 89, 182, 0.2); border-color: rgba(155, 89, 182, 0.45); color: #d5a9e8; }
.lot-tag.trait-lock-seal { background: rgba(231, 76, 60, 0.18); border-color: rgba(231, 76, 60, 0.45); color: #f0a79e; }
.lot-tag.trait-lock-none { background: rgba(120, 120, 120, 0.18); color: #b0b0b0; }
.lot-tag.trait-label-auction { background: rgba(241, 196, 15, 0.18); border-color: rgba(241, 196, 15, 0.45); color: #f5d97a; }
.lot-tag.trait-label-customs { background: rgba(41, 128, 185, 0.18); border-color: rgba(41, 128, 185, 0.45); color: #9ec9ea; }

.lot-smell {
  margin-top: 6px;
  color: #8e99a4;
  font-size: 11px;
  font-style: italic;
}

.lot-est {
  margin-top: 4px;
  color: #3498db;
  font-size: 12px;
}

/* --- Нижняя панель: карусель лотов и действия --- */
.lot-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 10px max(12px, env(safe-area-inset-bottom, 12px));
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
}

.lot-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.lot-nav {
  width: 34px;
  min-width: 34px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.lot-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  /* полосу можно листать пальцем (см. фильтр touchmove в main.js) */
  touch-action: pan-x;
  overscroll-behavior-x: contain;
}

.lot-cards::-webkit-scrollbar { display: none; }

.lot-card {
  flex: 0 0 auto;
  width: 92px;
  min-width: 92px;
  min-height: 0;
  padding: 4px 4px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.lot-card.selected {
  border-color: #f1c40f;
  background: rgba(241, 196, 15, 0.12);
  transform: translateY(-2px);
}

.lot-card-art {
  width: 100%;
  height: 46px;
}

.lot-card-art svg { display: block; width: 100%; height: 100%; }

.lot-card-bid {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: #f1c40f;
  font-variant-numeric: tabular-nums;
}

.lot-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.lot-actions .btn {
  font-size: 15px;
  padding: 11px 20px;
  min-height: 46px;
}

.lot-peek {
  font-size: 13px !important;
  padding: 10px 14px !important;
}

.lot-back {
  font-size: 13px !important;
  padding: 7px 18px !important;
  min-height: 38px !important;
  opacity: 0.8;
}

/* Узкий экран: стрелки съедали 80px из 300 — три из четырёх карточек резались
   краем полосы. Убираем стрелки (лот выбирается тапом по карточке) и подгоняем
   ширину карточки так, чтобы все четыре лота были видны целиком. */
@media (max-width: 430px) {
  .lot-nav { display: none; }
  .lot-cards { justify-content: center; width: 100%; }
  .lot-card {
    width: min(92px, calc((100vw - 44px) / 4));
    min-width: min(92px, calc((100vw - 44px) / 4));
  }
}

/* Ландшафт: карточка лота уходит влево, чтобы не закрывать сам контейнер */
@media (orientation: landscape) and (max-height: 560px) {
  .lot-info {
    left: 10px;
    transform: none;
    width: min(46%, 320px);
    text-align: left;
  }

  .lot-tags {
    justify-content: flex-start;
  }

  .lot-est,
  .lot-counter {
    text-align: left;
  }
}

/* Низкие экраны (ландшафт телефона): панель компактнее */
@media (max-height: 520px) {
  .lot-info {
    top: 42px;
    padding: 5px 10px 7px;
  }
  .lot-name { font-size: 15px; }
  .lot-smell { display: none; }
  .lot-card { width: 76px; min-width: 76px; }
  .lot-card-art { height: 38px; }
  .lot-bottom { gap: 5px; padding-top: 6px; }
  .lot-actions .btn { min-height: 40px; padding: 8px 16px; font-size: 14px; }
  .lot-back { min-height: 36px !important; padding: 6px 16px !important; }
}

/* ================================================
   ОСМОТР ЛОТА И ОТЧЁТ ОЦЕНЩИКА
   ================================================ */

/* На время осмотра интерфейс уезжает: панели закрывали ровно то,
   ради чего игрок и заглядывает в щель контейнера */
.hud-top,
.lot-info,
.lot-bottom,
.preview-bottom,
.container-hint {
  transition: opacity 0.25s ease;
}

#ui-root.inspect-mode .hud-top,
#ui-root.inspect-mode .lot-info,
#ui-root.inspect-mode .lot-bottom,
#ui-root.inspect-mode .preview-bottom,
#ui-root.inspect-mode .container-hint {
  opacity: 0;
  pointer-events: none;
}

.inspect-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  letter-spacing: 0.4px;
  pointer-events: none;
  animation: inspect-hint-in 0.4s ease both;
}

@keyframes inspect-hint-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Превью: бесплатный осмотр и отчёт оценщика — в один ряд,
   иначе панель кнопок вырастает вверх и снова лезет в кадр */
.preview-inspect {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Отчёт оценщика (за рекламу): данные о лоте, а не повторный осмотр */
.lot-report {
  width: min(92vw, 340px);
  padding: 8px 12px;
  border-radius: 12px;
  /* Плотная подложка: блок ложится поверх светлого контейнера */
  background: linear-gradient(180deg, rgba(8, 20, 30, 0.86), rgba(8, 20, 30, 0.7));
  border: 1px solid rgba(52, 152, 219, 0.45);
  backdrop-filter: blur(2px);
  text-align: center;
  animation: lot-report-in 0.35s ease both;
}

.lot-report-title {
  color: #3498db;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.lot-report-row {
  color: #dfe6ec;
  font-size: 13px;
  line-height: 1.45;
}

.lot-report-row b {
  color: #fff;
}

.lot-report-row.dim {
  color: #8e99a4;
  font-size: 12px;
}

@keyframes lot-report-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Низкие экраны: отчёт компактнее, иначе съедает высоту кадра */
@media (max-height: 560px) {
  /* Ландшафт телефона: отчёт выкладываем в строку, иначе панель уезжает за верх экрана */
  .lot-report {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px 10px;
    padding: 5px 10px;
  }

  .lot-report-title { margin-bottom: 0; }
  .lot-report-row { font-size: 12px; line-height: 1.35; }
  .lot-report-row.dim { display: none; }
}

/* Узкий экран: кнопки осмотра и отчёт компактнее, иначе панель растёт вверх */
@media (max-width: 430px) {
  /* Обе кнопки — в одну строку: столбик поднимал панель ещё на ряд и она лезла на лот */
  .preview-inspect {
    flex-wrap: nowrap;
    width: min(100%, 340px);
  }

  /* Осталась одна кнопка (отчёт уже получен) — не растягиваем её на всю ширину */
  .preview-inspect .btn:only-child { flex: 0 1 auto; }

  .preview-inspect .btn {
    flex: 1 1 0;
    font-size: 12px !important;
    padding: 9px 8px !important;
    min-height: 42px !important;
  }
  .lot-report { padding: 7px 10px; }
  .lot-report-row { font-size: 12px; }
}

/* === Верхний блок аукциона: соперники + прогресс серии === */
.auction-top {
  position: absolute;
  top: 56px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Блок соперников не должен перехватывать тапы по сцене:
   специфичность выше правила .screen.gameplay-overlay > * */
.screen.gameplay-overlay .auction-top,
.screen.gameplay-overlay .auction-center {
  pointer-events: none;
}

.bots-row {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  width: 100%;
  max-width: 460px;
  gap: 4px;
}

/* === Центр экрана аукциона === */
.auction-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: min(90%, 340px);
}

/* Затемнение под цифрой ставки: поверх светлого борта контейнера
   текст иначе теряется */
.auction-center::before {
  content: '';
  position: absolute;
  inset: -26px -30px -18px;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.42) 45%, rgba(0, 0, 0, 0) 78%);
  pointer-events: none;
  z-index: -1;
}

.highest-bidder {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 4px;
  min-height: 16px;
  transition: color 0.2s;
}

.highest-bidder.is-player {
  color: #2ecc71;
}

/* Лента ставок: последние 3 действия */
.bid-feed {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  pointer-events: none;
}

.bid-feed-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: center;
  min-width: 150px;
  padding: 2px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.bid-feed-row.show {
  opacity: 1;
  transform: translateY(0);
}

.bid-feed-row:nth-child(2) { opacity: 0.62; font-size: 11px; }
.bid-feed-row:nth-child(3) { opacity: 0.34; font-size: 11px; }

.bid-feed-row .bf-name { color: #ddd; }
.bid-feed-row.player .bf-name { color: #2ecc71; font-weight: 600; }
.bid-feed-row .bf-amount { color: #f1c40f; font-variant-numeric: tabular-nums; }

/* «Раз!» / «Два!» */
.auction-call {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 800;
  color: #e74c3c;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.85);
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.auction-call.show {
  animation: callPop 1s ease forwards;
}

@keyframes callPop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  25% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  60% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

/* Кнопка снова доступна — «ваш ход» */
.btn-your-turn {
  animation: yourTurn 0.9s ease;
}

@keyframes yourTurn {
  0%, 100% { box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3); }
  35% { box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.45), 0 6px 20px rgba(46, 204, 113, 0.6); }
}

/* === Молоток аукциониста === */
.gavel-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 40;
}

.gavel-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 235, 180, 0.55), transparent 55%);
  opacity: 0;
  animation: gavelFlash 0.6s ease 0.28s;
}

@keyframes gavelFlash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

.gavel-stage {
  position: relative;
  width: 132px;
  height: 132px;
}

.gavel-hammer {
  position: absolute;
  inset: 0;
  transform-origin: 31% 78%;
  animation: gavelSwing 0.55s cubic-bezier(0.5, 0, 0.35, 1.4) both;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

@keyframes gavelSwing {
  0% { transform: rotate(-58deg); }
  50% { transform: rotate(8deg); }
  68% { transform: rotate(-9deg); }
  100% { transform: rotate(0deg); }
}

.gavel-block {
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 84px;
  height: 14px;
  margin-left: -42px;
  border-radius: 5px;
  background: linear-gradient(180deg, #7a4a24, #4e2f16);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  animation: gavelHit 0.3s ease 0.28s;
}

@keyframes gavelHit {
  0%, 100% { transform: scaleY(1); }
  40% { transform: scaleY(0.72); }
}

.gavel-plate {
  margin-top: 6px;
  text-align: center;
  opacity: 0;
  animation: platePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
}

@keyframes platePop {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.gavel-sold {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #f1c40f;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9);
}

.gavel-winner {
  margin-top: 2px;
  font-size: 15px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

/* === Достижения === */
.ach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ach-row .ach-mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #2ecc71;
}

.ach-row.done .ach-mark {
  border-color: rgba(46, 204, 113, 0.6);
  background: rgba(46, 204, 113, 0.15);
}

.ach-row .ach-body {
  flex: 1;
  min-width: 0;
}

.ach-row .ach-name {
  font-size: 13px;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ach-row.done .ach-name {
  color: #7f8c8d;
}

.ach-row .ach-bar {
  height: 3px;
  margin-top: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.ach-row .ach-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f39c12, #f1c40f);
  border-radius: 2px;
}

.ach-row.done .ach-bar-fill {
  background: rgba(46, 204, 113, 0.5);
}

.ach-row .ach-count {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.ach-row.done .ach-count {
  color: #2ecc71;
}

/* === Репутация === */
.rep-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.rep-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #9b59b6, #f1c40f);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* === Панель банкротства === */
.bankrupt-panel {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(192, 57, 43, 0.2));
  border: 1px solid rgba(231, 76, 60, 0.4);
  border-radius: 12px;
  padding: 12px 20px;
  text-align: center;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === Адаптивные кнопки ставок === */
.bid-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: nowrap;
}

.bid-buttons .btn-bid {
  min-width: 60px;
  font-size: 15px;
  padding: 12px 12px;
  flex: 1;
  max-width: 120px;
}

.bid-buttons .btn-pass {
  flex: 1;
  max-width: 120px;
}

@media (max-height: 600px) {
  .bid-buttons .btn-bid,
  .bid-buttons .btn-pass {
    padding: 10px 8px;
    font-size: 14px;
    min-height: 42px;
  }
}

/* === Бот wrapper для речевых пузырей === */
.bot-wrapper {
  position: relative;
  text-align: center;
}

/* === Состояние предмета === */
.cond-mint { color: #2ecc71; }
.cond-good { color: #bbb; }
.cond-worn { color: #e67e22; }

.cond-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}

.cond-badge.mint { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.cond-badge.good { background: rgba(255, 255, 255, 0.08); color: #aaa; }
.cond-badge.worn { background: rgba(230, 126, 34, 0.2); color: #e67e22; }

/* === Кнопка реставрации === */
.restore-btn {
  background: linear-gradient(135deg, rgba(230, 126, 34, 0.3), rgba(211, 84, 0, 0.3));
  border: 1px solid rgba(230, 126, 34, 0.5);
  color: #e67e22;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  min-height: 32px;
  min-width: 32px;
  transition: transform 0.1s;
}

.restore-btn:active {
  transform: scale(0.95);
}

/* ================================================
   ПОРТРЕТНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ
   ================================================ */

/* Планшеты и десктоп: карточки лотов крупнее — места хватает */
@media (min-width: 700px) {
  .lot-card {
    width: 108px;
    min-width: 108px;
  }
  .lot-card-art {
    height: 54px;
  }
}

/* Десктоп: содержимое панелей не растягивается на всю ширину монитора —
   иначе строки уезжают к разным краям и читать их невозможно */
@media (min-width: 900px) {
  #profile-screen > div > *,
  #office-screen > div > *,
  #skills-screen > div > *,
  #market-screen > div > *,
  #settings-screen > div > *,
  #location-screen > div > * {
    max-width: 880px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Локации на широком экране — не в одну колонку на весь экран */
  #location-screen .scrollable-container {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ================================================
   ДЕСКТОП: наведение и крупные карточки
   ================================================ */

@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):not(.btn-disabled):hover {
    filter: brightness(1.12);
  }

  .icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .lot-card:hover {
    border-color: rgba(241, 196, 15, 0.55);
    background: rgba(255, 255, 255, 0.1);
  }

  .lot-nav:hover {
    background: rgba(255, 255, 255, 0.18);
  }
}

/* ================================================
   БОЛЬШИЕ ЭКРАНЫ: интерфейс крупнее
   Игра рисуется под мобильные, и на десктопе весь HUD выглядел мелким
   островком посреди пустого экрана.
   ================================================ */

@media (min-width: 1100px) and (min-height: 700px) {
  .bot-avatar {
    width: 68px;
    height: 68px;
  }

  .bot-name { font-size: 15px; margin-top: 6px; }
  .bot-money { font-size: 13px; }
  .bot-out-label { font-size: 13px; padding: 2px 10px; }
  .bot-speech { font-size: 13px; max-width: 200px; padding: 7px 11px; }
  .bots-row { max-width: 620px; }
  .auction-top { top: 66px; }

  .auction-center {
    width: min(90%, 460px);
  }

  #current-bid-display {
    font-size: 64px !important;
  }

  .highest-bidder { font-size: 16px; margin-top: 6px; }
  .bid-feed-row { font-size: 14px; min-width: 210px; padding: 3px 12px; }
  .auction-call { font-size: 34px; top: -58px; }

  .bid-buttons .btn-bid,
  .bid-buttons .btn-pass {
    font-size: 19px;
    min-height: 58px;
    max-width: 170px;
  }

  .hud-top .money-display { font-size: 26px; }

  .lot-info { width: min(94%, 520px); padding: 12px 18px 14px; }
  .lot-name { font-size: 21px; }
  .lot-bid { font-size: 16px; }
  .lot-tag { font-size: 12.5px; padding: 4px 10px; }
  .lot-smell, .lot-est { font-size: 13px; }
  .lot-card { width: 128px; min-width: 128px; padding: 6px 6px 7px; }
  .lot-card-art { height: 64px; }
  .lot-card-bid { font-size: 14px; }
  .lot-nav { width: 42px; min-width: 42px; height: 56px; font-size: 26px; }
  .lot-actions .btn { font-size: 17px; min-height: 52px; padding: 13px 26px; }

  .reveal-item-card { min-width: 300px; padding: 22px 34px; }
  .reveal-item-card .item-name { font-size: 23px; }
  .reveal-item-card .item-value { font-size: 34px; }

  .gavel-stage { width: 168px; height: 168px; }
  .gavel-sold { font-size: 38px; }
  .gavel-winner { font-size: 18px; }
}

/* Safe area — для устройств с вырезами (notch) */
@supports (padding-top: env(safe-area-inset-top)) {
  .hud-top {
    padding-top: env(safe-area-inset-top);
  }

  .hud-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .main-menu-screen > div {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* На экране выбора лота безопасные зоны учитывают сами блоки */
  .container-select-screen .lot-info {
    top: calc(52px + env(safe-area-inset-top));
  }
}

/* Ландшафт — предупреждение или адаптация */
@media (orientation: landscape) and (max-height: 420px) {
  /* Компактный HUD */
  .hud-top {
    top: 8px !important;
    padding-left: 68px;
  }

  .hud-bottom,
  .bid-buttons {
    bottom: 8px !important;
    padding-left: 68px;
  }

  /* Боты — ещё компактнее */
  .bot-avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
    border-width: 2px;
  }

  .auction-top {
    top: 38px;
    gap: 3px;
  }

  .bot-name {
    font-size: 10px;
    margin-top: 2px;
  }

  .bot-money {
    font-size: 9px;
  }

  .bot-out-label {
    font-size: 9px;
    padding: 0 5px;
    letter-spacing: 0;
  }

  /* В ландшафте по высоте места нет — оставляем только последнюю ставку */
  .bid-feed-row:nth-child(n + 2) {
    display: none;
  }

  .auction-call {
    top: -32px;
    font-size: 20px;
  }

  .gavel-stage {
    width: 88px;
    height: 88px;
  }

  .gavel-sold {
    font-size: 22px;
  }

  .gavel-winner {
    font-size: 12px;
  }

  #current-bid-display {
    font-size: 28px !important;
  }

  /* Карточка раскрытия — меньше */
  .reveal-item-card {
    padding: 12px 18px;
  }

  .reveal-item-card .item-value {
    font-size: 22px;
  }

  /* Экран поражения (loss) — компактные баннеры на ландшафте */
  .loss-banner {
    top: 6px !important;
  }
  .loss-banner > div {
    padding: 4px 12px !important;
  }
  .loss-banner h2,
  .loss-banner div[style*="font-size:20px"] {
    font-size: 16px !important;
  }
  .loss-summary {
    bottom: 6px !important;
    padding: 6px 14px !important;
    transform: translateX(-50%) scale(0.9);
  }
}

/* Узкие экраны портретные (телефон) */
@media (max-width: 480px) {
  .reveal-item-card {
    min-width: 180px;
    padding: 18px 24px;
  }
  .reveal-item-card .item-name {
    font-size: 17px;
  }
  .reveal-item-card .item-value {
    font-size: 24px;
  }
}

/* === In-game баннер CrazyGames (дуэлл-экраны меню, только ПК) === */
/* Контейнер скрыт по умолчанию; видимостью управляет BannerCanvas через inline display.
   Лежит под модалками (z-index .modal-overlay = 50), но над сценой и меню.
   Небольшой баннер 320×50 (по фидбэку CrazyGames). */
#cg-banner {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 320px;
  max-width: 100%;
  height: 50px;
  z-index: 35;
  pointer-events: auto;
}

/* Когда баннер показан — резервируем место снизу на активном экране, чтобы
   нижние кнопки (например «Play» на экране выбора локации) не уходили под баннер.
   Баннер прижат к нижней кромке (высота 50px) — резервируем чуть больше с запасом.
   !important нужен, т.к. у контейнеров экранов инлайновый padding. */
body.has-banner #ui-root > .screen > div {
  padding-bottom: 62px !important;
}
