:root {
  --bg: #080c12;
  --bg-elev: #0f1622;
  --bg-card: #131c2b;
  --bg-card-hover: #182336;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(56, 189, 248, 0.42);
  --text: #e6edf7;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --green: #10b981;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 10px;
  --max-w: 1280px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* Subtle technical grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 12, 18, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(245, 158, 11, 0.2));
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--bg-card);
  text-decoration: none;
}

.nav-links a.active {
  border: 1px solid var(--border-strong);
  color: var(--accent);
}

/* Hero */
.hero {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--border);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0 0 28px;
  max-width: 760px;
  color: var(--text-muted);
  font-size: 16px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #04101d;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #67cefa;
  border-color: #67cefa;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-val {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sections */
.section {
  padding: 40px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.section-head .more {
  font-family: var(--mono);
  font-size: 13px;
}

/* Filter Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-strong);
}

.search-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 240px;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Simulation Grid */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.sim-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.sim-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.sim-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05080d;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.sim-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sim-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(8, 12, 18, 0.82);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
}

.sim-size {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(8, 12, 18, 0.82);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
}

.sim-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.sim-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.38;
  color: var(--text);
}

.sim-title a { color: inherit; }
.sim-title a:hover { color: var(--accent); text-decoration: none; }

.sim-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Post Cards */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 18px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.16s ease;
}

.post-card:hover { border-color: var(--border-strong); }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.post-meta .cat { color: var(--amber); }

.post-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--accent); text-decoration: none; }

/* Simulation Detail Sandbox */
.sim-stage {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.sim-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #0b1019;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.sim-iframe-wrap {
  position: relative;
  width: 100%;
  height: 76vh;
  min-height: 540px;
  background: #05080d;
}

.sim-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.info-panel h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-family: var(--mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-panel p { margin: 0; font-size: 14px; color: var(--text-muted); }

/* Article Layout & ::sim[id] Embed */
.article-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 0 56px;
}

.article-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 22px;
  margin-bottom: 28px;
}

.article-header h1 {
  margin: 10px 0 12px;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.24;
}

.prose {
  font-size: 16px;
  line-height: 1.78;
  color: #dbe4f0;
}

.prose h2 {
  margin: 34px 0 14px;
  font-size: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prose h3 { margin: 24px 0 10px; font-size: 18px; }
.prose p { margin: 0 0 16px; }
.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(148, 163, 184, 0.14);
  padding: 2px 6px;
  border-radius: 4px;
}

.prose pre {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 18px 0;
}

.prose pre code {
  background: transparent;
  padding: 0;
  font-size: 13.5px;
}

.sim-embed {
  margin: 26px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.sim-embed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #0b111b;
  border-bottom: 1px solid var(--border);
}

.sim-embed-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.sim-embed-actions {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.sim-embed iframe {
  width: 100%;
  height: 520px;
  border: 0;
  display: block;
  background: #05080d;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0 40px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 720px) {
  .sim-grid, .post-list { grid-template-columns: 1fr; }
  .sim-iframe-wrap { height: 60vh; min-height: 380px; }
  .sim-embed iframe { height: 380px; }
}
