/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  background-color: #001e2b;
  color: #e3fcf7;
  font-family: "JetBrains Mono", monospace;
  min-height: 100vh;
  padding: 2rem;
  line-height: 1.6;
}

/* Layout */
.container {
  max-width: 900px;
  margin: 0 auto;
  overflow-x: hidden;
}

/* Terminal Styles */
.terminal {
  background-color: #0d2c3a;
  border-radius: 8px;
  margin-bottom: 2rem;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  max-width: 100%;
}

.terminal-header {
  background-color: #112733;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red {
  background-color: #ff5f56;
}

.terminal-dot.yellow {
  background-color: #ffbd2e;
}

.terminal-dot.green {
  background-color: #27c93f;
}

.terminal-title {
  margin-left: 0.75rem;
  font-size: 0.85rem;
  color: #889ba7;
}

.terminal-body {
  padding: 1.5rem;
  font-size: 0.85rem;
  overflow-x: auto;
}

/* Code Styles */
.code,
pre {
  white-space: pre;
  max-width: 100%;
}

.comment {
  color: #5c6d75;
}

.keyword,
.string {
  color: #00ed64;
}

.field {
  color: #e3fcf7;
}

.operator {
  color: #b8c4ce;
}

.error {
  color: #ff6f61;
}

.error-underline {
  color: inherit;
  text-decoration: none;
  will-change: color, text-decoration;
}

.error-underline.active {
  color: #ff6f61;
  text-decoration: wavy underline #ff6f61;
  text-underline-offset: 3px;
}

/* Error Sections */
.error-sections {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #1a3a4a;
  opacity: 0;
  transition: opacity 0.3s ease-in;
  will-change: opacity;
}

.error-sections.visible {
  opacity: 1;
}

.error-section {
  flex: 1;
  padding: 1rem;
  background-color: #001e2b;
  border-radius: 6px;
}

.error-section-title {
  font-size: 0.75rem;
  color: #889ba7;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.error-section-title.compile {
  color: #00ed64;
}

.error-section-title.runtime {
  color: #ff6f61;
}

.error-none {
  color: #5c6d75;
  font-style: italic;
}

.error-success {
  color: #00ed64;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.error-success.visible {
  opacity: 1;
}

.error-line,
.error-detail {
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity 0.2s ease-out,
    transform 0.2s ease-out,
    max-height 0.3s ease-out,
    margin-bottom 0.3s ease-out,
    padding 0.3s ease-out;
  will-change: opacity, transform, max-height;
  overflow: hidden;
}

.error-line {
  color: #ff6f61;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  max-height: 2em;
}

.error-detail {
  color: #889ba7;
  margin-left: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  max-height: 2em;
}

.error-line.visible,
.error-detail.visible {
  opacity: 1;
  transform: translateX(0);
}

.error-line.fade-out,
.error-detail.fade-out {
  opacity: 0 !important;
  transform: translateX(-10px) !important;
  max-height: 0 !important;
  margin-bottom: 0 !important;
}

.runtime-error-msg,
.runtime-error-note {
  opacity: 0;
  transition: opacity 0.3s ease-in;
  will-change: opacity;
}

.runtime-error-msg {
  color: #ff6f61;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.runtime-error-note {
  color: #5c6d75;
  font-size: 0.75rem;
}

.runtime-error-msg.visible,
.runtime-error-note.visible {
  opacity: 1;
}

.all-clear {
  color: #00ed64;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.all-clear.visible {
  opacity: 1;
}

/* Step Indicators */
.step-indicator {
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.2s ease-in;
  margin-bottom: 0.25rem;
}

.step-indicator.visible {
  opacity: 1;
}

.step-indicator .step-running {
  color: #ffbd2e;
}

.step-indicator .step-done {
  display: none;
  color: #00ed64;
}

.step-indicator .step-done.step-failed {
  color: #ff6f61;
}

.step-indicator.done .step-running {
  display: none;
}

.step-indicator.done .step-done {
  display: inline;
}

.step-indicator .dots::after {
  content: "";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: "";
  }
  40% {
    content: ".";
  }
  60% {
    content: "..";
  }
  80%,
  100% {
    content: "...";
  }
}

/* Fix Button */
.fix-btn {
  background: #252526;
  border: 1px solid #3c3c3c;
  color: #cccccc;
  padding: 0.35rem 0.6rem;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  margin-top: 0.75rem;
  opacity: 0;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.fix-btn .lightbulb {
  color: #ffcc00;
}

.fix-btn.visible {
  opacity: 1;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 122, 204, 0);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(0, 122, 204, 0.4);
  }
}

.fix-btn:hover {
  background: #094771;
  border-color: #007acc;
  color: #ffffff;
}

.fix-btn.hidden {
  display: none;
}

/* Code Cursor */
.code-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: #00ed64;
  margin-left: 1px;
  vertical-align: text-bottom;
  opacity: 0;
}

.code-cursor.visible {
  animation: cursor-blink 0.8s step-end infinite;
}

@keyframes cursor-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Fixable Code */
.fixable-code {
  display: inline;
}

.fixable-code .broken {
  transition: opacity 0.15s ease-out;
}

.fixable-code .fixed {
  display: none;
  opacity: 0;
}

.fixable-code.is-fixed .broken {
  display: none;
}

.fixable-code.is-fixed .fixed {
  display: inline;
  opacity: 1;
  transition: opacity 0.15s ease-in;
}

/* Compile Section Shrink */
#compile-section {
  transition: all 0.3s ease-out;
  overflow: hidden;
}

#compile-section.shrunk .error-line,
#compile-section.shrunk .error-detail {
  display: none;
}

/* Replay Button */
.replay-container {
  text-align: center;
  margin-bottom: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.replay-container.visible {
  opacity: 1;
}

.replay-btn {
  background: transparent;
  border: 1px solid #3d5a6c;
  color: #889ba7;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.replay-btn:hover {
  border-color: #00ed64;
  color: #00ed64;
}

/* Divider */
.divider {
  text-align: center;
  color: #3d5a6c;
  margin: 3rem 0;
  font-size: 0.9rem;
  overflow: hidden;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0;
}

.hero h1 {
  font-size: 2.5rem;
  color: #00ed64;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}

.hero .tagline {
  color: #889ba7;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.install-box {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #0d2c3a;
  padding: 1rem 2rem;
  border-radius: 8px;
  border: 1px solid #1a3a4a;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.install-box:hover {
  border-color: #00ed64;
  background-color: #112733;
}

.install-box .prompt {
  color: #00ed64;
  user-select: none;
}

.install-box .command {
  color: #e3fcf7;
}

.copy-feedback {
  position: absolute;
  right: -70px;
  color: #00ed64;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.copy-feedback.visible {
  opacity: 1;
}

.status {
  margin-top: 2rem;
  color: #889ba7;
  font-size: 0.85rem;
}

.status a {
  color: #00ed64;
  text-decoration: none;
}

.status a:hover {
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #0d2c3a;
  border: 1px solid #1a3a4a;
  border-radius: 8px;
  color: #889ba7;
  transition: all 0.2s ease;
}

.social-link:hover {
  border-color: #00ed64;
  color: #00ed64;
  transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 700px) {
  .error-sections {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  body {
    padding: 0.75rem;
  }

  .terminal-body {
    padding: 1rem;
    font-size: 0.75rem;
  }

  .terminal-title {
    font-size: 0.75rem;
  }

  .code {
    font-size: 0.7rem;
  }

  .error-section-title {
    font-size: 0.7rem;
  }

  .error-line {
    font-size: 0.7rem;
  }

  .error-detail {
    font-size: 0.65rem;
    margin-left: 0.5rem;
  }

  .error-none,
  .error-success {
    font-size: 0.7rem;
  }

  .step-indicator {
    font-size: 0.7rem;
  }

  .runtime-error-msg {
    font-size: 0.7rem;
  }

  .runtime-error-note {
    font-size: 0.65rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero .tagline {
    font-size: 0.95rem;
  }

  .install-box {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
  }

  .status {
    font-size: 0.75rem;
  }
}
