* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #1a1a2e;
  overflow-x: hidden;
}

#scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
  96% { opacity: 0.9; }
  97% { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { 
    box-shadow: 0 0 5px rgba(240, 165, 0, 0.3), 0 0 10px rgba(240, 165, 0, 0.1);
  }
  50% { 
    box-shadow: 0 0 10px rgba(240, 165, 0, 0.5), 0 0 20px rgba(240, 165, 0, 0.2);
  }
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes modalShake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  10% { transform: translate(-50%, -50%) rotate(-1deg); }
  20% { transform: translate(-50%, -50%) rotate(1deg); }
  30% { transform: translate(-50%, -50%) rotate(-0.5deg); }
  40% { transform: translate(-50%, -50%) rotate(0.5deg); }
  50% { transform: translate(-50%, -50%) rotate(0deg); }
}

@keyframes typingDot {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.flicker {
  animation: flicker 8s infinite;
}

.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.slide-in {
  animation: slideIn 0.3s ease-out forwards;
}

.modal-shake {
  animation: modalShake 0.5s ease-in-out;
}

.typing-dot:nth-child(1) { animation: typingDot 1.4s infinite 0s; }
.typing-dot:nth-child(2) { animation: typingDot 1.4s infinite 0.2s; }
.typing-dot:nth-child(3) { animation: typingDot 1.4s infinite 0.4s; }

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #16213e;
}
::-webkit-scrollbar-thumb {
  background: #cf7500;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #f0a500;
}

/* Textarea and input styling */
textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: #f0a500;
  box-shadow: 0 0 8px rgba(240, 165, 0, 0.3);
}

textarea, input[type="text"] {
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Card hover effect */
.char-card {
  transition: transform 0.2s, box-shadow 0.2s;
}
.char-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(240, 165, 0, 0.2);
}

/* Background texture */
.bg-texture {
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(22, 33, 62, 0.8) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(26, 26, 46, 0.9) 0%, transparent 50%),
    linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
}

.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: #cf7500 #16213e;
}

/* Settings panel appear animation */
@keyframes settingsPanelAppear {
  from { 
    opacity: 0; 
    transform: translateY(-8px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

.settings-panel-appear {
  animation: settingsPanelAppear 0.2s ease-out forwards;
}