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

:root {
  --bg: #0a0a0a;
  --terminal-bg: #111111;
  --terminal-border: #2a2a2a;
  --header-bg: #1a1a1a;
  --text: #c8c8c8;
  --text-dim: #666;
  --green: #00ff41;
  --cyan: #00e5ff;
  --yellow: #ffd600;
  --red: #ff5252;
  --white: #f0f0f0;
  --prompt-color: #00ff41;
  --command-color: #fff;
  --font: 'Source Code Pro', monospace;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
}

/* Background canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Hidden SEO content */
.seo-content {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Noscript fallback */
.noscript {
  max-width: 600px;
  margin: 100px auto;
  padding: 20px;
  color: var(--text);
  font-family: var(--font);
  text-align: center;
}
.noscript a {
  color: var(--cyan);
}

/* Terminal container */
#terminal {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 90vw;
  max-width: 860px;
  height: 85vh;
  max-height: 700px;
  margin: auto;
  margin-top: 7.5vh;
  border: 1px solid var(--terminal-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--terminal-bg);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(0, 255, 65, 0.03);
}

/* Header */
#terminal-header {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--terminal-border);
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.header-buttons .btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.btn.red { background: #ff5f57; }
.btn.yellow { background: #ffbd2e; }
.btn.green { background: #28c840; }

.header-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}

.header-spacer {
  width: 52px;
}

/* Terminal body */
#terminal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

#terminal-body::-webkit-scrollbar {
  width: 6px;
}
#terminal-body::-webkit-scrollbar-track {
  background: transparent;
}
#terminal-body::-webkit-scrollbar-thumb {
  background: var(--terminal-border);
  border-radius: 3px;
}

/* Output area */
#output {
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.6;
}

/* Command line that was entered (history) */
.cmd-line {
  margin-top: 8px;
}
.cmd-line .prompt {
  color: var(--prompt-color);
  font-weight: 600;
}
.cmd-line .cmd {
  color: var(--command-color);
  margin-left: 8px;
}

/* Response block */
.response {
  margin: 4px 0 8px 0;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.15s;
}
.response.visible {
  opacity: 1;
}

/* Animated words */
.word {
  opacity: 0;
  display: inline;
  transition: opacity 0.08s;
}
.word.show {
  opacity: 1;
}

/* Colored spans in output */
.c-green { color: var(--green); }
.c-cyan { color: var(--cyan); }
.c-yellow { color: var(--yellow); }
.c-red { color: var(--red); }
.c-white { color: var(--white); }
.c-dim { color: var(--text-dim); }
.c-bold { font-weight: 700; }

/* Links in output */
.response a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 229, 255, 0.3);
  transition: border-color 0.2s;
}
.response a:hover {
  border-bottom-color: var(--cyan);
}

/* Clickable project buttons inside output */
.project-btn {
  background: none;
  border: none;
  color: var(--cyan);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 229, 255, 0.3);
  transition: border-color 0.2s;
}
.project-btn:hover {
  border-bottom-color: var(--cyan);
}

/* Box drawing for project details */
.box-top, .box-bottom {
  color: var(--green);
}
.box-title {
  color: var(--green);
  font-weight: 700;
}

/* ASCII art */
pre.ascii {
  color: var(--green);
  font-size: 11px;
  line-height: 1;
  margin: 0;
  font-family: var(--font);
}

/* Input line */
#input-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

#input-line .prompt {
  color: var(--prompt-color);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

#input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--command-color);
  font-family: var(--font);
  font-size: 14px;
  caret-color: var(--green);
}
#input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

/* Footer shortcuts */
#terminal-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--header-bg);
  border-top: 1px solid var(--terminal-border);
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  flex-wrap: wrap;
}

#terminal-footer button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--terminal-border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#terminal-footer button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--green);
  color: var(--green);
}

/* Blinking cursor for boot sequence */
.cursor-blink::after {
  content: '\2588';
  animation: blink 1s step-end infinite;
  color: var(--green);
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Responsive */
@media (max-width: 600px) {
  #terminal {
    width: 100vw;
    height: 100vh;
    max-height: none;
    margin-top: 0;
    border-radius: 0;
    border: none;
  }

  #terminal-body {
    padding: 12px;
  }

  #output {
    font-size: 12px;
  }

  #input, #input-line .prompt {
    font-size: 12px;
  }

  pre.ascii {
    font-size: 6px;
  }

  .header-title {
    font-size: 11px;
  }

  #terminal-footer {
    font-size: 11px;
  }
  #terminal-footer button {
    font-size: 11px;
  }
}
