:root {
  --core-black: #000000;
  --core-white: #FFFFFF;
  --core-accent: #B0C4DE; /* Platinum/Accent color */
  --core-accent-dark: #7B8A9E;
  --core-card-bg: #1a1a1a;
  --core-accent-glow: rgba(176, 196, 222, 0.4);
  --core-line-subtle: rgba(176, 196, 222, 0.08);
  --core-line-active: rgba(176, 196, 222, 0.3);
}

html, body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: var(--core-black);
  color: var(--core-white);
  height: 100%;
  overflow: hidden; 
}

#chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(var(--vh, 1vh) * 100);
  background: var(--core-black);
}

#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#welcome-screen {
  display: flex;
  flex-direction: column; 
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(var(--vh, 1vh) * 100 - 150px);
}

#welcome-screen h1 {
  font-size: 2.5rem;
  color: var(--core-accent); 
  margin: 20px 0 5px 0;
  font-weight: 600;
}

#welcome-screen p {
  font-size: 1rem;
  color: var(--core-white); 
  margin: 0 0 20px 0;
  font-weight: 300;
}

/* --- === NEW ANIMATION STYLES === --- */

/* This is the container for BOTH the 3D globe and the Atlas image */
.welcome-animation-container {
  position: relative;
  width: 350px;  /* Increased size */
  height: 350px; /* Increased size */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* This targets the <canvas> element created by Three.js */
.welcome-animation-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important; /* Force canvas to fill container */
  height: 100% !important;
  z-index: 1; /* Place canvas BEHIND the man */
}

/* This is your Atlas man image */
.atlas-man {
  position: relative; /* Changed from absolute */
  height: 300px; /* Sized to fit */
  width: auto;
  z-index: 10; /* Place man IN FRONT of the canvas */
  
  /* This dark shadow helps him "pop" from the globe */
  filter: drop-shadow(0 0 15px rgba(0,0,0,0.7));
}


/* --- END NEW ANIMATION STYLES --- */


#chat-container {
  display: none; 
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 800px; 
  margin: 0 auto; 
  padding-bottom: 20px;
}

/* --- Small Corner Animation (Unchanged) --- */
/* We keep this for the "loading" spinner */
#loading-animation {
  position: fixed;
  bottom: 80px; 
  left: 20px;
  z-index: 10;
  display: none; 
  width: 200px; 
  height: 200px;
  transform: scale(0.25); 
  transform-origin: bottom left;
  perspective: 1500px;
  overflow: hidden;
}
.veridian-core-outer{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:220px;height:220px;background:var(--core-card-bg);border:3px solid var(--core-accent);box-shadow:0 0 50px var(--core-accent-glow),inset 0 0 30px var(--core-accent-glow);animation:core-pulseGlow 2.5s ease-in-out infinite alternate,core-rotate3D 15s linear infinite;clip-path:polygon(50% 0,90% 20%,90% 80%,50% 100%,10% 80%,10% 20%)}.veridian-core-inner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:70%;height:70%;background:transparent;border:1px dashed rgba(176,196,222,.4);animation:core-rotateInner 8s linear infinite reverse;clip-path:polygon(50% 0,90% 20%,90% 80%,50% 100%,10% 80%,10% 20%)}.veridian-core-innermost{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:15px;height:15px;background:var(--core-accent);border-radius:50%;box-shadow:0 0 20px var(--core-white),0 0 30px var(--core-accent);animation:core-pulseCoreDot 1.5s ease-in-out infinite alternate}.veridian-core-orbiter-path{position:absolute;top:50%;left:50%;width:300px;height:300px;transform:translate(-50%,-50%) rotateX(70deg) rotateY(20deg);border:1px dashed rgba(176,196,222,.1);border-radius:50%;animation:core-rotate3D 20s linear infinite}.veridian-core-orbiter{position:absolute;width:6px;height:6px;background:var(--core-accent);border-radius:50%;box-shadow:0 0 10px var(--core-white);top:50%;left:50%;margin:-3px;animation:core-orbit 4s linear infinite}.veridian-core-orbiter:nth-child(2){animation-delay:-1s}.veridian-core-orbiter:nth-child(3){animation-delay:-2s}.veridian-core-orbiter:nth-child(4){animation-delay:-3s}.veridian-core-flow-line{position:absolute;top:50%;left:50%;width:120px;height:2px;background:linear-gradient(to right,transparent,var(--core-line-active),transparent);transform-origin:left center;animation:core-radialFlow 4s linear infinite;opacity:0}.veridian-core-grid-line{position:absolute;background:var(--core-line-subtle);height:1px;opacity:0;animation:core-gridFadeAndMove 12s linear infinite;z-index:0;width:150%}@keyframes core-pulseGlow{from{box-shadow:0 0 20px var(--core-accent-glow),inset 0 0 10px var(--core-accent-glow)}to{box-shadow:0 0 70px var(--core-accent),inset 0 0 40px var(--core-accent)}}@keyframes core-rotate3D{from{transform:translate(-50%,-50%) rotateY(0deg) rotateX(10deg)}to{transform:translate(-50%,-50%) rotateY(360deg) rotateX(10deg)}}@keyframes core-rotateInner{from{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(-360deg)}}@keyframes core-pulseCoreDot{from{opacity:.7;transform:translate(-50%,-50%) scale(.8)}to{opacity:1;transform:translate(-50%,-50%) scale(1.2)}}@keyframes core-orbit{from{transform:rotate(0deg) translateX(150px) rotate(0deg)}to{transform:rotate(360deg) translateX(150px) rotate(-360deg)}}@keyframes core-radialFlow{0%{transform:scaleX(.1) rotate(var(--rotation-deg,0deg));opacity:0}20%{transform:scaleX(1.5) rotate(var(--rotation-deg,0deg));opacity:1}80%{transform:scaleX(.2) rotate(var(--rotation-deg,0deg));opacity:.5}100%{transform:scaleX(.1) rotate(var(--rotation-deg,0deg));opacity:0}}@keyframes core-gridFadeAndMove{0%{transform:translateX(-100%) rotate(var(--line-rotate,0deg));opacity:0}25%{opacity:.2}50%{transform:translateX(100%) rotate(var(--line-rotate,0deg));opacity:.1}75%{opacity:.2}100%{transform:translateX(-100%) rotate(var(--line-rotate,0deg));opacity:0}}

/* --- Message Bubbles (Unchanged) --- */
.message {
  margin: 5px 0;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.5;
  max-width: 90%; 
  word-wrap: break-word;
}
.user {
  text-align: right;
  color: var(--core-accent);
  background: rgba(176, 196, 222, 0.1);
  align-self: flex-end; 
}
.assistant { 
  text-align: left;
  color: var(--core-white);
  background: var(--core-card-bg); 
  align-self: flex-start; 
}

/* --- Input Form Styling (Unchanged) --- */

.message.assistant em {
  font-size: 0.8em;
  color: #999; /* Medium gray; adjust hex if needed, e.g., #666 for darker */
}

#chat-form-container {
  width: 100%;
  padding: 10px 0;
  background: var(--core-black);
  border-top: 1px solid var(--core-accent-dark);
  flex-shrink: 0;
}
#chat-form {
  display: flex;
  align-items: flex-end; 
  background: var(--core-card-bg);
  border: 1px solid var(--core-accent-dark);
  border-radius: 8px;
  padding: 8px;
  max-width: 800px; 
  margin: 0 auto; 
}
textarea#user-input {
  flex: 1;
  background: transparent;
  color: var(--core-white);
  border: none;
  font-size: 1rem;
  font-family: Arial, sans-serif;
  line-height: 1.5;
  resize: none;
  overflow-y: hidden; 
  max-height: 200px; 
  padding: 8px;
}
textarea#user-input:focus {
  outline: none;
}
button[type="submit"] {
  background: var(--core-accent);
  color: var(--core-black);
  border: 1px solid var(--core-accent);
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  padding: 8px 16px;
  margin-left: 8px;
  height: 40px; 
}
button[type="submit"]:hover {
  background: var(--core-white);
  border-color: var(--core-white);
}

/* --- MARKDOWN AND CODE STYLES (Unchanged) --- */
.code-block-wrapper {
  position: relative;
  background: #0D0D0D; 
  border-radius: 8px;
  margin: 10px 0;
}
.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #333;
  color: var(--core-white);
  border: 1px solid var(--core-accent-dark);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0.7;
  z-index: 1;
}
.code-block-wrapper:hover .copy-code-btn {
  opacity: 1;
}
.message.assistant pre {
  padding: 16px;
  padding-top: 40px; 
  overflow-x: auto;
  color: #f8f8f2; 
  background: transparent;
  border-radius: 8px;
  margin: 0;
}
.message.assistant code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  background: none;
  padding: 0;
}
.message.assistant code:not([class*="language-"]) {
  background: none;
  padding: 0;
  font-family: Arial, sans-serif;
  font-size: 1em;
  color: var(--core-accent-dark);
}
.message.assistant p,
.message.assistant li {
  margin: 16px 0 0 0;
  line-height: 1.6;
  font-weight: bold;
}
.message.assistant p:first-child,
.message.assistant li:first-child {
  margin-top: 0;
}
.message.assistant h1,
.message.assistant h2,
.message.assistant h3 {
  color: var(--core-accent);
  margin: 24px 0 10px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--core-accent-dark);
}
.message.assistant h1 { font-size: 1.8rem; }
.message.assistant h2 { font-size: 1.5rem; }
.message.assistant h3 { font-size: 1.2rem; }
.message.assistant ul {
  margin: 16px 0;
  padding-left: 25px;
}
.message.assistant li {
  margin-bottom: 8px;
}
.message.assistant a {
  color: var(--core-accent);
  text-decoration: underline;
  font-weight: normal;
}
.message.assistant a:hover {
  color: var(--core-white);
}

/* --- Media Queries (Unchanged) --- */
@media (max-width: 768px) {
  #main-content {
    padding: 10px;
  }
  #chat-form-container {
    padding: 10px;
  }
  
  /* Make animation container smaller on mobile */
  .welcome-animation-container {
    width: 300px;
    height: 300px;
  }
  .atlas-man {
    height: 250px;
  }

  #loading-animation {
    bottom: 70px; 
    left: 5px;
    transform: scale(0.2); 
  }
}
