/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #87CEEB;
  touch-action: none;
  font-family: 'Arial', sans-serif;
}

body.playing {
  cursor: none;
}

img {
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Fonts */
@font-face {
  font-family: 'TitanOne';
  src: url('https://fonts.gstatic.com/s/titanone/v13/m8JVjfWvCAn_BxGuqV8Yv3Lp.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

/* Root Container */
#root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #87CEEB;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Clouds */
.cloud {
  position: absolute;
  font-size: 80px;
  color: white;
  opacity: 0.3;
  pointer-events: none;
  z-index: 1;
}

.cloud-1 {
  top: 80px;
  left: 40px;
}

.cloud-2 {
  top: 160px;
  right: 80px;
  font-size: 100px;
  opacity: 0.2;
}

/* Mountains */
.mountains {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 25%;
  background-color: #818cf8;
  clip-path: polygon(0% 100%, 0% 20%, 20% 40%, 40% 10%, 60% 30%, 80% 15%, 100% 40%, 100% 100%);
  z-index: 0;
}

/* Game Container */
.game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: calc(100vh * 9 / 16);
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Building */
.building {
  position: relative;
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 10;
     margin-top: 96px; 
}

/* Building Roof */
.building-roof {
  width: 95%;
  height: 16px;
  background-color: #44403c;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 20;
}

.building-roof-top {
  width: 100%;
  height: 40px;
  background-color: #292524;
  border-radius: 4px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  border-bottom: 4px solid #1c1917;
}

/* Building Body */
.building-body {
  width: 92%;
  flex-grow: 1;
  background-color: #D97757;
  background-image: 
    linear-gradient(335deg, rgba(0,0,0,0.1) 23px, transparent 23px),
    linear-gradient(155deg, rgba(0,0,0,0.1) 23px, transparent 23px),
    linear-gradient(335deg, rgba(0,0,0,0.1) 23px, transparent 23px),
    linear-gradient(155deg, rgba(0,0,0,0.1) 23px, transparent 23px);
  background-size: 58px 58px;
  background-position: 0px 2px, 4px 35px, 29px 31px, 34px 6px;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.3);
  border-left: 4px solid rgba(28, 25, 23, 0.2);
  border-right: 4px solid rgba(28, 25, 23, 0.2);
  padding: 24px 16px;
  overflow: hidden;
  pointer-events: auto;
  position: relative;
}

.windows-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 8px;
  height: 100%;
  align-content: center;
}

/* Window Container */
.window-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Window */
.window-button {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background-color: #FDEBD0;
  border-radius: 4px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  border: 2px solid #fed7aa;
  cursor: pointer;
  outline: none;
  overflow: visible;
  padding: 0;
}

.window-interior {
  position: absolute;
  inset: 8px;
  background-color: #0c0a09;
  box-shadow: inset 0px 10px 20px rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  border-top: 4px solid rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.window-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(249, 115, 22, 0.2), transparent);
  opacity: 0.5;
}

/* Character in Window */
.character-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.character-appear {
  animation: pop-up 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


@keyframes pop-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.character-visual {
  position: relative;
  width: 100%;
  height: 80%;
  margin-bottom: -10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  max-height: 90%;
}

.character-emoji {
  font-size: 48px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.character-flashing {
  animation: pulse 0.2s infinite;
  transform: scale(1.1);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Threat Timer Bar */
.threat-timer {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 6px;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.threat-timer-fill {
  height: 100%;
  transition: width 0.1s, background-color 0.1s;
}

.threat-timer-fill.green { background-color: #22c55e; }
.threat-timer-fill.yellow { background-color: #eab308; }
.threat-timer-fill.red { background-color: #ef4444; }

/* Shutters */
.shutter-left {
  position: absolute;
  left: 0;
  height: 100%;
  width: 25%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  border-radius: 0 0 8px 0;
  z-index: 10;
  opacity: 0.9;
}

.shutter-right {
  position: absolute;
  right: 0;
  height: 100%;
  width: 25%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  border-radius: 0 0 0 8px;
  z-index: 10;
  opacity: 0.9;
}

/* Windowsill */
.windowsill {
  position: absolute;
  bottom: -6px;
  left: -6px;
  right: -6px;
  height: 16px;
  background-color: #d6d3d1;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border-bottom: 4px solid #a8a29e;
}

/* Building Base */
.building-base {
  width: 92%;
    height: 96px; /* было 128px */
  background-color: #4A5568;
  background-image: 
    linear-gradient(335deg, rgba(0,0,0,0.1) 23px, transparent 23px),
    linear-gradient(155deg, rgba(0,0,0,0.1) 23px, transparent 23px),
    linear-gradient(335deg, rgba(0,0,0,0.1) 23px, transparent 23px),
    linear-gradient(155deg, rgba(0,0,0,0.1) 23px, transparent 23px);
  background-size: 58px 58px;
  background-position: 0px 2px, 4px 35px, 29px 31px, 34px 6px;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.3);
  border-left: 4px solid rgba(28, 25, 23, 0.2);
  border-right: 4px solid rgba(28, 25, 23, 0.2);
  border-top: 8px solid #a8a29e;
  position: relative;
}

.building-base-shadow {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 32px;
  background-color: rgba(28, 25, 23, 0.5);
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Ground */
.ground {
  width: 100%;
  height: 48px;
  background-color: #a8a29e;
  border-top: 4px solid #78716c;
  z-index: 10;
}

/* Crosshair */
.crosshair {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
}

.crosshair-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid white;
  position: relative;
  transition: all 0.075s;
}

.crosshair.shooting .crosshair-circle {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.2);
  transform: scale(0.75);
}

.crosshair-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: white;
}

.crosshair.shooting .crosshair-dot {
  background-color: #ef4444;
}

.crosshair-line-h {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.5);
}

.crosshair-line-v {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1px;
  height: 32px;
  background-color: rgba(255, 255, 255, 0.5);
}

.crosshair-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.crosshair-corner.top-left {
  top: -4px;
  left: -4px;
  border-right: none;
  border-bottom: none;
}

.crosshair-corner.top-right {
  top: -4px;
  right: -4px;
  border-left: none;
  border-bottom: none;
}

.crosshair-corner.bottom-left {
  bottom: -4px;
  left: -4px;
  border-right: none;
  border-top: none;
}

.crosshair-corner.bottom-right {
  bottom: -4px;
  right: -4px;
  border-left: none;
  border-top: none;
}

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: 96px;            /* ⬅️ чуть меньше */
  z-index: 50;
  pointer-events: none;

  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 16px;
}



.hud-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.hud-header {
  background-color: rgba(15, 23, 42, 0.95);
  color: white;
  border-radius: 9999px;
  padding: 8px 24px; /* было 12px 32px */
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  border-bottom: 4px solid #475569;
}

.hud-level {
  font-family: 'TitanOne', cursive;
  font-size: 20px;
  letter-spacing: 0.05em;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hud-divider {
  width: 1px;
  height: 24px;
  background-color: #475569;
}

.hud-money {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-money-icon {
  background-color: #FFC107;
  border-radius: 50%;
  padding: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 2px solid #fbbf24;
  font-size: 18px;
}

.hud-money-amount {
  font-family: 'TitanOne', cursive;
  font-size: 24px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hud-lives {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-life {
  font-size: 24px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
}

.hud-life.active {
  color: #ef4444;
  animation: pulse 1s infinite;
}

.hud-life.inactive {
  color: #475569;
}

.hud-kills {
  background-color: rgba(0, 0, 0, 0.6);
  padding: 4px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hud-kills-text {
  font-family: 'TitanOne', cursive;
  color: white;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-kills-text .primary {
  color: #FFC107;
}

.hud-bottom {
  display: flex;
  justify-content: flex-end;
  padding: 8px 16px;
}

.hud-ammo {
  background-color: rgba(15, 23, 42, 0.95);
 padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  border-bottom: 4px solid #1e293b;
  transition: all 0.3s;
}

.hud-ammo.reloading {
  transform: scale(0.9);
  opacity: 0.6;
}

.hud-ammo-bullets {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.hud-bullet {
    width: 8px;
  height: 22px;
  background-color: #1e293b;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.hud-bullet-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, #ca8a04, #eab308);
  transition: height 0.3s;
}

.hud-bullet.empty .hud-bullet-fill {
  height: 0;
}

.hud-ammo-text {
  font-family: 'TitanOne', cursive;
  text-align: center;
  color: white;
  font-style: italic;
  font-size: 14px;
min-width: 48px;
}

/* Menu */
.menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.menu-container {
  background-color: #1e293b;
  color: white;
  padding: 40px;
  border-radius: 24px;
  border: 4px solid #475569;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 384px;
  width: 100%;
}

.menu-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  border: 4px solid;
  font-size: 40px;
}

.menu-icon.start {
  background-color: #FFC107;
  border-color: #fbbf24;
}

.menu-icon.warning-hit {
  background-color: #dc2626;
  border-color: #f87171;
  animation: pulse 1s infinite;
}

.menu-icon.warning-hostage {
  background-color: #ea580c;
  border-color: #fb923c;
}

.menu-icon.win {
  background-color: #22c55e;
  border-color: #86efac;
  animation: bounce 1s infinite;
}

.menu-icon.gameover {
  background-color: #dc2626;
  border-color: #f87171;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.menu-title {
  font-family: 'TitanOne', cursive;
  font-size: 48px;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.menu-title.primary {
  color: #FFC107;
}

.menu-title.red {
  color: #ef4444;
}

.menu-title.orange {
  color: #f97316;
}

.menu-subtitle {
  color: #cbd5e1;
  margin-bottom: 32px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 14px;
}

.menu-score-label {
  color: #64748b;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.menu-score-value {
  font-family: 'TitanOne', cursive;
  font-size: 72px;
  color: #FFC107;
}

.menu-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 48px;
  border-radius: 9999px;
  font-family: 'TitanOne', cursive;
  font-size: 24px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3);
  transition: all 0.1s;
  text-transform: uppercase;
}

.menu-button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.menu-button.primary {
  background-color: #FFC107;
  color: #78350f;
}

.menu-button.primary:hover {
  background-color: #fbbf24;
}

.menu-button.red {
  background-color: #dc2626;
  color: white;
}

.menu-button.red:hover {
  background-color: #ef4444;
}

.menu-button.orange {
  background-color: #ea580c;
  color: white;
}

.menu-button.orange:hover {
  background-color: #f97316;
}

.menu-button.green {
  background-color: #22c55e;
  color: white;
}

.menu-button.green:hover {
  background-color: #4ade80;
}

.menu-button.white {
  background-color: white;
  color: #0f172a;
}

.menu-button.white:hover {
  background-color: #f1f5f9;
}

/* Pause Overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.pause-text {
  font-family: 'TitanOne', cursive;
  font-size: 36px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* Responsive */
@media (max-width: 768px) {
  .building-roof {
    height: 8px;
  }
  
.hud {
  height: 72px;
}

.building {
  margin-top: 72px;
}

.hud-ammo-wrapper {
  bottom: 16px;
  right: 12px;
}


  
  .building-roof-top {
    height: 24px;
    border-bottom-width: 2px;
  }
  
  .building-body {
    padding: 16px 8px;
  }
  
  .windows-grid {
    gap: 8px 4px;
  }
  
  .windowsill {
    height: 12px;
    border-bottom-width: 2px;
  }
  
  .building-base {
    height: 64px;
    border-top-width: 4px;
  }
  
  .ground {
    height: 32px;
    border-top-width: 2px;
  }
  
  .hud-header {
    padding: 8px 16px;
    gap: 12px;
  }
  
  .hud-level {
    font-size: 14px;
  }
  
  .hud-money-amount {
    font-size: 18px;
  }
  
  .hud-life {
    font-size: 20px;
  }
  
  .menu-container {
    padding: 24px;
    max-width: 280px;
  }
  
  .menu-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
  }
  
  .menu-title {
    font-size: 32px;
  }
  
  .menu-button {
    padding: 12px 32px;
    font-size: 20px;
  }
}

/* Shutter Colors */
.shutter-blue { background-color: #1e3a8a; }
.shutter-red { background-color: #7f1d1d; }
.shutter-green { background-color: #064e3b; }
.shutter-amber { background-color: #78350f; }
.shutter-purple { background-color: #581c87; }
.shutter-teal { background-color: #164e63; }
.shutter-rose { background-color: #881337; }
.shutter-indigo { background-color: #1e1b4b; }
.shutter-slate { background-color: #1e293b; }


.hud-ammo-wrapper {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 20;
  pointer-events: none;
}


/* === ВАЖНО: ПРИНУДИТЕЛЬНО ПОКАЗЫВАЕМ РЕКЛАМУ ПОВЕРХ ВСЕГО === */
#gamemonetize-video {
    position: fixed !important;
    z-index: 2147483647 !important; /* Максимальный Z-Index */
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Гарантируем, что при активной рекламе интерфейс точно скрыт */
/* Скрываем конкретные контейнеры, так как #startScreen и т.д. не существуют в index.html */
body.ad-active #menu-container,
body.ad-active #hud,
body.ad-active .hud-ammo-wrapper,
body.ad-active #crosshair,
body.ad-active #building {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}