html:not([data-theme]),
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #111113;
  --line: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #818cf8;
  --accent-2: #4f46e5;
  --nav-bg: rgba(9, 9, 11, 0.9);
  --widget-bg: #0b1220;
  --bubble: #111827;
  --input-bg: #0b1220;
  --input-border: #374151;
  --on-accent: #fff;
  --theme-active: #27272a;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --line: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --accent: #4f46e5;
  --accent-2: #4f46e5;
  --nav-bg: rgba(250, 250, 250, 0.9);
  --widget-bg: #f4f4f5;
  --bubble: #e4e4e7;
  --input-bg: #fff;
  --input-border: #d4d4d8;
  --on-accent: #fff;
  --theme-active: #e4e4e7;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.mk-main { flex: 1 0 auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mk-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--nav-bg); backdrop-filter: blur(12px); z-index: 10;
}
.mk-brand { font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.mk-links { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.mk-links a { color: var(--muted); }
.mk-links a.mk-active { color: var(--text); }
.mk-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  background: var(--accent-2);
  color: var(--on-accent) !important;
  border-radius: 999px;
  text-decoration: none !important;
  line-height: 1;
  font-size: 14px;
}
.mk-hero { max-width: 980px; margin: 0 auto; padding: 80px 24px 40px; text-align: center; }
.mk-hero h1 { font-size: clamp(36px, 6vw, 64px); letter-spacing: -.04em; margin: 0 0 16px; }
.mk-hero p { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto 28px; }
.mk-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.mk-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  line-height: 1;
  font-size: 14px;
  text-decoration: none !important;
}
.mk-actions a:not(.mk-cta) {
  color: var(--text);
  border: 1px solid var(--line);
  background: transparent;
}
.mk-actions a:not(.mk-cta):hover { background: var(--theme-active); }
.mk-mock {
  max-width: 980px; margin: 20px auto 80px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  display: grid; grid-template-columns: 1.4fr .8fr;
  scroll-margin-top: 72px;
}
.mk-chrome { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.mk-app { padding: 24px; min-height: 280px; }
.mk-widget { border-left: 1px solid var(--line); padding: 16px; background: var(--widget-bg); }
.mk-bubble { background: var(--bubble); padding: 8px 10px; border-radius: 10px; margin-bottom: 8px; font-size: 13px; }
.mk-bubble.me { background: var(--accent-2); color: var(--on-accent); }
.mk-mock-input {
  width: 100%; padding: 6px; border-radius: 6px;
  border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text);
}
.mk-mock-submit {
  margin-top: 8px; background: var(--accent-2); color: var(--on-accent);
  border: 0; border-radius: 6px; padding: 6px 10px;
}
.mk-powered { font-size: 11px; color: var(--muted); text-align: center; }
.mk-muted { color: var(--muted); }
.mk-section { max-width: 980px; margin: 0 auto; padding: 40px 24px; scroll-margin-top: 72px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.mk-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.mk-card h3 { margin-top: 0; }
.mk-card ul {
  margin: 0 0 16px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}
.mk-card li { margin: 0 0 6px; }
.mk-faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.mk-faq summary { cursor: pointer; font-weight: 600; }
.mk-faq code,
.mk-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.mk-footer { border-top: 1px solid var(--line); padding: 28px; display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; flex-shrink: 0; margin-top: auto; }
.mk-docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1080px; margin: 0 auto; }
.mk-docs-toggle,
.mk-docs-backdrop,
.mk-side-head { display: none; }
.mk-side { padding: 24px 16px; border-right: 1px solid var(--line); }
.mk-side a { display: block; color: var(--muted); padding: 6px 0; }
.mk-side a.mk-active { color: var(--text); font-weight: 600; }
.mk-docs-toggle,
.mk-docs-close {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}
.mk-docs-toggle {
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  width: auto;
  height: auto;
  justify-self: start;
}
.mk-docs-toggle svg,
.mk-docs-close svg { width: 18px; height: 18px; display: block; }
.mk-docs-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0;
}
body.mk-docs-lock { overflow: hidden; }
.mk-article { padding: 32px 24px 80px; line-height: 1.6; min-width: 0; }
.mk-article h2 { margin: 2em 0 0.6em; font-size: 1.25rem; letter-spacing: -0.02em; }
.mk-article h3 { margin: 1.5em 0 0.5em; font-size: 1.05rem; }
.mk-article p { margin: 0 0 1em; color: var(--muted); }
.mk-article li { color: var(--muted); }
.mk-article ul, .mk-article ol { margin: 0 0 1.25em; padding-left: 1.25em; }
.mk-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.35em;
  color: var(--text);
}
.mk-article pre {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px;
  overflow: auto;
  border-radius: 10px;
  white-space: pre-wrap;
  margin: 0 0 1.25em;
}
.mk-article pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
}
.mk-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 1.25em;
}
.mk-article th, .mk-article td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px 8px 0;
  vertical-align: top;
}
.mk-article th { color: var(--text); font-weight: 600; }
.mk-article td { color: var(--muted); }
.mk-article .mk-note,
.mk-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 1.25em;
  color: var(--muted);
}

.mk-theme {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.mk-theme button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.mk-theme button svg { width: 14px; height: 14px; display: block; }
.mk-theme button[aria-checked="true"] {
  background: var(--theme-active);
  color: var(--text);
}
.mk-theme button:hover { color: var(--text); }

@media (max-width: 800px) {
  .mk-mock, .mk-docs { grid-template-columns: 1fr; }
  .mk-links { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .mk-docs-toggle {
    display: inline-flex;
    margin: 16px 24px 0;
    position: sticky;
    top: 72px;
    z-index: 9;
    justify-self: start;
  }
  .mk-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    font-weight: 600;
    color: var(--text);
  }
  .mk-docs-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 20;
    border: 0;
  }
  .mk-docs.is-nav-open .mk-docs-backdrop { display: block; }
  .mk-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    margin: 0;
    padding: 16px 16px 32px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
    z-index: 21;
    transform: translate3d(-110%, 0, 0);
    transition: transform 0.2s ease;
    overflow: auto;
  }
  .mk-side.is-open {
    transform: translate3d(0, 0, 0);
  }
  .mk-side a {
    padding: 10px 8px;
    border-radius: 8px;
  }
  .mk-side a.mk-active { background: var(--theme-active); }
  .mk-article { padding-top: 20px; }
}

@media (max-width: 800px) and (prefers-reduced-motion: reduce) {
  .mk-side { transition: none; }
}
