:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #67e8f9;
  --accent-2: #f43f5e;
  --border: #334155;
  --code: #020617;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

pre {
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--code);
  color: #dbeafe;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.shiki {
  background: var(--code) !important;
  color: #dbeafe !important;
}

.shiki span {
  color: var(--shiki-dark, var(--shiki-light, currentColor));
}

code {
  background: rgba(148, 163, 184, 0.12);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

pre code {
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  background: transparent;
  padding: 0;
}

.shiki code {
  display: block;
  min-width: max-content;
  background: transparent;
}

.site-shell {
  width: min(900px, calc(100% - 2rem));
  max-width: calc(100vw - 2rem);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.site-header {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.site-header > * {
  min-width: 0;
}

.site-title {
  display: inline-block;
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
  min-width: 0;
}

.site-tagline {
  color: var(--muted);
  margin: 0;
}

.home-header {
  justify-content: flex-start;
}

.site-main {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

.card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.96));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  min-width: 0;
  width: 100%;
}

.intro-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
}

.avatar {
  width: 150px;
  height: 150px;
  border-radius: 999px;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.intro-copy {
  display: grid;
  gap: 1rem;
}

.intro-copy p {
  margin: 0;
  color: var(--text);
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.post-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li + li {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(51, 65, 85, 0.65);
}

.post-list p,
.article-lead,
time,
.demo-note,
#demo-status {
  color: var(--muted);
}

.prose {
  line-height: 1.7;
  overflow-wrap: anywhere;
  min-width: 0;
}

.prose img,
.prose video,
.prose iframe,
.prose canvas {
  max-width: 100%;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.2;
}

.prose h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
}

.prose h2 {
  margin-top: 2.25rem;
}

.prose h3 {
  margin-top: 1.5rem;
}

.prose ol,
.prose ul {
  padding-left: 1.25rem;
}

.demo-panel {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.demo-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 1px solid #94a3b8;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-weight: 700;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

button:hover {
  background: #e5e7eb;
}

.demo-frame {
  border: 1px solid #0ea5e9;
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
}

#demo-canvas {
  display: block;
  margin: 0 auto;
  width: min(100%, 300px);
  height: auto;
  aspect-ratio: 1 / 1;
  touch-action: none;
  user-select: none;
  background: #020617;
}

@media (max-width: 640px) {
  .site-shell {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  .site-header {
    margin-bottom: 1.5rem;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .card {
    padding: 1rem;
    border-radius: 14px;
  }

  .intro-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .avatar {
    width: 120px;
    height: 120px;
  }

  .home-links {
    justify-content: center;
  }

  .prose h1 {
    font-size: 1.8rem;
  }

  .prose h2 {
    font-size: 1.35rem;
  }

  .prose h3 {
    font-size: 1.1rem;
  }

  .prose ul,
  .prose ol {
    padding-left: 1rem;
  }

  pre {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.85rem;
    border-radius: 10px;
    font-size: 0.82rem;
    scrollbar-gutter: stable both-edges;
  }

  .demo-panel {
    padding: 0.85rem;
  }

  .demo-toolbar {
    align-items: stretch;
  }

  .demo-toolbar button {
    width: 100%;
  }

  .demo-frame {
    padding: 0.75rem;
  }
}

@media (max-width: 420px) {
  .site-shell {
    width: calc(100vw - 0.75rem);
    max-width: calc(100vw - 0.75rem);
  }

  .card {
    padding: 0.85rem;
  }

  .home-links {
    gap: 0.5rem 0.85rem;
    font-size: 0.95rem;
  }

  .prose {
    font-size: 0.97rem;
  }

  .prose h1 {
    font-size: 1.6rem;
  }

  .prose h2 {
    font-size: 1.2rem;
  }

  .prose h3 {
    font-size: 1.05rem;
  }
}
