/* ===== Obby Online 样式表 ===== */
:root {
  --bg: #0b0f1a;
  --bg-alt: #101526;
  --surface: #161d33;
  --surface-2: #1d2745;
  --border: #27314f;
  --text: #e8ecf7;
  --text-dim: #9aa5c0;
  --accent: #4dd0ff;
  --accent-2: #7c5cff;
  --danger: #ff5c7a;
  --ok: #3ddc84;
  --radius: 14px;
  --max-w: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 跳过链接（无障碍） */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #000;
  padding: 8px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* ===== 头部 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.25rem;
}
.brand-mark {
  color: var(--accent);
  letter-spacing: -2px;
  font-size: 1.1rem;
}
.brand-text em { color: var(--accent-2); font-style: normal; }
.main-nav { display: flex; gap: 22px; }
.main-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s;
}
.main-nav a:hover { color: var(--accent); }

/* ===== 首屏 ===== */
.hero { padding: 48px 0 32px; text-align: center; }
.hero-title {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.5px;
}
.hero-title .sub {
  display: inline-block;
  margin-left: 12px;
  font-size: 0.5em;
  color: var(--text-dim);
  font-weight: 500;
  vertical-align: middle;
}
.hero-sub { margin: 0 0 28px; color: var(--text-dim); font-size: 1.05rem; }
.accent { color: var(--accent); font-weight: 600; }

/* ===== 门户（Portal）网格 ===== */
.portal-title {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.portal-sub {
  margin: 0 0 26px;
  color: var(--text-dim);
  font-size: 1rem;
  max-width: 720px;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  font: inherit;
  color: inherit;
  text-align: center;
}
.game-card img {
  width: 100%;
  max-width: 180px;
  height: auto;
  border-radius: 14px;
  display: block;
}
.game-card:hover:not(.game-card-soon),
.game-card:focus-visible:not(.game-card-soon) {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(77, 208, 255, 0.18);
  outline: none;
}
.game-card-title {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
}
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
}
.badge-hot { background: var(--danger); }
.badge-new { background: var(--accent-2); }
.game-card-soon {
  cursor: default;
  justify-content: center;
  min-height: 230px;
  opacity: 0.55;
  border-style: dashed;
}
.soon-mark {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-dim);
}
.btn-back {
  margin-bottom: 18px;
}

/* ===== 迷你游戏视图 ===== */
.mini-view { text-align: center; }
.mini-view .hero-title { margin-bottom: 10px; }
.mini-shell { max-width: 960px; }
.mini-view canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0a0e18;
  outline: none;
  cursor: pointer;
}
.howto-inline {
  margin-top: 30px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.howto-inline h2 { margin-top: 0; font-size: 1.4rem; }
.howto-inline .lead { font-size: 1rem; margin-bottom: 22px; }

/* ===== 游戏外壳 ===== */
.game-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 960px;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.game-toolbar {
  display: flex;
  gap: 28px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.game-toolbar .stat b { color: var(--text); margin-left: 4px; font-variant-numeric: tabular-nums; }

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0a0e18;
  outline: none;
  cursor: crosshair;
  image-rendering: auto;
}

.game-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: #243054; border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; }

.game-hint { margin: 14px 0 0; color: var(--text-dim); font-size: 0.85rem; }

/* ===== 正文内容区 ===== */
.content { padding: 24px 0 0; }
.section { padding: 56px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section h2 {
  margin: 0 0 16px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.3px;
}
.section h3 { margin: 28px 0 12px; font-size: 1.2rem; }
.lead { font-size: 1.08rem; color: var(--text-dim); max-width: 780px; margin: 0 0 24px; }
.lead b { color: var(--text); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card h3 { margin: 0 0 10px; font-size: 1.1rem; color: var(--accent); }
.card p { margin: 0; color: var(--text-dim); font-size: 0.97rem; }

/* 按键表 */
.key-table {
  width: 100%;
  max-width: 560px;
  border-collapse: collapse;
  margin-top: 12px;
}
.key-table th, .key-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.key-table th { color: var(--text-dim); font-weight: 600; font-size: 0.9rem; }
.key-table td { font-variant-numeric: tabular-nums; }

/* FAQ */
.faq-list { max-width: 780px; }
.faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 0 20px;
}
.faq summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  list-style: none;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 400;
  transition: transform 0.2s;
}
.faq[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq p { margin: 0 0 16px; color: var(--text-dim); }

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 40px 0;
  text-align: center;
  color: var(--text-dim);
}
.footer-brand { font-size: 1.2rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.footer-brand em { color: var(--accent-2); font-style: normal; }
.site-footer p { margin: 4px 0; font-size: 0.9rem; }
.footer-links { margin: 12px 0 !important; }
.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--accent); }
.footer-copy { opacity: 0.7; }

/* 无障碍：视觉隐藏但可被屏幕阅读器读取 */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== 排行榜弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.modal-head h3 { margin: 0; font-size: 1.3rem; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-sub { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 16px; }

.board-table-wrap { overflow-x: auto; }
.board-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.board-table th, .board-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.board-table th { color: var(--text-dim); font-weight: 600; font-size: 0.85rem; }
.board-table tbody tr:first-child td { color: var(--accent); font-weight: 600; }
.board-empty { text-align: center; color: var(--text-dim); padding: 24px 0; }
.board-note { margin: 16px 0 0; color: var(--accent); font-size: 0.9rem; }

/* ===== 响应式 ===== */
@media (max-width: 800px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main-nav { gap: 14px; }
  .main-nav a { font-size: 0.85rem; }
  .game-toolbar { gap: 16px; padding: 10px 14px; }
  .game-controls { padding: 12px 14px; }
  .section { padding: 40px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
