* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0d0a;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #e8e8e0;
  user-select: none;
}

#gameCanvas {
  display: block;
  position: fixed;
  inset: 0;
}

.hidden {
  display: none !important;
}

/* ---------- Mute button ---------- */

.mute-button {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(10, 12, 8, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  color: #fff;
  pointer-events: auto;
}

.mute-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---------- Damage vignette ---------- */

.damage-vignette {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center,
    rgba(180, 0, 0, 0) 45%,
    rgba(200, 0, 0, 0.35) 75%,
    rgba(255, 0, 0, 0.65) 100%);
}

/* ---------- Scope overlay ---------- */

.scope-overlay {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 0, transparent 29.5%, #000 30%);
}

.scope-crosshair-v,
.scope-crosshair-h {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(10, 15, 8, 0.85);
}

.scope-crosshair-v {
  width: 1.5px;
  height: 30vmin;
  transform: translate(-50%, -50%);
}

.scope-crosshair-h {
  width: 30vmin;
  height: 1.5px;
  transform: translate(-50%, -50%);
}

.scope-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30vmin;
  height: 30vmin;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(10, 15, 8, 0.5);
}

/* ---------- Crosshair ---------- */

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
}

.crosshair-line {
  position: absolute;
  background: rgba(232, 240, 245, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

.crosshair-line.horizontal {
  top: 50%;
  left: 0;
  width: 7px;
  height: 2px;
  transform: translateY(-50%);
  box-shadow: 15px 0 0 rgba(232, 240, 245, 0.85);
}

.crosshair-line.vertical {
  left: 50%;
  top: 0;
  width: 2px;
  height: 7px;
  transform: translateX(-50%);
  box-shadow: 0 15px 0 rgba(232, 240, 245, 0.85);
}

.crosshair-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffd76a;
  transform: translate(-50%, -50%);
}

.crosshair.build-invalid .crosshair-dot,
.crosshair.build-invalid .crosshair-line {
  background: #ff5a5a;
  box-shadow: none;
}

.crosshair.build-valid .crosshair-dot,
.crosshair.build-valid .crosshair-line {
  background: #8fdc7a;
  box-shadow: none;
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.hud-top-left {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 260px;
}

.hud-top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 12, 8, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
}

.bar-label {
  font-size: 16px;
  width: 18px;
  text-align: center;
}

.bar-track {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s ease-out;
}

.health-fill {
  background: linear-gradient(90deg, #ff4d4d, #ff8a3d);
}

.bar-value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
  opacity: 0.85;
}

.hud-pill {
  background: rgba(10, 12, 8, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.scrap-pill { color: #ffd35c; }
.wave-pill { color: #7dc4ff; }
.zombie-pill { color: #8fdc7a; }
.parts-pill { color: #ff9f5a; }

.skip-wave-button {
  pointer-events: auto;
  cursor: pointer;
  background: rgba(255, 90, 40, 0.18);
  border-color: rgba(255, 138, 61, 0.5);
  color: #ff9f5a;
  font-family: inherit;
}

.skip-wave-button:hover {
  background: rgba(255, 90, 40, 0.32);
}

.ammo-buff-pill {
  animation: ammo-buff-pulse 1.2s ease-in-out infinite;
}
.ammo-buff-explosive { color: #ff8a3d; border-color: rgba(255, 138, 61, 0.5); }
.ammo-buff-incendiary { color: #ff4d4d; border-color: rgba(255, 77, 77, 0.5); }
.ammo-buff-cryo { color: #4ad0ff; border-color: rgba(74, 208, 255, 0.5); }

@keyframes ammo-buff-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.pickup-toast {
  position: absolute;
  top: 150px;
  left: 50%;
  transform: translateX(-50%) translateY(6px) scale(0.92);
  background: rgba(10, 12, 8, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 8px 22px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}
.pickup-toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.craft-button {
  position: absolute;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  background: rgba(10, 12, 8, 0.65);
  border: 1px solid rgba(255, 159, 90, 0.5);
  color: #ff9f5a;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.craft-button:hover {
  background: rgba(255, 159, 90, 0.18);
}

.craft-key {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
}

.wave-banner {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 8, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  animation: banner-in 0.25s ease-out;
}

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

.car-prompt {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 8, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 600;
}

.click-to-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 12, 8, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}

/* ---------- Hotbar ---------- */

.hotbar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 8px;
}

.demolish-prompt {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 35;
  padding: 9px 16px;
  border: 1px solid rgba(255, 90, 70, 0.9);
  border-radius: 6px;
  color: #fff;
  background: rgba(80, 8, 5, 0.82);
  box-shadow: 0 0 20px rgba(255, 45, 30, 0.35);
  font-weight: 800;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.demolish-key-hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 21;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.hotbar-slot {
  position: relative;
  width: 72px;
  height: 78px;
  background: rgba(10, 12, 8, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.08s ease-out, border-color 0.15s;
}

.hotbar-slot:hover {
  transform: translateY(-2px);
}

.hotbar-slot.active {
  border-color: #8fdc7a;
  background: rgba(79, 156, 60, 0.28);
  box-shadow: 0 0 14px rgba(143, 220, 122, 0.35);
}

.hotbar-slot.unaffordable {
  opacity: 0.45;
}

.hotbar-key {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  opacity: 0.7;
}

.hotbar-icon {
  font-size: 24px;
}

.hotbar-label {
  font-size: 10px;
  opacity: 0.85;
}

.hotbar-cost {
  font-size: 11px;
  color: #ffd35c;
  font-weight: 700;
}

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(20, 24, 16, 0.92), rgba(4, 5, 3, 0.97));
}

.overlay-panel {
  max-width: 520px;
  width: 90%;
  background: rgba(14, 17, 11, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 32px 36px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.overlay-panel h1 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: 0.04em;
  color: #8fdc7a;
  text-shadow: 0 0 18px rgba(143, 220, 122, 0.4);
}

.subtitle {
  margin: 0 0 16px;
  font-size: 14px;
  opacity: 0.75;
}

.desc {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.85;
  margin-bottom: 18px;
}

.controls-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  font-size: 13px;
  line-height: 1.9;
  opacity: 0.9;
}

.controls-list li {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.play-button {
  background: linear-gradient(180deg, #8fdc7a, #4f9c3c);
  border: none;
  color: #0b0d0a;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(79, 156, 60, 0.35);
  transition: transform 0.08s ease-out;
}

.play-button:hover {
  transform: translateY(-2px);
}

.play-button.secondary {
  background: linear-gradient(180deg, #3a4a55, #24303a);
  color: #e8e8e0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.start-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

#deathStats {
  font-size: 15px;
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 22px;
}

/* ---------- Armory ---------- */

.armory-panel {
  max-width: 620px;
  text-align: left;
}

.armory-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.armory-header h2 {
  margin: 0;
  font-size: 22px;
  color: #8fdc7a;
  flex: 1;
}

.armory-salvage {
  font-size: 15px;
  font-weight: 700;
  color: #ffd35c;
  font-variant-numeric: tabular-nums;
}

.armory-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e8e8e0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.armory-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.armory-intro {
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.5;
  margin: 10px 0 16px;
}

.armory-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.armory-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e8e8e0;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.armory-tab.active {
  background: rgba(79, 156, 60, 0.3);
  border-color: #8fdc7a;
  color: #8fdc7a;
}

.armory-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.armory-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
}

.armory-item-info {
  flex: 1;
  min-width: 0;
}

.armory-item-name {
  font-size: 14px;
  font-weight: 700;
}

.armory-item-desc {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
  line-height: 1.4;
}

.armory-item-stats {
  font-size: 11px;
  color: #7dc4ff;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.armory-item-action {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.armory-item-action.buy {
  background: linear-gradient(180deg, #ffd76a, #d69a2e);
  color: #2a1e05;
}

.armory-item-action.buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.armory-item-action.equip {
  background: linear-gradient(180deg, #7dc4ff, #3d84c9);
  color: #04121e;
}

.armory-item-action.equipped {
  background: rgba(143, 220, 122, 0.18);
  border: 1px solid rgba(143, 220, 122, 0.5);
  color: #8fdc7a;
  cursor: default;
}

.armory-item-action.locked {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(232, 232, 224, 0.4);
  cursor: default;
}

.crate-divider {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.55;
  text-transform: uppercase;
  margin: 14px 2px 2px;
}

/* ---------- Trader ---------- */

.trader-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: rgba(179, 90, 255, 0.06);
  border: 1px solid rgba(179, 90, 255, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}

.trader-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
}

.trader-timer {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.trader-offer {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.trader-req em {
  font-style: normal;
  opacity: 0.65;
}

.trader-req.short {
  color: #ff8a5a;
}

.trader-arrow {
  opacity: 0.6;
}

.trader-receive {
  font-weight: 700;
}

.trader-box .armory-item-action {
  align-self: flex-start;
  margin-top: 10px;
}

.skin-rarity {
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  letter-spacing: 0.03em;
}

.crate-open-row {
  border: 1px solid rgba(255, 204, 51, 0.35);
  background: rgba(255, 204, 51, 0.06);
}

/* ---------- Crate reveal ---------- */

.crate-reveal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 3, 0.7);
  animation: reveal-fade-in 0.15s ease-out;
}

.case-opening-panel {
  background: rgba(10, 12, 8, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.6);
  width: min(94vw, 760px);
}

/* ---------- CS:GO-style case track ---------- */

.case-track {
  position: relative;
  height: 132px;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.case-strip {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  will-change: transform;
}

.case-item {
  flex: 0 0 110px;
  width: 110px;
  height: 104px;
  margin: 0 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--item-color, #9aa0a6);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--item-color, #9aa0a6) 35%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.case-item-icon {
  font-size: 30px;
  filter: drop-shadow(0 0 6px var(--item-color, #9aa0a6));
}

.case-item-name {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  padding: 0 6px;
  opacity: 0.9;
}

.case-marker {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: #ffd35c;
  box-shadow: 0 0 10px rgba(255, 211, 92, 0.9);
  transform: translateX(-50%);
  z-index: 3;
}

.case-marker::before,
.case-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
}

.case-marker::before {
  top: -1px;
  border-top: 9px solid #ffd35c;
}

.case-marker::after {
  bottom: -1px;
  border-bottom: 9px solid #ffd35c;
}

.case-fade-left,
.case-fade-right {
  position: absolute;
  top: 0;
  height: 100%;
  width: 70px;
  z-index: 2;
  pointer-events: none;
}

.case-fade-left {
  left: 0;
  background: linear-gradient(90deg, rgba(10, 12, 8, 0.95), transparent);
}

.case-fade-right {
  right: 0;
  background: linear-gradient(270deg, rgba(10, 12, 8, 0.95), transparent);
}

.crate-reveal-result {
  margin-top: 22px;
}

.crate-reveal-result .play-button {
  margin-top: 14px;
}

.crate-reveal-rarity {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--reveal-color, #9aa0a6);
  margin-bottom: 8px;
  text-shadow: 0 0 12px var(--reveal-color, #9aa0a6);
}

.crate-reveal-name {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.crate-reveal-sub {
  font-size: 13px;
  opacity: 0.75;
}

@keyframes reveal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes reveal-pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
