/* ============================================================
   minigames.css -- Maze, Incident Report (typing), Personnel Files (memory), Entity Quiz.
   Part of the split from the original single style.css.
   ============================================================ */

/* ---------- MAZE GAME ---------- */
.maze-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.maze-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.maze-size-buttons {
  display: flex;
  gap: 0.5rem;
}

.maze-hud {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.keycard-inventory {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.2rem;
}

.keycard-chip {
  display: inline-block;
  width: 1.1rem;
  height: 0.8rem;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 4px currentColor;
}

.maze-hud .stat-label {
  font-size: 0.85rem;
}

.maze-hud .stat-value {
  font-size: 1.4rem;
}

.maze-3d-wrap {
  position: relative;
  width: 100%;
  max-width: 780px;
  aspect-ratio: 16 / 10;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-black);
  box-shadow: 4px 4px 0 rgba(var(--shadow-rgb), 0.3);
}

.maze-3d-wrap canvas:not(#mazeCanvas) {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}

.crosshair::before, .crosshair::after {
  content: "";
  position: absolute;
  background: rgba(244, 240, 220, 0.7);
}

.crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair::after {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

.look-hint {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 0.4rem 0.9rem;
  background: rgba(13, 11, 6, 0.7);
  color: #f4f0dc;
  font-family: var(--font-term);
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  pointer-events: none;
  text-align: center;
}

.interact-hint {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 0.4rem 0.9rem;
  background: rgba(47, 224, 127, 0.85);
  color: #0d0b06;
  font-family: var(--font-term);
  font-weight: bold;
  font-size: 1rem;
  border-radius: var(--radius-md);
  pointer-events: none;
  text-align: center;
}

.minimap-wrap {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  background: rgba(244, 240, 220, 0.92);
  border: 2px solid #211b0f;
  border-radius: var(--radius-md);
  padding: 0.35rem;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

#mazeCanvas {
  display: block;
}

.maze-hint {
  font-size: 0.9rem;
  opacity: 0.75;
  text-align: center;
  margin: 0;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 3rem);
  grid-template-rows: repeat(3, 3rem);
  gap: 0.4rem;
  justify-content: center;
}

.dpad-btn {
  color: var(--ink);
  font-family: var(--font-term);
  font-size: 1.3rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.dpad-btn:hover { background: var(--fluoro-white); }
.dpad-btn:focus-visible { outline: 3px solid var(--cursed-green); outline-offset: 2px; }
.dpad-btn:active { transform: translateY(1px); }

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }
.dpad-right { grid-column: 3; grid-row: 2; }

/* ---------- MAZE: JUMPSCARE OVERLAY ---------- */
.jumpscare-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  background: rgba(239, 45, 118, 0.55);
  font-weight: 700;
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  color: var(--bg-black);
  text-align: center;
  padding: 2rem;
}

.jumpscare-overlay.active {
  opacity: 1;
  animation: jumpscareFlash 1.6s steps(2, jump-none);
}

@keyframes jumpscareFlash {
  0%, 100% { opacity: 0; }
  8% { opacity: 1; }
  20% { opacity: 0.3; }
  30% { opacity: 1; }
  85% { opacity: 0.95; }
}

/* ---------- MAZE: LEADERBOARD ---------- */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  background: var(--fluoro-white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  font-family: var(--font-term);
}

.lb-rank { color: var(--stain-brown); font-weight: bold; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-time { font-size: 1.1rem; }
.lb-moves { font-size: 0.85rem; opacity: 0.7; }

/* ---------- MAZE: WIN MODAL NAME INPUT ---------- */
.win-name-input {
  width: 100%;
  font-family: var(--font-term);
  font-size: 1.05rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--fluoro-white);
  color: var(--ink);
  margin-top: 0.5rem;
}

.win-name-input:focus-visible {
  outline: 3px solid var(--cursed-green);
  outline-offset: 1px;
}

/* ---------- INCIDENT REPORT (typing minigame) ---------- */
.typing-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.threat-meter-wrap {
  margin-bottom: 1.5rem;
}

.threat-meter-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-term);
  font-size: 0.9rem;
  opacity: 0.75;
  margin-bottom: 0.4rem;
}

.threat-meter-track {
  width: 100%;
  height: 0.9rem;
  border-radius: 999px;
  background: var(--fluoro-white);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.threat-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--stain-brown);
  transition: width 0.6s linear, background-color 0.3s ease;
  border-radius: 999px;
}

.threat-meter-fill.threat-critical {
  background: var(--danger-red);
  animation: temptPulse 0.8s ease-in-out infinite;
}

.passage-display {
  font-family: var(--font-term);
  font-size: 1.2rem;
  line-height: 1.9;
  background: var(--fluoro-white);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  cursor: text;
  user-select: none;
}

.passage-display:focus-within {
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.passage-char {
  opacity: 0.55;
}

.passage-char.correct {
  opacity: 1;
  color: var(--stain-brown);
}

.passage-char.incorrect {
  opacity: 1;
  color: var(--danger-red);
  background: rgba(200, 30, 58, 0.15);
  border-radius: 2px;
}

.passage-char.current {
  opacity: 1;
  border-bottom: 2px solid var(--ink);
  animation: caretBlink 1s step-end infinite;
}

@keyframes caretBlink {
  0%, 100% { border-bottom-color: var(--ink); }
  50% { border-bottom-color: transparent; }
}

.typing-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- PERSONNEL FILES (memory-matching minigame) ---------- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 1.1rem;
}

.memory-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  perspective: 1000px;
}

.memory-card:disabled,
.memory-card.matched {
  cursor: default;
}

.memory-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--ink);
  backface-visibility: hidden;
  padding: 0.75rem;
  text-align: center;
}

.memory-card-back {
  background: var(--paper);
  font-size: 2.8rem;
  color: var(--stain-brown);
  box-shadow: var(--shadow-sm);
}

.memory-card-front {
  background: var(--fluoro-white);
  transform: rotateY(180deg);
  font-size: 2.2rem;
}

.memory-card-front span {
  font-family: var(--font-term);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
}

.memory-card-front img {
  width: 100%;
  height: 72%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.memory-card.matched .memory-card-front {
  border-color: var(--stain-brown);
  box-shadow: var(--shadow-md);
}

/* ---------- ENTITY QUIZ ---------- */
.quiz-panel {
  max-width: 36rem;
  width: 100%;
  margin: 0 auto;
}

.quiz-answers {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.quiz-answer-btn {
  font-family: var(--font-term);
  font-size: 1.05rem;
  text-align: left;
  padding: 0.7rem 1rem;
  background: var(--fluoro-white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink);
}

.quiz-answer-btn:hover {
  background: var(--paper);
  transform: translateX(3px);
}

.quiz-answer-btn:focus-visible {
  outline: 3px solid var(--cursed-green);
  outline-offset: 2px;
}


