/* ============================================================
   Змейка — UI 2026: нейтральный графит + один кислотный акцент.
   Без сине-фиолетовых градиентов, без глоу-спама.
   Иерархия: контент → поверхность → фон; акцент только на действии/статусе.
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Нейтральная шкала */
  --bg: #0a0b0d;
  --surface-1: #131417;
  --surface-2: #1a1c20;
  --surface-3: #22252b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eceef1;
  --text-2: #9ba1ab;
  --text-3: #62676f;

  /* Один акцент — лайм. Статусы без радуги */
  --accent: #c8f04b;
  --accent-dim: rgba(200, 240, 75, 0.14);
  --danger: #ff5d5d;
  --danger-dim: rgba(255, 93, 93, 0.12);
  --warn: #ffb648;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font: "Inter", "SF Pro Text", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Игровой экран: вписываем в высоту окна — без скролла на десктопе */
@media (pointer: fine) and (min-width: 1081px) {
  body:has(#screen-game:not(.hidden)) {
    overflow: hidden;
    height: 100vh;
  }

  #screen-game {
    height: 100vh;
    justify-content: flex-start;
  }
}

.hidden { display: none !important; }

.screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Экран входа ===== */
#screen-login {
  justify-content: center;
  padding: 24px;
  position: relative;
}

.login-card {
  width: min(400px, 100%);
  padding: 8px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

/* Логотип: три сегмента змейки, чистая геометрия */
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background:
    linear-gradient(var(--accent), var(--accent)) 4px 22px / 9px 9px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 13px 13px / 9px 9px no-repeat,
    linear-gradient(var(--text), var(--text)) 22px 4px / 9px 9px no-repeat,
    var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.brand-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-dot { color: var(--accent); }

.subtitle {
  color: var(--text-2);
  margin-bottom: 32px;
  font-size: 15px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#nick-input {
  font-family: inherit;
  font-size: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease;
  appearance: none;
}

#nick-input::placeholder { color: var(--text-3); }

#nick-input:focus {
  border-color: rgba(200, 240, 75, 0.55);
}

#btn-play {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #10130a;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
}

#btn-play:hover { filter: brightness(1.06); }
#btn-play:active { transform: scale(0.98); }

.login-status {
  margin-top: 12px;
  min-height: 20px;
  font-size: 14px;
  color: var(--danger);
}

.hint {
  margin-top: 30px;
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.hint-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.hint-dim { color: var(--text-3); }

.kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.login-footnote {
  position: absolute;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ===== Игровой экран ===== */
#screen-game {
  justify-content: flex-start;
  padding: 10px 14px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.game-header {
  width: min(1240px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 10; /* выше баннера ивента */
}

.logo-small {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex: none;
  background:
    linear-gradient(var(--accent), var(--accent)) 3px 14px / 6px 6px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 8px 8px / 6px 6px no-repeat,
    linear-gradient(var(--text), var(--text)) 13px 3px / 6px 6px no-repeat,
    var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.conn-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}

.conn-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  transition: background 0.25s ease;
}

.conn-status.ok .dot { background: var(--accent); }
.conn-status.bad .dot { background: var(--danger); }
.conn-status.ok { color: var(--text); }

.conn-ping {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.conn-ping b { color: var(--text-2); font-weight: 600; }

.header-stats {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.stat-chip {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
}

.stat-chip b {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
  min-width: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stat-chip.accent b { color: var(--accent); }

.stat-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.icon-btn {
  font-family: inherit;
  font-size: 15px;
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.muted { opacity: 0.55; }

.panel-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 15px;
  color: var(--text-2);
}

.my-score { display: none; }

.game-layout {
  display: flex;
  gap: 14px;
  align-items: stretch;
  width: min(1240px, 100%);
  flex: 1 1 auto;
  min-height: 0;
}

/* Поле занимает всё свободное место */
.board-wrap {
  position: relative;
  line-height: 0;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  touch-action: none;
}

/* ===== Kill feed ===== */
.killfeed {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  line-height: 1.35;
  z-index: 4;
}

.killfeed-item {
  align-self: flex-start;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.killfeed-item b { color: var(--text); font-weight: 650; }
.killfeed-item.fading { opacity: 0.45; transition: opacity 1.8s linear; }

/* ===== Оверлеи ===== */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 11, 13, 0.72);
  border-radius: var(--radius-md);
  line-height: 1.45;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 5;
}

.overlay-card {
  text-align: center;
  padding: 30px 44px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  animation: overlay-in 0.22s ease-out;
}

@keyframes overlay-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.overlay-card h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--danger);
  margin-bottom: 10px;
}

.overlay-card h2.neutral { color: var(--text); }

.overlay-card p {
  font-size: 15px;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

#dead-reason { color: var(--text-2); }

#dead-score { color: var(--text); font-weight: 650; }

.overlay-hint {
  margin-top: 14px;
  color: var(--text-3);
  font-size: 13.5px;
}

.overlay-hint b { color: var(--accent); font-weight: 650; }
.overlay-hint.dim { margin-top: 4px; font-size: 13px; }

/* ===== Сайдбар: скрытая панель-оверлей на ВСЕХ устройствах (Tab / Q / кнопки) ===== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-1);
  border-left: 1px solid var(--line-strong);
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar.open { transform: translateX(0); }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.sidebar-head h3 {
  font-size: 13px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 39;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.scoreboard,
.legend-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  line-height: 1.35;
}

.sidebar-head {
  display: none;
}

.scoreboard h3,
.legend-card h3 {
  font-size: 11.5px;
  margin-bottom: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 650;
}

#players-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

#players-table th {
  text-align: left;
  color: var(--text-3);
  font-weight: 550;
  font-size: 11.5px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

th.col-score, td.col-score { text-align: right; }
th.col-kills, td.col-kills { text-align: center; width: 44px; }
th.col-status, td.col-status { text-align: center; width: 46px; }

#players-table td {
  padding: 7px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#players-table tr:last-child td { border-bottom: none; }

#players-table tr.me td { background: var(--accent-dim); }
#players-table tr.me td:first-child { border-radius: 6px 0 0 6px; }
#players-table tr.me td:last-child { border-radius: 0 6px 6px 0; }

.color-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.status-alive { color: var(--accent); font-weight: 700; }
.status-dead  { color: var(--text-3); font-weight: 600; }

.empty-row {
  text-align: center;
  color: var(--text-3);
  padding: 14px 0 !important;
}

#players-table tr.dead-row td:not(.col-name) { opacity: 0.55; }

/* Метка бота и строка червя */
.bot-tag {
  display: none;
  margin-left: 7px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--danger);
  border: 1px solid rgba(255, 93, 93, 0.4);
  vertical-align: middle;
}

.bot-tag.on { display: inline-block; }

.bot-row .p-name { color: #ff8a8a; }

/* Легенда еды */
.food-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  font-size: 12.5px;
  color: var(--text-2);
}

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

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* ===== Мобильные контролы: только кнопка буста (движение — свайпы) ===== */
.btn-boost {
  position: fixed;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 74px;
  height: 74px;
  border-radius: 50%;
  font-size: 27px;
  color: #10130a;
  background: var(--accent);
  border: none;
  z-index: 20;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.06s ease, filter 0.2s ease, opacity 0.2s ease;
}

.btn-boost:active { transform: scale(0.92); }

.btn-boost:disabled {
  opacity: 0.3;
  filter: grayscale(1);
}

.btn-boost.boosting {
  animation: boosting-pulse 0.7s ease-in-out infinite;
}

@keyframes boosting-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.35); }
}

.controls-hint {
  margin-top: 12px;
  width: min(1240px, 100%);
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}

/* Показ/скрытие по типу устройства (JS управляет #btn-boost/#btn-panel) */
.touch-only { display: none; }
.desktop-only { display: block; }

@media (pointer: coarse) {
  .touch-only { display: block; }
  .desktop-only { display: none; }
  .conn-ping { display: none; }
}

@media (hover: hover) and (pointer: fine) {
  .touch-only { display: none; }
  .desktop-only { display: block; }
}

/* ===== Эффекты (умеренные) ===== */

/* Всплывающие «+N» */
#floaters {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  line-height: 1;
  z-index: 3;
}

.floater {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  animation: floater-rise 0.9s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes floater-rise {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.85); }
  15%  { opacity: 1; transform: translate(-50%, -65%) scale(1.05); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}

/* Тряска поля при смерти — короткая и неглубокая */
.board-wrap.shake { animation: board-shake 0.34s ease-out; }

@keyframes board-shake {
  20% { transform: translate3d(-3px, 1px, 0); }
  45% { transform: translate3d(3px, -1px, 0); }
  70% { transform: translate3d(-2px, 0, 0); }
  90% { transform: translate3d(1px, 0, 0); }
}

/* Индикатор режима — тонкая линия под полем вместо свечения всего поля */
.mode-strip {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 3px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.board-wrap.has-mode .mode-strip { opacity: 1; }

.mode-strip.fx-boost { background: repeating-linear-gradient(90deg, #38bdf8 0 14px, transparent 14px 22px); animation: strip-run 0.7s linear infinite; }
.mode-strip.fx-ghost { background: repeating-linear-gradient(90deg, #e2e8f0 0 14px, transparent 14px 22px); animation: strip-run 1.4s linear infinite; }
.mode-strip.fx-snake { background: repeating-linear-gradient(90deg, var(--accent) 0 14px, transparent 14px 22px); animation: strip-run 1s linear infinite; }
.mode-strip.fx-chaos { background: repeating-linear-gradient(90deg, #c084fc 0 14px, transparent 14px 22px); animation: strip-run 0.45s linear infinite; }

@keyframes strip-run {
  to { background-position: 44px 0; }
}

/* Пульс чипа «Очки» — один аккуратный тик */
.stat-chip.accent.bump { animation: chip-bump 0.32s ease-out; }

@keyframes chip-bump {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.07); }
  100% { transform: scale(1); }
}

/* ===== Индикаторы эффектов: чипы с прогресс-баром (низ поля слева) ===== */
.fx-bar {
  position: absolute;
  left: 10px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 4;
  pointer-events: none;
}

.fx-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 8px;
  border-radius: 8px;
  background: rgba(10, 11, 13, 0.82);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.fx-ico { font-size: 13px; line-height: 1; }

.fx-track {
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.fx-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  transform-origin: left;
}

.fx-shield .fx-fill { background: #ffffff; }
.fx-dash   .fx-fill { background: #38bdf8; }
.fx-ghost  .fx-fill { background: #e2e8f0; }
.fx-chaos  .fx-fill { background: #c084fc; }
.fx-snake  .fx-fill { background: var(--accent); }

/* ===== Слот предмета (низ по центру поля) ===== */
.item-slot {
  position: fixed;
  left: 0;
  right: 0;
  margin: 0 auto;               /* центрирование без transform */
  width: max-content;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(19, 20, 23, 0.92);
  border: 1px solid rgba(200, 240, 75, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
  max-width: min(420px, calc(100vw - 32px));
}

.item-slot.pulse { animation: slot-pulse 0.5s ease-out; }

@keyframes slot-pulse {
  0%   { transform: scale(0.85); }
  55%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.item-slot .is-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 21px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  flex: none;
}

.item-slot .is-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-slot .is-text b {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.item-slot .is-text small {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.item-slot .is-key {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(200, 240, 75, 0.45);
  border-radius: 6px;
  padding: 3px 8px;
  flex: none;
}

/* Тач: слот кликабелен */
@media (pointer: coarse) {
  .item-slot { cursor: pointer; pointer-events: auto; }
  .item-slot .is-key { font-size: 10px; }
}

/* ===== Мобильный drawer: базовые правила уже задают панель-оверлей ===== */
@media (max-width: 1080px) {
  .game-layout { flex-direction: column; }
}

/* Тач + портрет: поле центрируем в остатке экрана (контролы — только буст) */
@media (pointer: coarse) and (orientation: portrait) {
  #screen-game {
    height: 100dvh;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  .game-layout {
    flex: 1 1 auto;
  }
}

@media (max-width: 600px) {
  .game-header { gap: 8px; }

  .header-stats { gap: 5px; }

  .stat-chip { padding: 4px 10px; }
  .stat-chip b { font-size: 13.5px; }
  .stat-label { font-size: 10px; }

  .conn-status { font-size: 12.5px; }

  /* Шапка в две строки: статус+пинг / чипы+кнопки */
  .conn-status, .conn-ping { order: 1; }
  .logo-small { order: 0; }
  .header-stats { order: 2; margin-left: auto; }
  .icon-btn { order: 3; }
  .panel-toggle { margin-left: 2px; }

  .login-card { width: min(400px, 100%); }

  .killfeed-item { font-size: 11px; }

  .overlay-card { padding: 24px 26px; }
  .overlay-card h2 { font-size: 22px; }
}

/* ===== Ландшафт телефона: всё в один экран ===== */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #screen-game {
    height: 100vh;
    height: 100dvh;
    padding: 8px 12px;
    justify-content: flex-start;
  }

  .game-header { margin-bottom: 6px; }
  .logo-small { display: none; }

  .controls-hint.desktop-only { display: none !important; }
}

/* ===== Миникарта (правый верхний угол поля) ===== */
#minimap {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 140px;
  height: 140px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(13, 15, 18, 0.85);
  pointer-events: none;
  z-index: 4;
}

@media (max-width: 600px), (orientation: landscape) and (max-height: 500px) {
  #minimap {
    width: 92px;
    height: 92px;
    top: 8px;
    right: 8px;
  }
}

/* ===== Баннер ивента — крупный, по центру верха поля, с прогресс-баром ===== */
.event-banner {
  position: absolute;
  top: 52px;
  /* Центрирование БЕЗ transform: его перезаписывает anime.js.
     Ширина — по контенту, но не шире поля. */
  left: 50%;
  transform: translateX(-50%) !important;  /* anime не должен двигать по X */
  min-width: 340px;
  max-width: min(560px, calc(100% - 32px));
  width: max-content;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 26px 14px;
  border-radius: var(--radius-md);
  background: rgba(10, 11, 13, 0.88);
  border: 1px solid rgba(200, 240, 75, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.event-banner .eb-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.event-banner #event-name {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.01em;
  color: var(--accent);
  white-space: nowrap;
}

.event-banner .eb-desc { color: var(--text-2); font-size: 13px; white-space: nowrap; }

/* На узких экранах описание режем эллипсисом, а не переносим */
@media (max-width: 600px) {
  .event-banner { min-width: 0; max-width: calc(100% - 20px); top: 46px; }
  .event-banner #event-name { font-size: 15px; }
  .event-banner .eb-desc { font-size: 11.5px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
}

.event-banner .eb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: eb-blink 1s ease-in-out infinite;
  flex: none;
  align-self: center;
}

/* Прогресс-бар до конца ивента */
.event-banner .eb-progress {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.event-banner .eb-progress i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: left;
}

@keyframes eb-blink { 50% { opacity: 0.25; } }

/* ===== Магазин (после смерти): 3 оффера, покупка за очки ===== */
.shop-overlay { z-index: 7; }

.shop-card {
  width: min(400px, calc(100% - 32px));
  max-height: calc(100% - 40px);
  overflow-y: auto;
  text-align: center;
  padding: 22px 22px 16px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
}

.shop-title {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.shop-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 14px;
}

.shop-sub b { color: var(--accent); font-weight: 700; }

.shop-offers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.shop-offer {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.shop-offer:hover {
  border-color: rgba(200, 240, 75, 0.45);
  background: #1e2025;
}

.shop-offer.poor { opacity: 0.55; }
.shop-offer.poor:hover { border-color: var(--line); }

.so-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 19px;
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line);
}

.so-text { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }

.so-name { font-size: 13.5px; font-weight: 700; color: var(--text); }

.so-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }

.so-buy {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(200, 240, 75, 0.35);
}

.so-buy b { font-size: 14px; font-weight: 750; color: var(--accent); line-height: 1.1; }

.so-buy small { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }

.shop-skip { font-size: 12px; color: var(--text-3); margin: 0; }

.shop-skip-btn { color: var(--text-2); cursor: pointer; }

/* ===== Легенда еды: список с иконками ===== */
.food-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
}

.legend-item:hover { background: var(--surface-2); }

.legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.legend-text { min-width: 0; display: flex; flex-direction: column; }

.legend-name {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.3;
}

.legend-desc {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-3);
}

/* Уважение к reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
