:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #253044;
  --page: #080b11;
  --sidebar: #0d121c;
  --panel: #111827;
  --editor: #070a10;
  --paper: #faf7ef;
  --paper-ink: #1d2430;
  --accent: #f7b955;
  --accent-2: #64d4c3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 20px 16px;
  background:
    linear-gradient(180deg, rgba(247, 185, 85, 0.08), transparent 280px),
    var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  font-weight: 850;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #17110a;
  background: var(--accent);
  font-weight: 950;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
}

.side-nav a.active,
.side-nav a:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.doc-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 5px;
}

.doc-card.subtle {
  margin-top: auto;
}

.label,
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.doc-card strong {
  font-size: 15px;
}

.doc-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.main-area {
  min-width: 0;
  padding: 20px;
}

.titlebar {
  min-height: 96px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, rgba(100, 212, 195, 0.1), transparent),
    var(--panel);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 7px;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
}

#status {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 7px;
  color: #12231f;
  background: var(--accent-2);
  font-size: 13px;
  font-weight: 850;
}

.toolbar {
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #0b1018;
}

button {
  border: 1px solid #344156;
  border-radius: 7px;
  padding: 9px 11px;
  color: #e5edf8;
  background: #172235;
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.secondary {
  margin-left: auto;
  color: #17110a;
  border-color: transparent;
  background: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(0, 1.14fr);
  min-height: 630px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.editor-pane {
  background: var(--editor);
  border-right: 1px solid var(--line);
}

.preview-pane {
  color: var(--paper-ink);
  background: var(--paper);
}

.pane-head {
  min-height: 50px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview-pane .pane-head {
  border-bottom-color: #ded6c6;
}

.pane-head h2 {
  margin: 0;
  font-size: 17px;
}

.pane-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

.preview-pane .pane-head span {
  color: #6b7280;
}

textarea {
  flex: 1;
  width: 100%;
  border: 0;
  padding: 18px;
  resize: none;
  outline: none;
  color: #dbe7f4;
  background:
    linear-gradient(90deg, rgba(247, 185, 85, 0.08) 1px, transparent 1px),
    var(--editor);
  background-size: 56px 100%;
  font: 15px/1.68 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rendered {
  flex: 1;
  padding: 30px 40px 44px;
  overflow: auto;
  line-height: 1.72;
}

.rendered h1,
.rendered h2,
.rendered h3 {
  margin: 1.22em 0 0.35em;
  color: #111827;
  line-height: 1.2;
}

.rendered h1:first-child,
.rendered h2:first-child,
.rendered h3:first-child {
  margin-top: 0;
}

.rendered p {
  margin: 0 0 1em;
}

.rendered a {
  color: #315cfd;
  text-decoration: underline;
}

.rendered code {
  padding: 2px 6px;
  border-radius: 6px;
  color: #f7f3ea;
  background: #1b2535;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.rendered pre {
  padding: 14px;
  overflow: auto;
  border-radius: 8px;
  color: #e5e7eb;
  background: #121a27;
}

.rendered pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.rendered blockquote {
  margin: 1.1em 0;
  padding: 5px 0 5px 18px;
  border-left: 4px solid var(--accent);
  color: #5b6472;
}

.rendered ul,
.rendered ol {
  padding-left: 24px;
}

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

.info-strip article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.info-strip strong {
  display: block;
  margin-top: 7px;
}

.info-strip p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav,
  .info-strip,
  .workspace {
    grid-template-columns: 1fr;
  }

  .doc-card.subtle {
    margin-top: 0;
  }

  .editor-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  button.secondary {
    margin-left: 0;
  }
}
