:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --surface: #111827;
  --card: #0b1224;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22d3ee;
  --border: #1f2937;
  --code-bg: #0b1020;
  --code-border: #1f2937;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 20% 20%, rgba(34, 211, 238, 0.08), transparent),
              radial-gradient(1000px 500px at 80% 0%, rgba(168, 85, 247, 0.1), transparent),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem clamp(1rem, 2vw, 2rem);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(14, 165, 233, 0.05)), var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  margin: 0.2rem 0;
  letter-spacing: -0.02em;
}

p { line-height: 1.7; }

.eyebrow {
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  margin: 0;
}

.lede { margin: 0; color: #cbd5e1; max-width: 760px; }

.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  min-width: 200px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.65rem 1rem;
  background: var(--card);
  color: var(--text);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover { transform: translateY(-1px); border-color: var(--accent); }
button:active { transform: translateY(0); }

button.primary { background: linear-gradient(135deg, #06b6d4, #6366f1); border: none; color: #0b1224; font-weight: 700; }

#copy-status { min-height: 1.2rem; color: var(--muted); font-size: 0.9rem; }

main { padding: clamp(1rem, 3vw, 2rem); display: grid; justify-content: center; }

.content {
  max-width: 960px;
  width: min(960px, 100%);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(1rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.content h2, .content h3, .content h4 { margin-top: 2rem; scroll-margin-top: 120px; }
.content a { color: #38bdf8; }
.content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.content th, .content td { border: 1px solid var(--border); padding: 0.6rem 0.8rem; text-align: left; }
.content th { background: rgba(56, 189, 248, 0.08); }

blockquote { border-left: 3px solid #38bdf8; padding-left: 1rem; color: #cbd5e1; margin: 1.2rem 0; }

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  margin: 1.5rem 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.code-block pre {
  margin: 0;
  overflow-x: auto;
  padding: 1rem;
}

.copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
}

.uml-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin: 1.5rem 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
}

.uml-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.uml-block .copy-code {
  position: static;
}

.uml-source {
  background: #0e1522;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 0 0 0.75rem;
}

.uml-source code {
  color: #e8eef9;
  font-family: var(--mono);
  white-space: pre;
}

.uml-preview img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--border);
}

@media (max-width: 780px) {
  .page-header { flex-direction: column; }
  .actions { align-items: flex-start; }
}
