:root {
  --bg: #f8f2e8;
  --card: #fffdf9;
  --ink: #241f1a;
  --muted: #776b5d;
  --line: #e6ddd0;
  --line-soft: #f1e9dd;
  --game-card-h: 120px;
  --grid-gap: 14px;
  --accent: #2b2b2b;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.75;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 22px;
}

.narrow { max-width: 760px; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 252, 246, 0.94);
  border-bottom: 1px solid #ddd3c4;
  backdrop-filter: blur(10px);
}

.header-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand img {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 0;
  image-rendering: pixelated;
}

nav {
  display: flex;
  gap: 26px;
}

nav a {
  position: relative;
  padding: 19px 0;
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s ease;
}

nav a:hover { color: var(--ink); }

nav a.active {
  color: var(--ink);
  font-weight: 600;
}

nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
}

/* ---------- 首页 ---------- */
.home-splash {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 24px 22px 10px;
  overflow: hidden;
}

.home-splash img {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
}

main.wrap {
  flex: 1 0 auto;
  padding-top: 48px;
  padding-bottom: 16px;
}

main.grid-page { padding-top: 32px; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.section-card {
  display: flex;
  flex-direction: column;
  min-height: 232px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-card:hover {
  border-color: #c9bca9;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.045);
}

.card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid #eee4d6;
  border-radius: 0;
  background: #fbf6ee;
  color: #3d3d3d;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.section-card h2 {
  margin: 0 0 7px;
  font-size: 19px;
  font-weight: 600;
}

.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}

.card-link {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: #333;
  font-size: 13px;
  font-weight: 500;
}

.card-link::after { content: " →"; }

.section-card:hover .card-link { color: #000; }

@font-face {
  font-family: "Smiley Sans";
  src: url("fonts/smiley-notes.woff?v=4") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* ---------- 板块内容字体 ---------- */
.game-name,
.gallery-name,
.panel h1,
.panel h2,
.panel p,
.changelog li,
.changelog time,
.article-box h1,
.article-meta {
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 400;
}

/* ---------- 文章 ---------- */
.notes-line {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: baseline;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--ink);
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.55;
}

.notes-no,
.notes-date {
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
  white-space: nowrap;
}

.notes-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.notes-title:hover { text-decoration: underline; text-underline-offset: 4px; }

.note-page .notes-title {
  margin: 0;
  overflow: visible;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.55;
  text-overflow: clip;
  white-space: normal;
}

.note-body {
  padding-top: 20px;
  color: #3a332b;
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.95;
}

.note-body p { margin: 0; }

.about-link {
  color: #b23a2b;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
}

.about-link:hover { color: #7e2d22; }

@media (max-width: 600px) {
  .notes-line {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 4px 12px;
    font-size: 16px;
  }

  .notes-no {
    grid-row: 1 / 3;
    font-size: 16px;
  }

  .notes-title {
    grid-column: 2;
    font-size: 16px;
    white-space: normal;
    overflow: visible;
  }

  .notes-date {
    grid-column: 2;
    font-size: 16px;
  }

  .note-page .notes-title { font-size: 16px; }
  .about-head .notes-title { font-size: 16px; }
  .note-body { font-size: 16px; }
  .update-line {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 4px 12px;
    font-size: 16px;
  }
  .update-line .notes-no {
    grid-row: 1 / 3;
    font-size: 16px;
  }
  .update-text {
    grid-column: 2;
    font-size: 16px;
  }
  .update-line .notes-date {
    grid-column: 2;
    font-size: 16px;
  }
}

.about-head {
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--ink);
}

.about-head .notes-title {
  margin: 0;
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.55;
}

.about-page .about-block + .about-block { margin-top: 42px; }

.update-line {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: baseline;
  padding-top: 16px;
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.55;
}

.update-text {
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
}
.about-page .notes-line { padding-bottom: 14px; }
.about-page .note-body { padding-top: 16px; }

/* ---------- 图集 ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
  grid-auto-rows: calc(var(--game-card-h) * 2 + var(--grid-gap));
}

.gallery-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

a.gallery-card:hover {
  border-color: #c9bca9;
  box-shadow: 0 8px 24px rgba(60, 47, 34, 0.1);
}

.gallery-thumb {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #0f1024;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

a.gallery-card:hover .gallery-thumb img { transform: scale(1.03); }

.gallery-name {
  display: block;
  flex: 0 0 auto;
  margin-top: 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
  line-height: 24px;
}

.gallery-card.is-empty {
  background: rgba(255, 253, 249, 0.32);
  border-color: var(--line);
}

/* ---------- 游戏 ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
  grid-auto-rows: var(--game-card-h);
}

.game-card {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

a.game-card:hover {
  border-color: #c9bca9;
  box-shadow: 0 8px 24px rgba(60, 47, 34, 0.1);
}

.game-icon {
  display: block;
  width: 80px;
  height: 80px;
  flex: 0 0 80px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.game-copy { min-width: 0; }

.game-title {
  display: block;
  margin: 0;
  color: var(--ink);
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}

.game-desc {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-family: "Smiley Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.game-card.is-empty {
  background: rgba(255, 253, 249, 0.32);
  border-color: var(--line);
}

@media (max-width: 900px) {
  .game-grid,
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  :root {
    --game-card-h: 96px;
    --grid-gap: 12px;
  }

  .game-grid,
  .gallery-grid { grid-template-columns: 1fr; }

  .game-card { padding: 12px; }

  .game-icon {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .game-title { font-size: 15px; }
  .game-desc { font-size: 12.5px; }

  .gallery-card { padding: 8px; }
  .gallery-name { margin-top: 6px; font-size: 16px; line-height: 22px; }
}

/* ---------- 文章 ---------- */
.article-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0;
}

.article-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  background: #f7f7f7;
  border-bottom: 1px solid var(--line);
  color: #6f6f6f;
  font-size: 12px;
}

.article-head .article-date {
  color: #6f6f6f;
}

.article-head .article-title {
  color: #6f6f6f;
  font-weight: 500;
}

.article-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.2s ease;
}

.article-row:last-child { border-bottom: 0; }
.article-row:hover { background: #fdf9f2; }

.article-no {
  flex: 0 0 auto;
  color: #8a8a8a;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.article-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}

.article-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.article-row:hover .article-title { color: #000; }
.article-row:hover .article-text { text-decoration: underline; }

.article-date {
  flex: 0 0 auto;
  color: #8a8a8a;
  font-size: 16px;
  white-space: nowrap;
}

.pagination {
  padding: 14px 22px 12px;
  border-top: 1px solid var(--line);
}

.page-info {
  margin-bottom: 10px;
  color: #7a7a7a;
  font-size: 12px;
}

.page-info b {
  color: #333;
  font-weight: 600;
}

.page-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.page-numbers {
  display: flex;
  gap: 4px;
}

.page-btn {
  height: 28px;
  min-width: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: #333;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { border-color: #999; }

.page-btn:disabled {
  background: #fafafa;
  color: #bbb;
  cursor: not-allowed;
}

.page-btn.active {
  border-color: #222;
  background: #222;
  color: #fff;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: #666;
  font-size: 12px;
}

.page-jump input {
  width: 48px;
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: #333;
  font-family: inherit;
  font-size: 12px;
  text-align: center;
}

.page-hint {
  min-height: 16px;
  margin: 6px 0 0;
  color: #a33;
  font-size: 11.5px;
}

/* ---------- 文章详情 ---------- */
.article-box {
  padding: 32px 36px;
  background: var(--card);
  border: 1px solid var(--line);
}

.article-box h1 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.45;
}

.article-meta {
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  color: #8a8a8a;
  font-size: 12px;
}

.article-body p {
  margin: 0 0 16px;
  color: #333;
  font-size: 14px;
  line-height: 1.95;
}

.article-body p:last-child { margin-bottom: 0; }

.photo-figure {
  max-width: 560px;
  margin: 4px auto 10px;
  border: 1px solid var(--line);
  background: #000;
}

.photo-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.photo-credit {
  margin: 0;
  color: #8a8a8a;
  font-size: 12px;
  text-align: center;
}

/* ---------- 关于 ---------- */
.panel {
  margin-bottom: 16px;
  padding: 24px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.panel:last-child { margin-bottom: 0; }

.panel h1,
.panel h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

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

.changelog li {
  display: flex;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 14px;
}

.changelog li:last-child { border-bottom: 0; }

.changelog time {
  flex: 0 0 74px;
  padding-top: 2px;
  color: #555;
  font-size: 12px;
}

/* ---------- 页脚 ---------- */
footer {
  flex: 0 0 auto;
  margin-top: 48px;
  padding: 20px 0 30px;
  border-top: 1px solid #e4dacd;
  color: #8d8172;
  font-size: 12px;
  text-align: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .section-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .section-grid { grid-template-columns: 1fr; }
}

@media (min-width: 761px) {
  nav { margin-right: 36px; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .home-splash { padding-left: 16px; padding-right: 16px; }
  .game-showcase { max-width: 200px; }
  .gallery-item { width: 200px; }
  .game-name, .gallery-name { font-size: 16px; }
  .header-inner { height: 54px; gap: 12px; }
  nav { gap: 10px; }
  nav a { padding: 17px 0; font-size: 12.5px; }
  .brand { font-size: 15.5px; }

  main.wrap { padding-top: 28px; }
  main.grid-page { padding-top: 24px; }

  .section-card { min-height: 0; }

  .game-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 22px;
  }

  .mini-board { width: 100%; max-width: 210px; }

  .game-head {
    padding-left: 16px;
    padding-right: 16px;
  }

  .game-head,
  .game-row {
    padding-left: 16px;
    padding-right: 16px;
  }

  .game-main h1 { font-size: 15.5px; }

  .article-row,
  .article-head {
    gap: 10px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .article-title { gap: 8px; font-size: 15px; }
  .panel h1,
  .panel h2 { font-size: 15px; }
  .article-no { font-size: 11.5px; }
  .article-date { font-size: 15px; }

  .pagination { padding: 14px 16px 12px; }
  .page-jump { width: 100%; margin-left: 0; }

  .article-box { padding: 24px 20px; }
  .article-box h1 { font-size: 22px; }

  .panel { padding: 22px 20px; }
  footer { margin-top: 36px; }
}

@media (max-width: 380px) {
  .brand span { display: none; }
  nav { gap: 10px; }
  nav a { font-size: 12px; }
  .brand img { width: 24px; height: 24px; }
}

/* perf: picture wrapper stays out of layout */
picture { display: contents; }
picture source { display: none; }
