/* ============================================================
   mlflab — 内容区极简，游戏区彩色
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg: #fbfaf8;
  --bg-soft: #f4f1ec;
  --fg: #1b1a19;
  --fg-soft: #45413c;
  --muted: #78736c;
  --line: #e7e2db;
  --line-soft: #f0ede8;
  --accent: #b8532c;
  --accent-ink: #a0451f;
  --accent-soft: #f8e9e1;
  --code-bg: #f2eee9;
  --code-fg: #35322e;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono",
    Consolas, "Liberation Mono", monospace;

  --maxw: 44rem;
  --pad: clamp(1.25rem, 5vw, 2rem);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --bg-soft: #1c1c20;
    --fg: #eae6e0;
    --fg-soft: #c6c1b9;
    --muted: #8b857d;
    --line: #2c2c31;
    --line-soft: #232327;
    --accent: #e08a5f;
    --accent-ink: #eda07a;
    --accent-soft: #2b201a;
    --code-bg: #1d1d21;
    --code-fg: #cdc7bf;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.75;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- 顶栏 ---------- */

.site-head {
  width: 100%;
  max-width: calc(var(--maxw) + var(--pad) * 2);
  margin: 0 auto;
  padding: 2.1rem var(--pad) 1.1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--fg);
  font-weight: 500;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.brand:hover .brand-dot {
  transform: rotate(225deg);
}

.site-nav {
  display: flex;
  align-items: baseline;
  gap: clamp(0.9rem, 3vw, 1.6rem);
  font-size: 0.86rem;
  letter-spacing: 0.03em;
}

.site-nav a {
  color: var(--muted);
  position: relative;
  padding-bottom: 2px;
  transition: color 0.2s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.site-nav a:hover {
  color: var(--fg);
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

.site-nav a.active {
  color: var(--fg);
}

.site-nav a.active::after {
  transform: scaleX(1);
  background: var(--accent);
}

/* ---------- 主体 ---------- */

.site-main {
  width: 100%;
  max-width: calc(var(--maxw) + var(--pad) * 2);
  margin: 0 auto;
  padding: 2rem var(--pad) 5rem;
  flex: 1;
}

/* ---------- 首页 ---------- */

.hero {
  padding: 2.5rem 0 3.5rem;
  position: relative;
}

.eyebrow {
  margin: 0 0 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 1.6rem;
  font-size: clamp(1.85rem, 5.2vw, 2.85rem);
  line-height: 1.4;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.lead {
  margin: 0;
  max-width: 34rem;
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--fg-soft);
}

.home-block {
  padding: 2.6rem 0 0;
  border-top: 1px solid var(--line);
  margin-top: 2.6rem;
}

.hero + .home-block {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.block-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.block-more {
  font-size: 0.82rem;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.block-more:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.home-notes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-note + .home-note {
  border-top: 1px solid var(--line-soft);
}

.home-note a {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: baseline;
  gap: 0.4rem 1rem;
  padding: 0.95rem 0;
  transition: padding-left 0.25s ease;
}

.home-note a:hover {
  padding-left: 0.5rem;
}

.home-note a:hover .home-note-title {
  color: var(--accent);
}

.home-note-date {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.home-note-title {
  font-size: 1rem;
  color: var(--fg);
  transition: color 0.2s ease;
}

/* ---------- 笔记列表页 ---------- */

.page-head {
  padding: 1.6rem 0 2.2rem;
}

.page-head h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.7rem, 4.4vw, 2.25rem);
  font-weight: 640;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.page-head .lead {
  font-size: 0.98rem;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.note-row {
  border-bottom: 1px solid var(--line-soft);
}

.note-link {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: baseline;
  gap: 0.35rem 1.1rem;
  padding: 1.15rem 0;
  transition: padding-left 0.25s ease;
}

.note-link:hover {
  padding-left: 0.5rem;
}

.note-link:hover .note-title {
  color: var(--accent);
}

.note-date {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.note-title {
  font-size: 1.02rem;
  color: var(--fg);
  transition: color 0.2s ease;
}

.note-sum {
  grid-column: 2 / -1;
  font-size: 0.87rem;
  line-height: 1.7;
  color: var(--muted);
}

.note-badge {
  justify-self: start;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
}

/* ---------- 文章正文 ---------- */

.post-foot {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.post-foot a {
  font-size: 0.88rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.post-foot a:hover {
  color: var(--accent);
}

.draft-note {
  margin: 0 0 2rem;
  padding: 0.9rem 1.15rem;
  border-left: 2px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
}

.draft-note p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg-soft);
}

.prose {
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--fg-soft);
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--fg);
  line-height: 1.45;
  letter-spacing: -0.01em;
  font-weight: 620;
}

.prose h1 {
  font-size: 1.6rem;
  margin: 2.6rem 0 1.1rem;
}

.prose h2 {
  font-size: 1.24rem;
  margin: 2.6rem 0 0.9rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
}

.prose h3 {
  font-size: 1.06rem;
  margin: 2rem 0 0.6rem;
}

.prose h4 {
  font-size: 0.95rem;
  margin: 1.6rem 0 0.5rem;
}

.prose p {
  margin: 0 0 1.25rem;
}

.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color 0.2s ease;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose strong {
  color: var(--fg);
  font-weight: 620;
}

.prose ul,
.prose ol {
  margin: 0 0 1.3rem;
  padding-left: 1.35rem;
}

.prose li {
  margin: 0.35rem 0;
}

.prose li::marker {
  color: var(--muted);
}

.prose blockquote {
  margin: 1.7rem 0;
  padding: 0.2rem 0 0.2rem 1.15rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-soft);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.6rem 0;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.15em 0.38em;
  border-radius: 5px;
  word-break: break-word;
}

.prose pre {
  margin: 1.6rem 0;
  padding: 1.1rem 1.2rem;
  background: var(--code-bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.65;
  position: relative;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--code-fg);
}

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  font-family: var(--font);
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.prose pre:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--accent);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line-soft);
}

.prose th {
  color: var(--fg);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

/* ---------- 实验室入口卡片（首页） ---------- */

.lab-teaser {
  border-top: none;
  margin-top: 3rem;
}

.lab-card {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 2rem 1.8rem;
  background: #14141b;
  color: #f2efe9;
  isolation: isolate;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.35s ease;
}

.lab-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -18px rgba(180, 83, 44, 0.45);
}

.lab-card-glow {
  position: absolute;
  inset: -60% -20% auto -20%;
  height: 220%;
  z-index: -1;
  background:
    radial-gradient(38% 45% at 22% 18%, rgba(255, 118, 68, 0.55), transparent 70%),
    radial-gradient(34% 40% at 78% 24%, rgba(88, 150, 255, 0.5), transparent 70%),
    radial-gradient(40% 46% at 52% 96%, rgba(120, 226, 168, 0.38), transparent 70%);
  filter: blur(18px);
  opacity: 0.75;
  transition: opacity 0.4s ease, transform 0.6s ease;
}

.lab-card:hover .lab-card-glow {
  opacity: 1;
  transform: translateY(-6px);
}

.lab-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lab-card-kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(242, 239, 233, 0.62);
}

.lab-card-title {
  font-size: 1.35rem;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.lab-card-desc {
  max-width: 30rem;
  font-size: 0.92rem;
  line-height: 1.8;
  color: rgba(242, 239, 233, 0.72);
}

.lab-card-cta {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: rgba(242, 239, 233, 0.9);
}

/* ---------- 页脚 ---------- */

.site-foot {
  width: 100%;
  max-width: calc(var(--maxw) + var(--pad) * 2);
  margin: 0 auto;
  padding: 1.8rem var(--pad) 2.4rem;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.site-foot code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

/* ============================================================
   实验室页面（深色 + 彩色）
   ============================================================ */

body.lab {
  --bg: #0e0e13;
  --bg-soft: #16161d;
  --fg: #eeebe5;
  --fg-soft: #c9c5bd;
  --muted: #8f8a82;
  --line: #26262e;
  --line-soft: #1e1e25;
  --accent: #ff7a4d;
  --accent-ink: #ff9472;
  --accent-soft: #2a1a15;
  --code-bg: #1a1a21;
  --code-fg: #d5d0c8;
  color-scheme: dark;
}

body.lab .site-foot {
  border-top-color: var(--line);
}

.lab-hero {
  padding: 2rem 0 2.6rem;
  position: relative;
}

.lab-hero .eyebrow {
  color: var(--accent);
}

.lab-hero h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  font-weight: 660;
  letter-spacing: -0.025em;
  line-height: 1.35;
  background: linear-gradient(100deg, #ff8a5c 0%, #ffd2a8 30%, #9fc4ff 62%, #8ff0c0 92%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lab-hero .lead {
  color: var(--fg-soft);
  max-width: 36rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}

.game-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 16px;
  padding: 1.5rem 1.35rem 1.35rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1), border-color 0.3s ease;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 122, 77, 0.6), rgba(120, 160, 255, 0.35), rgba(140, 240, 190, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: transparent;
}

.game-card:hover::before {
  opacity: 1;
}

.game-card.is-soon {
  cursor: default;
}

.game-card.is-soon:hover {
  transform: none;
}

.game-card.is-soon:hover::before {
  opacity: 0.35;
}

.game-card-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  margin-bottom: 1.15rem;
  background: #1d1d26;
  border: 1px solid #2a2a35;
}

.game-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.04rem;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.game-card p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.75;
  color: var(--muted);
}

.game-card-tag {
  display: inline-block;
  margin-top: 1.15rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
}

.lab-slot-note {
  margin-top: 3rem;
  padding: 1.4rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.85;
  color: var(--muted);
}

.lab-slot-note code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--accent-ink);
}

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
  .site-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
    padding-top: 1.6rem;
  }

  .site-main {
    padding-top: 1rem;
  }

  .home-note a,
  .note-link {
    grid-template-columns: 1fr auto;
  }

  .note-date,
  .home-note-date {
    grid-column: 1 / -1;
    order: -1;
    font-size: 0.72rem;
  }

  .home-note-title {
    font-size: 0.98rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-head,
  .site-foot,
  .post-foot,
  .copy-btn {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
