@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Share+Tech+Mono&family=Fredoka:wght@400;500;600;700&display=swap');

:root {
  --bg: #030310;
  --surface: #0a0a1e;
  --surface2: #151530;
  --border: #2a2a4a;
  --text: #e8e8f0;
  --text-dim: #8888a8;
  --neon-green: #39ff14;
  --neon-red: #ff4444;
  --neon-orange: #ff8c00;
  --neon-purple: #bf00ff;
  --neon-cyan: #00f5ff;
}

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

body {
  font-family: 'Fredoka', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

h1, h2, h3, h4 {
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
}

.hidden {
  display: none !important;
}

/* Scanline overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    transparent, transparent 3px,
    rgba(0,0,0,0.03) 3px, rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* === LAYOUT === */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* === PROJECT PANEL === */
.project-panel {
  width: 380px;
  min-width: 340px;
  background: var(--surface);
  border-right: 2px solid var(--neon-purple);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.project-selector {
  width: 100%;
  padding: 10px 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
}

.project-selector:focus {
  border-color: var(--neon-purple);
  outline: none;
}

.project-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
}

.project-title {
  font-size: 12px;
  color: var(--neon-purple);
  text-shadow: 0 0 10px var(--neon-purple);
  line-height: 1.4;
  flex: 1;
}

.show-intro-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, box-shadow 0.15s;
}

.show-intro-btn:hover {
  background: rgba(0, 245, 255, 0.15);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

.project-description {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

.project-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* === EDITOR PANEL === */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 300px;
  background: var(--surface);
}

.editor-container {
  flex: 1;
  overflow: hidden;
}

.editor-container .CodeMirror {
  height: 100%;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
}

/* === TERMINAL PANEL === */
.terminal-panel {
  width: 320px;
  min-width: 280px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.terminal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.terminal-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 8px 16px;
  border: 2px solid;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.terminal-btn.run {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(57, 255, 20, 0.1);
}

.terminal-btn.run:hover {
  background: rgba(57, 255, 20, 0.2);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}

.terminal-btn.stop {
  border-color: var(--neon-red);
  color: var(--neon-red);
  background: rgba(255, 68, 68, 0.1);
}

.terminal-btn.stop:hover {
  background: rgba(255, 68, 68, 0.2);
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

.terminal-btn.clear {
  border-color: var(--neon-orange);
  color: var(--neon-orange);
  background: rgba(255, 140, 0, 0.1);
}

.terminal-btn.clear:hover {
  background: rgba(255, 140, 0, 0.2);
  box-shadow: 0 0 15px rgba(255, 140, 0, 0.4);
}

.terminal-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-output {
  color: var(--text);
}

.terminal-error {
  color: var(--neon-red);
}

.terminal-input-line {
  display: flex;
  align-items: center;
}

.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--neon-green);
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Terminal input */
.terminal-body.waiting-input {
  cursor: text;
}

.terminal-input-wrapper {
  display: inline;
}

.terminal-input-text {
  color: var(--neon-cyan);
}

/* === STEPS === */
.section-title {
  font-size: 10px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.steps-list {
  list-style: none;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface2);
  border-radius: 4px;
  border-left: 3px solid var(--border);
  font-size: 13px;
  transition: border-color 0.2s;
}

.step-item.completed {
  border-left-color: var(--neon-green);
}

.step-item.manual {
  cursor: pointer;
}

.step-item.manual:hover {
  background: rgba(191, 0, 255, 0.1);
}

.step-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-top: 1px;
}

.step-item.completed .step-checkbox {
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.step-item.completed .step-checkbox::after {
  content: '✓';
}

.step-text {
  flex: 1;
  line-height: 1.4;
}

.step-badge {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: auto;
}

/* === HINTS === */
.hints-section {
  margin-top: 24px;
}

.hint-item {
  margin-bottom: 8px;
}

.hint-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  color: var(--neon-orange);
  cursor: pointer;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 4px;
  transition: background 0.15s;
}

.hint-title:hover {
  background: rgba(255, 140, 0, 0.1);
}

.hint-content {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  padding: 12px;
  margin-top: 4px;
  border-radius: 4px;
  border-left: 2px solid var(--neon-orange);
  white-space: pre-wrap;
  overflow-x: auto;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .project-panel {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 2px solid var(--neon-purple);
  }

  .project-panel.collapsed {
    max-height: 60px;
    overflow: hidden;
  }

  .project-panel.collapsed .project-content {
    display: none;
  }

  .project-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .collapse-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 4px;
    cursor: pointer;
  }

  .collapse-btn:hover {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
  }

  .editor-panel {
    min-height: 300px;
    height: 40vh;
  }

  .terminal-panel {
    width: 100%;
    min-height: 200px;
    height: 30vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 600px) {
  .project-selector {
    font-size: 12px;
  }

  .project-title {
    font-size: 10px;
  }

  .terminal-btn {
    font-size: 8px;
    padding: 6px 10px;
  }

  .step-item {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* === SPECIAL FUNCTIONS === */
.special-functions-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--neon-purple);
}

.special-func {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface2);
  border-radius: 4px;
  border-left: 3px solid var(--neon-purple);
}

.special-func code {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--neon-purple);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.special-func-desc {
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
}

.show-voices-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.show-voices-btn:hover {
  background: rgba(0, 245, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

/* === VOICE POPUP === */
.voice-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.voice-popup {
  background: var(--surface);
  border: 2px solid var(--neon-purple);
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(191, 0, 255, 0.3);
}

.voice-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.voice-popup-header h3 {
  font-size: 10px;
  color: var(--neon-purple);
  text-shadow: 0 0 8px var(--neon-purple);
}

.voice-popup-close {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--neon-red);
  color: var(--neon-red);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.voice-popup-close:hover {
  background: rgba(255, 68, 68, 0.2);
}

.voice-popup-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.voice-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--surface2);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
}

.voice-item:hover {
  background: rgba(191, 0, 255, 0.1);
  border-left-color: var(--neon-purple);
}

.voice-item.copied {
  border-left-color: var(--neon-green);
  background: rgba(57, 255, 20, 0.1);
}

.voice-item.copied::after {
  content: 'Copied!';
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--neon-green);
  margin-top: 4px;
}

.voice-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--neon-cyan);
}

.voice-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
}

/* === PROJECT INTRO MODAL === */
.intro-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.intro-modal {
  background: var(--surface);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 245, 255, 0.3);
}

.intro-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.intro-modal-header h2 {
  font-size: 14px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  line-height: 1.3;
}

.intro-modal-close {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--neon-red);
  color: var(--neon-red);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.intro-modal-close:hover {
  background: rgba(255, 68, 68, 0.2);
}

.intro-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.intro-modal-body h3 {
  font-size: 11px;
  color: var(--neon-purple);
  text-shadow: 0 0 8px var(--neon-purple);
  margin-bottom: 8px;
  margin-top: 20px;
}

.intro-modal-body h3:first-child {
  margin-top: 0;
}

.intro-modal-body .subtitle {
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  color: var(--neon-orange);
  margin-bottom: 20px;
}

.intro-modal-body p,
.intro-modal-body li {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 8px;
}

.intro-modal-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.intro-modal-body code {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--neon-green);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.intro-modal-body .example-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-top: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.intro-modal-body .example-box .input {
  color: var(--neon-cyan);
}

.intro-modal-body .example-box .output {
  color: var(--text);
}

.intro-modal-body .example-box .snark {
  color: var(--neon-orange);
}

.intro-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.intro-modal-start {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 12px 32px;
  background: rgba(57, 255, 20, 0.1);
  border: 2px solid var(--neon-green);
  color: var(--neon-green);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.intro-modal-start:hover {
  background: rgba(57, 255, 20, 0.2);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.5);
  transform: scale(1.02);
}

/* === COOLDOWN BAR === */
.cooldown-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 20px;
  background: rgba(10, 10, 30, 0.95);
  border-top: 2px solid var(--neon-orange);
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: var(--neon-orange);
  text-align: center;
  z-index: 999;
  box-shadow: 0 -4px 20px rgba(255, 140, 0, 0.2);
}
