  :root { 
  --red: #ff0000; 
  --black: #050505; 
  --dark-grey: #121212; 
  --white: #ffffff; 
   --primary-dark: #000000;	
}

* { 
  -webkit-tap-highlight-color: transparent; 
  box-sizing: border-box; 
}

body { 
  background: var(--black); 
  color: var(--white); 
  font-family: 'Nova Mono', monospace; 
  margin: 0; 
  overflow: hidden; 
  height: 100vh;
}

/* CRT Scanline Overlay */
body::after {
  content: " "; 
  display: block; 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
  z-index: 999; 
  background-size: 100% 3px; 
  pointer-events: none; 
  opacity: 0.3;
}

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
  
.splash-screen.fade-out { opacity: 0; }
.splash-screen.hidden { display: none; }

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.splash-video {
    max-width: 500px;
    width: 80%;
    height: auto;
    filter: grayscale(100%) contrast(1.1);
    opacity: 0;
    animation: splashFadeIn 0.3s ease-in forwards;
}

.splash-logo {
    opacity: 0;
    animation: splashFadeIn 0.5s ease-in 0.3s forwards;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
    animation: logoEntrance 2s ease-out 0.3s forwards, neonPulse 3s ease-in-out 2.3s infinite, rgbGlitch 0.3s ease-in-out 1.5s 3;
}

.splash-logo .logo-text {
    animation: typewriterReveal 1.5s steps(12) 0.8s forwards;
    opacity: 0;
}

/* Scanline overlay */
.splash-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        0deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    background-size: 100% 8px;
    pointer-events: none;
    animation: scanlinesSweep 2s linear infinite;
    opacity: 0.3;
}

@keyframes splashFadeIn {
    to { opacity: 1; }
}

@keyframes logoEntrance {
    0% { 
        opacity: 0;
        transform: scale(0.8);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes neonPulse {
    0%, 100% { 
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
    }
    50% { 
        filter: drop-shadow(0 0 40px rgba(255, 255, 255, 1)) drop-shadow(0 0 60px rgba(200, 200, 255, 0.6));
    }
}

@keyframes rgbGlitch {
    0%, 100% {
        transform: translate(0, 0);
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
    }
    25% {
        transform: translate(-3px, 0);
        filter: drop-shadow(-3px 0 5px rgba(255, 0, 0, 0.8)) drop-shadow(3px 0 5px rgba(0, 255, 255, 0.8));
    }
    50% {
        transform: translate(2px, 0);
        filter: drop-shadow(2px 0 5px rgba(0, 255, 0, 0.8)) drop-shadow(-2px 0 5px rgba(255, 0, 255, 0.8));
    }
    75% {
        transform: translate(-1px, 0);
        filter: drop-shadow(-2px 0 5px rgba(0, 0, 255, 0.8)) drop-shadow(2px 0 5px rgba(255, 255, 0, 0.8));
    }
}

@keyframes typewriterReveal {
    0% {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
    }
    1% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

@keyframes scanlinesSweep {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}
	      background: var(--black) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Hide everything except splash */
.splash-screen ~ * {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.splash-screen.fade-out ~ * {
    visibility: visible;
    opacity: 1;
}

.app-grid { 
  display: grid; 
  grid-template-columns: 200px 1fr; 
  grid-template-rows: 50px 1fr 350px 30px;
  height: 100vh;
}

header { 
  grid-column: span 2; 
  border-bottom: 1px solid var(--red); 
  background: #000; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 0 20px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-4 {
  gap: 1rem;
}

.w-2 {
  width: 0.5rem;
}

.h-2 {
  height: 0.5rem;
}

.bg-zinc-900 {
  background-color: #18181b;
}

.rounded-full {
  border-radius: 9999px;
}

.bg-red-600 {
  background-color: #dc2626;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

.text-white {
  color: #ffffff;
}

.font-bold {
  font-weight: 700;
}

.tracking-tighter {
  letter-spacing: -0.05em;
}

.text-sm {
  font-size: 0.875rem;
}

.uppercase {
  text-transform: uppercase;
}

.text-red-700 {
  color: #b91c1c;
}

.text-\[10px\] {
  font-size: 10px;
}

.border {
  border-width: 1px;
}

.border-zinc-800 {
  border-color: #27272a;
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.hover\:border-red-600:hover {
  border-color: #dc2626;
}

.menu-trigger {
  background: #000;
  cursor: pointer;
}

.sidebar { 
  background: #0a0a0a; 
  border-right: 1px solid #222; 
  overflow-y: auto; 
  padding: 20px; 
}

.section-label {
  color: #666;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.mt-6 {
  margin-top: 1.5rem;
}

.text-\[8px\] {
  font-size: 8px;
}

.text-zinc-700 {
  color: #3f3f46;
}

.mt-1 {
  margin-top: 0.25rem;
}

.text-zinc-600 {
  color: #52525b;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.tracking-widest {
  letter-spacing: 0.1em;
}

.cursor-pointer {
  cursor: pointer;
}

.hover\:text-red-600:hover {
  color: #dc2626;
}

/* VIEWPORT SPLIT */
#viewport { 
  display: grid; 
  grid-template-columns: 1fr 320px; 
  background: #000; 
  border-bottom: 1px solid var(--red); 
  overflow: hidden;
}

.story-panel {
  padding: 30px; 
  overflow-y: auto; 
  border-right: 1px solid #222;
  font-family: 'Special Elite', serif; 
  font-size: 14px; 
  line-height: 1.7; 
  background: #080808;
}

.log-panel {
  display: flex;         /* NEW: Enables flex layout */
  flex-direction: column;/* NEW: Stacks AI and Ticker vertically */
  padding: 0;            /* Changed: We move padding to inner divs */
  overflow: hidden;      /* NEW: Prevents the whole panel from scrolling */
  font-family: 'VT323', monospace; 
  font-size: 13px; 
  color: #555; 
  background: #050505;
  height: 100%;          /* Ensure it fills its grid cell */
}

/* Middle: The AI Interface & Onboarding */
#ai-chat-history {
  flex: 1;               /* Takes up all available top space */
  overflow-y: auto;      /* Allows AI answers to scroll */
  padding: 20px;         /* Restores the padding for the AI area */
  scrollbar-width: thin;
  scrollbar-color: #ff0000 transparent;
}

/* Bottom: The System Ticker (Logs) */
#log-ticker {
  height: 45px;          /* Fixed height for 1-2 lines of logs */
  padding: 5px 20px;     /* Internal spacing */
  border-top: 1px solid #1a1a1a;
  background: #080808;
  font-size: 10px;       /* Smaller for ticker vibe */
  color: #444;
  overflow: hidden;      /* Keeps it strictly to its height */
}

/* BOTTOM SECTION */
.bottom-container {
  display: grid; 
  grid-template-columns: 350px 1fr; 
  grid-column: span 2;
  border-top: 1px solid var(--red); 
  height: 350px; 
  background: #000;
}

/* SIGIL FORGE */
.sigil-forge {
  background: #000; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center;
  border-left: 1px solid #222; 
  position: relative; 
  overflow: hidden;
}

.absolute {
  position: absolute;
}

.top-2 {
  top: 0.5rem;
}

.left-4 {
  left: 1rem;
}

.text-\[9px\] {
  font-size: 9px;
}

.mt-4 {
  margin-top: 1rem;
}

.text-red-900 {
  color: #7f1d1d;
}

#sigil-canvas { 
  cursor: crosshair; 
  filter: drop-shadow(0 0 10px var(--red)); 
}

.chat-section { 
  background: var(--red); 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  border-right: 1px solid #000;
}

.editor-header { 
  background: #111; 
  color: white; 
  padding: 8px 15px; 
  font-family: 'Special Elite', serif; 
  font-size: 10px; 
  text-transform: uppercase; 
  letter-spacing: 2px; 
  border-bottom: 1px solid #000;
}

.chat-control-btn {
  background: #000;
  color: #444;
  border: 1px solid #222;
  padding: 4px 12px;
  font-size: 9px;
  cursor: pointer;
  font-family: 'Nova Mono', monospace;
  transition: all 0.2s;
  margin: 5px;
}

.chat-control-btn:hover {
  color: var(--red);
  border-color: var(--red);
}

#chat-container { 
  flex: 1; 
  padding: 15px; 
  overflow-y: auto; 
  background: #000; 
  font-family: 'VT323', monospace; 
}

.chat-bubble { 
  margin-bottom: 10px; 
  padding: 10px; 
  border: 1px solid #222; 
  font-size: 1.1rem; 
}

.user-message { 
  border-left: 4px solid #444; 
  color: #888; 
}

.bot-message { 
  border-left: 4px solid var(--red); 
  color: var(--white); 
  background: #0a0000; 
}

.chat-input-area { 
  background: #111; 
  padding: 10px; 
  display: flex; 
  gap: 8px; 
}

#chat-input { 
  background: #000; 
  color: var(--red); 
  border: 1px solid #333; 
  flex: 1; 
  padding: 8px; 
  font-family: 'VT323'; 
  font-size: 18px; 
  outline: none; 
}

footer { 
  grid-column: span 2; 
  background: #000; 
  border-top: 1px solid #222; 
  font-size: 9px; 
  color: #444; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 0 20px; 
}

.italic {
  font-style: italic;
}

.power-btn { 
  font-size: 9px; 
  padding: 2px 8px; 
  border: 1px solid #333; 
  color: #444; 
  cursor: pointer; 
  background: #000;
}

.power-on { 
  color: var(--red); 
  border-color: var(--red); 
  box-shadow: 0 0 5px var(--red); 
}

#ton-qr {
  width: 66px;
  border: 1px solid var(--white);
  padding: 2px;
  background: #000;
  cursor: zoom-in;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 10001;
}

#ton-qr:hover,
#to-qr:active {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  border-color: var(--red);
}

#ton-qr.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(3.5);
  z-index: 999999;
  border-color: var(--white);
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 50px rgba(255, 255, 255, 0.8);
  cursor: zoom-out;
}

#toq-qr {
  width: 108px;
  border: 1px solid var(--white);
  padding: 2px;
  background: #000;
  cursor: zoom-in;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 10001;
}

#toq-qr:hover,
#toq-qr:active {  /* ← Fixed: changed #to-qr to #toq-qr */
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  border-color: var(--red);
}

#toq-qr.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(3.5);
  z-index: 999999;
  border-color: var(--white);
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 50px rgba(255, 255, 255, 0.8);
  cursor: zoom-out;
}
  
/* SLIDE MENU */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.slide-menu {
  position: fixed;
  bottom: -100%;
  left: 0;
  width: 100%;
  height: 70%;
  background: #000;
  border-top: 2px solid var(--red);
  z-index: 9999;
  transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow-y: auto;
  padding: 40px 30px;
}

.slide-menu.active {
  bottom: 0;
}

.menu-content {
  max-width: 600px;
  margin: 0 auto;
}

.menu-title {
  color: var(--red);
  font-size: 1.8rem;
  margin-bottom: 30px;
  text-transform: uppercase;
}

.menu-section {
  margin-bottom: 25px;
}

.menu-section-title {
  color: #666;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.menu-link {
  display: block;
  color: var(--white);
  text-decoration: none;
  padding: 12px 0;
  border-bottom: 1px solid #222;
  transition: all 0.2s;
  font-size: 13px;
}

.menu-link:hover {
  color: var(--red);
  padding-left: 10px;
  border-color: var(--red);
}

.witch-symbol {
  animation: witch-glow 3s ease-in-out infinite;
}

@keyframes witch-glow {
  0%, 100% {
    opacity: 0.6;
    filter: drop-shadow(0 0 2px var(--red));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 8px var(--red));
  }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
  body {
    overflow: visible !important;
    height: auto !important;
  }

  .app-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto;
    height: auto;
    overflow-y: visible;
    grid-auto-rows: min-content;
  }

  .sidebar {
    grid-row: 2;
    height: auto;
    min-height: 150px;
    border-right: none;
    border-bottom: 1px solid #222;
    z-index: 1;
  }

  #ton-qr {
    z-index: 1 !important;
  }

  #ton-qr.expanded {
    z-index: 10000 !important;
  }

  #viewport {
    grid-row: 3;
    grid-template-columns: 1fr;
    height: 400px;
  }

  .story-panel {
    border-right: none;
    border-bottom: 1px solid #222;
  }

  .bottom-container {
    grid-row: 4 / 6;
    grid-template-columns: 1fr;
    height: auto;
    display: flex;
    flex-direction: column;
  }

.chat-section {
  height: 300px;
  border-right: none;
  border-bottom: 1px solid #222;
}

  .sigil-forge {
    height: auto;
    min-height: 300px;
    border-left: none;
    padding: 20px;
  }

  /* Fix side-by-side layout to stack on mobile */
  .sigil-forge > div:first-of-type {
    flex-direction: column !important;
    gap: 20px;
  }
  
  .sigil-forge > div:first-of-type > div {
    width: 100% !important;
    flex: none !important;
  }
  
  /* Adjust video and audio containers */
  .sigil-forge > div:first-of-type > div:first-child,
  .sigil-forge > div:first-of-type > div:last-child {
    width: 100% !important;
    margin-bottom: 20px;
  }

  .slide-menu {
    height: 90%;
    padding: 30px 20px;
  }

  .menu-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }

  .menu-section-title {
    font-size: 0.65rem;
  }

  .menu-link {
    font-size: 12px;
    padding: 8px 0;
  }
}

@media (max-width: 480px) {
  #viewport {
    min-height: 40vh;
  }

  .slide-menu {
    height: 95%;
  }

  header {
    padding: 0 10px;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  header > div {
    width: 100%;
    justify-content: center;
  }

  .text-sm {
    font-size: 0.75rem;
  }
  
  /* Make ASCII container scrollable on very small screens */
  #ascii-container {
    font-size: 7px;
    max-height: 250px;
  }
  
  /* Adjust audio/video for very small screens */
  .sigil-forge canvas,
  .sigil-forge video {
    max-width: 160px;
    max-height: 160px;
  }
}

		/* CUBE NAVIGATION */
.cube-menu-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 20px 0 30px 0;
}

.cube-container {
  position: relative;
  width: 120px;
  height: 120px;
  perspective: 600px;
}

.cube {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 15px auto;
  transform-style: preserve-3d;
  transform: rotateX(-20deg) rotateY(30deg);
}

.cube-face {
  position: absolute;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 2px solid #666;
  background: rgba(0, 0, 0, 0.9);
  transition: all 0.4s ease;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  line-height: 1.2;
}

.cube-face:hover {
  border-color: #ff0000;
  background: rgba(255, 0, 0, 0.1);
  transform: translateZ(10px);
}

.cube-front {
  color: #ff0000;
  transform: translateZ(45px);
}

.cube-right {
  color: #ccc;
  transform: rotateY(90deg) translateZ(45px);
}

.cube-left {
  color: #aaa;
  transform: rotateY(-90deg) translateZ(45px);
}

.cube-top {
  color: #999;
  transform: rotateX(90deg) translateZ(45px);
}

.cube-container:hover .cube {
  transform: rotateX(-25deg) rotateY(35deg);
}

.cube-geo-label {
  text-align: center;
  color: #666;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

@media (max-width: 600px) {
  .cube-menu-container {
    gap: 15px;
  }
  .cube-container {
    width: 100px;
    height: 100px;
  }
  .cube {
    width: 75px;
    height: 75px;
  }
  .cube-face {
    width: 75px;
    height: 75px;
    font-size: 8px;
  }
  .cube-front { transform: translateZ(37.5px); }
  .cube-right { transform: rotateY(90deg) translateZ(37.5px); }
  .cube-left { transform: rotateY(-90deg) translateZ(37.5px); }
  .cube-top { transform: rotateX(90deg) translateZ(37.5px); }
}
		 .witch-symbol {
      stroke-dasharray: 1000;
      stroke-dashoffset: 1000;
      animation: draw 5s ease-in-out infinite;
    }
    
    @keyframes draw {
      0% { stroke-dashoffset: 1000; }
      50% { stroke-dashoffset: 0; }
      100% { stroke-dashoffset: 1000; }
    }
#anastasia-img:hover,
#anastasia-img:active {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
  border-color: var(--red);
}

#anastasia-img.expanded {
  transform: scale(3.5);
  z-index: 999999;
  border-color: var(--white);
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 50px rgba(255, 255, 255, 0.8);
  cursor: zoom-out;
  filter: grayscale(0%); /* Remove greyscale when expanded */
}	
		
.tts-trigger {
  color: #ff0000;
  cursor: pointer;
  font-size: 16px;
  display: inline-block;
  margin-left: 10px;
  transition: all 0.2s;
  user-select: none;
}

.tts-trigger:hover {
  color: #fff;
  text-shadow: 0 0 8px #ff0000;
}

.tts-trigger.speaking {
  animation: pulse 1s infinite;
}		
	
	   /* ORB CONTAINER */
.orb-container {
    display: inline-block;
    vertical-align: middle;
    margin-right: 15px; /* Spacing between orb and title */
    width: 50px;
    height: 50px;
    position: relative;
}

/* THE SVG SHAPE */
.glitch-orb {
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 3;
    overflow: visible;
}

/* PARTS COLORS */
.orb-circle { stroke: #ff0033; } /* Red Circle */
.orb-triangle { stroke: #ffffff; } /* White Triangle */

/* IDLE ANIMATION (Slow breathe/rotate) */
.orb-container svg {
    animation: slow-spin 10s linear infinite;
    filter: drop-shadow(0 0 5px rgba(255, 0, 51, 0.4));
    transition: all 0.2s ease;
}

/* HOVER STATE (The Glitch) */
.orb-container:hover svg {
    animation: glitch-shake 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
    filter: drop-shadow(2px 2px 0px rgba(255, 255, 255, 0.5)) 
            drop-shadow(-2px -2px 0px rgba(255, 0, 51, 0.8));
}

.orb-container:hover .orb-triangle {
    fill: rgba(255, 255, 255, 0.1);
}

/* KEYFRAMES */
@keyframes slow-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes glitch-shake {
    0% { transform: translate(0) rotate(0deg); }
    20% { transform: translate(-2px, 2px) rotate(-5deg); }
    40% { transform: translate(-2px, -2px) rotate(5deg); }
    60% { transform: translate(2px, 2px) rotate(-5deg); }
    80% { transform: translate(2px, -2px) rotate(5deg); }
    100% { transform: translate(0) rotate(0deg); }
}
		
	/* ASCII Container Glitch Effect */
#ascii-container {
    animation: ascii-glitch 10s infinite;
}

@keyframes ascii-glitch {
    0%, 100% { 
        color: #ffffff; 
        text-shadow: 0 0 5px rgba(255,255,255,0.3);
    }
    50% { 
        color: #ff0000; 
        text-shadow: 0 0 10px rgba(255,0,0,0.5);
    }
    95% {
        color: #00ffff;
        transform: translateX(1px);
    }
}	
    
#power-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: redWhiteAlternate 1s infinite;
}

@keyframes redWhiteAlternate {
  0%, 50% { 
    background-color: #ef4444;
    box-shadow: 0 0 10px #ef4444;
  }
  51%, 100% { 
    background-color: white;
    box-shadow: 0 0 10px white;
  }
}

.log-panel {
    transition: opacity 0.2s ease-in-out;
}
