/* palace.css — 16-Bit Retro Memory Palace & CRT HUD Styles */

/* ==========================================================================
   PALACE VIEWPORT & RETRO CANVAS
   ========================================================================== */
.palace-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 3rem auto;
  border-radius: var(--radius-lg);
  background: #05070a;
  border: 2px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.2), 0 20px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  user-select: none;
}

.palace-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 600px;
  background: #000;
  overflow: hidden;
  cursor: crosshair;
}

@media (max-width: 768px) {
  .palace-viewport-wrapper {
    height: 440px;
  }
}

#palace-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* CRT Scanline & Vignette Overlay */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 3px, 6px 100%;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.85);
  z-index: 10;
}

/* In-Game Reticle / Crosshair */
.palace-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: 11;
}

.palace-crosshair::before,
.palace-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(56, 189, 248, 0.75);
}

.palace-crosshair::before {
  top: 5px; left: 0; width: 12px; height: 2px;
}
.palace-crosshair::after {
  top: 0; left: 5px; width: 2px; height: 12px;
}

/* Mouse Look Engagement Hint */
.mouse-lock-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  pointer-events: none;
  z-index: 15;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s ease-in-out;
}

/* Minimap Widget (Top Right) */
.minimap-wrapper {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(8, 12, 22, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-sm);
  padding: 6px;
  z-index: 15;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.minimap-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  text-align: center;
}

#minimap-canvas {
  width: 112px;
  height: 112px;
  display: block;
  image-rendering: pixelated;
}

/* ==========================================================================
   DOOM-STYLE RETRO VISOR / STATUS BAR HUD
   ========================================================================== */
.palace-hud {
  background: linear-gradient(180deg, #0f172a 0%, #030712 100%);
  border-top: 2px solid rgba(56, 189, 248, 0.4);
  padding: 0.95rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  font-family: var(--font-mono);
  color: #f8fafc;
  z-index: 20;
  position: relative;
  flex-wrap: wrap;
}

.hud-panel {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hud-panel-subject {
  min-width: 150px;
  flex: 0.8;
}

.hud-panel-zone {
  min-width: 180px;
  flex: 1;
}

.hud-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.hud-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* --- HERO TARGET PROXIMITY SCANNER BOX --- */
.hud-target-indicator {
  flex: 2.4;
  min-width: 400px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.1rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 2px solid rgba(56, 189, 248, 0.4);
  padding: 0.75rem 1.3rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.hud-target-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.8), transparent);
  transition: opacity 0.3s;
}

.hud-target-indicator:hover {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.25);
  transform: translateY(-1px);
}

.hud-target-icon-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.hud-radar-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  opacity: 0;
  animation: radarRing 2.4s infinite;
  pointer-events: none;
}

.hud-panel-target {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hud-target-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-target-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hud-target-status {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.3s ease;
}

.hud-target-status.standby {
  background: rgba(100, 116, 139, 0.25);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

.hud-target-status.locked {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid #10b981;
  animation: pulseStatus 1.2s infinite;
}

.hud-target-status.warp {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border: 1px solid #38bdf8;
  animation: pulseStatus 1.2s infinite;
}

.hud-target-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #cbd5e1;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.hud-prompt-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.45rem 0.95rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

/* --- ACTIVE TARGET IN RANGE STATE --- */
.hud-target-indicator.in-range {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.6) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-color: #10b981;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.45), 0 4px 20px rgba(0, 0, 0, 0.7), inset 0 0 15px rgba(16, 185, 129, 0.2);
  transform: translateY(-2px);
}

.hud-target-indicator.in-range::before {
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.9), transparent);
}

.hud-target-indicator.in-range .hud-target-icon-wrap {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #34d399;
}

.hud-target-indicator.in-range .hud-radar-pulse {
  border-color: #10b981;
  animation: radarRingFast 1.2s infinite;
}

.hud-target-indicator.in-range .hud-target-name {
  color: #f0fdf4 !important;
  text-shadow: 0 0 14px rgba(52, 211, 153, 0.85);
}

.hud-target-indicator.in-range .hud-prompt-badge {
  background: #10b981;
  color: #022c22;
  border-color: #34d399;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.75);
  animation: pulsePromptStrong 1.2s infinite;
}

@keyframes radarRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes radarRingFast {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes pulseStatus {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.97); }
}

@keyframes pulsePromptStrong {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(16, 185, 129, 0.75); }
  50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(16, 185, 129, 0.95); }
}

/* --- FLOATING IN-VIEWPORT PROXIMITY ALERT --- */
.canvas-proximity-alert {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  background: rgba(7, 13, 26, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid #10b981;
  border-radius: 12px;
  padding: 0.7rem 1.3rem;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.5), 0 10px 30px rgba(0, 0, 0, 0.85);
  color: #ffffff;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  max-width: 90%;
}

.canvas-proximity-alert.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.proximity-alert-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
}

.proximity-alert-radar {
  position: absolute;
  left: -2px;
  top: -2px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #10b981;
  opacity: 0;
  animation: radarRingFast 1.2s infinite;
  pointer-events: none;
}

.proximity-alert-icon {
  font-size: 1.4rem;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.proximity-alert-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.proximity-alert-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #34d399;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.proximity-alert-title {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 800;
  color: #f0fdf4;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.proximity-alert-action {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #10b981;
  color: #022c22;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}

.proximity-action-key {
  background: rgba(2, 44, 34, 0.3);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.proximity-action-label {
  letter-spacing: 0.04em;
}

/* ==========================================================================
   INTERACTIVE RETRO CRT DOSSIER MODAL
   ========================================================================== */
.palace-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.palace-modal-overlay.active {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.palace-dossier-card {
  width: 100%;
  max-width: 650px;
  background: #090e1a;
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.4), 0 20px 50px rgba(0, 0, 0, 0.9);
  position: relative;
  font-family: var(--font-sans);
}

.dossier-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.dossier-tag-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.dossier-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
}

.dossier-pillar {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #a5b4fc;
}

.dossier-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.dossier-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition-fast);
}

.dossier-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: #ef4444;
}

.dossier-body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.dossier-metrics {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #38bdf8;
  margin-bottom: 1.5rem;
}

.dossier-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dossier-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: var(--transition-base);
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

.dossier-primary-btn:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

.dossier-dismiss-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MOBILE VIRTUAL CONTROLS
   ========================================================================== */
.palace-mobile-controls {
  display: none;
  background: #090e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 1023px) {
  .palace-mobile-controls {
    display: flex;
  }
}

.touch-dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}

.touch-btn {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
  transition: background 0.1s;
}

.touch-btn:active {
  background: var(--accent-cyan);
  color: #030712;
}

.touch-action-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.touch-inspect-btn {
  padding: 0.75rem 1.25rem;
  background: var(--accent-cyan);
  color: #030712;
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   INSTRUCTIONS CARD
   ========================================================================== */
.palace-instructions-card {
  margin-top: 2rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.instruction-key {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.instruction-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
