:root {
  /* App Variables */
  --bg: #05070e;
  --surface: #0a0f1a;
  --surface2: #111827;
  --surface3: #1e293b;
  --border: #1e293b;
  --border2: #334155;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #f43f5e;
  --text: #f8fafc;
  --muted: #94a3b8;
  --muted2: #cbd5e1;

  /* Hero Variables */
  --hero-bg: #02040a;
  --hero-text: #ffffff;
  --grad-cyan: #22d3ee;
  --grad-blue: #6366f1;
  --grad-purple: #c084fc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  /* Smooth scroll to app section */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  overflow-x: hidden;
}

/* ── APP GRID BACKGROUND ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%,
      rgba(56, 189, 248, 0.05) 0%,
      transparent 50%),
    radial-gradient(circle at 80% 80%,
      rgba(129, 140, 248, 0.05) 0%,
      transparent 50%);
  pointer-events: none;
  z-index: -2;
  /* Kept deeply in background */
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -2;
}

/* =======================================================
   FUTURISTIC HERO SECTION
======================================================= */

.hero-wrapper {
  background-color: var(--hero-bg);
  color: var(--hero-text);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  /* Locks the floating elements inside this section */
  z-index: 10;
  /* Sits on top of the fixed body grids */
}

.hero-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 40%,
      rgba(99, 102, 241, 0.08) 0%,
      transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.top-nav {
  position: absolute;
  top: 40px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5%;
  z-index: 50;
}

.hero-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.hero-logo svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

.hero-source-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted2);
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.hero-source-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.hero-source-link svg {
  width: 16px;
  height: 16px;
}

.hero-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 5%;
  position: relative;
  z-index: 10;
}

.hero-title {
  font-size: clamp(60px, 11vw, 150px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-align: center;
  margin-top: -5vh;
  background: linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.scroll-action {
  position: absolute;
  bottom: 50px;
  z-index: 50;
  display: flex;
  justify-content: center;
  width: 100%;
}

.scroll-btn {
  background: linear-gradient(90deg,
      rgba(10, 15, 26, 0.8) 0%,
      rgba(99, 102, 241, 0.3) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 16px 36px;
  border-radius: 50px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(99, 102, 241, 0.2);
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 30px rgba(129, 140, 248, 0.4);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ── 3D CSS ART ASSETS ── */
@keyframes floatSlow {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-15px) rotate(2deg);
  }
}

@keyframes floatFast {

  0%,
  100% {
    transform: translateY(0) rotate(15deg);
  }

  50% {
    transform: translateY(-20px) rotate(12deg);
  }
}

.css-asterisk {
  position: absolute;
  right: 12%;
  top: 15%;
  width: 180px;
  height: 180px;
  animation: floatFast 6s ease-in-out infinite;
  z-index: 5;
  filter: drop-shadow(0 20px 40px rgba(99, 102, 241, 0.2));
}

.ast-arm {
  position: absolute;
  width: 50px;
  height: 180px;
  border-radius: 50px;
  left: 65px;
  top: 0;
  box-shadow:
    inset 6px 6px 15px rgba(255, 255, 255, 0.9),
    inset -6px -6px 20px rgba(99, 102, 241, 0.6),
    10px 15px 30px rgba(0, 0, 0, 0.6);
}

.ast-arm:nth-child(1) {
  transform: rotate(0deg);
  background: linear-gradient(180deg,
      var(--grad-cyan) 0%,
      var(--grad-blue) 50%,
      var(--grad-purple) 100%);
}

.ast-arm:nth-child(2) {
  transform: rotate(60deg);
  background: linear-gradient(120deg,
      var(--grad-cyan) 0%,
      var(--grad-blue) 50%,
      var(--grad-purple) 100%);
}

.ast-arm:nth-child(3) {
  transform: rotate(120deg);
  background: linear-gradient(60deg,
      var(--grad-cyan) 0%,
      var(--grad-blue) 50%,
      var(--grad-purple) 100%);
}

.css-pills {
  position: absolute;
  right: 25%;
  bottom: 20%;
  width: 160px;
  height: 250px;
  animation: floatSlow 8s ease-in-out infinite;
  z-index: 4;
  filter: drop-shadow(0 20px 40px rgba(34, 211, 238, 0.15));
}

.css-pill {
  position: absolute;
  width: 130px;
  height: 90px;
  border-radius: 60px;
}

.css-pill:nth-child(1) {
  top: 0;
  left: 0;
  background: var(--grad-cyan);
  z-index: 1;
  box-shadow:
    inset 8px 8px 15px rgba(255, 255, 255, 0.9),
    inset -8px -8px 25px rgba(14, 165, 233, 0.4),
    15px 20px 30px rgba(0, 0, 0, 0.5);
}

.css-pill:nth-child(2) {
  top: 60px;
  left: 30px;
  background: var(--grad-blue);
  z-index: 2;
  box-shadow:
    inset 8px 8px 15px rgba(255, 255, 255, 0.8),
    inset -8px -8px 25px rgba(79, 70, 229, 0.5),
    15px 20px 30px rgba(0, 0, 0, 0.6);
}

.css-pill:nth-child(3) {
  top: 120px;
  left: 60px;
  background: var(--grad-purple);
  z-index: 3;
  box-shadow:
    inset 8px 8px 15px rgba(255, 255, 255, 0.7),
    inset -8px -8px 25px rgba(147, 51, 234, 0.6),
    15px 20px 30px rgba(0, 0, 0, 0.7);
}

@media (max-width: 1024px) {
  .css-asterisk {
    right: 5%;
    transform: scale(0.8);
  }

  .css-pills {
    right: 10%;
    bottom: 25%;
    transform: scale(0.8);
  }
}

@media (max-width: 768px) {
  .css-asterisk {
    opacity: 0.4;
    right: -10%;
    top: 10%;
  }

  .css-pills {
    opacity: 0.4;
    right: -10%;
    bottom: 30%;
  }

  .hero-title {
    font-size: 14vw;
  }
}

/* =======================================================
   APP WORKSPACE SECTION
======================================================= */
#app-builder {
  position: relative;
  z-index: 10;
}

/* ── HEADER ── */
.header {
  position: relative;
  z-index: 200;
  background: rgba(5, 7, 14, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.logo-name span {
  color: var(--accent);
}

.header-center {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  padding: 6px 16px;
  border-radius: 30px;
  border: 1px solid var(--border2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hbtn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--muted2);
  letter-spacing: 0.3px;
}

.hbtn:hover {
  color: var(--text);
  border-color: var(--muted);
  background: var(--surface3);
}

.hbtn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.hbtn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.5);
}

/* ── MAIN LAYOUT ── */
.main {
  position: relative;
  z-index: 10;
  display: flex;
  /* Leaves room for the top header so it fits exactly in viewport */
  height: calc(100vh - 64px);
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.editor {
  flex: 1;
  overflow-y: auto;
  background: transparent;
}

.preview {
  width: 460px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── SIDEBAR ── */
.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-label {
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-label::before {
  content: "";
  width: 4px;
  height: 12px;
  background: var(--accent);
  border-radius: 4px;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent);
}

/* Section toggles */
.section-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sec-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.sec-toggle:hover {
  background: var(--surface2);
}

.sec-toggle.active {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.2);
}

.sec-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.sec-toggle-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.tslider {
  position: absolute;
  inset: 0;
  background: var(--border2);
  border-radius: 20px;
  cursor: pointer;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tslider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  top: 3px;
  left: 3px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:checked+.tslider {
  background: rgba(56, 189, 248, 0.3);
}

input:checked+.tslider::before {
  transform: translateX(16px);
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Templates */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.template-btn {
  padding: 10px 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: "Space Grotesk", sans-serif;
}

.template-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-1px);
}

.template-btn.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
}

/* ── EDITOR ── */
.editor-inner {
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
}

.editor-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 24px;
  overflow: hidden;
  transition: all 0.3s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.editor-section.hidden {
  display: none;
}

.es-header {
  padding: 16px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.es-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.es-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  flex: 1;
}

.es-badge {
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.es-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: block;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  padding: 12px 16px;
  border-radius: 10px;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--muted);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

textarea {
  resize: vertical;
  line-height: 1.65;
  min-height: 80px;
}

select option {
  background: var(--surface2);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Tech stack picker */
.tech-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-chip {
  padding: 8px 14px;
  border-radius: 24px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--muted2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Space Grotesk", sans-serif;
}

.tech-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.05);
  transform: translateY(-2px);
}

.tech-chip.selected {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.tech-chip .emoji {
  font-size: 14px;
}

/* Badge picker */
.badge-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-chip {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--muted2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: "JetBrains Mono", monospace;
}

.badge-chip:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(245, 158, 11, 0.05);
  transform: translateY(-2px);
}

.badge-chip.selected {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

/* Structure visualizer */
.struct-preview {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: #bae6fd;
  line-height: 1.8;
  margin-top: 8px;
  white-space: pre;
  overflow-x: auto;
  min-height: 60px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Screenshot drop zone */
.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface2);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}

.drop-zone-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.drop-zone p {
  font-size: 13px;
  color: var(--muted2);
  font-weight: 500;
  margin-bottom: 4px;
}

.drop-zone small {
  font-size: 11px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.screenshot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.screenshot-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 12px;
}

.screenshot-item img {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
}

.screenshot-item-name {
  flex: 1;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
}

.screenshot-item-remove {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.screenshot-item-remove:hover {
  background: var(--red);
  color: #fff;
}

/* ── PREVIEW PANEL ── */
.preview-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  flex-shrink: 0;
}

.preview-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ptab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all 0.2s;
  font-family: "Space Grotesk", sans-serif;
}

.ptab.active {
  background: var(--surface3);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.pbtn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--muted2);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Space Grotesk", sans-serif;
  white-space: nowrap;
}

.pbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.pbtn.green {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--green);
}

.pbtn.green:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* GitHub-style rendered preview */
.gh-preview {
  background: #ffffff;
  border-radius: 12px;
  padding: 32px 40px;
  color: #24292f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.gh-preview h1 {
  font-size: 28px;
  font-weight: 700;
  border-bottom: 1px solid #d0d7de;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.gh-preview h2 {
  font-size: 20px;
  font-weight: 600;
  border-bottom: 1px solid #d0d7de;
  padding-bottom: 7px;
  margin: 24px 0 12px;
}

.gh-preview h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 18px 0 8px;
}

.gh-preview p {
  margin-bottom: 12px;
}

.gh-preview code {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  padding: 3px 6px;
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: #e36209;
}

.gh-preview pre {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.gh-preview pre code {
  background: none;
  border: none;
  padding: 0;
  color: #24292f;
  font-size: 13px;
}

.gh-preview ul,
.gh-preview ol {
  padding-left: 28px;
  margin-bottom: 12px;
}

.gh-preview li {
  margin-bottom: 4px;
}

.gh-preview a {
  color: #0969da;
  text-decoration: none;
}

.gh-preview a:hover {
  text-decoration: underline;
}

.gh-preview hr {
  border: none;
  border-top: 1px solid #d0d7de;
  margin: 24px 0;
}

.gh-preview table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  font-size: 14px;
}

.gh-preview th,
.gh-preview td {
  border: 1px solid #d0d7de;
  padding: 8px 14px;
  text-align: left;
}

.gh-preview th {
  background: #f6f8fa;
  font-weight: 600;
}

.gh-preview img {
  max-width: 100%;
  border-radius: 8px;
}

.gh-preview blockquote {
  border-left: 4px solid #d0d7de;
  padding-left: 16px;
  color: #57606a;
  margin: 16px 0;
}

/* Styled badges */
.gh-badge {
  display: inline-flex;
  align-items: stretch;
  border-radius: 6px;
  overflow: hidden;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  margin: 2px 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.gh-badge-left {
  background: #555;
  color: #fff;
  padding: 4px 8px;
  white-space: nowrap;
}

.gh-badge-right {
  color: #fff;
  padding: 4px 8px;
  white-space: nowrap;
}

/* Raw markdown view */
.raw-view {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 24px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.85;
  color: #bae6fd;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 2px 15px rgba(0, 0, 0, 0.3);
}

/* Empty state */
.empty-preview {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty-preview .icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.empty-preview h3 {
  font-size: 16px;
  color: var(--muted2);
  margin-bottom: 8px;
}

.empty-preview p {
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  opacity: 0.5;
}

/* =======================================================
   FOOTER SECTION
======================================================= */
.app-footer {
  background: transparent;
  padding: 40px 32px;
  position: relative;
  z-index: 20;
  margin-top: 20px;
}

.app-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.08),
      transparent);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted2);
  font-size: 13px;
  font-family: "Space Grotesk", sans-serif;
}

.footer-left strong {
  color: var(--text);
  font-weight: 600;
}

.footer-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-divider {
  width: 1px;
  height: 24px;
  background: var(--border2);
}

.footer-link,
.footer-icon {
  color: var(--muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: "Inter", sans-serif;
}

.footer-link:hover,
.footer-icon:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.footer-link svg,
.footer-icon svg {
  width: 20px;
  height: 20px;
  transition: filter 0.3s ease;
}

.footer-link:hover svg,
.footer-icon:hover svg {
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

@media (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }
}

/* =======================================================
   UTILITIES
======================================================= */
/* Toast notification */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: "JetBrains Mono", monospace;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 40px rgba(56, 189, 248, 0.2);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Loading spinner */
.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* =======================================================
   RESPONSIVENESS (MOBILE & TABLET)
======================================================= */
@media (max-width: 1024px) {
  .main {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 64px);
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .editor {
    width: 100%;
  }

  .preview {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .sidebar,
  .editor,
  .preview {
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .header {
    height: auto;
    padding: 16px;
    flex-direction: column;
    gap: 16px;
    align-items: center;
  }

  .header-center {
    width: 100%;
    justify-content: center;
  }

  .header-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .hbtn,
  .hbtn.primary {
    flex: 1;
    text-align: center;
    justify-content: center;
    min-width: 100px;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .editor-inner {
    padding: 16px;
  }

  .preview-body {
    padding: 16px;
  }

  .preview-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .preview-tabs {
    flex-wrap: wrap;
    justify-content: center;
  }

  .preview-actions {
    width: 100%;
    justify-content: space-between;
  }

  .preview-actions .pbtn {
    flex: 1;
    justify-content: center;
  }
}

/* ── MODAL STYLES ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.3s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface2);
}

.hidden {
  display: none !important;
}