/* === 1. 变量与基础 (Variables & Base) === */
:root {
  --bg: #F7F4EC;
  --surface: #FFFFFF;
  --ink: #1B1B18;
  --muted: #6B6A63;
  --accent: #E4572E;
  --accent-hover: #CC4620;
  --teal: #2E6B5E;
  --line: rgba(27, 27, 24, 0.12);
  --line-strong: rgba(27, 27, 24, 0.22);
  --radius: 10px;
  --font-head: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --maxw: 1060px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
  color: var(--ink);
}
h1 { font-size: clamp(24px, 6vw, 32px); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--surface);
  padding: 8px 14px; border-radius: var(--radius); z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* === 2. 布局与页头页脚 (Layout, Header & Footer) === */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.sec { padding: 48px 0; border-top: 1px solid var(--line); }
.sec-alt { background: rgba(255, 255, 255, 0.55); }
.sec-tight { padding: 24px 0 36px; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.sec-h2 { margin: 0; }
.sec-meta { font-size: 0.9rem; color: var(--muted); }
.home-flow { display: block; }

.hd {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 244, 236, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.hd-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); font-family: var(--font-head);
  font-weight: 700; font-size: 1.2rem; text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #FFFFFF; font-weight: 700;
}
.nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.nav a { color: var(--ink); font-weight: 500; font-size: 0.95rem; }
.nav a:hover { color: var(--accent); text-decoration: none; }

.ft {
  border-top: 1px solid var(--line);
  padding: 44px 0 32px;
  background: var(--surface);
}
.ft-in {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 32px; flex-wrap: wrap;
}
.ft-about { max-width: 440px; }
.ft-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; margin-bottom: 6px; }
.ft-note, .ft-copy { color: var(--muted); font-size: 0.9rem; }
.ft-links { display: flex; gap: 18px; flex-wrap: wrap; }
.ft-links a { color: var(--ink); font-size: 0.92rem; font-weight: 500; }
.ft-bottom { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* === 3. 组件 (Components: Buttons, Badges, Thumbnails, Search) === */
.eyebrow {
  display: inline-block;
  font-family: var(--font-head); font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--teal); margin-bottom: 12px;
}
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 0.78rem; font-weight: 600; color: var(--ink);
}
.mode-badge {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 0.78rem; font-weight: 600;
}
.mode-badge.is-embed { background: rgba(46, 107, 94, 0.12); color: var(--teal); }
.mode-badge.is-ext { background: rgba(228, 87, 46, 0.12); color: var(--accent); }

.thumb {
  width: 52px; height: 52px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--bg);
}

.btn-primary, .btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #FFFFFF; border: none;
  border-radius: var(--radius); padding: 12px 22px;
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn-sm { padding: 8px 18px; font-size: 0.92rem; }
.btn-primary:hover, .btn-play:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 8px 16px; font-family: var(--font-head);
  font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none;
}
.btn-outline:hover { border-color: var(--ink); text-decoration: none; }

.bc {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.88rem; color: var(--muted); padding: 24px 0 8px;
}
.bc a { color: var(--muted); }
.bc a:hover { color: var(--ink); }
.bc-sep { opacity: 0.5; }

.search-bar { margin-top: 20px; margin-bottom: 10px; }
.search-input {
  width: 100%; max-width: 560px; box-sizing: border-box;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 13px 16px; font-family: var(--font-body); font-size: 1rem;
}
.search-input::placeholder { color: rgba(27, 27, 24, 0.58); opacity: 1; }
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-count { font-size: 0.9rem; color: var(--muted); font-weight: 500; margin: 0 0 16px; }

/* === 4. 各区块 (Page Sections, Chessboard Grid, Player, Engage, FAQ) === */
.hero { padding: 44px 0 28px; }
.hero-lead, .page-lead { font-size: 1.08rem; color: var(--muted); max-width: 68ch; }
.page-head { padding: 12px 0 28px; }
.page-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* 区块 1：Today's Lineup 紧凑行列表 */
.lineup-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.lineup-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.lineup-row:last-child { border-bottom: none; }
.lineup-row[hidden] { display: none; }
.lineup-left { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.lineup-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.lineup-name { font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.lineup-desc { margin: 0; color: var(--muted); font-size: 0.94rem; }
.lineup-action { flex-shrink: 0; }

/* 区块 2：分类 2x2 */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.cat-tile {
  display: block; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; color: var(--ink); text-decoration: none;
  transition: border-color 0.15s ease;
}
.cat-tile:hover { border-color: var(--accent); text-decoration: none; }
.cat-kicker { display: block; font-size: 0.8rem; font-weight: 600; color: var(--teal); margin-bottom: 6px; }
.cat-title { margin: 0 0 6px; font-size: 1.2rem; }
.cat-desc { margin: 0; color: var(--muted); font-size: 0.94rem; }

/* 区块 3（记忆点）：1px 极淡网格线分隔成棋盘格 */
.grid-board {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--line); gap: 1px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.grid-cell {
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface); padding: 24px; color: var(--ink);
  text-decoration: none; min-height: auto;
}
.grid-cell[hidden] { display: none; }
.grid-cell:hover { background: #FCFBF7; text-decoration: none; }
.cell-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.cell-brand { display: flex; align-items: center; gap: 10px; }
.cell-title { margin: 0 0 8px; font-size: 1.2rem; }
.cell-title a { color: var(--ink); }
.cell-desc { color: var(--muted); font-size: 0.94rem; margin: 0 0 18px; }
.cell-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.86rem; }
.cell-reset { color: var(--muted); }
.cell-link { font-family: var(--font-head); font-weight: 600; color: var(--accent); }
.no-results { margin-top: 18px; color: var(--muted); font-style: italic; }

/* 游戏播放器（封面 -> 加载动画 -> iframe 同位置同大小） */
.player-wrap { margin-bottom: 24px; }
.stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); overflow: hidden;
}
.stage iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
}
.cover, .loader {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 18px; text-align: center;
}
.cover { background: var(--surface); z-index: 3; }
.cover img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0.24; pointer-events: none;
}
.cover-placeholder {
  position: relative; z-index: 1; max-width: 520px; margin-bottom: 14px;
  background: rgba(247, 244, 236, 0.92); padding: 14px 20px; border-radius: var(--radius);
  border: 1px solid var(--line);
}
.cover-badge {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.78rem; font-weight: 600; color: var(--teal); margin-bottom: 6px;
}
.cover-title { font-family: var(--font-head); font-size: clamp(1.25rem, 3vw, 1.65rem); font-weight: 700; margin: 0 0 4px; }
.cover-sub { color: var(--muted); margin: 0; font-size: 0.92rem; }
.cover .btn-play { position: relative; z-index: 2; }

.loader { display: none; background: var(--bg); z-index: 2; color: var(--ink); font-weight: 500; }
.stage[data-gf-state="loading"] .cover { display: none; }
.stage[data-gf-state="loading"] .loader { display: flex; }
.stage[data-gf-state="playing"] .cover,
.stage[data-gf-state="playing"] .loader { display: none; }

.loader-grid {
  display: grid; grid-template-columns: repeat(2, 14px); gap: 4px; margin-bottom: 12px;
}
.loader-grid span {
  width: 14px; height: 14px; border-radius: 3px; background: var(--accent);
  animation: pulseGrid 1s infinite ease-in-out;
}
.loader-grid span:nth-child(2) { animation-delay: 0.15s; background: var(--teal); }
.loader-grid span:nth-child(3) { animation-delay: 0.3s; background: var(--teal); }
.loader-grid span:nth-child(4) { animation-delay: 0.45s; }
@keyframes pulseGrid {
  0%, 100% { opacity: 0.35; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1); }
}

.stage-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 12px;
}
.stage-source { font-size: 0.88rem; color: var(--muted); }

/* 外部跳转游戏卡片 */
.ext-card {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 24px; margin-bottom: 28px; align-items: center;
}
.ext-preview {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.ext-preview img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.cover-placeholder-compact .cover-title { font-size: 1.4rem; }
.ext-title { margin: 0 0 8px; font-size: 1.3rem; }
.ext-note { color: var(--muted); margin-bottom: 18px; }

/* The Facts 表格 */
.facts-sec { margin: 36px 0; }
.facts-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 0;
}
.fact-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.fact-row dt { font-weight: 600; color: var(--muted); font-size: 0.92rem; }
.fact-row dd { margin: 0; font-weight: 500; text-align: right; font-size: 0.94rem; }

/* 正文排版 */
.prose { max-width: 74ch; margin: 28px auto; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.1rem; }
.prose li { margin-bottom: 0.45rem; }

/* 互动：点赞、分享、评论 */
.engage {
  margin: 12px 0; padding: 24px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.engage-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.engage-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-like, .btn-share {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 8px 14px; font-family: var(--font-head);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.btn-like[data-gf-liked], .btn-like[aria-pressed="true"] {
  background: var(--accent); color: #FFFFFF; border-color: var(--accent);
}
.share-msg, .comment-msg { font-size: 0.88rem; color: var(--teal); font-weight: 500; }
.comment-total { font-size: 0.9rem; color: var(--muted); font-weight: 500; }

.comments-wrap { margin-top: 20px; }
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.comment-fields { display: grid; grid-template-columns: 200px 1fr; gap: 12px; }
.comment-fields input, .comment-fields textarea {
  width: 100%; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 10px 12px; font-family: var(--font-body); font-size: 0.95rem;
}
.comment-submit-row { display: flex; align-items: center; gap: 14px; }
.comments-list { display: flex; flex-direction: column; gap: 12px; }
.comments-empty { display: none; color: var(--muted); font-size: 0.94rem; margin: 0; }
.comments-list[data-gf-empty] .comments-empty { display: block; }
.comments-list[data-gf-off] { display: none; }
.comment-item {
  padding: 14px 16px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.comment-item[data-gf-owner] { border-color: var(--teal); background: rgba(46, 107, 94, 0.06); }
.comment-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.86rem; margin-bottom: 6px; }
.owner-badge {
  display: none; padding: 2px 7px; border-radius: 4px;
  background: var(--teal); color: #FFFFFF; font-size: 0.75rem; font-weight: 600;
}
.comment-item[data-gf-owner] .owner-badge { display: inline-block; }
.comment-time { color: var(--muted); }
.comment-reply-btn {
  margin-left: auto; background: none; border: none; color: var(--accent);
  font-weight: 600; font-size: 0.84rem; cursor: pointer;
}
.comment-body { margin: 0; font-size: 0.95rem; }
.comment-replies { margin-top: 10px; padding-left: 16px; border-left: 2px solid var(--line); }

/* Suggest & FAQ */
.suggest-box {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 28px;
}
.suggest-desc { color: var(--muted); margin: 0; max-width: 58ch; }

.faq-sec { padding: 36px 0; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px;
}
.faq-q {
  font-family: var(--font-head); font-weight: 600; font-size: 1.02rem;
  cursor: pointer; list-style: none;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after { content: " +"; float: right; color: var(--accent); font-weight: 700; }
.faq-item[open] .faq-q::after { content: " −"; }
.faq-a { margin-top: 10px; color: var(--muted); font-size: 0.96rem; }
.faq-a p:last-child { margin-bottom: 0; }

.related-sec { padding: 24px 0 48px; }
.err-page { padding: 72px 0; }

/* === 5. 手机断点 (Mobile Breakpoints <= 720px) === */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .hd-in { flex-wrap: wrap; padding: 10px 0; }
  .nav { gap: 14px; font-size: 0.9rem; }
  .hero { padding: 28px 0 20px; }
  .sec { padding: 32px 0; }
  .home-flow { display: flex; flex-direction: column; }
  #featured-play { order: -1; }
  .lineup-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cat-grid, .grid-board, .facts-grid, .ext-card, .comment-fields {
    grid-template-columns: 1fr;
  }
  .stage { aspect-ratio: auto; min-height: 240px; }
  .cover { position: relative; min-height: 240px; }
  .stage[data-gf-state="loading"] .cover,
  .stage[data-gf-state="playing"] .cover { display: none; }
  .stage[data-gf-state="playing"] { aspect-ratio: 4 / 3; min-height: 300px; }
}