/* ============================================================
   gameplay.css — video player, HUD, timer, response buttons
   ============================================================ */

/* ── Gameplay screen layout ─────────────────────────────────── */
#screen-gameplay {
  padding: 0;
  background: #000;
  justify-content: flex-start;
  overflow: hidden;
}

/* ── HUD ────────────────────────────────────────────────────── */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
  pointer-events: none;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
}

.hud-level {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.hud-video {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
}

.hud-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.3);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.progress-dot--done {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.progress-dot--active {
  background: transparent;
  border-color: var(--color-accent);
  transform: scale(1.3);
  box-shadow: 0 0 8px var(--color-accent);
}

.hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 100px;
}

.hud-score {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--color-accent);
  line-height: 1;
}

.hud-streak {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-gold);
  background: rgba(255, 215, 0, 0.12);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ── Video ──────────────────────────────────────────────────── */
.video-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.game-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Score flash ────────────────────────────────────────────── */
.score-flash {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 60;
  text-shadow: 0 0 20px currentColor;
  animation: score-pop 0.8s ease forwards;
}

.score-flash--positive { color: var(--color-accent); }
.score-flash--negative { color: var(--color-danger); }

@keyframes score-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.2); }
  80%  { opacity: 1; transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

/* ── Shared slide-up animation ──────────────────────────────── */
@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Easy/Medium: bottom response overlay ───────────────────── */
/* Video remains visible above; only the bottom is covered.     */
.response-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: 20px 16px 28px;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.97) 0%,
    rgba(0,0,0,0.82) 65%,
    transparent 100%
  );
  animation: slide-up 0.3s ease;
}

/* Inner row: [ring] [2×2 buttons] */
.response-overlay-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 740px;
  margin: 0 auto;
}

/* ── Timer ring ─────────────────────────────────────────────── */
.timer-ring-wrapper {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-track {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 8;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73; /* 2π × 52 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s ease;
}

.timer-ring-progress--warning {
  stroke: var(--color-danger);
  filter: drop-shadow(0 0 6px var(--color-danger));
}

.timer-ring-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--color-text);
}

/* ── Response buttons (shared by all modes) ─────────────────── */
.response-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1; /* fills remaining width inside .response-overlay-inner */
}

.response-btn {
  background: rgba(26, 26, 46, 0.92);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 500;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
  min-height: 80px;
}

.response-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  background: rgba(26, 26, 46, 0.98);
  transform: translateY(-2px);
}

.response-btn:disabled {
  cursor: not-allowed;
}

.response-btn--chosen {
  border-color: var(--color-accent) !important;
  background: var(--color-accent-dim) !important;
  color: var(--color-accent) !important;
}

.response-btn--timeout {
  border-color: rgba(255,68,68,0.3);
  opacity: 0.6;
}

.response-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  background: var(--color-accent-dim);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
  margin-top: 1px;
}

.response-text {
  flex: 1;
}

/* ── Hard mode overlay ──────────────────────────────────────── */
.hard-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding: 16px 16px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.65) 80%, transparent 100%);
  animation: slide-up 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* ── Hard timer bar ─────────────────────────────────────────── */
.hard-timer-bar-wrapper {
  height: 5px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  margin-bottom: 14px;
  overflow: hidden;
}

.hard-timer-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 999px;
  width: 100%;
  transition: width linear, background 0.3s ease;
}

.hard-timer-bar--warning {
  background: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
}

/* Hard buttons: centered, not flex-fill */
.response-buttons--hard {
  max-width: 680px;
  margin: 0 auto;
  flex: none;
}

/* ── Post-video review panel ────────────────────────────────── */
.post-video-review {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0,0,0,0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.post-review-inner {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 8px 0;
}

.post-review-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-gold);
}

.post-review-frame {
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #000;
  display: block;
}

.post-review-frame--loading {
  min-height: 160px;
  background: var(--color-bg-card);
}

.post-review-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: -4px;
}

/* Post-review buttons: not flex-fill, centered */
.post-review-inner .response-buttons {
  flex: none;
  width: 100%;
  max-width: 560px;
}

/* ── Between-video transition overlay ──────────────────────── */
.video-transition {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in-fast 0.3s ease;
}

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

.video-transition-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
}

.video-transition-icon {
  font-size: 3.5rem;
  animation: float 1.5s ease-in-out infinite;
}

.video-transition-message {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.video-transition-countdown {
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-accent);
  line-height: 1;
  min-width: 2ch;
  text-align: center;
  text-shadow: 0 0 24px rgba(0, 255, 136, 0.5);
}

/* ── Timeout message — shown above the bottom overlay ───────── */
.timeout-msg {
  position: fixed;
  top: 72px; /* below HUD */
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  background: var(--color-danger-dim);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 24px;
  white-space: nowrap;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 560px) {
  /* On narrow screens: stack timer above buttons */
  .response-overlay-inner {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .timer-ring-wrapper {
    width: 72px;
    height: 72px;
  }

  .timer-ring-count {
    font-size: 1.4rem;
  }

  .response-buttons {
    flex: none;
    width: 100%;
  }

  .response-btn {
    min-height: 70px;
    font-size: 0.92rem;
    padding: 14px 14px;
  }
}

@media (max-width: 380px) {
  .response-buttons {
    grid-template-columns: 1fr;
  }
}
