/* ═══════════════════════════════════════════════════════════
   Poise — Design System
   "Aurora Glass" & Neural Network Architecture
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg:              #030305;
  --text:            #f4f4f5;
  --text-muted:      #a1a1aa;
  --text-faint:      #52525b;

  --glass-bg:        rgba(15, 15, 20, 0.45);
  --glass-panel:     rgba(25, 25, 35, 0.2);
  --glass-border:    rgba(255, 255, 255, 0.08);
  
  --input-bg:        rgba(0, 0, 0, 0.35);
  --input-border:    rgba(255, 255, 255, 0.06);
  --input-focus:     rgba(138, 116, 255, 0.5);

  --aurora-1:        #7c3aed;
  --aurora-2:        #2563eb;
  --aurora-3:        #ec4899;

  --accent-base:     #8b5cf6;
  --success:         #10b981;
  --error:           #f43f5e;

  /* Static Variables */
  --radius-lg:       24px;
  --radius:          14px;
  --radius-sm:       8px;
  --panel-w:         clamp(280px, 25vw, 360px);
  --app-max-w:       clamp(800px, 95vw, 1600px);
  
  /* Fluid Spacing & Layout */
  --space-sm:        clamp(6px, 1vw, 10px);
  --space-md:        clamp(12px, 1.5vw, 16px);
  --space-lg:        clamp(16px, 2vw, 24px);
  --content-w:       clamp(300px, 80vw, 950px);

  /* Fluid Typography */
  --text-xs:         clamp(0.65rem, 0.7vw + 0.3rem, 0.7rem);
  --text-sm:         clamp(0.75rem, 0.8vw + 0.3rem, 0.8rem);
  --text-base:       clamp(0.8rem, 0.9vw + 0.4rem, 0.85rem);
  --text-lg:         clamp(1rem, 1.2vw + 0.4rem, 1.1rem);
  --text-hero:       clamp(1.8rem, 2.5vw + 0.8rem, 2.5rem);

  /* Animation */
  --ease-fluid:      cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-bounce:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:        0.2s;
  --dur:             0.4s;
  --dur-slow:        0.7s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-size: 16px; }

body {
  background: var(--bg); color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: var(--text-base); font-weight: 300; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, textarea, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; opacity: 0.4; }
a { color: var(--accent-base); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: #fff; }
:focus-visible { outline: none; }

/* ── Aurora Background ── */
.aurora-bg {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0; pointer-events: none;
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.6;
  animation: float 20s infinite alternate ease-in-out; transform: translateZ(0);
}
.orb-1 { width: 60vw; height: 60vw; background: radial-gradient(circle, var(--aurora-1) 0%, transparent 70%); top: -10vw; left: -10vw; animation-duration: 25s; }
.orb-2 { width: 50vw; height: 50vw; background: radial-gradient(circle, var(--aurora-2) 0%, transparent 70%); bottom: -10vw; right: -5vw; animation-duration: 22s; animation-delay: -5s; }
.orb-3 { width: 40vw; height: 40vw; background: radial-gradient(circle, var(--aurora-3) 0%, transparent 70%); top: 20vh; left: 40vw; animation-duration: 28s; animation-delay: -10s; opacity: 0.4; }

@keyframes float {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(5vw, 5vh) scale(1.1); }
  66%  { transform: translate(-3vw, 8vh) scale(0.9); }
  100% { transform: translate(-8vw, -2vh) scale(1.05); }
}

/* ── View Router ── */
.view-layer {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s var(--ease-fluid), transform 0.6s var(--ease-fluid);
  transform: scale(0.95);
  display: flex; align-items: center; justify-content: center;
}
.view-layer.active { opacity: 1; pointer-events: auto; transform: scale(1); z-index: 20; }

/* ── View 1: Global Setup Modal ── */
.glass-card {
  width: 100%; max-width: 440px; padding: 40px;
  background: var(--glass-bg); backdrop-filter: blur(40px) saturate(120%); -webkit-backdrop-filter: blur(40px) saturate(120%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.api-modal-header { margin-bottom: 32px; text-align: center; }
.api-modal-header h1 { font-size: 1.5rem; font-weight: 500; margin-bottom: 8px; }
.api-modal-header p { color: var(--text-muted); font-size: 0.95rem; }

/* ── View 2: Neural Network Hub ── */
#networkHubView {
  perspective: 1000px;
}
.network-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}
.network-line {
  stroke: rgba(255,255,255,0.15); stroke-width: 1.5;
  stroke-dasharray: 4 4; animation: dashMove 20s linear infinite;
}
@keyframes dashMove { to { stroke-dashoffset: -100; } }

.network-center {
  position: absolute; z-index: 2;
  top: 50%; left: 65%; transform: translate(-50%, -50%);
  width: 120px; height: 120px;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(20px);
  border-radius: 50%; border: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}
.silhouette { width: 70%; height: 70%; filter: drop-shadow(0 0 10px rgba(255,255,255,0.5)); }
.center-pulse {
  position: absolute; width: 100%; height: 100%; border-radius: 50%;
  border: 1px solid var(--accent-base); opacity: 0;
  animation: pulseOut 3s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pulseOut { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(2.5); opacity: 0; } }

#networkNodesContainer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.network-node {
  position: absolute; pointer-events: auto;
  width: 80px; height: 80px; transform: translate(-50%, -50%);
  background: var(--glass-bg); backdrop-filter: blur(20px);
  border-radius: 50%; border: 1px solid var(--glass-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--dur-fast) var(--ease-bounce);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.network-node:hover {
  transform: translate(-50%, -50%) scale(1.15);
  border-color: rgba(255,255,255,0.3); color: #fff;
  background: rgba(255,255,255,0.05);
}
.network-node svg { margin-bottom: 4px; color: inherit; }
.network-node .node-label { font-size: 0.7rem; font-weight: 500; text-align: center; line-height: 1.1; padding: 0 5px; }

.network-node.disabled { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; }
.network-node.disabled:hover { transform: translate(-50%, -50%); border-color: var(--glass-border); color: var(--text-muted); }

/* ── View 3 & 4: Tool Wrappers ── */
#toolView, #chatView { flex-direction: column; align-items: stretch; padding: 24px; }
.tool-header {
  flex-shrink: 0; display: flex; justify-content: space-between; align-items: center;
  max-width: var(--app-max-w); width: 100%; margin: 0 auto 16px auto; z-index: 30;
}
.btn-action.ghost { display: flex; align-items: center; gap: 8px; color: var(--text-muted); padding: 8px 12px; border-radius: var(--radius-sm); transition: all 0.2s; }
.btn-action.ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }

.connection-badge.small {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none;
  padding: 6px 12px; font-size: 0.75rem; opacity: 0.3;
  pointer-events: none; /* Make it strictly background */
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.badge-text { font-weight: 400; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.badge-text { font-weight: 500; }
.badge-change { color: var(--text-faint); font-size: 0.75rem; transition: color 0.2s; }
.badge-change:hover { color: #fff; }

.app-wrapper { flex: 1; display: flex; justify-content: center; min-height: 0; }
.app {
  width: 100%; max-width: var(--app-max-w); height: 100%;
  background: var(--glass-bg); backdrop-filter: blur(40px) saturate(120%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.1);
  display: grid; grid-template-columns: var(--panel-w) 1fr; overflow: hidden;
}

/* ── Panel & Editor (Inside Tool) ── */
.panel { display: flex; flex-direction: column; background: var(--glass-panel); border-right: 1px solid var(--glass-border); padding: 32px; overflow-y: auto; }
.panel-brand { margin-bottom: 32px; }
.brand { font-size: 1.5rem; font-weight: 600; background: linear-gradient(to right, #fff, #a1a1aa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.tool-options { display: flex; flex-direction: column; }
.field { margin-bottom: 20px; }
.field > label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.02em; }

input[type="password"], input[type="text"], textarea {
  width: 100%; padding: 12px 16px; border-radius: var(--radius);
  background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text);
  font-size: 0.95rem; transition: all var(--dur-fast); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { border-color: var(--input-focus); background: rgba(0,0,0,0.5); box-shadow: 0 0 0 1px var(--input-focus), 0 0 20px rgba(138,116,255,0.2); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.btn-icon { display: flex; align-items: center; justify-content: center; width: 48px; border-radius: var(--radius); background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text-muted); transition: all 0.2s; }
.btn-icon:hover { color: #fff; background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }

.checkbox-row { display: flex; align-items: center; gap: 10px; margin: 20px 0; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }
.checkbox-row:hover { color: var(--text); }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent-base); cursor: pointer; }
.privacy-note { margin-top: 24px; font-size: 0.8rem; color: var(--text-faint); text-align: center; }

/* Custom Select */
.custom-select { position: relative; }
.select-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: var(--radius); background: var(--input-bg); border: 1px solid var(--input-border); font-size: 0.95rem; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); transition: all 0.2s; }
.select-trigger:hover { border-color: rgba(255,255,255,0.15); background: rgba(0,0,0,0.5); }
.select-trigger[aria-expanded="true"] { border-color: var(--input-focus); box-shadow: 0 0 0 1px var(--input-focus), 0 0 20px rgba(138,116,255,0.2); }
.select-arrow { opacity: 0.5; transition: transform 0.2s; font-size: 0.8rem; }
.select-trigger[aria-expanded="true"] .select-arrow { transform: rotate(180deg); }
.select-dropdown { position: absolute; top: calc(100% + 8px); left: 0; min-width: 100%; padding: 6px; border-radius: var(--radius); background: #121216; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 20px 40px rgba(0,0,0,0.5); z-index: 100; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: all 0.2s var(--ease-bounce); }
.select-dropdown.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.select-dropdown.dropup { top: auto; bottom: calc(100% + 8px); transform: translateY(10px); box-shadow: 0 -20px 40px rgba(0,0,0,0.5); }
.select-dropdown.dropup.open { transform: translateY(0); }
.select-option { width: 100%; display: block; padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-muted); text-align: left; transition: all 0.1s; white-space: nowrap; }
.select-option:hover { background: rgba(255,255,255,0.08); color: #fff; }
.select-option.active { background: rgba(139, 92, 246, 0.2); color: #fff; }

/* Primary Button */
.btn-primary { position: relative; width: 100%; height: 50px; border-radius: var(--radius); background: #fff; color: #000; font-weight: 600; font-size: 1rem; overflow: hidden; transition: transform 0.2s var(--ease-bounce); }
.btn-primary:hover:not(:disabled) { transform: scale(1.02); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-text { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.btn-glow { position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent); z-index: 1; transform: skewX(-20deg); transition: left 0.5s; }
.btn-primary:hover:not(:disabled) .btn-glow { left: 150%; transition: left 0.8s ease-in-out; }
.btn-primary.working { background: rgba(255,255,255,0.8); }
.btn-primary.working .btn-glow { width: 200%; left: -50%; background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.8), transparent); animation: scanning 1.5s infinite linear; }
@keyframes scanning { 0% { left: -100%; } 100% { left: 100%; } }
.shortcut-hint { display: block; text-align: center; color: var(--text-faint); font-size: 0.75rem; margin-top: 12px; }

/* Editor Split View */
.editor { display: flex; flex-direction: column; padding: var(--space-lg); height: 100%; position: relative; max-width: var(--content-w); margin: 0 auto; width: 100%; }
.editor-input { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; transition: flex var(--dur-slow) var(--ease-fluid); background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: var(--space-lg); box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.editor.split .editor-input { flex: 0 0 40%; }
.editor-label { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); flex-shrink: 0; }
.editor textarea#sourceText { flex: 1; width: 100%; min-height: 0; padding: 4px 0; background: transparent; border: 1px solid transparent; color: #fff; font-size: var(--text-base); line-height: 1.6; font-weight: 300; resize: none; transition: all 0.2s; box-shadow: none; outline: none; }
.editor textarea#sourceText:focus { background: transparent; border-color: transparent; box-shadow: none; }

.editor-divider { flex: 0 0 0px; display: flex; align-items: center; gap: 16px; overflow: hidden; opacity: 0; transition: flex-basis var(--dur-slow) var(--ease-fluid), opacity 0.3s 0.1s; margin: 0; }
.editor.split .editor-divider { flex-basis: 32px; opacity: 1; margin: 8px 0; }
.divider-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent); }
.btn-clear { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.3); font-size: var(--text-sm); color: var(--text-muted); transition: all 0.2s; }
.btn-clear:hover { background: rgba(255,255,255,0.1); color: #fff; }

.editor-result { flex: 0 0 0%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: translateY(20px); transition: flex var(--dur-slow) var(--ease-fluid), opacity 0.4s 0.2s, transform 0.4s 0.2s; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: var(--space-lg); box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.editor.split .editor-result { flex: 1 1 auto; opacity: 1; transform: translateY(0); }
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-shrink: 0; }
.result-label { font-size: var(--text-sm); font-weight: 500; color: var(--accent-base); }
.model-badge { font-size: var(--text-xs); color: var(--text-muted); padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.05); }

.result-content { flex: 1; min-height: 0; padding: var(--space-lg); background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); border-radius: var(--radius); box-shadow: inset 0 2px 20px rgba(0,0,0,0.3); font-size: var(--text-base); line-height: 1.7; font-weight: 300; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-content.loading { display: flex; align-items: center; justify-content: center; background: linear-gradient(120deg, rgba(0,0,0,0.2) 0%, rgba(139,92,246,0.1) 50%, rgba(0,0,0,0.2) 100%); background-size: 200% 100%; animation: shimmerLoad 2s infinite linear; border-color: rgba(139,92,246,0.3); }
@keyframes shimmerLoad { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.loading-indicator { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loading-text { font-size: 0.95rem; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(139,92,246,0.2); border-top-color: var(--accent-base); animation: spin 1s infinite linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-content.revealed { animation: fadeReveal 0.6s var(--ease-fluid); }
@keyframes fadeReveal { from { opacity: 0; filter: blur(4px); transform: translateY(10px); } to { opacity: 1; filter: blur(0); transform: translateY(0); } }

.result-actions { display: flex; gap: 12px; margin-top: 16px; flex-shrink: 0; }
.btn-action { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.05); color: #fff; transition: transform 0.2s var(--ease-bounce), background 0.2s; }
.btn-action:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255,255,255,0.15); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.btn-action.copied { background: var(--success); border-color: var(--success); color: #000; animation: pop 0.4s var(--ease-bounce); }
@keyframes pop { 0% { transform: scale(0.95); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
.editor-message { flex-shrink: 0; min-height: 0; color: var(--error); font-size: 0.85rem; transition: min-height 0.3s; margin-top: 8px; }
.editor-message:not(:empty) { min-height: 24px; }
/* -- View 4: Chat -- */
.chat-app { grid-template-columns: 1fr; display: flex; flex-direction: column; align-items: center; }
.chat-messages {
  flex: 1; padding: var(--space-lg); overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-lg); scroll-behavior: smooth;
  width: 100%; max-width: var(--content-w); margin: 0 auto;
}
.chat-empty-state {
  margin: auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; max-width: 700px; padding: 24px 20px;
}
.chat-greeting {
  font-size: var(--text-hero); line-height: 1.2; margin-bottom: 40px;
  color: var(--text-muted);
}
.greeting-highlight {
  background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 500;
}
.greeting-sub {
  font-size: var(--text-hero); font-weight: 300; opacity: 0.8;
}
.suggestion-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  width: 100%; max-width: 850px;
}
@media (max-width: 900px) {
  .suggestion-cards { grid-template-columns: repeat(2, 1fr); max-width: 500px; }
}
@media (max-width: 500px) {
  .suggestion-cards { grid-template-columns: 1fr; }
}
.suggestion-card {
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: left; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px; padding: 16px; min-height: 100px; transition: all 0.2s ease; cursor: pointer;
  position: relative;
}
.suggestion-card:hover {
  background: rgba(255,255,255,0.06); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.1);
}
.card-text { display: flex; flex-direction: column; gap: 4px; padding-right: 24px; }
.card-text strong { font-size: 0.95rem; font-weight: 500; color: #fff; }
.card-text span { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.card-icon {
  position: absolute; bottom: 16px; right: 16px; color: var(--accent-base); opacity: 0.8;
  background: rgba(139,92,246,0.1); padding: 8px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; transition: all 0.2s;
}
.suggestion-card:hover .card-icon { color: #fff; background: rgba(139, 92, 246, 0.4); opacity: 1; }

.chat-bubble-wrapper { display: flex; flex-direction: column; width: 100%; margin-bottom: var(--space-lg); }
.chat-bubble-wrapper.user { align-items: flex-end; }
.chat-bubble-wrapper.ai { align-items: flex-start; }
.chat-bubble { max-width: 85%; padding: 12px 16px; font-size: var(--text-base); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble.user { background: rgba(255, 255, 255, 0.05); color: #fff; border-radius: 16px; border-bottom-right-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.chat-bubble.ai { background: transparent; border: none; color: var(--text-base); padding: 0; padding-right: 40px; }
.chat-bubble.loading { opacity: 0.7; font-style: italic; color: var(--text-muted); animation: pulse 1s infinite alternate; }

.app-footer {
  position: absolute;
  bottom: 24px;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  opacity: 0.6;
  z-index: 10;
  pointer-events: none;
}

.chat-input-area { padding: var(--space-lg); background: transparent; border-top: none; max-width: var(--content-w); margin: 0 auto; width: 100%; flex-shrink: 0; }
.chat-input-box { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 24px; padding: 16px; box-shadow: 0 8px 30px rgba(0,0,0,0.2); transition: border-color 0.2s; }
.chat-input-box:focus-within { border-color: rgba(255,255,255,0.15); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.chat-input-box textarea { width: 100%; background: transparent; border: none; outline: none; color: var(--text-base); font-family: inherit; font-size: var(--text-base); resize: none; min-height: 40px; max-height: 200px; padding: 8px; margin-bottom: 8px; box-shadow: none; }
.chat-input-box textarea::placeholder { color: rgba(255,255,255,0.35); }
.chat-input-box textarea:focus { background: transparent; border: none; box-shadow: none; outline: none; border-color: transparent; }
.chat-input-controls-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.controls-left { display: flex; gap: 8px; }
.btn-send-compact { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; transition: all 0.2s var(--ease-bounce); border: none; cursor: pointer; }
.btn-send-compact:hover:not(:disabled) { background: #9333ea; color: #fff; transform: translateY(-2px); box-shadow: 0 4px 16px rgba(147,51,234,0.4); }
.btn-send-compact:disabled { opacity: 0.4; cursor: not-allowed; }
.compact-select { max-width: 140px; }
.compact-select .select-trigger { padding: 6px 12px; font-size: 0.85rem; background: transparent; border: none; border-radius: 8px; height: auto; color: var(--text-muted); }
.compact-select .select-trigger:hover { color: #fff; background: rgba(255,255,255,0.04); }
.compact-select .select-dropdown { bottom: calc(100% + 4px); top: auto; }
/* -- Network Hero Text -- */
.network-hero {
  position: absolute;
  top: 50%; left: 8%;
  transform: translateY(-50%);
  z-index: 5; max-width: 450px;
  animation: slideIn 1s var(--ease-fluid) forwards; opacity: 0;
}
@keyframes slideIn { from { transform: translate(-20px, -50%); opacity: 0; } to { transform: translate(0, -50%); opacity: 1; } }

.hero-badge {
  display: inline-block; padding: 6px 12px; margin-bottom: 24px;
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--accent-base); border: 1px solid rgba(138, 116, 255, 0.3); border-radius: 20px;
  background: rgba(138, 116, 255, 0.1); backdrop-filter: blur(10px);
}
.hero-title {
  font-size: var(--text-hero); font-weight: 300; line-height: 1.1; letter-spacing: -0.02em;
  margin: 0 0 20px 0;
}
.hero-desc {
  font-size: var(--text-lg); line-height: 1.6; color: var(--text-faint); font-weight: 300;
}
/* -- Hover Upgrades -- */
.network-center { transition: all 0.4s var(--ease-bounce); }
.network-center:hover {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 40px rgba(138, 116, 255, 0.5), inset 0 0 30px rgba(138, 116, 255, 0.3);
  border-color: rgba(138, 116, 255, 0.8);
}
.network-center:hover svg { transform: scale(1.1); fill: #fff; }

.network-node:hover:not(.disabled) {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 25px rgba(138, 116, 255, 0.4);
  border-color: rgba(138, 116, 255, 0.6);
  z-index: 10;
}
/* -- Modal Overlay -- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 3, 5, 0.85); backdrop-filter: blur(10px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1; pointer-events: auto;
}
.modal-overlay .glass-card {
  transform: translateY(20px); transition: transform 0.4s var(--ease-bounce);
}
.modal-overlay.active .glass-card {
  transform: translateY(0);
}

/* -- Intro Animation Sequence -- */
.network-hero {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5; max-width: 450px; text-align: center;
  /* Removed previous static positioning, now driven by body classes */
}
body.intro-done .network-hero {
  left: 8%; text-align: left;
  transform: translateY(-50%);
  transition: left 1s var(--ease-fluid), transform 1s var(--ease-fluid);
}

/* Word by word animation */
.hero-title span {
  display: inline-block;
  opacity: 0; transform: translateY(10px);
  background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.4));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
body.intro-play .hero-title span {
  animation: wordFade 0.6s var(--ease-fluid) forwards;
}
body.intro-play .hero-title span:nth-child(1) { animation-delay: 0.1s; }
body.intro-play .hero-title span:nth-child(3) { animation-delay: 0.3s; }

@keyframes wordFade { to { opacity: 1; transform: translateY(0); } }

/* Fading in the rest */
.hero-badge, .hero-desc {
  opacity: 0; transition: opacity 1s 1s;
}
body.intro-done .hero-badge, body.intro-done .hero-desc {
  opacity: 1;
}

/* Network fade */
#networkCanvas, .network-center, #networkNodesContainer, #hubSettingsBtn {
  opacity: 0; transition: opacity 1.5s var(--ease-fluid); pointer-events: none;
}
body.intro-done #networkCanvas, 
body.intro-done .network-center, 
body.intro-done #networkNodesContainer,
body.intro-done #hubSettingsBtn {
  opacity: 1; pointer-events: auto;
}

/* -- Chat Controls Consistency -- */
.chat-controls .custom-select .select-trigger {
  height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}
.chat-controls .btn-action.ghost {
  height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
}
.chat-controls .btn-action.ghost:hover {
  background: rgba(255,255,255,0.1);
}
.chat-controls .custom-select .select-value {
  margin-right: 8px;
}

/* -- View Transitions and Backgrounds -- */
#chatView, #toolView {
  background: var(--bg-color); /* Prevents transparent crossfades */
}
.view-bg-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(3);
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.view-bg-icon svg {
  width: 300px;
  height: 300px;
}
