/* ==========================================
   DESIGN SYSTEM & VARIABLES
   ========================================== */
:root {
  /* Color Palette - HSL Tailored Colors */
  --bg-primary: hsl(220, 29%, 7%);       /* #0b0e14 */
  --bg-secondary: hsl(220, 26%, 12%);   /* #151b26 */
  --bg-sidebar: hsl(220, 26%, 10%);
  --bg-bubble-bot: hsl(220, 22%, 15%);
  --bg-bubble-user: hsl(210, 56%, 23%);
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: hsla(210, 100%, 60%, 0.4);
  
  --text-primary: hsl(210, 15%, 90%);
  --text-secondary: hsl(210, 10%, 65%);
  --text-muted: hsl(210, 8%, 45%);
  
  --accent-blue: hsl(210, 100%, 60%);
  --accent-amber: hsl(40, 95%, 53%);
  --accent-red: hsl(6, 88%, 51%);
  --accent-cyan: hsl(182, 100%, 50%);
  
  /* Fonts */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Outfit', sans-serif;
  
  /* Layout */
  --sidebar-width: 320px;
  --header-height: 70px;
}

/* ==========================================
   RESET & BASICS
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, .brand-info h1, .chat-title {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================
   LAYOUT STRUCTURE
   ========================================== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ==========================================
   SIDEBAR & WIDGETS
   ========================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-light);
}

.avatar-container {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-info h1 {
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.version-badge {
  font-size: 11px;
  font-family: var(--font-display);
  background-color: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Widget Generic Style */
.widget {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.widget h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Drift Meter (Gauge Widget) */
.drift-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gauge-container {
  width: 160px;
  height: 90px;
  position: relative;
  margin-bottom: 12px;
}

.gauge {
  width: 100%;
  height: 100%;
}

.gauge-fill {
  stroke-dasharray: 251.2; /* Approximate circumference of semicircle A 40 40 */
  stroke-dashoffset: 125.6; /* Starts half-filled */
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.gauge-needle {
  width: 4px;
  height: 55px;
  background-color: var(--text-primary);
  position: absolute;
  bottom: 0;
  left: calc(50% - 2px);
  transform-origin: bottom center;
  transform: rotate(0deg); /* Range: -90deg to +90deg */
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.gauge-center {
  width: 12px;
  height: 12px;
  background-color: var(--accent-blue);
  border-radius: 50%;
  position: absolute;
  bottom: -6px;
  left: calc(50% - 6px);
  border: 2px solid var(--bg-sidebar);
}

.gauge-label-container {
  margin-bottom: 16px;
}

.gauge-value-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent-amber);
  transition: color 0.3s ease;
}

/* System Stats Row Style */
.stat-row {
  margin-bottom: 14px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.stat-bar-container {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.stat-bar {
  height: 100%;
  background-color: var(--accent-blue);
  border-radius: 3px;
  transition: width 1s ease-in-out, background-color 0.5s ease;
}

.stat-bar.warning {
  background-color: var(--accent-amber);
}

.stat-bar.danger {
  background-color: var(--accent-red);
}

.stat-bar.info {
  background-color: var(--accent-cyan);
}

.stat-value {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  text-align: right;
}

/* ==========================================
   MAIN CHAT WORKSPACE
   ========================================== */
.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
}

/* Chat Header */
.chat-header {
  height: var(--header-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.header-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-title {
  font-size: 18px;
  font-weight: 500;
  display: inline-block;
  margin-right: 8px;
}

.title-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sub-badges {
  display: flex;
  gap: 8px;
}

.badge {
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 8px;
}

.badge-accent {
  background-color: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.badge-outline {
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-style: italic;
}

/* ==========================================
   CHAT MESSAGES AREA
   ========================================== */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.messages-scroll {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-bottom: 40px;
}

/* Message Bubble Formatting */
.message-wrapper {
  display: flex;
  gap: 16px;
  animation: messageSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
  background-color: var(--bg-secondary);
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-bubble-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: calc(100% - 54px);
}

.message-sender-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--font-display);
}

.message-bubble {
  border-radius: 4px 18px 18px 18px;
  padding: 16px 20px;
  font-size: 15px;
  color: var(--text-primary);
  word-break: break-word;
}

/* Bot vs User Bubble Styling */
.message-wrapper.bot .message-bubble {
  background-color: var(--bg-bubble-bot);
  border: 1px solid var(--border-light);
}

.message-wrapper.user {
  flex-direction: row-reverse;
}

.message-wrapper.user .message-bubble-container {
  align-items: flex-end;
}

.message-wrapper.user .message-bubble {
  background-color: var(--bg-bubble-user);
  border-radius: 18px 4px 18px 18px;
  color: #fff;
}

.message-bubble p {
  margin-bottom: 12px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

/* ==========================================
   INPUT AREA & SUGGESTIONS
   ========================================== */
.chat-input-area {
  padding: 24px;
  background-color: var(--bg-primary);
  z-index: 10;
}

.input-container-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Starter Prompts */
.starter-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.suggestion-chip {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.suggestion-chip:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Input Form Control */
.input-form {
  position: relative;
  display: flex;
  align-items: center;
}

#user-input {
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 16px 60px 16px 24px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#user-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 4px 24px var(--border-focus);
}

.send-btn {
  position: absolute;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn svg {
  width: 16px;
  height: 16px;
  transform: translate(-1px, 0.5px);
}

.send-btn:hover {
  background-color: var(--accent-blue);
  color: #000;
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Satirical Disclaimer */
.satirical-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  padding: 0 16px;
}

/* Copyright Footer */
.copyright-footer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  line-height: 1.4;
}
.copyright-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.2s ease;
}
.copyright-footer a:hover {
  color: #00e5ff;
  text-decoration: underline;
}

/* ==========================================
   TYPING & THINKING LOADING STATES
   ========================================== */
.typing-indicator-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  animation: fadeIn 0.25s ease forwards;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 10px;
}

.typing-dots span {
  display: block;
  width: 6px;
  height: 6px;
  background-color: var(--accent-amber);
  border-radius: 50%;
  opacity: 0.4;
  animation: dotPulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.4);
    opacity: 1;
    background-color: var(--accent-cyan);
  }
}

.typing-text {
  font-size: 13px;
  font-family: var(--font-display);
  color: var(--accent-amber);
  font-style: italic;
  letter-spacing: 0.3px;
}

/* ==========================================
   MODAL DIALOG (PREMIUM UPGRADE)
   ========================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 40px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  animation: modalScaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 20px;
  display: inline-block;
  animation: wobble 2s infinite ease-in-out;
}

@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-8deg) scale(1.05); }
  30% { transform: rotate(6deg); }
  45% { transform: rotate(-4deg); }
  60% { transform: rotate(2deg); }
  75% { transform: rotate(-1deg); }
}

.modal-card h2 {
  font-size: 22px;
  margin-bottom: 12px;
  color: #fff;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 30px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================
   BUTTON SYSTEM
   ========================================== */
.btn {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #000;
}

.btn-primary:hover {
  background-color: hsl(210, 100%, 70%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary-outline {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-secondary-outline:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

/* ==========================================
   HELPER CLASSES & STATES
   ========================================== */
.hidden {
  display: none !important;
}

/* ==========================================
   RESPONSIVE LAYOUTS (MOBILE STYLING)
   ========================================== */
@media (max-width: 900px) {
  .sidebar-toggle {
    display: flex;
  }
  
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  /* Show close button logic on burger icon when sidebar is open */
  .sidebar-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  
  .sidebar-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .sidebar-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  
  .starter-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  
  .suggestion-chip {
    flex-shrink: 0;
  }
}

/* ==========================================
   ADVANCED SATIRICAL ENHANCEMENTS STYLING
   ========================================== */

/* Flashing Context Window Alert Bar */
.flashing-bar {
  animation: flash-red-bar 0.8s infinite alternate;
}
@keyframes flash-red-bar {
  from { opacity: 0.5; background-color: var(--accent-red); box-shadow: 0 0 2px var(--accent-red); }
  to { opacity: 1; background-color: #ff4d4d; box-shadow: 0 0 10px #ff4d4d; }
}

/* Header Action Layout & Panic Button */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.volume-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease;
  user-select: none;
  padding: 4px;
}
.volume-btn:hover {
  transform: scale(1.2);
}

.btn-panic {
  background-color: var(--accent-red);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(241, 39, 17, 0.2);
  animation: shake-fidget 5s infinite;
}
.btn-panic:hover {
  background-color: #ff3b25;
  box-shadow: 0 0 20px rgba(241, 39, 17, 0.6);
  transform: scale(1.03);
}
.btn-panic:active {
  transform: scale(0.97);
}

@keyframes shake-fidget {
  0%, 92%, 100% { transform: rotate(0); }
  93% { transform: rotate(-8deg) scale(1.05); }
  95% { transform: rotate(6deg); }
  97% { transform: rotate(-4deg); }
  99% { transform: rotate(2deg); }
}

/* Caffeine Crash Mode Layout */
.caffeine-crash {
  filter: sepia(0.2) brightness(0.85);
  transition: filter 1.5s ease-in-out;
}
.caffeine-crash .app-container {
  transform: rotate(0.4deg);
  transform-origin: center center;
  transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.caffeine-crash #user-input {
  font-family: 'Comic Sans MS', cursive, sans-serif !important;
  font-style: italic;
  letter-spacing: -0.5px;
  background-color: #121622;
  border-color: var(--accent-amber);
}

/* Satirical Code Editor Canvas Panel */
.canvas-panel {
  width: 420px;
  height: 100%;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 90;
}
.canvas-panel.hidden {
  transform: translateX(100%);
  display: flex !important; /* Force layout but keep off-screen */
  position: absolute;
  right: 0;
}
.canvas-panel:not(.hidden) {
  position: relative;
  transform: translateX(0);
}
.canvas-header {
  height: var(--header-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(21, 27, 38, 0.9);
}
.canvas-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.canvas-title-wrapper h3 {
  font-size: 15px;
  color: #fff;
  font-family: var(--font-display);
}
.canvas-icon {
  font-size: 18px;
}
.canvas-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-canvas-action {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-canvas-action:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}
.canvas-body {
  flex: 1;
  overflow: auto;
  background-color: #0b0e14;
  padding: 20px;
}
.code-editor-wrapper {
  display: flex;
  font-family: 'Space Mono', monospace, Consolas, Monaco;
  font-size: 13px;
  line-height: 1.6;
}
.line-numbers {
  color: var(--text-muted);
  text-align: right;
  padding-right: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
  display: flex;
  flex-direction: column;
}
.code-display {
  padding-left: 16px;
  color: #a9b1d6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
.code-display code {
  font-family: inherit;
}

/* Copy Tooltip Animation (Passive-Aggressive Clipboard) */
.copy-tooltip {
  position: absolute;
  background-color: var(--bg-sidebar);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-display);
  z-index: 500;
  pointer-events: none;
  animation: tooltip-fade 1.8s forwards;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes tooltip-fade {
  0% { opacity: 0; transform: translateY(5px); }
  10%, 80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

.copy-bubble-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}
.copy-bubble-btn:hover {
  color: var(--accent-cyan);
}
.copy-bubble-btn svg {
  width: 14px;
  height: 14px;
}

/* Panic Alert Overlay Screen */
.panic-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(241, 39, 17, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  animation: flash-red 0.5s infinite alternate;
}
@keyframes flash-red {
  from { background-color: rgba(241, 39, 17, 0.9); }
  to { background-color: rgba(130, 15, 10, 0.95); }
}
.panic-alert-box {
  background-color: #000;
  border: 4px solid #fff;
  border-radius: 20px;
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
}
.panic-alert-box h2 {
  color: #ff3b25;
  font-size: 22px;
  margin-bottom: 16px;
  font-family: var(--font-display);
  animation: pulse-scale 0.4s infinite alternate;
}
@keyframes pulse-scale {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}
.panic-alert-box p {
  color: #fff;
  font-size: 14px;
}
.panic-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .canvas-panel {
    position: absolute !important;
    right: 0;
    top: var(--header-height);
    bottom: 0;
    z-index: 95;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  }
  .canvas-panel.hidden {
    transform: translateX(100%) !important;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
