:root {
  --bg: #161412;
  --panel: rgba(29, 24, 20, 0.88);
  --line: rgba(255, 212, 166, 0.24);
  --text: #f8ead5;
  --muted: #c0ad95;
  --accent: #d58f3d;
  --danger: #e07979;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 8%, rgba(213, 143, 61, 0.26), transparent 36%),
    radial-gradient(circle at 84% 88%, rgba(77, 110, 137, 0.2), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

#game-root {
  width: 100%;
  height: 100%;
}

#game-root.dead {
  filter: grayscale(1);
}

.hud {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 15;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.88rem;
  backdrop-filter: blur(6px);
}

.weapon-panel {
  position: fixed;
  top: 56px;
  left: 12px;
  z-index: 16;
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  backdrop-filter: blur(6px);
}

#hudWeaponCanvas {
  display: block;
  width: 72px;
  height: 28px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

.weapon-name {
  font-size: 0.88rem;
  color: #ffe4b9;
}

.loadout-panel {
  position: fixed;
  top: 56px;
  left: 12px;
  z-index: 16;
  width: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
}

.loadout-title {
  display: none;
}

.loadout-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loadout-item {
  display: block;
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.loadout-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
}

.minimap-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 15;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  backdrop-filter: blur(6px);
}

.minimap-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

#minimapCanvas {
  display: block;
  width: 196px;
  height: 196px;
  border-radius: 8px;
  background: #171513;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
  background: rgba(8, 7, 6, 0.5);
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

#roundOverlay {
  z-index: 19;
}

#roundOverlay .card {
  width: min(560px, calc(100vw - 24px));
  text-align: center;
}

#highscoreOverlay {
  z-index: 21;
}

#shopOverlay {
  z-index: 22;
}

#eventWarningOverlay {
  z-index: 23;
  pointer-events: none;
  background: transparent;
  backdrop-filter: none;
  align-items: start;
  padding-top: 26px;
}

.event-warning-card {
  width: min(520px, calc(100vw - 24px));
  text-align: center;
  border-color: rgba(255, 120, 120, 0.44);
  background: rgba(26, 17, 17, 0.86);
  animation: event-warning-blink 0.6s linear infinite alternate;
  padding: 10px 14px;
}

.event-warning-card h2 {
  color: #ff8f8f;
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.event-warning-card p {
  margin: 0;
  color: #ffe2e2;
}

.storm-damage {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 18;
  box-shadow:
    inset 110px 0 120px rgba(240, 62, 62, 0.45),
    inset -110px 0 120px rgba(240, 62, 62, 0.45);
  animation: storm-damage-blink 0.45s linear infinite alternate;
}

.storm-damage.hidden {
  display: none;
}

@keyframes storm-damage-blink {
  from {
    opacity: 0.22;
  }
  to {
    opacity: 0.9;
  }
}

@keyframes event-warning-blink {
  from {
    opacity: 0.72;
    transform: scale(1);
  }
  to {
    opacity: 1;
    transform: scale(1.02);
  }
}

.highscore-card {
  width: min(480px, calc(100vw - 24px));
  text-align: center;
}

.highscore-list {
  margin-top: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.highscore-row {
  display: grid;
  grid-template-columns: 52px 1fr 110px 80px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 212, 166, 0.12);
}

.highscore-row:last-child {
  border-bottom: 0;
}

.highscore-place {
  color: var(--muted);
}

.highscore-score {
  text-align: right;
  font-weight: 700;
}

.highscore-money {
  text-align: right;
  font-weight: 700;
  color: #8dff9f;
}

.shop-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.shop-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.shop-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  border: 1px solid rgba(255, 212, 166, 0.24);
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 6px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.shop-tab.active {
  border-color: rgba(255, 192, 118, 0.72);
  background: linear-gradient(140deg, rgba(213, 143, 61, 0.24), rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, 0.16);
}

.shop-tab-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
}

.shop-empty {
  border: 1px dashed rgba(255, 212, 166, 0.22);
  border-radius: 10px;
  padding: 14px 10px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.16);
}

.shop-row {
  display: grid;
  grid-template-columns: 48px 1fr 72px;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(255, 212, 166, 0.2);
  border-radius: 9px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.shop-icon {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
}

.shop-row.selected {
  border-color: rgba(140, 255, 165, 0.62);
  box-shadow: inset 0 0 0 1px rgba(140, 255, 165, 0.24);
}

.shop-price {
  font-weight: 700;
  text-align: right;
}

.shop-warning {
  color: #ff8282;
  font-size: 0.85rem;
}

.card {
  width: min(420px, calc(100vw - 24px));
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

h1,
h2 {
  margin: 0 0 10px;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  margin-bottom: 10px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--accent), #9e6123);
  color: #1f160e;
  font-weight: 700;
  cursor: pointer;
}

button.hidden {
  display: none;
}

.status {
  margin-top: 10px;
  min-height: 20px;
  font-size: 0.86rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.telegram-wrap {
  margin-bottom: 10px;
  min-height: 40px;
}

.hidden {
  display: none;
}
