:root {
  color-scheme: dark;
  --bg: #06101d;
  --panel: rgba(15, 23, 42, 0.82);
  --panel-strong: rgba(15, 23, 42, 0.95);
  --line: rgba(148, 163, 184, 0.18);
  --text: #edf5ff;
  --muted: #94a9c3;
  --heading: #ffffff;
  --primary: #2dd4bf;
  --primary-strong: #38bdf8;
  --success: #34d399;
  --danger: #fb7185;
  --editor: #07111f;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.32);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8fc;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(15, 23, 42, 0.1);
  --text: #162033;
  --muted: #64748b;
  --heading: #07111f;
  --primary: #0f766e;
  --primary-strong: #0284c7;
  --success: #047857;
  --danger: #be123c;
  --editor: #ffffff;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(45, 212, 191, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 6%, rgba(56, 189, 248, 0.16), transparent 24rem),
    linear-gradient(180deg, rgba(15, 23, 42, 0.22), transparent 45%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

button,
textarea,
select {
  font: inherit;
}

textarea,
code,
pre {
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

.page-shell {
  position: relative;
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 32px;
}

main {
  display: grid;
  gap: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.nav,
.nav-links,
.hero-row,
.toolbar,
.toolbar-actions,
.editor-head,
.status-bar,
.advanced-bar,
.advanced-options {
  display: flex;
  align-items: center;
}

.nav {
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: #04111f;
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.nav-links {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a,
.theme-toggle,
.btn,
.advanced-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.nav-links a,
.theme-toggle {
  padding: 9px 13px;
  font-size: 0.84rem;
}

.hero {
  padding-bottom: 6px;
}

.hero-row {
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 10px;
}

.eyebrow,
.section-kicker {
  margin-bottom: 8px;
  color: var(--primary);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

h1 {
  margin-bottom: 8px;
  color: var(--heading);
  font-size: clamp(1.22rem, 2.3vw, 1.72rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.workspace,
.seo-panel {
  margin-top: 16px;
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
}

.toolbar {
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar h2 {
  margin-bottom: 0;
  font-size: 1.04rem;
}

.toolbar-actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
}

.btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.btn-primary {
  border: 0;
  color: #04111f;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.status-bar {
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.status-pill.idle {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.status-pill.success {
  color: var(--success);
  background: rgba(52, 211, 153, 0.14);
}

.status-pill.error {
  color: var(--danger);
  background: rgba(251, 113, 133, 0.14);
}

.status-message {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: 0.88rem;
}

.advanced-bar {
  justify-content: flex-end;
  padding: 12px 16px 0;
}

.advanced-toggle {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.advanced-options {
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px 16px;
  border-bottom: 1px solid var(--line);
}

.advanced-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.advanced-options label span {
  color: var(--text);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.advanced-options select {
  border: 0;
  background: transparent;
  color: var(--text);
  outline: 0;
  font-weight: 800;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.editor-panel {
  background: var(--panel-strong);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.editor-head {
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-strong);
}

.editor-head h3 {
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.editor-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

textarea {
  display: block;
  width: 100%;
  min-height: 360px;
  height: min(48vh, 620px);
  padding: 16px;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--text);
  background: var(--editor);
  font-size: 0.9rem;
  line-height: 1.52;
  tab-size: 2;
}

textarea[readonly] {
  background: linear-gradient(180deg, rgba(7, 17, 31, 0.98), rgba(7, 17, 31, 0.94));
}

.seo-panel {
  padding: 22px;
}

.seo-intro {
  max-width: 980px;
}

.seo-panel h2 {
  margin-bottom: 10px;
  font-size: 1.22rem;
}

.seo-panel p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.92rem;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.seo-grid article,
.faq-list details,
.content-columns article {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.seo-grid h3,
.content-columns h2 {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.content-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.faq-list summary {
  cursor: pointer;
  color: var(--heading);
  font-weight: 800;
  font-size: 0.92rem;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 800;
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.55);
}

@media (max-width: 1040px) {
  .editor-grid,
  .seo-grid,
  .content-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 1320px);
    padding-top: 10px;
  }

  .nav,
  .hero-row,
  .toolbar,
  .editor-head,
  .status-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-links,
  .toolbar-actions,
  .advanced-options {
    justify-content: flex-start;
  }

  .btn {
    width: 100%;
  }

  textarea {
    min-height: 280px;
    height: 320px;
  }
}
