/* ==========================================================================
   PROJECT BLACK FEATHER - 404 SPECIFIC INTERACTION STYLES
   ========================================================================== */

.error-wrapper {
  width: 100%;
  max-width: 1050px; /* Wider footprint tracking for an authentic VN display look */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}

/* --------------------------------------------------------------------------
   HIGH IMPEDANCE ERROR BRANDING BLOCK
   -------------------------------------------------------------------------- */
.glitch-matrix {
  text-align: center;
  margin-bottom: 35px;
  user-select: none;
}

.error-code {
  font-family: 'Courier Prime', monospace;
  font-size: 5.5rem;
  font-weight: 700;
  line-height: 1;
  color: #8B2626;
  position: relative;
  letter-spacing: -1px;
  display: inline-block;
}

.error-code::before {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 3px;
  text-shadow: -2px 0 #E6DFD3;
  width: 100%;
  height: 100%;
  background: #121314;
  clip: rect(0, 0, 0, 0);
  animation: glitch-anim-1 1.5s infinite linear alternate-reverse;
}

.error-msg {
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 3px;
  color: #9A9386;
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   COMPANION ZONE SYSTEM (Strict Layout Locking)
   -------------------------------------------------------------------------- */
.companion-zone {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 280px; /* Enlarged avatar column track */
  gap: 25px;
  align-items: start;
}

/* Hard height anchors enforced to eliminate responsive shifting during runtime nodes */
.dialogue-box {
  background-color: #161719;
  border: 1px solid #343538;
  border-left: 4px solid #8B2626;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9), 0 10px 30px rgba(0,0,0,0.6);
  padding: 30px;
  position: relative;
  height: 380px; /* Absolute fixed height tracker */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.dialogue-header {
  font-size: 0.8rem;
  letter-spacing: 2px;
  border-bottom: 1px dashed #222325;
  padding-bottom: 10px;
  margin-bottom: 15px;
  flex-shrink: 0;
}

.companion-name {
  color: #8B2626;
  font-weight: bold;
}

/* Dedicated scrolling body space to accommodate custom text dumps gracefully if needed */
.dialogue-body {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 15px;
}

.dialogue-text {
  font-size: 1.15rem; /* Expanded text scaling */
  line-height: 1.6;
  color: #E6DFD3;
  letter-spacing: 0.5px;
  margin: 0;
}

/* --------------------------------------------------------------------------
   PROCEDURAL AVATAR SYSTEM DISPLAY (HUD / Clean Workspace Layout)
   -------------------------------------------------------------------------- */
.avatar-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 380px; /* Synced with dialogue-box to balance columns perfectly */
  box-sizing: border-box;
}

.avatar-display {
  width: 100%;
  flex-grow: 1; /* Instructs inner layout view to maximize full vertical space */
  background-color: #0E0F10;
  border: 1px solid #343538;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.9);
}

/* Hook to execute the animated hand-drawn line boiling on internal art components */
.targeted-boil-layer {
  filter: url(#line-boil);
}

/* Clear setup instructions for future PNG asset insertion */
.avatar-display img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0.85;
}

/* Tactical HUD border container */
.hud-frame {
  position: absolute;
  width: 86%;
  height: 86%;
  border: 1px dashed rgba(139, 38, 38, 0.15);
  z-index: 2;
  box-sizing: border-box;
}

.hud-corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #8B2626;
}
.hud-corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.hud-corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.hud-corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.hud-corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }

/* Minimal low-profile telemetry items placed safely out of the frame path */
.hud-status-line {
  position: absolute;
  top: -18px;
  left: 0;
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: rgba(139, 38, 38, 0.5);
  font-family: monospace;
}

.hud-data-bit {
  position: absolute;
  bottom: -18px;
  right: 0;
  font-size: 0.65rem;
  color: #555047;
  font-family: monospace;
}

.matrix-scanner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: rgba(139, 38, 38, 0.3);
  box-shadow: 0 0 8px #8B2626;
  z-index: 3;
  animation: scanMotion 3.5s infinite linear;
}

.noise-glitch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(139, 38, 38, 0.03) 2px,
    rgba(139, 38, 38, 0.03) 4px
  );
  opacity: 0.7;
  z-index: 4;
  animation: blink 0.15s infinite;
  pointer-events: none;
}

.avatar-tag {
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: #555047;
  text-align: center;
  font-weight: bold;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   INTERACTIVE GAME CHOICE PATTERNS (Locked Footer Stack)
   -------------------------------------------------------------------------- */
.choices-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0; /* Keeps panel locked in footer zone */
}

.choice-btn {
  background: #0E0F10;
  color: #9A9386;
  border: 1px solid #222325;
  padding: 12px 20px;
  font-family: 'Courier Prime', monospace;
  font-size: 0.9rem; /* Slightly larger text matching scaling goals */
  text-align: left;
  cursor: pointer;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.choice-btn span {
  position: relative;
  z-index: 2;
}

.choice-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: rgba(139, 38, 38, 0.15);
  transform: skewX(-10deg);
  transition: left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.choice-btn:hover {
  color: #E6DFD3;
  border-color: #8B2626;
}

.choice-btn:hover::before {
  left: 0;
  width: 110%;
}

.choice-btn:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   ANIMATION KEYFRAME HOOKS
   -------------------------------------------------------------------------- */
@keyframes scanMotion {
  0% { top: -5%; }
  100% { top: 105%; }
}

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN ADAPTATIONS
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .error-code {
    font-size: 3.5rem;
  }
  .companion-zone {
    grid-template-columns: 1fr;
  }
  .avatar-box {
    grid-row: 1;
    height: 220px;
    max-width: 100%;
  }
  .dialogue-box {
    height: 420px; /* Extended vertical tracking on mobile to guard choices space from overflowing layout bounds */
    padding: 20px;
  }
  .dialogue-text {
    font-size: 1rem;
  }
}