:root, html, body {
  --bg: #f4f6f8;
  --bg2: #eaecf0;
  --surface: #fff;
  --border: #d0d4da;
  --text: #1a1e26;
  --muted: #6b7280;
  --accent: #3b6cf5;
  --accent-light: rgba(59,108,245,0.10);
  --green: #10b981;
  --cyan: #0ea5e9;
  --yellow: #eab308;
  --toggle-bg: #e2e5eb;
  --toggle-knob: #fff;
  --toggle-track-active: #3b6cf5;
  --mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}
html.dark, html.dark body, html.dark #root {
  --bg: #111318;
  --bg2: #181b22;
  --surface: #1a1e26;
  --border: #2a2f3a;
  --text: #e4e7ec;
  --muted: #6b7280;
  --accent: #6b8ff8;
  --accent-light: rgba(107,143,248,0.12);
  --green: #34d399;
  --cyan: #38bdf8;
  --yellow: #facc15;
  --toggle-bg: #2a2f3a;
  --toggle-knob: #1a1e26;
  --toggle-track-active: #6b8ff8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.header-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.header-title {
  font-size: clamp(26px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1.1;
  text-decoration: none;
}
.header-title span { color: var(--accent); }
.header-tagline { text-align: right; max-width: 320px; }
.header-tagline p { font-size: 13px; color: var(--muted); line-height: 1.6; font-weight: 300; }

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 44px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  gap: 12px;
}
.nav-links { display: flex; align-items: center; }
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  padding: 10px 16px;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.theme-toggle-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-label {
  font-family: var(--mono);
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.04em; user-select: none;
  min-width: 28px; text-align: right;
}
.toggle-switch { position: relative; width: 40px; height: 22px; cursor: pointer; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 100px;
  background: var(--toggle-bg);
  transition: background 0.25s;
  border: 1px solid var(--border);
}
.toggle-switch input:checked + .toggle-track { background: var(--toggle-track-active); border-color: var(--toggle-track-active); }
.toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--toggle-knob);
  transition: transform 0.25s, background 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle-switch input:checked ~ .toggle-knob { transform: translateX(18px); }
.toggle-knob::after {
  content: '\2600'; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 9px; line-height: 1;
}

.post-type {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.type-pip { width: 8px; height: 3px; border-radius: 1px; }
.type-writing .type-pip { background: var(--cyan); }
.type-writing .type-label { color: var(--cyan); }
.type-project .type-pip { background: var(--green); }
.type-project .type-label { color: var(--green); }
.type-note .type-pip { background: var(--yellow); }
.type-note .type-label { color: var(--yellow); }
.post-date { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.post-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 100px;
  background: var(--accent-light); color: var(--accent);
  font-family: var(--mono); font-weight: 600;
}

.main {
  max-width: 840px;
  margin: 0 auto;
  width: 100%;
}
.post-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 28px 48px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.post-row .post-type { margin-bottom: 6px; font-size: 12px; }
.post-row .post-date { font-size: 13px; }
.post-row .post-tag { font-size: 12px; }
.post-title {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  cursor: pointer;
}
.post-title a {
  text-decoration: none !important;
  color: inherit !important;
}
.post-title a:hover {
  text-decoration: none !important;
  color: inherit !important;
}
.post-excerpt {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.65;
  font-weight: 300;
}
.post-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.post-thumb {
  width: 72px; height: 72px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 21px;
  background: var(--bg2); color: var(--muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.article-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  margin-bottom: 36px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }
.back-link::before { content: '\2190'; font-size: 13px; }
.article-title {
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 16px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.article-body { font-size: 15px; line-height: 1.8; color: var(--text); }
.article-body p { margin-bottom: 22px; }
.article-body p:last-child { margin-bottom: 0; }
.article-body h2 {
  font-size: 20px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); margin: 40px 0 14px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.article-body h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 28px 0 10px; }
.article-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-light); transition: border-color 0.15s; }
.article-body a:hover { border-bottom-color: var(--accent); }
.article-body code {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg2); color: var(--accent);
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border);
}
.article-body pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px 24px; overflow-x: auto; margin: 24px 0;
}
.article-body pre code {
  background: none; border: none; padding: 0;
  font-size: 13px; color: var(--text); line-height: 1.7;
}
.article-body blockquote {
  border-left: 3px solid var(--accent); padding: 2px 0 2px 20px;
  margin: 24px 0; color: var(--muted); font-style: italic;
}
.article-body ul, .article-body ol { padding-left: 24px; margin-bottom: 22px; }
.article-body li { margin-bottom: 6px; line-height: 1.75; }
.article-footer {
  margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.footer-nav-link { text-decoration: none; max-width: 280px; }
.footer-nav-link .fnl-dir {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.footer-nav-link .fnl-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: color 0.15s; letter-spacing: -0.01em;
}
.footer-nav-link:hover .fnl-title { color: var(--accent); }
.footer-nav-link.next { text-align: right; margin-left: auto; }

.page-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 52px 40px 80px;
}
.about-intro {
  display: flex; align-items: flex-start; gap: 28px;
  padding-bottom: 40px; border-bottom: 1px solid var(--border);
  margin-bottom: 44px; flex-wrap: wrap;
}
.avatar {
  width: 72px; height: 72px; border-radius: 14px;
  background: var(--bg2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 22px; color: var(--muted); flex-shrink: 0;
}
.intro-text h1 {
  font-size: clamp(22px, 5vw, 28px); font-weight: 700;
  letter-spacing: -0.03em; color: var(--text);
  margin-bottom: 6px; line-height: 1.2;
}
.intro-text .subtitle { font-size: 14px; color: var(--muted); font-weight: 300; line-height: 1.5; }
.about-section { margin-bottom: 44px; }
.section-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.about-section p { font-size: 15px; line-height: 1.8; color: var(--text); margin-bottom: 16px; }
.about-section p:last-child { margin-bottom: 0; }
.about-section a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-light); transition: border-color 0.15s; }
.about-section a:hover { border-bottom-color: var(--accent); }
.tech-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; margin-top: 4px;
}
.tech-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  transition: border-color  0.15s;
}
.tech-item:hover { border-color: var(--accent); }
.tech-pip { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.tech-name { font-family: var(--mono); font-size: 12px; color: var(--text); font-weight: 400; }
.tech-note { font-size: 11px; color: var(--muted); margin-left: auto; font-weight: 300; }
.links-list { display: flex; flex-direction: column; gap: 8px; }
.ext-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; transition: all 0.15s;
}
.ext-link:hover { border-color: var(--accent); background: var(--bg2); }
.ext-link-left { display: flex; align-items: center; gap: 12px; }
.ext-link-icon {
  width: 32px; height: 32px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; color: var(--muted); flex-shrink: 0;
}
.ext-link-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ext-link-desc { font-size: 12px; color: var(--muted); font-weight: 300; margin-top: 1px; }
.ext-link-arrow { font-size: 14px; color: var(--muted); }
.ext-link:hover .ext-link-arrow { color: var(--accent); }

@media (max-width: 600px) {
  .header-band { padding: 20px 20px 16px; }
  .header-tagline { display: none; }
  .nav-bar { padding: 0 20px; }
  .nav-links a { padding: 10px 10px; font-size: 11px; }
  .post-row { padding: 20px 24px; gap: 12px; }
  .post-thumb { width: 56px; height: 56px; font-size: 18px; }
  .article-wrap { padding: 32px 20px 60px; }
  .page-wrap { padding: 32px 20px 60px; }
  .tech-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .post-thumb { display: none; }
  .post-row { grid-template-columns: 1fr; }
}