:root {
  --void: #000000;
  --void-deep: #000000;
  --bone: #b3121f;
  --pumpkin: #e0142a;
  --pumpkin-dim: #4a0810;
  --sick-green: #7a1017;
  --line: rgba(179, 18, 31, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--void);
  color: var(--bone);
  font-family: 'Special Elite', 'Work Sans', monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  line-height: 1.65;
  position: relative;
  overflow: hidden;
}

/* grain de bruit */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.045;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.6) 0px, transparent 1px, transparent 2px);
  animation: noise 0.2s steps(2) infinite;
}

/* lignes de scan */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.25) 3px
  );
  mix-blend-mode: multiply;
}

@keyframes noise {
  0% { transform: translateY(0); }
  100% { transform: translateY(-1px); }
}

.frame {
  width: 100%;
  max-width: 640px;
}

.masthead {
  text-align: left;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.masthead h1 {
  font-family: 'Special Elite', monospace;
  font-weight: 400;
  font-size: clamp(24px, 5.5vw, 32px);
  margin: 0 0 6px 0;
  letter-spacing: 0.01em;
  color: var(--pumpkin);
  text-shadow:
    0 0 6px rgba(224, 20, 42, 0.65),
    0 0 22px rgba(224, 20, 42, 0.35),
    2px 0 0 rgba(80, 0, 0, 0.5);
  animation: flicker 6s infinite;
}

@keyframes flicker {
  0%, 91%, 100% { opacity: 1; }
  92% { opacity: 0.75; }
  93% { opacity: 1; }
  94% { opacity: 0.4; }
  95% { opacity: 1; }
}

.masthead p {
  margin: 0;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  color: var(--sick-green);
  letter-spacing: 0.03em;
}

.masthead p::before {
  content: "● REC ";
  color: #c0392b;
}

.scene {
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.scene-id {
  display: inline-block;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--sick-green);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 0;
  margin-bottom: 14px;
}

.scene-text {
  font-family: 'Special Elite', monospace;
  font-size: clamp(15px, 3vw, 17px);
  font-weight: 400;
  color: var(--bone);
  margin: 0 0 30px 0;
  max-width: 62ch;
  white-space: pre-line;
}

.placeholder {
  color: rgba(232, 226, 213, 0.45);
  font-style: italic;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.choice-btn {
  text-align: left;
  background: rgba(240, 240, 240, 0.03);
  border: 1px solid var(--line);
  color: var(--bone);
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  font-weight: 400;
  padding: 16px 18px;
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, padding-left 0.15s ease;
  position: relative;
}

.choice-btn::before {
  content: "> ";
  position: absolute;
  left: 0;
  top: 16px;
  color: var(--pumpkin);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.choice-btn:hover {
  background: rgba(240, 240, 240, 0.06);
  border-color: var(--sick-green);
  padding-left: 28px;
}

.choice-btn:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.choice-btn:focus-visible {
  outline: 2px solid var(--sick-green);
  outline-offset: 2px;
}

.end-badge {
  display: inline-block;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  color: #000000;
  background: var(--pumpkin);
  padding: 4px 10px;
  border-radius: 0;
  margin-bottom: 18px;
}

.restart-btn {
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--bone);
  font-family: 'Special Elite', monospace;
  font-weight: 400;
  font-size: 13px;
  padding: 12px 20px;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.restart-btn:hover {
  background: var(--bone);
  color: var(--void);
}

.path {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: rgba(240, 240, 240, 0.3);
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ===== Відео зі сценою ===== */

.video-container {
  position: relative;
  width: 100%;
  background-color: #000;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.scene-video {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  display: block;
  background-color: #000;
  pointer-events: none; /* Вимикає будь-які кліки та взаємодію з відео */
}

.scene-image {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  display: block;
  background-color: #000;
}

/* Текст і кнопки накладаються поверх відео, внизу */
.video-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 46px 18px 20px 18px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.85) 40%,
    rgba(0, 0, 0, 0.35) 75%,
    rgba(0, 0, 0, 0) 100%
  );
}

.video-overlay .scene-text {
  margin-bottom: 16px;
}

.video-overlay .choices {
  margin-bottom: 0;
}

/* =========================================================================
   МОБІЛЬНА АДАПТАЦІЯ (телефони)
   ========================================================================= */

@media (max-width: 480px) {
  body {
    padding: 18px 12px;
    align-items: flex-start;
  }

  .frame {
    max-width: 100%;
  }

  .masthead {
    margin-bottom: 20px;
    padding-bottom: 12px;
  }

  .masthead h1 {
    font-size: 22px;
  }

  .masthead p {
    font-size: 11px;
  }

  .scene-text {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .choice-btn {
    padding: 14px 14px;
    font-size: 13px;
  }

  .choice-btn:hover {
    padding-left: 14px; /* на телефоні немає hover, лишаємо як є */
  }

  .video-container {
    margin-bottom: 16px;
  }

  .scene-video,
  .scene-image {
    max-height: 60vh;
  }

  .video-overlay {
    padding: 30px 12px 14px 12px;
  }

  .video-overlay .scene-text {
    margin-bottom: 12px;
  }

  .end-badge {
    font-size: 11px;
  }

  .restart-btn {
    width: 100%;
    text-align: center;
    padding: 14px 20px;
  }

  .path {
    font-size: 10px;
    margin-top: 18px;
    padding-top: 10px;
  }
}

@media (max-width: 360px) {
  .masthead h1 {
    font-size: 19px;
  }

  .scene-text {
    font-size: 13px;
  }
  
}
.scene-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.scene-id {
  display: none !important;
}
#path-trace {
  display: none !important;
}
.scene-image,
.scene-media img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Картинка полностью помещается без искажений пропорций */
}
#btn-son{
  position:fixed;
  top:14px;
  right:14px;
  z-index:10;
  background:transparent;
  border:1px solid rgba(179,18,31,0.4);
  color:#b3121f;
  font-size:16px;
  padding:6px 10px;
  cursor:pointer;
}