:root {
  --bg: #0b0f14;
  --panel: #111826;
  --panel-2: #0f1723;
  --border: #1f2a3a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #f5c518;
  --accent-dark: #c79f10;
  --success: #22c55e;
  --danger: #ef4444;
  --editor-bg: #081120;
  --code: #dbeafe;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --radius-lg: 18px;
  --mono: Consolas, "Courier New", monospace;
  --ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
}

body {
  padding: 16px;
}

/* ===== Shared shells ===== */

.app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 32px);
}

.topbar,
.editor-panel,
.result-panel,
.helper-panel,
.docs-panel,
.statusbar,
.hero-card,
.feature-card,
.playground-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===== Header ===== */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}

.brand-block {
  min-width: 0;
}

.brand-mother {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 4px;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.back-link:hover {
  color: var(--text);
}

/* ===== Buttons / controls ===== */

.version-badge,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.22);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.control,
.btn {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  font-size: 0.92rem;
  text-decoration: none;
}

.control {
  min-width: 180px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover,
.control:hover {
  border-color: rgba(245, 197, 24, 0.35);
}

.btn-primary,
.btn-run {
  background: var(--accent);
  color: #161616;
  border-color: var(--accent);
  font-weight: 700;
}

.btn-primary:hover,
.btn-run:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

/* ===== Panels ===== */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-weight: 600;
  color: var(--muted);
}

/* ===== Landing / docs / community ===== */

.hero-card,
.feature-card {
  padding: 24px;
}

.hero-card h1,
.feature-card h1,
.feature-card h2,
.feature-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.hero-card p,
.feature-card p {
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.feature-card ul {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.7;
}

.code-preview {
  margin-top: 16px;
  background: var(--editor-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.code-preview pre {
  margin: 0;
  color: var(--code);
  font-family: var(--mono);
  white-space: pre-wrap;
}

/* ===== Workspace ===== */

.workspace {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  min-height: 56vh;
}

.editor-panel,
.result-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-wrap {
  flex: 1;
  min-height: 0;
}

#editor {
  width: 100%;
  height: 100%;
  min-height: 480px;
  resize: none;
  border: none;
  outline: none;
  padding: 18px;
  background: var(--editor-bg);
  color: var(--code);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.6;
  border-radius: 0 0 var(--radius) var(--radius);
}

.tabs {
  justify-content: flex-start;
  gap: 8px;
}

.tab-btn {
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(245, 197, 24, 0.12);
  color: var(--accent);
  border-color: rgba(245, 197, 24, 0.22);
}

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
}

.tab-content.active {
  display: block;
}

#outputPanel,
#jsPanel,
#errorPanel,
.helper-code,
.docs-code {
  margin: 0;
  padding: 18px;
  background: var(--editor-bg);
  color: var(--code);
  font-family: var(--mono);
  font-size: 0.93rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

#outputPanel,
#jsPanel,
#errorPanel {
  min-height: 480px;
}

/* ===== Playground ===== */

.playground-panel {
  display: grid;
  gap: 0;
}

.playground-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.playground-wrap {
  padding: 16px;
}

.playground-preview {
  min-height: 240px;
  border: 1px solid var(--border);
  background: var(--editor-bg);
  border-radius: 12px;
  padding: 16px;
  color: var(--text);
}

/* ===== Bottom grid ===== */

.bottom-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}

.helper-card,
.docs-card {
  padding: 16px;
}

.helper-title,
.docs-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.docs-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.helper-code {
  min-height: auto;
  border-radius: 12px;
  padding: 14px;
}

.docs-section {
  margin-bottom: 20px;
}

.docs-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

.docs-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(31, 42, 58, 0.55);
}

.docs-key {
  font-family: var(--mono);
  color: var(--text);
}

.docs-desc {
  color: var(--muted);
}

.docs-example {
  font-family: var(--mono);
  background: var(--editor-bg);
  color: var(--code);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  overflow-x: auto;
}

.docs-example a {
  color: var(--code);
  text-decoration: none;
}

.docs-example a:hover {
  color: var(--accent);
}

.docs-code {
  min-height: auto;
  border-radius: 12px;
  padding: 14px;
}

/* ===== Footer ===== */

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-separator {
  opacity: 0.6;
}

/* ===== Utilities ===== */

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.link-card {
  display: block;
  padding: 18px;
  text-decoration: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
}

.link-card:hover {
  border-color: rgba(245, 197, 24, 0.35);
}

.link-card-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.link-card-text {
  color: var(--muted);
  line-height: 1.6;
}

/* ===== Responsive ===== */

@media (max-width: 1100px) {
  .workspace,
  .bottom-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  #editor,
  #outputPanel,
  #jsPanel,
  #errorPanel {
    min-height: 340px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
  }

  .control {
    flex: 1;
  }

  .docs-item {
    grid-template-columns: 1fr;
  }
}
/* ===== Docs Layout Upgrade ===== */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  min-height: 70vh;
}

.docs-sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 16px;
  height: fit-content;
}

.docs-nav-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 8px 10px;
  border-radius: 8px;
  display: block;
  transition: 0.2s ease;
}

.docs-nav a:hover {
  background: rgba(245, 197, 24, 0.08);
  color: var(--text);
}

.docs-nav a.active {
  background: rgba(245, 197, 24, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 197, 24, 0.25);
}

.docs-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.docs-content h2 {
  margin-top: 0;
}

.docs-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: relative;
  }
}
