* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: system-ui, sans-serif;
  background: transparent;
  color: #fff;
}
#app {
  width: 100%;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 0;
  overflow: hidden;
  user-select: none;
}
.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  pointer-events: none; /* клики ловят canvas (зоны) и оверлеи, не видео-слой */
}
.video-wrapper canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
.video-wrapper #tapToStart {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  color: #fff;
  cursor: pointer;
  z-index: 10;
}
.video-wrapper #tapToStart svg {
  width: 72px;
  height: 72px;
  padding: 18px;
  box-sizing: content-box;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  backdrop-filter: blur(2px);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  transition: transform 0.15s ease, background 0.15s ease;
}
.video-wrapper #tapToStart:hover svg {
  transform: scale(1.08);
  background: rgba(255,255,255,0.28);
}
.video-wrapper #restartBtn {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  z-index: 12;
}
.video-wrapper #restartBtn:hover svg {
  /* лёгкое «оживление» при наведении — крошечная подсветка, без скачка */
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.game-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding-top: 28px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.game-controls.visible {
  opacity: 1;
  pointer-events: auto;
}
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
}
.game-controls button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  line-height: 1;
}
.game-controls .flex-spacer { flex: 1 1 auto; }
.game-controls .mute-btn { font-size: 1.2rem; }

/* Ползунок перемотки — длинный, тонкий, полупрозрачный, заполнение белое */
#progressBar {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  height: 5px;
  margin: 0 2px;
  background: linear-gradient(to right,
    #fff 0%,
    #fff var(--p, 0%),
    rgba(255,255,255,0.25) var(--p, 0%),
    rgba(255,255,255,0.25) 100%);
  cursor: pointer;
  border: none;
  outline: none;
}
#progressBar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 0;
  border: none;
}
#progressBar::-moz-range-thumb {
  width: 0;
  height: 0;
  border: none;
}

/* Ползунок громкости — короткий, полупрозрачный */
.volume-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 5px;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  border-radius: 3px;
  flex: 0 0 64px;
}
.volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
}
.volume-bar::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

.time-display {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* Узкие экраны: оставляем только кнопки play/pause и mute */
@media (max-width: 480px) {
  .game-controls .volume-bar,
  .game-controls .time-display {
    display: none;
  }
  .controls-row {
    justify-content: center;
  }
}
/* Ошибка загрузки видео */
.player-error {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0,0,0,0.75);
  padding: 20px;
  text-align: center;
}
.player-error-msg {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffb74d;
}
.player-error-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.player-error-actions button {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: #3a3a3a;
  color: #fff;
}
.player-error-actions button[data-reload] { background: #4caf50; }
.player-error-actions button[data-next] { background: #555; }