:root {
  /* Cosmic Color Palette */
  --bg-deep: hsl(230, 45%, 4%);
  --bg-space: hsl(235, 40%, 8%);
  --accent-nebula: hsl(280, 70%, 60%);
  --accent-star: hsl(190, 80%, 70%);
  --text-primary: hsl(210, 20%, 95%);
  --text-secondary: hsl(210, 10%, 70%);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

/* Cosmic Background */
.space-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, #1a1b3a 0%, #0a0b1e 100%);
}

.stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/stars.png') repeat;
  opacity: 0.5;
  animation: move-stars 200s linear infinite;
}

@keyframes move-stars {
  from { background-position: 0 0; }
  to { background-position: 10000px 5000px; }
}

/* Glassmorphism Utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
}

/* Layout */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4rem;
  padding: 1.5rem 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent-star), var(--accent-nebula));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.05em;
}

.hero {
  text-align: center;
  padding: 6rem 0;
  animation: fade-in 1s ease-out;
}

.hero h1 {
  font-size: 4.5rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 3rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.card {
  padding: 2.5rem;
  transition: var(--transition);
  cursor: default;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-star);
  background: rgba(255, 255, 255, 0.05);
}

.card i {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--accent-star);
}

.card h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.card p {
  color: var(--text-secondary);
}

/* Streamlit Console Integration */
.streamlit-console {
  margin-top: 4rem;
  padding: 0;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--glass-border);
}

.console-title {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-star);
}

.console-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}

.status-indicator.live {
  background: #2ecc71;
  box-shadow: 0 0 10px #2ecc71;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.iframe-container {
  position: relative;
  width: 100%;
  height: 600px;
  background: #000;
}

.iframe-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(10, 11, 30, 0.95), rgba(5, 5, 10, 0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  padding: 2rem;
  opacity: 1;
  transition: var(--transition);
}

.iframe-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content h3 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.overlay-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.overlay-content code {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem;
  border-radius: 8px;
  font-family: monospace;
  color: var(--accent-star);
  border: 1px solid var(--glass-border);
  margin-bottom: 1rem;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Gallery Section */
.gallery-section {
  margin-top: 6rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.result-card {
  overflow: hidden;
  border-radius: 16px;
}

.result-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: var(--transition);
}

.result-card:hover img {
  transform: scale(1.05);
}

.result-info {
  padding: 1.5rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent-star), var(--accent-nebula));
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 0 20px rgba(0, 195, 255, 0.4);
}
