/* ================================================================
   «СИГНАЛ ИЗ ПОДВАЛА» — игровой слой главного экрана (только .hero на главной):
   лампа над столом, раунд с патронами, экран дефибриллятора, помехи монитора.
   Философия: design/philosophy.md. Файлы игры не используются — всё нарисовано заново.
   ================================================================ */

@font-face {
  font-family: 'Pixelify Sans';
  src: url('../fonts/PixelifySans-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}

:root {
  --font-pixel: 'Pixelify Sans', var(--font-mono);
  --phosphor:     #7dffa0;          /* свечение экрана дефибриллятора */
  --phosphor-dim: rgba(125, 255, 160, 0.5);
  --crt-bg:       #06110a;
  --shell-live:   #ff6b63;
  --shell-blank:  #7fb2ff;
}

/* ==== ПОМЕХИ МОНИТОРА — только на главном экране (поверх готовой полосы .hero-scanline) ==== */
.hero .hero-scanline {
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.12) 2px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  animation: crt-flicker 7s steps(1) infinite;
}
@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  41%      { opacity: 0.9; }
  42%      { opacity: 1; }
  77%      { opacity: 0.94; }
  78%      { opacity: 1; }
}

/* ==== ЛАМПА НАД СТОЛОМ ==== */
.hero-inner { position: relative; }
.lamp {
  position: absolute;
  top: -170px;                       /* провод уходит под шапку, абажур — над репликой */
  left: 230px;
  width: 0;
  height: 0;
  z-index: -1;                       /* свет под текстом */
  pointer-events: none;
  transform-origin: 0 0;
  animation: lamp-sway 9s ease-in-out infinite alternate;
}
.lamp-cord {
  position: absolute;
  left: -1px;
  width: 2px;
  height: 130px;
  background: linear-gradient(#111, #3a3a3a);
}
.lamp-shade {
  position: absolute;
  top: 128px;
  left: -34px;
  width: 68px;
  height: 28px;
  border-radius: 50% 50% 6px 6px / 95% 95% 6px 6px;
  background: linear-gradient(#444, #161616 80%);
  box-shadow: 0 2px 0 #0a0a0a;
}
.lamp-shade::after {                /* лампочка */
  content: '';
  position: absolute;
  left: 24px;
  bottom: -6px;
  width: 20px;
  height: 10px;
  border-radius: 50%;
  background: #fff3cf;
  box-shadow: 0 0 22px 8px rgba(255, 236, 190, 0.55);
  animation: lamp-flicker 11s steps(1) infinite;
}
.lamp-light {
  position: absolute;
  top: 150px;
  left: -420px;
  width: 840px;
  height: 720px;
  background: radial-gradient(ellipse 48% 62% at 50% 0%, rgba(255, 240, 205, 0.15), rgba(255, 240, 205, 0.05) 45%, transparent 75%);
  clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%);
  mix-blend-mode: screen;
  animation: lamp-flicker 11s steps(1) infinite;
}
@keyframes lamp-sway {
  from { transform: rotate(-2.2deg); }
  to   { transform: rotate(2.2deg); }
}
@keyframes lamp-flicker {
  0%, 100% { opacity: 1; }
  63%      { opacity: 0.55; }
  64%      { opacity: 1; }
  66%      { opacity: 0.7; }
  67%      { opacity: 1; }
}

/* ==== ЗАГОЛОВОК: сбой сигнала красным и синим, как патроны ==== */
.hero-title {
  text-shadow: -2px 0 rgba(196, 58, 58, 0.5), 2px 0 rgba(60, 111, 181, 0.5);
  animation: title-glitch 6.5s steps(1) infinite;
}
@keyframes title-glitch {
  0%, 92%, 100% { transform: none; }
  93% { transform: translateX(-3px) skewX(-4deg); text-shadow: -6px 0 rgba(196, 58, 58, 0.8), 5px 0 rgba(60, 111, 181, 0.8); }
  94% { transform: translateX(2px);              text-shadow: 4px 0 rgba(196, 58, 58, 0.7), -4px 0 rgba(60, 111, 181, 0.7); }
  95% { transform: none;                          text-shadow: -2px 0 rgba(196, 58, 58, 0.5), 2px 0 rgba(60, 111, 181, 0.5); }
}

/* ==== РЕПЛИКА ДИЛЕРА — пиксельный шрифт, печатается по букве ==== */
.hero .hero-tag {
  font-family: var(--font-pixel);
  font-size: 15px;
  letter-spacing: 0.06em;
  min-height: 1.5em;
}
.hero-tag.is-typing::after {
  content: '▌';
  margin-left: 2px;
  animation: caret 0.8s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ==== ПРИБОР НА СТОЛЕ: раунд с патронами + экран дефибриллятора ==== */
.hud {
  position: relative;
  max-width: 520px;
  border: 1px solid #1d3324;
  border-radius: 10px;
  background: var(--crt-bg);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.85), 0 0 0 4px #121212, 0 0 0 5px #2a2a2a;
  overflow: hidden;
}
.hud::after {                        /* строки экрана */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(125, 255, 160, 0.035) 0 1px, transparent 1px 3px);
}
.hud-screen { padding: 18px 20px 12px; transition: background 0.2s; }
.hud.is-flash .hud-screen { animation: hud-flash 0.25s ease-out; }
@keyframes hud-flash { from { background: rgba(255, 240, 205, 0.22); } to { background: transparent; } }

.hud-shells {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 40px;
}
/* Патроны прибора — своё имя класса: .shell уже занят гильзами по краям страницы */
.hud-shell {
  position: relative;
  width: 14px;
  height: 38px;
  border-radius: 4px 4px 2px 2px;
  animation: hud-shell-in 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.hud-shell::before {                 /* блик */
  content: '';
  position: absolute;
  top: 4px;
  bottom: 12px;
  left: 3px;
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
}
.hud-shell::after {                  /* латунное донце */
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: 0;
  height: 10px;
  border-radius: 1px;
  background: linear-gradient(90deg, #8a6a2a, #e3c06e 45%, #8a6a2a);
}
.hud-shell-live  { background: linear-gradient(90deg, #7d1f1c, #c9413b 45%, #7d1f1c); }
.hud-shell-blank { background: linear-gradient(90deg, #22416e, #4d84cf 45%, #22416e); }
.hud-shell.is-out { animation: hud-shell-out 0.35s ease-in forwards; }
@keyframes hud-shell-in  { from { opacity: 0; transform: translateY(-26px) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes hud-shell-out { to { opacity: 0; transform: translateX(46px); } }

.hud-label {
  min-height: 1.4em;
  margin-top: 10px;
  font-family: var(--font-pixel);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor-dim);
}
.hud-label .live  { color: var(--shell-live);  text-shadow: 0 0 6px rgba(255, 80, 70, 0.6); }
.hud-label .blank { color: var(--shell-blank); text-shadow: 0 0 6px rgba(110, 160, 255, 0.6); }

/* «до 4 игроков · 60 мин · 14+» — строка экрана дефибриллятора, заряды-молнии */
.hud .hero-meta {
  margin: 0;
  padding: 10px 20px 12px;
  border-top: 1px solid #1d3324;
  gap: 24px;
  font-family: var(--font-pixel);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor-dim);
}
.hud .hero-meta span::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -1px;
  background: var(--phosphor);
  clip-path: polygon(60% 0, 0 58%, 42% 58%, 30% 100%, 100% 38%, 56% 38%);
}

/* ==== ТЕЛЕФОНЫ ==== */
@media (max-width: 560px) {
  .lamp { left: 150px; top: -160px; }
  .lamp-shade { transform: scale(0.75); transform-origin: 34px 0; }
  .lamp-light { left: -260px; width: 520px; height: 560px; top: 140px; }
  .hud-screen { padding: 14px 14px 10px; }
  .hud .hero-meta { padding: 10px 14px 12px; gap: 14px; font-size: 13px; flex-wrap: wrap; }
}

/* ==== БЕЗ АНИМАЦИЙ, если они выключены в системе ==== */
@media (prefers-reduced-motion: reduce) {
  .hero .hero-scanline, .lamp, .lamp-light, .lamp-shade::after, .hero-title, .hud-shell, .hud.is-flash .hud-screen { animation: none !important; }
}
