/* ===== PlayDen 主样式 ===== */
/* Design tokens — P1-C-1, from .claude/视觉设计系统-终版.html (青柠英雄色 / 60-30-10).
   The block below is the single source of truth for color/type/radius/glow.
   Old token names are kept as backward-compat aliases at the bottom and are
   retired progressively as components are rewritten in P1-C-3. */
:root {
  /* hero / accent — v4 翠绿 (青柠 #4ade80 → #34d399), Apple/Epic 克制 */
  --lime: #34d399; --lime-br: #6ee7b7; --lime-dp: #059669; --lime-glow: rgba(52,211,153,0.25);
  --coral: #ff7849; --coral-dp: #e8470f;
  --violet-haze: rgba(124,93,250,0.10);
  /* surfaces — v4 明度分层 (background → card → floating) */
  --bg: #0b0c0e; --bg-2: #101216; --surface: #171a1f; --surface-2: #1e2228;
  --border: #262a30; --border-2: #363c44;
  /* text — v4 灰阶 (靠灰阶层次, 不靠颜色) */
  --text: #f5f5f7; --text-dim: #a1a1a6; --text-faint: #8e8e93; /* faint bumped #6e6e73→#8e8e93 for WCAG AA (≥4.5:1) on dark — no gray-on-dark below contrast */
  /* status */
  --warning: #fbbf24; --danger: #f4515f;
  /* type — Inter (en/num, SF Pro 开源近亲) + Noto (zh/ja) */
  --fd: 'Inter','Noto Sans SC','Noto Sans JP',-apple-system,sans-serif;
  --fb: 'Inter','Noto Sans SC','Noto Sans JP',-apple-system,sans-serif;
  --fzh: 'Noto Sans SC','PingFang SC',sans-serif;
  --fja: 'Noto Sans JP','Hiragino Sans',sans-serif;
  --fm: 'JetBrains Mono',monospace;
  /* radii */
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;
  /* glow (only hero color + hover) */
  --glow-lime: 0 0 0 1px rgba(52,211,153,0.35),0 10px 36px var(--lime-glow);
  --glow-coral: 0 8px 30px rgba(255,120,73,0.35);
  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;

  /* ---- backward-compat aliases (legacy names still referenced by existing
     components/templates; remapped onto the new system, retired in C-3) ---- */
  --bg-3: var(--surface);
  --line: var(--border);
  --line-strong: var(--border-2);
  --muted: var(--text-faint);
  --accent: var(--lime);
  --accent-hi: var(--lime-br);
  --warn: var(--warning);
  --radius: var(--r-md);
  --shadow-md: 0 8px 28px rgba(0,0,0,.4);
  --shadow-lg: 0 14px 44px rgba(0,0,0,.55);

  /* ---- v4 token aliases (homepage redesign reads these; resolve to the
     remapped system above so the whole site shares one palette) ---- */
  --green: var(--lime); --green-br: var(--lime-br);
  --ink: #000; --band: var(--bg-2);
  --ink-2: var(--surface); --ink-3: var(--surface-2);
  --line-2: var(--border-2);
  --orange: #fb923c;
  --t1: var(--text); --t2: var(--text-dim); --t3: var(--text-faint);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fb);
  line-height: 1.65;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
/* Trilingual font stack — CJK UI leads with its Noto face so kanji/hanzi
   render with the correct regional glyphs; Latin falls through to the brand
   fonts. Latin headings pick up Outfit/Space Grotesk via --fb's leading face. */
html[lang="zh"] body { font-family: var(--fzh), var(--fb); }
html[lang="ja"] body { font-family: var(--fja), var(--fb); }
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 75% -5%, var(--lime-glow), transparent 60%),
    radial-gradient(ellipse 50% 40% at 5% 20%, var(--violet-haze), transparent 55%);
  pointer-events: none; z-index: 0;
}
body > * { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hi); }
h1, h2, h3 { color: var(--text); }
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; width: 100%; }
main.container { flex: 1; padding-top: 28px; padding-bottom: 80px; }

.muted { color: var(--muted); }

/* ===== 顶部导航 ===== */
.site-header {
  background: rgba(18,21,25,0.8);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav {
  display: flex; align-items: center;
  gap: 22px; padding: 20px 28px;
}
.nav-collapse { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.nav-right { display: flex; align-items: center; gap: 12px; }

/* header search — pill styled to match the nav controls, with a magnifier icon */
.nav-search { display: flex; align-items: center; min-width: 0; }
.nav-search input {
  width: 190px; max-width: 38vw;
  padding: 8px 14px 8px 34px;
  border-radius: var(--r-full);
  background: var(--surface-2) no-repeat 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='15' height='15' fill='none' stroke='%238a948f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5l3 3'/%3E%3C/svg%3E");
  border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 13px; line-height: 1;
  transition: border-color .15s, background-color .15s, width .2s ease;
}
.nav-search input::placeholder { color: var(--text-dim); }
.nav-search input:focus { width: 230px; }
.nav-search input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }
.nav-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* Inner-page nav search — icon button that opens a centered <dialog> modal.
   ESC closes it natively (showModal API). Backdrop click + Cmd/Ctrl+K wired
   in main.js. Frees ~190px of nav width vs. the always-visible input. */
.nav-search-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-full); color: var(--text-dim);
  cursor: pointer; padding: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.nav-search-icon:hover { color: var(--text); border-color: var(--border-2); background: var(--surface); }
.nav-search-icon svg { display: block; }

dialog.nav-search-dialog {
  border: 0; padding: 0; background: transparent;
  max-width: 720px; width: 90vw;
  color: var(--text); margin: 14vh auto auto auto; /* visually upper portion */
}
dialog.nav-search-dialog::backdrop {
  background: rgba(8, 10, 14, 0.7);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
}
.nav-search-dialog-form {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink-2); border: 1px solid var(--line-2);
  border-radius: var(--r-full); padding: 8px 14px 8px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  transition: border-color .15s;
}
.nav-search-dialog-form:focus-within { border-color: var(--green); }
.nav-search-dialog-form > svg { color: var(--text-dim); flex: none; }
.nav-search-dialog-form input {
  flex: 1; min-width: 0; background: transparent; border: 0;
  font: inherit; font-size: 17px; color: var(--text); outline: 0;
  padding: 12px 6px; letter-spacing: -.01em;
}
.nav-search-dialog-form input::placeholder { color: var(--text-dim); }
.nav-search-dialog-form input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.nav-search-esc {
  font-family: var(--fm); font-size: 11px; font-weight: 600;
  color: var(--text-dim); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 4px 8px; cursor: pointer; flex: none;
  letter-spacing: .04em;
  transition: color .15s, border-color .15s;
}
.nav-search-esc:hover { color: var(--text); border-color: var(--border-2); }

/* hamburger (mobile only) */
.nav-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; padding: 9px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
}
.nav-burger span { display: block; width: 100%; height: 2px; background: var(--text-dim); border-radius: 2px; transition: transform .2s, opacity .2s; }
.site-header.nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* logo lockup — pixel+play glyph + wordmark */
.logo-lockup { display: inline-flex; align-items: center; gap: 11px; }
.logo-lockup:hover { color: inherit; }
.logo-lockup .glyph { width: 30px; height: 30px; display: block; flex: none; } /* legacy — kept harmless */
/* Brand image logo (replaces the legacy SVG glyph + wordmark span pair). */
.logo-lockup .logo-img { height: 30px; width: auto; display: block; }
.logo-lockup picture   { display: block; line-height: 0; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links > a:not(.btn) {
  color: var(--text-dim); font-weight: 500; font-size: 14px;
  white-space: nowrap; /* don't let "Daily Challenge" / "今日のおすすめ" wrap into two lines */
  transition: color .15s;
}
.nav-links > a:not(.btn):hover { color: var(--lime); }

/* language dropdown */
.lang-dd { position: relative; }
.lang-dd-btn { white-space: nowrap; } /* nav dropdowns "+ Create" / lang label must stay one line — esp. JA */
.lang-dd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim); font-family: inherit; font-size: 13px; font-weight: 600;
  line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.lang-dd-btn:hover,
.lang-dd.open .lang-dd-btn { color: var(--text); border-color: var(--border-2); }
.lang-dd-btn .ic-globe { width: 15px; height: 15px; flex: none; }
.lang-dd-btn .ic-caret { width: 12px; height: 12px; flex: none; transition: transform .2s; }
.lang-dd.open .lang-dd-btn .ic-caret { transform: rotate(180deg); }

.lang-dd-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 150px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  display: none; z-index: 60;
}
.lang-dd.open .lang-dd-menu { display: block; }
.lang-dd-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--text-dim); font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background .12s, color .12s;
}
.lang-dd-item:hover { background: var(--surface-2); color: var(--text); }
.lang-dd-item.active { color: var(--lime); }
.lang-dd-item.active::after { content: '✓'; font-size: 12px; font-weight: 700; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap; /* nav buttons "Sign in" / "Sign up" must stay on one line */
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .15s ease, color .15s ease, background .15s ease;
  font-family: inherit;
  text-align: center;
  user-select: none;
  line-height: 1.2;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hi) 100%);
  color: #08160f;
  box-shadow: 0 4px 14px rgba(52,211,153,0.22);
}
.btn-primary:hover {
  color: #08160f;
  box-shadow: 0 6px 22px rgba(52,211,153,0.42);
  transform: translateY(-1px);
}
/* Nav "Sign in" — demoted to a text link so the primary "Sign up" pill stands
   out clearly. Same color/weight as nav links, hover lifts to accent. */
.nav-signin {
  color: var(--text-dim); font-weight: 500; font-size: 14px;
  white-space: nowrap; padding: 6px 4px;
  transition: color .15s;
}
.nav-signin:hover { color: var(--text); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-2); }
/* coral — reserved for the single highest-value conversion action (Fork) */
.btn-coral { background: var(--coral); color: #fff; font-weight: 700; box-shadow: var(--glow-coral); }
.btn-coral:hover { background: var(--coral-dp); color: #fff; }
.btn-coral svg { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 26px; font-size: 15px; }

/* ===== 首页 Hero ===== */
.hero {
  padding: 80px 0 40px;
  text-align: center;
  position: relative;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 15px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--lime-dp);
  color: var(--lime); font-size: 12px; font-weight: 600;
  letter-spacing: .4px;
  margin-bottom: 22px;
}
.hero .eyebrow::before {
  content: ''; width: 6px; height: 6px; background: var(--lime);
  border-radius: 50%; box-shadow: 0 0 8px var(--lime-glow);
}
.hero h1 {
  font-family: var(--fd);
  font-size: 56px; line-height: 1.05; margin: 0 0 18px;
  font-weight: 800; letter-spacing: -1.5px;
  background: linear-gradient(120deg, #fff 0%, var(--lime-br) 55%, var(--lime) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p.lead { font-size: 18px; color: var(--text-dim); max-width: 600px; margin: 0 auto 30px; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; max-width: 720px; margin: 50px auto 0;
}
.stat {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  transition: transform .2s, border-color .2s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.stat .num {
  font-family: var(--fd);
  font-size: 36px; font-weight: 800; color: var(--lime);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.stat .label { color: var(--text-faint); font-size: 13px; margin-top: 8px; letter-spacing: .5px; }

/* ===== 板块 ===== */
.section { margin: 56px 0 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 22px; gap: 16px;
}
.section-head h2 {
  font-family: var(--fd);
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em;
  text-wrap: balance;
  display: flex; align-items: center; gap: 10px;
}
/* Page-level h1 inside a section-head container — Marcellus matches game/home/forms */
.section-head h1 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);
  margin: 0; font-size: clamp(26px, 3vw, 32px); font-weight: 400;
  letter-spacing: -.01em; line-height: 1.15;
  text-wrap: balance;
  display: flex; align-items: center; gap: 10px;
}
/* Page heading wrapper used by engines_list and other top-of-page layouts */
.page-head { margin: 18px 0 22px; }
.page-head h1 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);
  margin: 0 0 6px; font-size: clamp(28px, 3.4vw, 36px); font-weight: 400;
  letter-spacing: -.01em; line-height: 1.15;
  text-wrap: balance;
}
.page-head p, .page-head .muted { text-wrap: pretty; }
/* Narrow page wrapper for single-column flows (generate result, etc.) */
.page-narrow { max-width: 840px; margin: 24px auto; }
.page-narrow > h1 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);
  margin: 0 0 6px; font-size: clamp(26px, 3vw, 32px); font-weight: 400;
  letter-spacing: -.01em; line-height: 1.15; text-wrap: balance;
}
.section-head h2::before {
  content: ''; width: 4px; height: 22px;
  background: var(--lime); border-radius: 2px;
  box-shadow: 0 0 8px var(--lime-glow);
}
.section-head .more {
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: color .15s;
}
.section-head .more:hover { color: var(--accent); }

/* ===== 游戏卡片 ===== */
.game-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
/* Topic cards — used on /discover. Sized for text-only cards (smaller min,
   tighter gap than .game-grid which is built around 16:10 thumbnails). */
.topic-grid {
  display: grid; gap: 14px; margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.topic-card {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 124px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none; color: inherit;
  transition: border-color .2s, transform .2s, background .2s;
}
.topic-card:hover { border-color: var(--lime); transform: translateY(-1px); }
.topic-card:hover .topic-card-arrow { transform: translateX(2px); color: var(--lime); }
.topic-card-title {
  margin: 0; font-family: var(--fd);
  font-size: 17px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3;
  color: var(--text); text-wrap: balance;
}
.topic-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; font-size: 13px;
}
.topic-card-count { font-family: var(--fm); color: var(--text-faint); }
.topic-card-arrow { color: var(--text-faint); transition: transform .2s, color .2s; font-size: 16px; }

/* Engine cards — /engines hub (the public hub for each engine + remix entry) */
.engine-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.engine-card {
  display: block; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none; color: inherit;
  transition: border-color .2s, transform .2s, background .2s;
}
.engine-card:hover { border-color: var(--lime); transform: translateY(-1px); }
.engine-card-genre { font-size: 13px; color: var(--lime); font-weight: 600; text-transform: capitalize; line-height: 1.2; }
.engine-card-name { margin: 5px 0 8px; font-family: var(--fd); font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; color: var(--text); text-wrap: balance; }
.engine-card-summary { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-dim); text-wrap: pretty; }
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s ease;
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  position: relative;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--lime);
  box-shadow: var(--glow-lime);
  color: inherit;
}
.game-card .cover {
  display: block; background: var(--bg-3);
  aspect-ratio: 16 / 10;
  position: relative; overflow: hidden;
}
.game-card .cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.game-card:hover .cover img { transform: scale(1.06); }
.game-card .placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; width: 100%;
  position: relative; overflow: hidden;
}
.game-card .placeholder::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.05), transparent 50%);
}
.game-card .placeholder-text {
  font-size: 26px; font-weight: 800; color: rgba(255,255,255,0.92);
  letter-spacing: -0.5px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
  position: relative;
}
.vote-badge {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(8,10,16,0.78);
  backdrop-filter: blur(8px);
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  border: 1px solid rgba(52,211,153,0.25);
}
.vote-badge svg { width: 12px; height: 12px; }
.gcard-fork-tag {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--fm); font-size: 10px; font-weight: 600;
  background: rgba(12,14,16,0.72); backdrop-filter: blur(6px);
  color: var(--lime); padding: 3px 8px; border-radius: var(--r-full);
  max-width: calc(100% - 70px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.game-card .body {
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
}
.game-card .title {
  font-family: var(--fd);
  font-size: 16px; font-weight: 700; margin: 0;
  color: var(--text);
  line-height: 1.35; letter-spacing: -0.01em;
}
.game-card:hover .title { color: var(--accent); }
.game-card .tagline {
  color: var(--text-dim); font-size: 13px; margin: 0;
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card .meta {
  color: var(--text-dim); font-size: 12px;
  display: flex; gap: 8px; align-items: center;
  margin-top: 4px; flex-wrap: wrap;
}
.game-card .author { font-weight: 500; }
.ai-chip {
  background: rgba(52,211,153,0.12);
  color: var(--lime-br);
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--lime-dp);
  display: inline-flex; align-items: center; gap: 4px;
}

/* ===== 表单 ===== */
.form-box {
  max-width: 460px; margin: 48px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}
/* All form-box pages (login / register / upload / generate) share the Marcellus
   display treatment for cross-page brand identity. Matches home hero + game title. */
.form-box h1 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);
  margin: 0 0 24px;
  font-size: clamp(26px, 3.2vw, 34px); letter-spacing: -.01em;
  text-align: center;
  font-weight: 400; line-height: 1.15;
  text-wrap: balance;
}
.form-box > p.muted { text-wrap: pretty; }
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 7px;
  color: var(--text-dim); font-size: 13px; font-weight: 500;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.15);
}
.form-group input[type="file"] { padding: 9px 10px; cursor: pointer; }
.form-group textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.form-foot {
  text-align: center; margin-top: 20px;
  color: var(--text-faint); font-size: 13.5px;
  padding-top: 18px; border-top: 1px solid var(--border);
}

/* ===== Inline editor (/game/{pid}/edit) ===== */
.editor-page { max-width: 1200px; margin: 18px auto; }
.editor-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.editor-toolbar h1 {
  margin: 0; font-family: var(--fd);
  font-size: 18px; font-weight: 600; letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.editor-toolbar-sep { color: var(--text-faint); font-weight: 400; }
.editor-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.editor-pane .CodeMirror { border: 1px solid var(--border); border-radius: var(--r-md); height: 60vh; font-size: 13.5px; }
.editor-form-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.editor-form-changelog { flex: 1; min-width: 180px; }
.editor-preview-wrap {
  position: sticky; top: 16px; border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: #000; aspect-ratio: 4/3;
}
.editor-preview-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.editor-ai {
  margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
}
.editor-ai-head { font-family: var(--fd); font-weight: 600; font-size: 14px; letter-spacing: -.01em; margin-bottom: 8px; }
.editor-ai-quota { font-weight: 400; font-size: 12.5px; font-family: var(--fm); }
.editor-ai textarea, .editor-ai-input { width: 100%; resize: vertical; min-height: 54px; }
.editor-ai-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.editor-ai-model { max-width: 220px; }
.editor-ai-hint { margin-top: 6px; }
.editor-ai-msg { font-size: 13px; margin-top: 6px; }
@media (max-width: 880px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-preview-wrap { position: static; aspect-ratio: 16/10; }
  .pg-layout { grid-template-columns: 1fr; }
}
/* Engine playground — 2-column code/preview by default, collapses with .editor-layout */
.pg-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 880px) {
  /* Re-stated after the base rule above so the cascade actually collapses
     to single column on mobile (the @media block earlier in the file lost
     to the later base rule under equal specificity). */
  .pg-layout { grid-template-columns: 1fr; }
}

/* /generate — quota meter card + form bits */
.gen-quota {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 18px;
}
.gen-quota-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.gen-quota-bar { height: 8px; background: var(--bg); border-radius: var(--r-full); overflow: hidden; }
.gen-quota-bar-fill { height: 100%; background: var(--lime); transition: width .25s; }
.gen-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }
.gen-consent-box { width: auto; margin-top: 3px; }
.gen-consent label { margin: 0; line-height: 1.5; }
.gen-terms-notice { margin-bottom: 10px; }
.gen-scan-notice { text-align: center; margin-top: 10px; }

/* /search — search form (text input + submit pill) */
.search-form { margin: 8px 0 22px; display: flex; gap: 10px; max-width: 520px; }
.search-form-input {
  flex: 1; padding: 11px 14px;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 14.5px;
}
.search-form-input:focus-visible { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }

/* ===== 创作者工作台 (P4-B) ===== */
.dash-wrap { max-width: 920px; margin: 24px auto; }
.dash-title { font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd); font-size: clamp(26px, 3vw, 32px); font-weight: 400; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 16px; text-wrap: balance; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 18px; }
.dash-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.dash-tab { padding: 8px 14px; border-radius: var(--r-sm); color: var(--text-dim); text-decoration: none; font-size: 14.5px; font-weight: 600; }
.dash-tab:hover { background: var(--surface); color: var(--text); }
.dash-tab.active { background: rgba(52,211,153,0.12); color: var(--lime); }
.dash-create-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 18px; }
.dash-create-title { font-weight: 700; font-size: 16px; }
.dash-create-sub { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.dash-create-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-quota { font-size: 13px; }
.dash-quota-n { font-family: var(--fd); font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--lime); font-variant-numeric: tabular-nums; }
.dash-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-full); border: 1px solid var(--border-2); color: var(--text-dim); text-decoration: none; font-size: 13px; }
.dash-chip:hover { border-color: var(--text-faint); color: var(--text); }
.dash-chip.active { border-color: var(--lime); color: var(--lime); background: rgba(52,211,153,0.08); }
.dash-chip-n { font-family: var(--fm); font-size: 11.5px; opacity: 0.75; }
.dash-works { display: flex; flex-direction: column; gap: 10px; }
.dash-work { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; }
.dash-work-title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-work-type { font-size: 11.5px; color: var(--text-faint); font-family: var(--fm); }
.dash-work-meta { font-size: 12.5px; margin-top: 5px; }
.dash-work-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-work-actions .btn { padding: 6px 12px; font-size: 12.5px; }
.dash-data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 600px) { .dash-work { flex-direction: column; align-items: flex-start; } }

/* ===== 举报按钮 (P4-A) ===== */
.report-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--text-faint); font-size: 12.5px; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px;
}
.report-btn:hover { color: var(--danger); }

/* ===== 管理员后台 (P4-A · 中文化 + 精装) ===== */
.admin-body { background: var(--bg); color: var(--text); }
.admin-shell { display: flex; min-height: 100vh; align-items: stretch; }

/* sidebar */
.admin-sidebar {
  width: 226px; flex: none; background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border); padding: 18px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-brand { font-family: var(--fd); font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--text); text-decoration: none; margin: 2px 6px 12px; display: flex; align-items: center; gap: 8px; }
.admin-brand .den { color: var(--lime); }
.admin-tag { font-size: 9px; font-family: var(--fm); color: var(--text-faint); text-transform: uppercase; letter-spacing: .14em; border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 2px 5px; }
.admin-nav { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 24px; }
.admin-nav-group { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--t2); opacity: .6; padding: 9px 0 3px 8px; }
.admin-nav-group:first-child { padding-top: 2px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 11px; position: relative;
  padding: 7px 12px; border-radius: var(--r-sm); color: var(--text-dim);
  text-decoration: none; font-size: 14px; font-weight: 500; transition: background .14s, color .14s;
}
.admin-nav-item svg { flex: none; opacity: .85; }
.admin-nav-item:hover { background: var(--surface); color: var(--text); }
.admin-nav-item.active { background: rgba(52,211,153,.12); color: var(--lime); font-weight: 600; }
.admin-nav-item.active::before { content: ''; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.admin-side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }

/* main + page header */
.admin-main { flex: 1; min-width: 0; padding: 30px 36px 64px; max-width: 1200px; margin-inline: auto; width: 100%; }
.admin-h1 { font-family: var(--fd); font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-h1 .muted, .admin-h1 .sub { font-size: 14px; font-weight: 400; color: var(--text-faint); }
.admin-pagehead { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-pagehead .admin-h1 { margin: 0; }

/* cards + stats */
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; }
.admin-card-title { font-weight: 700; font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.admin-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; transition: border-color .15s, transform .15s; }
a.admin-stat { text-decoration: none; color: inherit; }
a.admin-stat:hover { border-color: var(--border-2); transform: translateY(-2px); }
.admin-stat .n { font-family: var(--fd); font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.05; color: var(--text); font-variant-numeric: tabular-nums; }
.admin-stat .l { color: var(--text-faint); font-size: 12.5px; margin-top: 6px; }

/* tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; color: var(--text-faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr { transition: background .12s; }
.admin-table tbody tr:hover td { background: var(--bg-2); }
.admin-table code { font-size: 12px; color: var(--text-dim); }

/* badges */
.admin-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 500; border: 1px solid var(--border-2); color: var(--text-dim); }
.admin-badge.ok { border-color: rgba(52,211,153,.4); color: var(--lime); background: rgba(52,211,153,.08); }
.admin-badge.warn { border-color: rgba(251,146,60,.4); color: var(--orange); background: rgba(251,146,60,.08); }
.admin-badge.danger { border-color: rgba(244,81,95,.4); color: var(--danger); background: rgba(244,81,95,.08); }

/* toolbar / filter pills */
.admin-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.admin-toolbar input[type="text"], .admin-toolbar input[type="search"], .admin-toolbar select { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); padding: 8px 12px; font: inherit; font-size: 13.5px; }
.admin-toolbar input:focus, .admin-toolbar select:focus { outline: none; border-color: var(--lime); }
.admin-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: var(--r-full); border: 1px solid var(--border-2); color: var(--text-dim); text-decoration: none; font-size: 13px; transition: border-color .14s, color .14s, background .14s; cursor: pointer; }
.admin-pill:hover { border-color: var(--text-faint); color: var(--text); }
.admin-pill.active { border-color: var(--lime); color: var(--lime); background: rgba(52,211,153,.08); }
.admin-pill .c { font-family: var(--fm); font-size: 11px; opacity: .7; }

/* compact admin buttons */
.admin-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); transition: border-color .15s, background .15s, color .15s; }
.admin-btn:hover { border-color: var(--text-faint); }
.admin-btn-primary { background: var(--lime); border-color: var(--lime); color: #04331f; }
.admin-btn-primary:hover { background: var(--lime-br); border-color: var(--lime-br); }
.admin-btn-danger { color: rgba(244,81,95,.88); border-color: rgba(244,81,95,.28); background: transparent; }
.admin-btn-danger:hover { color: var(--danger); border-color: rgba(244,81,95,.55); background: rgba(244,81,95,.08); }
.admin-btn-sm { padding: 5px 11px; font-size: 12px; }

/* forms */
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-field { display: block; }
.admin-field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.admin-field input, .admin-field select, .admin-field textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); padding: 9px 12px; font: inherit; font-size: 14px; }
.admin-field input:focus, .admin-field select:focus, .admin-field textarea:focus { outline: none; border-color: var(--lime); }
.admin-hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }

/* key-value + empty + subnav */
.admin-kv { font-size: 13.5px; line-height: 1.95; }
.admin-kv .k { color: var(--text-faint); }
.admin-empty { background: var(--surface); border: 1px dashed var(--border-2); border-radius: var(--r-md); padding: 34px; text-align: center; color: var(--text-faint); }
.admin-subnav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: auto; height: auto; position: static; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-nav-group { flex-basis: 100%; padding: 8px 0 2px 2px; }
  .admin-nav-item.active::before { display: none; }
  .admin-side-foot { margin: 8px 0 0; padding: 8px 0 0; flex-direction: row; }
  .admin-main { padding: 20px 16px 48px; }
  .admin-form-grid { grid-template-columns: 1fr; }
}

/* ===== OAuth 登录按钮 (P2-E) ===== */
.oauth-block { margin-top: 20px; }
.oauth-sep {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-faint); font-size: 12.5px; margin: 4px 0 16px;
}
.oauth-sep::before, .oauth-sep::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.btn-oauth {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  font-weight: 600; margin-bottom: 10px;
}
.btn-oauth:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn-oauth svg { flex: none; }

/* ===== Flash 提示 ===== */
.flash {
  padding: 12px 16px; border-radius: var(--r-md);
  margin: 18px 0;
  border: 1px solid var(--border);
  font-size: 14px;
}
.flash-success { background: rgba(52,211,153,0.08); border-color: rgba(52,211,153,0.4); color: var(--lime); }
.flash-error { background: rgba(244,81,95,0.10); border-color: rgba(244,81,95,0.45); color: var(--danger); }

/* ===== 游戏详情/播放页 ===== */
.game-detail-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; margin-bottom: 24px; flex-wrap: wrap;
}
.game-detail-head .left h1 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);  /* matches the home hero — game title gets the same display treatment */
  margin: 0 0 12px;
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 400; letter-spacing: -.01em;
  line-height: 1.15;
  text-wrap: balance;
}
.game-detail-head .meta {
  color: var(--text-dim); font-size: 13.5px;
  display: flex; gap: 13px; align-items: center; flex-wrap: wrap;
}
.game-detail-head .meta > span { display: inline-flex; align-items: center; gap: 5px; }
.game-detail-head .meta .dot { color: var(--border-2); }
.game-detail-head .meta strong { color: var(--text); font-weight: 600; }
.game-detail-head .meta strong a { color: var(--text); }
.game-detail-head .meta strong a:hover { color: var(--lime); }
.game-detail-head .meta .report-btn { display: inline-flex; align-items: center; gap: 4px; }

/* action group: Fork (primary) + Vote/Save (ghost), equal width, aligned */
.game-detail-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 172px; }
.game-detail-actions .btn-act { width: 100%; justify-content: center; gap: 7px; }

/* Share dropdown — collapses Share / X / Embed (3 buttons) into one trigger
   with a popover. Uses native <details>; click-outside-to-close in main.js. */
.share-menu { position: relative; width: 100%; }
.share-menu > summary {
  list-style: none; cursor: pointer;
  /* inherits .btn .btn-ghost .btn-act styling via the summary's class */
}
.share-menu > summary::-webkit-details-marker { display: none; }
.share-menu > summary::marker { display: none; }
.share-menu .ic-caret { width: 12px; height: 12px; margin-left: 2px; transition: transform .15s; flex: none; }
.share-menu[open] > summary .ic-caret { transform: rotate(180deg); }
.share-menu-content {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 4px; z-index: 30;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1px;
}
.share-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; font-size: 13px; color: var(--text);
  background: transparent; border: 0; border-radius: var(--r-sm);
  cursor: pointer; text-align: left; text-decoration: none;
  font-family: inherit; font-weight: 500; line-height: 1.3;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.share-menu-item:hover { background: var(--surface); color: var(--lime); }
.share-menu-item svg { color: var(--text-faint); flex: none; }
.share-menu-item:hover svg { color: var(--lime); }
.vote-btn { cursor: pointer; font-family: inherit; }
.vote-btn .ic-star path { transition: fill .15s, stroke .15s; }
.vote-btn.voted { color: var(--orange); border-color: rgba(251,146,60,0.45); }
.vote-btn.voted .ic-star path { fill: var(--orange); stroke: var(--orange); }
.vote-count { opacity: .65; font-variant-numeric: tabular-nums; }
.bookmark-btn.bookmarked { color: var(--lime); border-color: rgba(52,211,153,0.45); }
.bookmark-btn.bookmarked svg path { fill: rgba(52,211,153,0.20); }

.player-wrap {
  position: relative;
  background: #000;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-2);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.player-frame {
  width: 100%; aspect-ratio: 16/10;
  background: #000;
  overflow: hidden;
}
.player-frame iframe {
  width: 100%; height: 100%; border: 0; display: block;
}
.player-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.player-actions button {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: 6px 12px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px; font-family: inherit;
  transition: border-color .15s, color .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.player-actions button:hover {
  border-color: var(--lime); color: var(--lime);
}

.game-desc {
  margin-top: 28px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
/* Section header — display font, sentence case (i18n strings are already
   sentence-case); the old caps+letter-spacing was a shouty SKILL.md anti-pattern. */
.game-desc h3 {
  font-family: var(--fd);
  margin: 0 0 14px; font-size: 16px; color: var(--text);
  font-weight: 700; letter-spacing: -.01em;
  text-wrap: balance;
}
.game-desc .desc-body {
  white-space: pre-wrap; line-height: 1.75; color: var(--text-dim);
  font-size: 14.5px;
}
.tag {
  display: inline-flex; align-items: center;
  background: var(--surface-2);
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  color: var(--text-dim);
  margin-right: 6px; margin-top: 8px;
}
/* Home about + FAQ block */
.hv4-about { max-width: 760px; }
.hv4-about h2 { font-size: 22px; font-weight: 800; margin: 0 0 12px; }
.hv4-about-body { color: var(--text-dim); line-height: 1.75; font-size: 15px; margin: 0 0 22px; }
.hv4-faq .faq-item { padding: 14px 0; border-top: 1px solid var(--border); }
.hv4-faq .faq-item:first-of-type { border-top: 0; }

/* Intro line under a section heading (browse / tag / trending) */
.section-intro {
  margin: -6px 0 20px; max-width: 70ch;
  color: var(--text-dim); font-size: 14px; line-height: 1.6;
}
/* FAQ block (game detail) — reuses the .game-desc card shell */
.faq-item { padding: 12px 0; border-top: 1px solid var(--border); }
.faq-item:first-of-type { border-top: 0; padding-top: 2px; }
.faq-q { margin: 0 0 5px; font-weight: 600; font-size: 14.5px; color: var(--text); }
.faq-a { margin: 0; line-height: 1.7; color: var(--text-dim); font-size: 14px; }
/* Related games grid */
.related-games { margin-top: 44px; } /* match home section rhythm */
.related-head {
  font-family: var(--fd);
  margin: 0 0 16px; font-size: 16px; color: var(--text);
  font-weight: 700; letter-spacing: -.01em;
  text-wrap: balance;
}

/* fork attribution */
.fork-from {
  display: flex; align-items: center; gap: 8px;
  margin: -4px 0 20px; padding: 10px 14px;
  background: rgba(255,120,73,0.08); border: 1px solid var(--coral-dp);
  border-radius: var(--r-md); font-size: 13.5px; color: var(--text-dim);
}
.fork-from svg { color: var(--coral); flex: none; }
.fork-from a { color: var(--coral); font-weight: 600; }
.fork-list ul { list-style: none; padding: 0; margin: 0; }
.fork-list li {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.fork-list li:last-child { border-bottom: none; }
.fork-list li a { color: var(--text); font-weight: 600; }
.fork-list li a:hover { color: var(--lime); }
.fork-list li .muted { font-size: 12.5px; }

/* Creator leaderboard — /trending?range=creators */
.leaderboard { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 18px;
  transition: border-color .2s;
}
.lb-row:hover { border-color: var(--border-2); }
.lb-rank { font-family: var(--fd); font-weight: 600; font-size: 20px; color: var(--text-faint); min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.lb-rank.top { color: var(--lime); }
.lb-av {
  width: 40px; height: 40px; border-radius: var(--r-full); flex: none;
  background: linear-gradient(135deg, var(--lime-dp), var(--lime));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fd); font-weight: 700; color: #06340f; font-size: 16px;
  text-decoration: none;
}
.lb-name { display: flex; flex-direction: column; gap: 1px; font-weight: 600; letter-spacing: -.01em; color: var(--text); margin-right: auto; min-width: 0; text-decoration: none; }
.lb-name:hover { color: var(--lime); }
.lb-name .muted { font-weight: 400; font-size: 12.5px; font-family: var(--fm); letter-spacing: 0; }
.lb-stat { font-size: 12px; color: var(--text-faint); text-align: center; min-width: 56px; }
.lb-stat strong { display: block; font-family: var(--fd); font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .lb-stat:nth-child(n+5) { display: none; } }

/* ===== /challenge — Daily Challenge ===== */
.section-head h2 svg { color: var(--lime); flex: none; }
.challenge-hero {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  margin-bottom: 22px;
}
.challenge-hero-cover {
  width: 120px; height: 120px; object-fit: cover;
  border-radius: var(--r-md); flex: none;
}
.challenge-hero-body { flex: 1; min-width: 200px; }
.challenge-hero-title {
  font-family: var(--fd); font-size: 20px; font-weight: 600;
  letter-spacing: -.01em; line-height: 1.2; margin-bottom: 4px;
  text-wrap: balance;
}
.challenge-hero-tagline { margin-bottom: 6px; font-size: 14px; text-wrap: pretty; }
.challenge-hero-author { font-size: 13px; font-family: var(--fm); }
.challenge-hero-best { margin-top: 10px; font-size: 14px; color: var(--text); }
.challenge-hero-cta { flex: none; }

.challenge-lb-head { font-family: var(--fd); font-weight: 600; font-size: 16px; letter-spacing: -.01em; margin: 0 0 12px; text-wrap: balance; }
.challenge-lb { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.challenge-lb thead tr { text-align: left; color: var(--text-faint); font-size: 12.5px; }
.challenge-lb th { padding: 8px 10px; font-weight: 500; }
.challenge-lb .lb-rank-col { width: 48px; }
.challenge-lb .lb-score-col { text-align: right; }
.challenge-lb tbody tr { border-top: 1px solid var(--border); }
.challenge-lb tbody tr.lb-self { background: rgba(52,211,153,.07); }
.challenge-lb td { padding: 10px; }
.challenge-lb .lb-rank-cell { font-variant-numeric: tabular-nums; font-family: var(--fd); }
.challenge-lb .lb-score-cell { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--fd); font-weight: 700; letter-spacing: -.01em; }

/* Today's puzzles grid (engine daily anchors) */
.dly-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.dly-card {
  display: block; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none; color: inherit;
  transition: border-color .2s, transform .2s;
}
.dly-card:hover { border-color: var(--lime); transform: translateY(-1px); }
.dly-card-title { font-family: var(--fd); font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 8px; text-wrap: balance; color: var(--text); }
.dly-card-board { list-style: none; padding: 0; margin: 0; font-size: 12.5px; color: var(--text-dim); }
.dly-card-board li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; }
.dly-card-score { font-variant-numeric: tabular-nums; font-weight: 600; font-family: var(--fd); }
.dly-card-empty { font-size: 12.5px; }

/* ===== /notifications ===== */
.notif-list { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.notif-item {
  display: flex; gap: 10px; align-items: baseline;
  padding: 12px 14px; border-radius: var(--r-md);
}
.notif-item.is-unread { background: rgba(52, 211, 153, .07); }
.notif-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; }
.notif-dot.is-on { background: var(--lime); }
.notif-body { flex: 1; min-width: 0; }
.notif-actor { font-weight: 600; }
.notif-actor:hover { color: var(--lime); }
.notif-game { color: var(--lime); }
.notif-snippet { font-size: 13px; margin-top: 2px; text-wrap: pretty; }
.notif-time { flex: 0 0 auto; font-size: 12px; font-family: var(--fm); }

/* comments */
.comments { margin-top: 44px; } /* match home section rhythm */
.comments-head { font-family: var(--fd); font-weight: 700; font-size: 16px; margin: 0 0 16px; letter-spacing: -.01em; text-wrap: balance; }
.comment-form textarea { width: 100%; min-height: 80px; padding: 11px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); font-family: inherit; font-size: 14.5px; resize: vertical; line-height: 1.55; }
.comment-form textarea:focus-visible { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(52,211,153,0.15); }
.comment-login { padding: 14px 0; }
.comment-list { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 16px; }
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; }
.comment-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-bottom: 6px; }
.comment-author { color: var(--text); font-weight: 600; }
.comment-author:hover { color: var(--lime); }
.comment-del { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 6px 10px; border-radius: var(--r-sm); }
.comment-del:hover { color: var(--danger); background: rgba(244,81,95,0.10); }
.comment-body { color: var(--text-dim); font-size: 14.5px; line-height: 1.6; word-break: break-word; }

/* version switcher */
.version-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.version-switch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-label { font-family: var(--fm); font-size: 12px; color: var(--text-faint); }
.version-chip {
  display: inline-flex; align-items: center; padding: 5px 12px;
  border-radius: var(--r-full); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim);
  font-size: 13px; font-weight: 600;
}
.version-chip:hover { border-color: var(--lime); color: var(--lime); }
.version-chip.active { background: var(--lime); color: #06340f; border-color: var(--lime); }
.version-chip.active:hover { color: #06340f; }
.version-changelog {
  margin-top: 14px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
}
.version-changelog-head { font-family: var(--fm); font-size: 12px; color: var(--text-faint); margin-bottom: 8px; }

/* ===== List-page filter chips (browse/trending/profile tabs) ===== */
.filter-bar {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.filter-bar .btn {
  padding: 6px 13px; font-size: 13px; border-radius: var(--r-full);
}
.filter-bar .btn.active {
  border-color: var(--lime); color: var(--lime); background: rgba(52,211,153,0.10);
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 40px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 80px;
}
.site-footer p { margin: 4px 0; text-wrap: pretty; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.footer-links {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin-top: 10px; font-size: 13px;
}

/* ===== Empty states (list pages, profile, generate, etc.) ===== */
.empty-state {
  text-align: center; padding: 64px 24px;
  color: var(--text-dim);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
/* Optional Marcellus title slot — give the empty state a clear voice */
.empty-state h2 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);
  margin: 0 0 8px; font-weight: 400;
  font-size: clamp(20px, 2.2vw, 24px); letter-spacing: -.01em;
  color: var(--text); text-wrap: balance;
}
.empty-state p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.55; max-width: 460px; margin-inline: auto; text-wrap: pretty; }
.empty-state p + p { margin-top: 6px; }
.empty-state .btn + .btn { margin-left: 8px; }

/* ===== Pagination — compact, current page highlighted ===== */
.pagination {
  display: flex; justify-content: center; gap: 4px;
  margin-top: 44px; flex-wrap: wrap;
}
.pagination .btn { min-width: 36px; padding: 6px 11px; font-size: 13.5px; }
.pagination-gap { display: inline-flex; align-items: center; padding: 0 4px; color: var(--text-faint); font-size: 13.5px; }

/* ===== Long-form doc / terms / rules pages (.doc) ===== */
.doc {
  max-width: 720px; margin: 32px auto 0; line-height: 1.75;
}
.doc h1 {
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd); font-weight: 400;
  font-size: clamp(28px, 3.4vw, 36px); letter-spacing: -.01em;
  line-height: 1.15; margin-bottom: 10px; text-wrap: balance;
}
.doc h2 {
  font-family: var(--fd); font-weight: 600; font-size: 19px;
  letter-spacing: -.01em;
  margin: 36px 0 14px; padding-top: 22px; border-top: 1px solid var(--border);
  text-wrap: balance;
}
.doc p { color: var(--text-dim); margin-bottom: 12px; text-wrap: pretty; }
.doc ul { list-style: none; padding: 0; margin: 0 0 12px; }
.doc li {
  position: relative; padding-left: 22px; margin-bottom: 8px;
  color: var(--text-dim);
}
.doc li::before {
  content: '▸'; position: absolute; left: 0; color: var(--lime);
}
.doc a { color: var(--lime); }
.doc > p.muted:first-of-type { font-size: 15px; max-width: 600px; }

/* ===== 作者主页 ===== */
.profile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s8);
  display: flex; gap: var(--s6); align-items: center; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.profile::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 80px;
  background: linear-gradient(120deg, rgba(52,211,153,0.18), rgba(13,148,136,0.12));
}
.profile-avatar {
  width: 92px; height: 92px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--lime-dp), var(--lime));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fd); font-weight: 700; font-size: 38px; color: #06340f;
  border: 3px solid var(--surface);
  position: relative; z-index: 1; overflow: hidden; flex: none;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { position: relative; z-index: 1; min-width: 0; }
.profile-name { font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd); font-weight: 400; font-size: clamp(26px, 3vw, 32px); letter-spacing: -.01em; line-height: 1.15; text-wrap: balance; }
.profile-slug { font-family: var(--fm); color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.profile-bio { color: var(--text-dim); margin-top: var(--s2); font-size: 14px; line-height: 1.55; text-wrap: pretty; }
.profile-bio a { color: var(--lime); }
.profile-website { margin-top: 6px; font-size: 13.5px; }
.profile-website a { display: inline-flex; align-items: center; gap: 5px; color: var(--lime); text-decoration: none; }
.profile-website a:hover { text-decoration: underline; }
.profile-website svg { color: var(--lime); flex: none; }
.profile-stats { display: flex; gap: var(--s6); margin-top: var(--s4); flex-wrap: wrap; }
.pstat-num { font-family: var(--fd); font-weight: 700; font-size: 22px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pstat-num.hl { color: var(--lime); }
.pstat-label { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.profile-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.profile-badges .tag { display: inline-flex; align-items: center; gap: 5px; }
.profile-collections { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.profile-collections-label { font-size: 13px; }
.profile-actions { display: flex; align-items: center; gap: 14px; margin-top: var(--s4); flex-wrap: wrap; }
.profile-joined { font-family: var(--fm); font-size: 12px; color: var(--text-faint); }
.follow-btn {
  background: var(--lime); color: #06340f; border-color: var(--lime);
  box-shadow: 0 4px 14px rgba(52,211,153,0.22);
}
.follow-btn:hover { background: var(--lime-br); color: #06340f; transform: translateY(-1px); }
.follow-btn.following {
  background: transparent; color: var(--text-dim);
  border-color: var(--border-2); box-shadow: none;
}
.follow-btn.following::before { content: '✓ '; color: var(--lime); }
.follow-btn.following:hover { color: var(--text); border-color: var(--lime); transform: none; }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .hero { padding: 50px 0 24px; }
  .hero h1 { font-size: 34px; }
  .hero p.lead { font-size: 15.5px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 32px; }
  .stat { padding: 16px 8px; }
  .stat .num { font-size: 24px; }
}
@media (max-width: 460px) {
  /* On very narrow screens 3 stat cols crowd. Auto-fit gives 2 cols
     for short labels, or 1 col when the longest needs more room. */
  .stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .stat .num { font-size: 22px; }
}
@media (max-width: 720px) {
  .nav { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .logo-lockup { margin-right: auto; }
  .nav-burger { display: flex; }
  .nav-collapse { display: none; order: 3; width: 100%; flex: none; }
  .site-header.nav-open .nav-collapse {
    display: flex; flex-direction: column; align-items: stretch; gap: 16px;
    padding-top: 14px; border-top: 1px solid var(--border);
  }
  .nav-collapse .nav-links { flex-direction: column; align-items: flex-start; gap: 14px; }
  .nav-collapse .nav-right { flex-direction: column; align-items: stretch; gap: 10px; }
  .nav-collapse .lang-dd { align-self: flex-start; }
  .nav-collapse .lang-dd-menu { left: 0; right: auto; }
  .nav-collapse .nav-right .btn { width: 100%; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .game-card .body { padding: 11px 12px 13px; }
  .game-card .title { font-size: 14.5px; }
  .game-card .tagline { font-size: 12px; }
  .section { margin-top: 40px; }
  .section-head h2 { font-size: 20px; }
  .game-detail-head .left h1 { font-size: 22px; }
  .form-box { padding: 28px 22px; margin: 24px 16px; }
  /* Section heads stack on narrow viewports: side-by-side title + meta/CTA
     squeezes the title into multi-line on iPhone widths. */
  .section-head, .hv4-sec-head { flex-wrap: wrap; align-items: flex-start; row-gap: 6px; }
  .section-head h2, .hv4-sec-head h2 { flex-wrap: wrap; }
  .hv4-today .hv4-today-sub { display: block; margin-left: 0; margin-top: 4px; }
}

/* ===== 首页重设计 v4 (homepage only — .main-bare + .hv4-*) ===== */
main.main-bare { max-width: none; padding: 0; margin: 0; }

/* HERO: pure ink + particle canvas, fades into the content base colour */
.hv4-hero { position: relative; overflow: hidden; padding: 40px 0 40px; text-align: center; background: var(--ink); }
#hv4-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hv4-hero-in { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.hv4-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--t2); background: rgba(17,17,19,.7); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r-full); padding: 6px 15px; margin-bottom: 22px; }
.hv4-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.hv4-hero h1 { font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd); font-weight: 400; font-size: clamp(46px, 7vw, 74px); line-height: 1.06; letter-spacing: -.01em; margin: 0 0 18px;
  /* text-wrap: balance produces uneven line gaps for short CJK lines because
     Chrome's balance algorithm treats CJK punctuation as a hard break. pretty
     preserves the Latin look without the CJK gap artefact. */
  text-wrap: pretty;
}
.hv4-hero h1 .l2 { color: var(--green); }
.hv4-hero p { color: var(--t2); font-size: 17px; font-weight: 400; max-width: 760px; margin: 0 auto 28px; line-height: 1.5; letter-spacing: -.01em; }
.hv4-stats { display: flex; gap: 44px; justify-content: center; margin-top: 38px; }
.hv4-stats div { display: flex; flex-direction: column; gap: 3px; }
.hv4-stats .n { font-family: var(--fd); font-weight: 700; font-size: 24px; letter-spacing: -.03em; color: var(--t1); }
.hv4-stats .l { font-size: 12px; color: var(--t3); letter-spacing: .02em; }

/* Compact hero variant (redesign-taste-v1) — drop the particle canvas + halve
   the vertical real-estate so the game wall is reachable above the fold.
   Applied via .hv4-hero.compact in templates/home.php.
   2nd pass: slightly more breathing — was 22/30, sections 36 — felt cramped. */
.hv4-hero.compact { padding: 36px 0 44px; }
.hv4-hero.compact .hv4-badge { margin-bottom: 20px; }
.hv4-hero.compact h1 { font-size: clamp(34px, 5vw, 54px); margin: 0 0 20px; text-wrap: pretty; }
.hv4-hero.compact p  { font-size: 15.5px; margin: 0 auto 26px; text-wrap: pretty; }
.hv4-hero.compact .hv4-cta .btn { padding: 10px 20px; font-size: 14px; }
.hv4-hero.compact .hv4-cta { margin-top: 6px; }
.hv4-hero.compact .hv4-stats { gap: 34px; margin-top: 36px; }

/* Hero search — primary action, prominent. Centered, 640px max, big input. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
/* Skip-to-content link — invisible until keyboard-focused. Lets AT/keyboard
   users bypass the entire header on every page load. */
.skip-link {
  position: absolute; top: -40px; left: 12px; z-index: 1000;
  background: var(--accent, #34d399); color: #04140d;
  padding: 8px 14px; border-radius: 6px;
  font-weight: 600; text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; outline: 3px solid #04140d; outline-offset: 2px; }
.hv4-hero-search {
  position: relative; display: flex; align-items: stretch;
  max-width: 640px; margin: 0 auto;
  background: var(--ink-2); border: 1px solid var(--line-2);
  border-radius: var(--r-full); padding: 6px 6px 6px 18px;
  transition: border-color .2s, box-shadow .2s;
}
.hv4-hero-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,0.12); }
.hv4-hero-search-ic { width: 18px; height: 18px; color: var(--t3); align-self: center; flex: none; }
.hv4-hero-search input {
  flex: 1; min-width: 0; background: transparent; border: 0;
  padding: 12px 14px; font: inherit; font-size: 15.5px; color: var(--text); outline: 0;
  letter-spacing: -.01em;
}
.hv4-hero-search input::placeholder { color: var(--t3); }
.hv4-hero-search-btn {
  background: var(--green); color: #04140d;
  border: 0; border-radius: var(--r-full);
  padding: 0 22px; font: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: background .15s;
  white-space: nowrap;
}
.hv4-hero-search-btn:hover { background: var(--green-br); }

/* Popular-search chips — give users vocabulary to click instead of guessing.
   FORCED to one row; if chips overflow the viewport, the row scrolls
   horizontally (touch-friendly), scrollbar hidden for clean look. */
.hv4-popular {
  display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: center;
  gap: 8px; max-width: 800px; margin: 18px auto 0;
  padding: 4px 16px;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.hv4-popular::-webkit-scrollbar { display: none; }
.hv4-popular-label {
  font-size: 12px; color: var(--t3); margin-right: 4px;
  letter-spacing: .02em;
  flex: none; white-space: nowrap;
}
.hv4-chip {
  display: inline-block; padding: 5px 12px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--r-full); font-size: 12.5px; color: var(--t2);
  text-decoration: none; transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap; flex: none;
}
.hv4-chip:hover { border-color: var(--green); color: var(--green); background: rgba(52,211,153,0.06); }

@media (max-width: 640px) {
  .hv4-hero-search { padding: 4px 4px 4px 12px; }
  .hv4-hero-search input { font-size: 14.5px; padding: 10px 8px; }
  .hv4-hero-search-btn { padding: 0 14px; font-size: 13px; }
  .hv4-popular { gap: 6px; padding: 4px 14px; }
  .hv4-chip { padding: 4px 10px; font-size: 12px; }
}
.hv4-hero.compact .hv4-stats .n { font-size: 22px; }
.hv4-hero.compact .hv4-stats .l { font-size: 11.5px; }
/* Section headings benefit from text-wrap balance too (avoid orphans). */
.hv4-sec-head h2 { text-wrap: balance; }
/* Section padding: original 52 felt heavy, compressed 36 felt cramped — 44 is right. */
.hv4-sec { padding: 44px 0; }
.hv4-sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.hv4-sec-head h2 { font-family: var(--fd); font-weight: 700; font-size: 23px; letter-spacing: -.03em; margin: 0; }

/* Today's daily-engine anchors — pinned row above the rotating daily picks.
   Cards sized to actually SHOW their puppeteer cover (16:10) + give the
   localized title and 1-line tag room to breathe. 3 anchors → 3 cols on
   desktop, single column stacks on mobile. */
.hv4-today { padding: 30px 0 32px; background: var(--ink-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hv4-today .hv4-today-sub { font-size: 12.5px; font-weight: 400; color: var(--t3); margin-left: 10px; letter-spacing: 0; }
.hv4-today-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.hv4-today-card {
  display: block;
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: border-color .2s, transform .2s, box-shadow .3s;
}
.hv4-today-card:hover { border-color: var(--green); transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0,0,0,.4); }
.hv4-today-cover {
  position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--surface);
}
.hv4-today-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s cubic-bezier(.2,.7,.3,1); }
.hv4-today-card:hover .hv4-today-cover img { transform: scale(1.04); }
.hv4-today-cover .hv4-ph { width: 100%; height: 100%; }
.hv4-today-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.55), transparent 55%); pointer-events: none; }
.hv4-today-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--green); color: #04140d;
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
  padding: 3px 8px; border-radius: var(--r-sm);
}
.hv4-today-meta { padding: 12px 14px 14px; }
.hv4-today-name { font-family: var(--fd); font-size: 16px; font-weight: 700; color: var(--t1); letter-spacing: -.02em; line-height: 1.2; }
.hv4-today-tag  { font-size: 12.5px; color: var(--t3); margin-top: 5px; line-height: 1.4; }

/* alternating bands; border-top separates each section */
.hv4-sec.hv4-picks, .hv4-sec.hv4-band { background: var(--band); border-top: 1px solid var(--line); }
.hv4-sec.hv4-band { border-bottom: 1px solid var(--line); }
.hv4-wrap { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.hv4-more { color: var(--t2); font-size: 14px; text-decoration: none; font-weight: 450; transition: color .2s; }
.hv4-more:hover { color: var(--green); }

/* Today's picks — image + separate solid info area */
.hv4-featured { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.hv4-fcard { display: block; text-decoration: none; color: inherit; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; transition: transform .4s cubic-bezier(.2,.7,.3,1), box-shadow .4s, border-color .3s; }
.hv4-fcard:hover { transform: translateY(-3px); box-shadow: 0 26px 64px rgba(0,0,0,.55); border-color: var(--line-2); }
.hv4-fcard-cover { position: relative; aspect-ratio: 21/9; overflow: hidden; }
.hv4-fcard-cover img { width: 100%; height: 100%; object-fit: cover; }
.hv4-fcard-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.5), transparent 50%); }
.hv4-fbadge { position: absolute; top: 14px; left: 14px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--green); background: rgba(0,0,0,.55); backdrop-filter: blur(10px); padding: 5px 12px; border-radius: var(--r-full); }
.hv4-fcard-info { padding: 20px 24px 22px; }
.hv4-fcard-info h3 { font-family: var(--fd); font-weight: 700; font-size: 22px; letter-spacing: -.03em; margin: 0 0 5px; }
.hv4-fcard-info .meta { color: var(--t2); font-size: 13.5px; margin-bottom: 14px; }
.hv4-fstats { display: flex; gap: 18px; font-size: 12.5px; color: var(--t3); }
.hv4-fstats .star { color: var(--orange); }
.hv4-fstats .fk { color: var(--green); }

/* card grid (4 / 2 / 1) */
.hv4-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.hv4-card { display: block; text-decoration: none; color: inherit; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .4s, border-color .3s; }
.hv4-card:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.hv4-card-cover { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.hv4-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.3,1); }
.hv4-card:hover .hv4-card-cover img { transform: scale(1.05); }
.hv4-card-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.35), transparent 35%); }
.hv4-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--fd); font-weight: 800; font-size: 30px; letter-spacing: -.03em; color: rgba(245,245,247,.82); text-align: center; padding: 0 10px; }
.hv4-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .3s; background: rgba(0,0,0,.3); z-index: 1; }
.hv4-card:hover .hv4-play { opacity: 1; }
.hv4-play svg { box-sizing: border-box; width: 48px; height: 48px; padding: 15px; border-radius: 50%; background: rgba(245,245,247,.95); }
.hv4-fork { position: absolute; top: 11px; left: 11px; z-index: 2; font-size: 10px; font-weight: 600; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); color: var(--green); padding: 3px 9px; border-radius: var(--r-full); }
.hv4-card-body { padding: 14px 15px 15px; background: var(--ink-2); border-top: 1px solid var(--line); }
.hv4-card-title { font-family: var(--fd); font-weight: 600; font-size: 15px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv4-card-author { font-size: 12.5px; color: var(--t3); margin-top: 3px; }
.hv4-card-foot { display: flex; align-items: center; gap: 13px; margin-top: 12px; font-size: 12px; color: var(--t3); }
.hv4-card-foot .star { color: var(--orange); }
.hv4-card-foot .ai { margin-left: auto; font-size: 10px; font-weight: 500; color: var(--t3); border: 1px solid var(--line-2); padding: 2px 8px; border-radius: var(--r-full); white-space: nowrap; }

@media (max-width: 980px) { .hv4-cards { grid-template-columns: repeat(2, 1fr); } .hv4-featured { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .hv4-featured { grid-template-columns: 1fr; } .hv4-stats { gap: 30px; } .hv4-sec { padding: 40px 0; } }
@media (max-width: 560px) { .hv4-cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { #hv4-canvas { display: none; } }

/* ── a11y (P3): keyboard focus ring + reduce-motion ─────────────────────────
   Visible focus for keyboard users on every interactive element. :focus-visible
   shows only for keyboard (not mouse), so normal clicking stays ring-free. Form
   inputs keep their own box-shadow focus (higher specificity), so no double ring. */
:focus-visible { outline: 2px solid var(--accent, #34d399); outline-offset: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible { border-radius: 6px; }

/* Honor "reduce motion" globally (the hero particle canvas is already hidden above,
   and hero-particles.js bails early; this neutralizes the rest of the animations
   and transitions for users with vestibular sensitivity). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* AI Sprite Studio (/sprites) */
.ss-wrap { max-width: 900px; margin: 0 auto; padding: 6px 0 44px; }
.ss-title {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 6px;
  font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd);
  font-weight: 400; font-size: clamp(28px, 3.4vw, 36px);
  letter-spacing: -.01em; line-height: 1.15; text-wrap: balance;
}
.ss-title svg { color: var(--lime); flex: none; }
.ss-intro { max-width: 640px; margin: 0 0 22px; font-size: 14.5px; line-height: 1.55; text-wrap: pretty; }
.ss-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg, 14px); padding: 22px; }
.ss-field { margin-bottom: 20px; }
.ss-field:last-child { margin-bottom: 0; }
.ss-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 10px; }
.ss-styles { display: flex; flex-wrap: wrap; gap: 10px; }
.ss-pill { position: relative; cursor: pointer; }
.ss-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.ss-pill span { display: inline-block; white-space: nowrap; padding: 8px 18px; border: 1px solid var(--border); border-radius: var(--r-full, 999px); font-size: 14px; color: var(--text-dim); transition: background .15s, border-color .15s, color .15s; }
.ss-pill:hover span { border-color: var(--text-faint); color: var(--text); }
.ss-pill input:checked + span { background: var(--accent, #34d399); border-color: var(--accent, #34d399); color: #04241a; font-weight: 600; }
.ss-pill input:focus-visible + span { outline: 2px solid var(--accent, #34d399); outline-offset: 2px; }
#sprite-subjects { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md, 10px); color: var(--text); padding: 11px 13px; font: inherit; font-size: 14px; line-height: 1.7; resize: vertical; }
#sprite-subjects:focus-visible { outline: none; border-color: var(--accent, #34d399); box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }
.ss-hint { font-size: 12.5px; margin: 8px 0 0; }
.ss-go-row { display: flex; align-items: center; gap: 12px; }
.ss-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 14px; margin-top: 22px; }
.ss-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: 12px; text-align: center; }
.ss-img { width: 112px; height: 112px; object-fit: contain; image-rendering: pixelated; border-radius: 8px; background: repeating-conic-gradient(var(--bg-2, #1b1f27) 0% 25%, var(--bg-3, #11141a) 0% 50%) 50% / 18px 18px; }
.ss-card-label { font-size: 12.5px; color: var(--text-dim); margin: 9px 0; word-break: break-word; min-height: 2.2em; }
.ss-card-actions { display: flex; gap: 6px; justify-content: center; }
.ss-mini { font-size: 12px; padding: 5px 11px; }
.ss-err { font-size: 12px; padding: 10px; grid-column: 1 / -1; }
@media (max-width: 560px) { .ss-results { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } }

/* About / how-it-works (/about) */
.about-wrap { max-width: 760px; margin: 0 auto; padding: 22px 0 52px; text-align: center; }
/* eyebrow kept as a deliberate kicker, but small + low-key — no longer SHOUTY */
.about-eyebrow { font-size: 13px; letter-spacing: 0; color: var(--accent, #34d399); font-weight: 600; margin: 0 0 10px; }
.about-title { font-family: 'Marcellus', Georgia, 'Times New Roman', var(--fd); font-weight: 400; font-size: clamp(28px, 5vw, 40px); letter-spacing: -.01em; line-height: 1.1; margin: 0 0 16px; text-wrap: balance; }
.about-lead { font-size: 17px; line-height: 1.6; color: var(--text-dim); max-width: 640px; margin: 0 auto 26px; }
.about-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 38px; }
.about-features { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.about-feat { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: 14px 16px; font-size: 14px; line-height: 1.5; }
.about-dot { color: var(--accent, #34d399); flex: 0 0 auto; margin-top: 1px; }
@media (max-width: 600px) { .about-features { grid-template-columns: 1fr; } }
