/* ==========================================================================
   静态游戏大厅 — 子游戏共享样式
   用于 2048、记忆翻翻乐、扫雷；不包含任何第三方资源
   ========================================================================== */

:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #475569;
  --line: #dbe3ef;
  --accent: #4f46e5;
  --accent-dark: #3730a3;
  --accent-soft: #eef2ff;
  --accent-contrast: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 22px 52px -30px rgba(15, 23, 42, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --content: 1060px;
}

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

html {
  line-height: 1.65;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(760px 360px at 90% -80px, var(--accent-soft), transparent 72%),
    var(--bg);
  color: var(--ink);
  font-size: 1rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

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

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  margin: 0;
}

h1, h2, h3, h4, p, ul, ol, dl, dd {
  margin-top: 0;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.02em;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  padding: 10px 16px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* 主题 */
.theme-2048 {
  --accent: #b45309;
  --accent-dark: #92400e;
  --accent-soft: #fffbeb;
  --accent-contrast: #ffffff;
}

.theme-memory {
  --accent: #be185d;
  --accent-dark: #9d174d;
  --accent-soft: #fdf2f8;
  --accent-contrast: #ffffff;
}

.theme-minesweeper {
  --accent: #0369a1;
  --accent-dark: #075985;
  --accent-soft: #f0f9ff;
  --accent-contrast: #ffffff;
}

/* 导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(219, 227, 239, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.nav-link:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.btn-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: #b8c4d8;
  background: #f8fafc;
}

.btn-large {
  min-height: 48px;
  padding: 11px 20px;
  font-size: 1rem;
}

.btn-small {
  min-height: 36px;
  padding: 5px 12px;
  font-size: 0.82rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 面包屑 */
.breadcrumb {
  padding-top: 18px;
  font-size: 0.8rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breadcrumb li + li::before {
  content: "/";
  color: #94a3b8;
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.breadcrumb a:hover {
  color: var(--accent-dark);
}

/* Hero */
.hero {
  padding: 40px 0 54px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
  gap: 44px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
  padding: 4px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  margin-bottom: 16px;
  font-size: clamp(2.1rem, 5.2vw, 3.7rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.hero h1 .accent-text {
  color: var(--accent-dark);
}

.hero-lede {
  max-width: 670px;
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 1.8vw, 1.08rem);
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 650;
}

.hero-facts li {
  display: inline-flex;
  align-items: center;
}

.hero-facts li + li::before {
  content: "";
  width: 4px;
  height: 4px;
  margin: 0 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.hero-facts strong {
  color: var(--ink);
  font-weight: 800;
}

.hero-art {
  display: grid;
  place-items: center;
  min-height: 230px;
}

.hero-art-card {
  width: 100%;
  max-width: 330px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-md);
  transform: rotate(1.4deg);
}

/* 通用区块 */
.section {
  padding: 58px 0;
}

.section-tight {
  padding-top: 34px;
}

.section-header {
  max-width: 730px;
  margin: 0 auto 28px;
  text-align: center;
}

.section-header-left {
  max-width: 730px;
  margin: 0 0 26px;
}

.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-header h2,
.section-header-left h2 {
  margin-bottom: 9px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.section-desc {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* 游戏面板 */
.game-section {
  padding-top: 20px;
}

.game-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0;
}

.hud-item {
  min-width: 86px;
  padding: 9px 12px;
  border: 1px solid #e6ebf3;
  border-radius: 10px;
  background: #f8fafc;
}

.hud-label {
  display: block;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.hud-value {
  display: block;
  color: var(--ink);
  font-size: 1.14rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-status {
  min-height: 24px;
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}

.game-status:empty {
  display: none;
}

.game-help {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
  text-align: center;
}

kbd {
  display: inline-block;
  min-width: 1.65em;
  padding: 0.1em 0.38em;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f8fafc;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.82em;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* 方向键 */
.dpad {
  width: 174px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  margin: 18px auto 0;
}

.dpad-btn {
  width: 54px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.dpad-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dpad-btn[data-dir="up"] { grid-column: 2; grid-row: 1; }
.dpad-btn[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad-btn[data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad-btn[data-dir="right"] { grid-column: 3; grid-row: 2; }

/* 规则 */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rule-num {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.rule-card h3 {
  margin-bottom: 6px;
  font-size: 0.98rem;
}

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

.tips-box {
  margin-top: 30px;
  padding: 24px;
  border: 1px solid #dbe3ef;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
}

.tips-box h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.tips-box p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.tips-box p:last-child {
  margin-bottom: 0;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 9px;
  max-width: 860px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.faq-item summary {
  position: relative;
  padding: 15px 48px 15px 18px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 17px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1;
  transform: translateY(-50%);
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* 页脚 */
.site-footer {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.footer-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0 22px;
}

.footer-brand {
  max-width: 430px;
}

.footer-brand .brand {
  margin-bottom: 6px;
}

.footer-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  max-width: 470px;
  padding-top: 4px;
}

.footer-links a {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0 22px;
  border-top: 1px solid #edf1f7;
  color: var(--muted);
  font-size: 0.74rem;
}

.footer-bottom p {
  margin: 0;
}

.noscript {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #fcd34d;
  border-radius: 9px;
  background: #fffbeb;
  color: #78350f;
  font-size: 0.86rem;
  line-height: 1.6;
}

/* 响应式 */
@media (max-width: 820px) {
  .hero {
    padding-top: 30px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero-art {
    display: none;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 14px;
  }

  .header-inner {
    min-height: 58px;
  }

  .brand {
    font-size: 0.95rem;
  }

  .brand-icon {
    width: 29px;
    height: 29px;
  }

  .nav-link {
    padding: 4px 7px;
    font-size: 0.79rem;
  }

  .header-actions .nav-link:not(.nav-home) {
    display: none;
  }

  .breadcrumb {
    padding-top: 12px;
  }

  .hero {
    padding-bottom: 38px;
  }

  .hero h1 {
    font-size: clamp(2rem, 11vw, 2.85rem);
  }

  .hero-actions .btn {
    flex: 1 1 140px;
  }

  .section {
    padding: 42px 0;
  }

  .game-panel {
    padding: 14px;
    border-radius: 14px;
  }

  .game-toolbar {
    align-items: flex-start;
  }

  .hud {
    width: 100%;
  }

  .hud-item {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 9px;
  }

  .hud-value {
    font-size: 1rem;
  }

  .game-actions {
    width: 100%;
  }

  .game-actions .btn {
    flex: 1 1 0;
  }

  .tips-box {
    padding: 18px;
  }

  .footer-main {
    display: block;
    padding-top: 24px;
  }

  .footer-links {
    margin-top: 18px;
  }

  .footer-bottom {
    display: block;
    line-height: 1.7;
  }

  .footer-bottom p + p {
    margin-top: 4px;
  }
}

@media (max-width: 380px) {
  .header-actions .nav-link {
    font-size: 0.74rem;
  }

  .hero-facts {
    display: grid;
    gap: 3px;
  }

  .hero-facts li + li::before {
    display: 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;
  }
}

@media (forced-colors: active) {
  .btn,
  .game-panel,
  .faq-item,
  .rule-card,
  .hud-item,
  .hero-art-card {
    border: 1px solid ButtonText;
  }

  .dpad-btn {
    border: 1px solid ButtonText;
  }
}
