@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-input: #1a1a1a;
  --accent: #00ff41;
  --accent-hover: #00cc33;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #222;
  --error: #ff3333;
  --warning: #ffaa00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(0, 255, 65, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(0, 255, 65, 0.03) 0%, transparent 50%);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

h1 {
  font-family: 'Orbitron', monospace;
  font-size: 2.5rem;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(135deg, var(--accent), #00ffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

#hub {
  margin-bottom: 2rem;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hub-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.15);
  transform: translateY(-2px);
  background: #1a1a1a;
}
.hub-card:active {
  transform: translateY(0);
}

.hub-card-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  color: var(--accent);
}

.hub-card-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#backToHubBtn {
  margin-bottom: 1.5rem;
  display: none;
}

.grid {
  display: block;
  width: 100%;
  margin-bottom: 2rem;
}

.module {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  position: relative;
  transition: all 0.3s ease;
  display: block; /* Changed from none to block for separate pages */
  margin-bottom: 2rem;
}

.module:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.1);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.module h2 {
  font-family: 'Orbitron', monospace;
  color: var(--accent);
  margin: 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.module h2::before {
  content: "⚡";
  animation: pulse 2s infinite;
}

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

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

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.2);
}

input[type="color"] {
  padding: 0;
  height: 40px;
  cursor: pointer;
}

button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 255, 65, 0.3);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.secondary-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
}

#canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  width: 100%;
  min-height: 400px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

#asciiCanvas {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  display: block;
}

#aiGeneratedArt {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.2;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre;
}

#video-container {
  margin-bottom: 1rem;
}

video {
  width: 100%;
  max-height: 400px;
  border-radius: 8px;
  background: #000;
}

.progress-container {
  margin: 1.5rem 0;
}

#progressWrap {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  display: none;
}

#progressBar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00ffff);
  transition: width 0.3s ease;
  border-radius: 4px;
}

#loading {
  text-align: center;
  padding: 2rem;
  color: var(--accent);
}

#loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#error {
  background: rgba(255, 51, 51, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  display: none;
}

.effect-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
}

.radio-label input {
    width: auto;
    margin: 0;
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .container {
    padding: 1rem;
  }
  
  .module {
    padding: 1.5rem;
  }
}

#fileInput {
  width: 100%;
  margin-bottom: 1rem;
}

#customAsciiChars {
  display: none;
  width: 100%;
  margin-top: 0.5rem;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Fullscreen Mode */
.module.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  border-radius: 0;
  border: none;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.module.fullscreen .module-header {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.module.fullscreen #canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
  min-height: 0;
}

.module.fullscreen #asciiCanvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
}

.module.fullscreen .interface-panel {
  flex-shrink: 0;
  max-height: 30vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  background: var(--bg-card);
}