:root {
  --bg-color: #0d0f14;
  --card-bg: #141822;
  --card-border: #21283b;
  --primary: #9d4edd;
  --primary-hover: #b5179e;
  --primary-glow: rgba(157, 78, 221, 0.25);
  --accent: #4cc9f0;
  --accent-glow: rgba(76, 201, 240, 0.15);
  --text-color: #f8f9fa;
  --text-muted: #9ba1b0;
  --success: #38b000;
  --error: #e63946;
  --warning: #ffb703;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  line-height: 1.6;
  padding-bottom: 5rem;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Header & Glassmorphism */
header {
  background: rgba(13, 15, 20, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--text-color);
  text-decoration: none;
}

.github-link {
  display: inline-flex !important;
  align-items: center !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 15px var(--primary-glow);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--primary-glow);
  color: #fff;
  text-decoration: none;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

.hero::after {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -1px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 2.5rem auto;
}

.install-box {
  background: #07090d;
  border: 1px solid var(--card-border);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
}

.install-box button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.install-box button:hover {
  color: var(--text-color);
}

/* Feature Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 4rem;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: rgba(157, 78, 221, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.feature-icon {
  color: var(--accent);
  font-size: 1.5rem;
}

/* Interactive Playground Section */
.playground-section {
  padding: 5rem 0;
  border-top: 1px solid var(--card-border);
}

.playground-title {
  text-align: center;
  margin-bottom: 3rem;
}

.playground-title h2 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.playground-title p {
  color: var(--text-muted);
}

.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  min-width: 0;
}

@media (max-width: 900px) {
  .playground-grid {
    grid-template-columns: 1fr;
  }
}

.editor-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  height: 380px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b212f;
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid var(--card-border);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.panel-header-actions {
  display: flex;
  gap: 0.75rem;
}

.panel-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-btn:hover {
  color: var(--text-color);
  border-color: var(--primary);
  background: rgba(157, 78, 221, 0.1);
}

.textarea-container {
  flex-grow: 1;
  min-height: 0; /* Prevents container from stretching the flex layout height */
  min-width: 0;
  position: relative;
  background: #090b0f;
  border-radius: 0 0 8px 8px;
  border: 1px solid var(--card-border);
  border-top: none;
}

.textarea-container textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #c9d1d9;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 1rem;
  line-height: 1.5;
  tab-size: 2;
}

/* Output Column / Tabs */
.output-column {
  display: flex;
  flex-direction: column;
  height: 785px;
  min-width: 0;
}

.tabs-header {
  display: flex;
  flex-shrink: 0; /* Prevents browser from shrinking the header block in flex columns */
  background: #1b212f;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid var(--card-border);
  padding: 0 0.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-color);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-badge {
  background: var(--error);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  margin-left: 0.35rem;
  font-weight: 700;
}

.tab-badge.hidden {
  display: none;
}

.output-container {
  flex-grow: 1;
  min-height: 0; /* Prevents container from stretching the flex layout height */
  background: #090b0f;
  border-radius: 0 0 8px 8px;
  border: 1px solid var(--card-border);
  border-top: none;
  padding: 1rem;
  overflow: auto;
  position: relative;
}

.output-container pre {
  margin: 0;
  height: 100%;
}

.output-container code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  background: transparent !important;
  padding: 0 !important;
}

/* Diagnostic Box */
.diagnostic-item {
  border-left: 4px solid var(--error);
  background: rgba(230, 57, 70, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  font-family: var(--font-sans);
}

.diagnostic-item.warning {
  border-left-color: var(--warning);
  background: rgba(255, 183, 3, 0.08);
}

.diagnostic-item h5 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.diagnostic-item p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Docs Reference Section */
.docs-section {
  padding: 5rem 0;
  border-top: 1px solid var(--card-border);
}

.docs-section h2 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: center;
}

.docs-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
}


.docs-nav {
  position: sticky;
  top: 6rem;
  align-self: start;
}

.docs-nav ul {
  list-style: none;
}

.docs-nav li {
  margin-bottom: 0.75rem;
}

.docs-nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  display: block;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 1rem;
  transition: all 0.2s ease;
}

.docs-nav a:hover, .docs-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  text-decoration: none;
}

.docs-content {
  display: flex;
  flex-direction: column;
  gap: 4rem;
  min-width: 0;
}

.docs-block {
  min-width: 0;
}

.docs-block h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-color);
}

.docs-block p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.docs-block pre {
  background: #090b0f;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.docs-block code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Reference Table */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.ref-table th, .ref-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.ref-table th {
  background: #1b212f;
  font-weight: 700;
  color: var(--text-color);
}

.ref-table td code {
  color: var(--accent);
}

/* Toast/Copied message */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--success);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Editor interactive overlay styling */
.editor-interactive {
  position: relative;
  overflow: hidden;
}

.editor-interactive textarea,
.editor-interactive .highlight-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 1rem;
  font-family: var(--font-mono) !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  word-wrap: normal !important;
  overflow-wrap: normal !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  border: none;
  outline: none;
  background: transparent;
  white-space: pre;
  box-sizing: border-box;
}

.editor-interactive textarea {
  color: transparent;
  -webkit-text-fill-color: transparent; /* Makes text transparent but keeps cursor */
  caret-color: var(--accent);
  background: transparent;
  z-index: 2;
  resize: none;
  overflow: auto;
}

.editor-interactive .highlight-overlay {
  z-index: 1;
  pointer-events: none;
  background: #090b0f;
  color: #c9d1d9;
  overflow: hidden; /* Prevent showing scrollbar in backdrop */
}

.editor-interactive .highlight-overlay code {
  font-family: var(--font-mono) !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  word-wrap: normal !important;
  overflow-wrap: normal !important;
  background: transparent !important;
  padding: 0 !important;
  display: block;
  white-space: pre;
}

/* Custom Highlight JS override to match theme */
.hljs-keyword {
  color: #ff79c6;
  font-weight: bold;
}
.hljs-string {
  color: #f1fa8c;
}
.hljs-number {
  color: #bd93f9;
}
.hljs-symbol {
  color: #ffb86c;
}
.hljs-variable {
  color: #8be9fd;
}
.hljs-comment {
  color: #6272a4;
  font-style: italic;
}
.hljs-operator {
  color: #ff79c6;
}

.hljs-name {
  color: #ff79c6; /* HTML tag names: pink */
  font-weight: bold;
}
.hljs-attr {
  color: #50fa7b; /* HTML attributes and JSON keys: green */
}
.hljs-tag {
  color: #f8f8f2; /* HTML brackets: greyish white */
}
.hljs-literal {
  color: #bd93f9; /* JSON literals: purple */
}
.hljs-bullet {
  color: #ff79c6;
}
.hljs-title {
  color: #50fa7b;
}
.hljs-built_in {
  color: #8be9fd; /* Built-in class names: cyan */
}
.hljs-title.function_ {
  color: #50fa7b; /* Function calls/declarations: green */
}

/* Mobile responsive enhancements */
@media (max-width: 800px) {
  header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    text-align: center;
  }

  .logo {
    font-size: 1.3rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.85rem;
  }

  .hero {
    padding: 3rem 0 2rem 0;
  }

  .hero h1 {
    font-size: 2.25rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
  }

  .hero p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .install-box {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    gap: 0.5rem;
  }

  /* Main container responsiveness */
  .container {
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
  }

  /* Playground responsive grid and editors */
  .playground-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.75rem;
    gap: 1rem;
    box-sizing: border-box !important;
  }

  .playground-grid * {
    min-width: 0 !important;
  }

  .editor-column, .output-column, .editor-panel, .output-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }

  .textarea-container, textarea, pre, code {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .editor-panel {
    height: 320px !important;
  }

  .output-column {
    height: 420px !important;
  }

  /* Docs grid and nav horizontal scroll */
  .docs-grid {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 1.5rem;
    box-sizing: border-box !important;
  }

  .docs-nav, .docs-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .docs-nav {
    position: relative;
    top: 0;
    width: 100%;
    margin-bottom: 0rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem;
  }

  .docs-nav ul {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 1rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    scrollbar-width: none;
    width: 100% !important;
  }

  .docs-nav ul::-webkit-scrollbar {
    display: none;
  }

  .docs-nav li {
    margin-bottom: 0;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .docs-nav a {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
    border-left: none;
    padding-left: 0.75rem;
  }

  .docs-nav a:hover, .docs-nav a.active {
    background: var(--accent-glow);
    color: var(--accent);
    border-left-color: transparent;
  }

  /* Enable horizontal scroll on reference tables */
  .docs-block {
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .ref-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .ref-table td code {
    white-space: normal !important;
    word-break: break-word !important;
  }

  .docs-section h2 {
    font-size: 1.75rem;
  }

  .toast {
    bottom: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .editor-panel {
    height: 260px !important;
  }

  .output-column {
    height: 350px !important;
  }

  .tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .panel-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
}

/* Global viewport fluid constraints */
.playground-section,
.playground-grid,
.editor-column,
.output-column,
.editor-panel,
.textarea-container,
.output-container,
.docs-grid,
.docs-content,
.docs-block {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

pre, code, table, .install-box {
  max-width: 100% !important;
  overflow-x: auto !important;
  box-sizing: border-box !important;
}

.footer {
  margin-top: 4rem;
  border-top: 1px solid var(--card-border);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 2rem 0;
  width: 100%;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  box-sizing: border-box;
}

.footer-content a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-content a:hover {
  color: var(--text-color);
}

@media (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}



