/* ==========================================================
   base.css — 主站和游戏广场共用的设计基础
   注意：site/css/base.css 和 games/css/base.css 必须保持一致
   ========================================================== */

@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2122, U+2191, U+2193;
}

:root {
  color-scheme: light;
  --paper: #fff6e5;
  --paper-dot: #f1dfbf;
  --card: #ffffff;
  --ink: #1b1530;
  --muted: #5d5570;
  --line: #1b1530;
  --shadow: #1b1530;

  --tomato: #ff5b3a;
  --lemon: #ffd23f;
  --mint: #2ed6a0;
  --sky: #3fa7ff;
  --grape: #7c5cff;
  --on-accent: #1b1530;

  --font-display: "Bricolage", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --text-sm: 0.875rem;
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --text-xl: clamp(1.75rem, 1.2rem + 2.4vw, 3rem);
  --text-hero: clamp(3rem, 1.4rem + 7vw, 7.5rem);

  --space-section: clamp(4.5rem, 3rem + 6vw, 9rem);
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;

  --border: 3px solid var(--line);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --pop: 6px 6px 0 var(--shadow);
  --pop-sm: 3px 3px 0 var(--shadow);

  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15111f;
    --paper-dot: #2a2240;
    --card: #211a33;
    --ink: #fff3dc;
    --muted: #b7aecb;
    --line: #fff3dc;
    --shadow: #7c5cff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15111f;
  --paper-dot: #2a2240;
  --card: #211a33;
  --ink: #fff3dc;
  --muted: #b7aecb;
  --line: #fff3dc;
  --shadow: #7c5cff;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(var(--paper-dot) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 8px 14px; background: var(--lemon); color: var(--on-accent); border: var(--border); border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-block: 14px;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border-bottom: 3px solid transparent;
  transition: border-color var(--duration-normal);
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem;
  text-decoration: none; letter-spacing: -0.02em;
}
.logo-mark {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: var(--lemon); color: var(--on-accent);
  border: var(--border); border-radius: 12px; box-shadow: var(--pop-sm);
  transform: rotate(-6deg);
  transition: transform var(--duration-normal) var(--ease-spring);
}
.logo:hover .logo-mark { transform: rotate(8deg) scale(1.08); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 6px 12px; border-radius: 999px; text-decoration: none; font-weight: 600;
  transition: background var(--duration-fast);
}
.nav a:hover { background: color-mix(in srgb, var(--lemon) 55%, transparent); }
.tools { display: flex; gap: 8px; }
.tool-btn {
  display: inline-grid; place-items: center; min-width: 44px; height: 40px; padding: 0 10px;
  font: 700 0.9rem var(--font-display); color: var(--ink);
  background: var(--card); border: var(--border); border-radius: 12px; box-shadow: var(--pop-sm);
  cursor: pointer;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}
.tool-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }
.tool-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); }
.tool-btn svg { width: 20px; height: 20px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
@media (max-width: 760px) { .nav { display: none; } .tools { margin-left: auto; } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  font: 800 1.05rem var(--font-display); text-decoration: none; color: var(--on-accent);
  background: var(--lemon); border: var(--border); border-radius: 999px; box-shadow: var(--pop);
  transition: transform var(--duration-fast) var(--ease-out-expo), box-shadow var(--duration-fast) var(--ease-out-expo);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--shadow); }
.btn:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--shadow); }
.btn-hot { background: var(--tomato); }
.btn-ghost { background: var(--card); color: var(--ink); }
.btn .arrow { transition: transform var(--duration-normal) var(--ease-spring); }
.btn:hover .arrow { transform: translateX(4px) rotate(-8deg); }

/* ---------- 小标签 / 贴纸 ---------- */
.tag {
  display: inline-block; padding: 2px 10px;
  font: 700 var(--text-sm) var(--font-display); color: var(--on-accent);
  background: var(--mint); border: 2px solid var(--line); border-radius: 999px;
}
.tag:nth-child(3n + 2) { background: var(--sky); }
.tag:nth-child(3n + 3) { background: var(--lemon); }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; font: 800 var(--text-sm) var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--on-accent); background: var(--mint); border: var(--border); border-radius: 999px; box-shadow: var(--pop-sm);
  transform: rotate(-2deg);
}
.kicker .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tomato); animation: blink 1.2s steps(2) infinite; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 40px; }
.section-head h2 { font-size: var(--text-xl); font-weight: 800; }
.section-head p { color: var(--muted); max-width: 42ch; }
.section-num { display: block; font: 800 var(--text-sm) var(--font-mono); color: var(--tomato); margin-bottom: 10px; }

/* ---------- 页脚 ---------- */
.footer { padding-block: 40px; border-top: var(--border); font-size: var(--text-sm); color: var(--muted); }
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { font-weight: 700; color: var(--ink); }

/* ---------- 动效 ---------- */
@keyframes blink { 50% { opacity: 0; } }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
