/* AIGame41 — TERMINAL, mobile-first: CLI aesthetic, touch-friendly, bottom nav */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg: #0a0a0b;
  --bg-panel: #111113;
  --bg-card: #0e0e10;
  --border: #27272a;
  --text: #e4e4e7;
  --text-dim: #71717a;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.2);
  --accent-hover: #22c55e;
  --font: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --radius: 0;
  --radius-sm: 2px;
  --touch: 44px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body {
  font-family: var(--font);
  font-size: clamp(15px, 2.5vw, 16px);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  letter-spacing: 0.02em;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: calc(56px + var(--safe-bottom));
  overflow-x: hidden;
  max-width: 100vw;
}
@media (min-width: 769px) {
  body { padding-bottom: 0; }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button, input { font-family: var(--font); font-size: inherit; }
button { cursor: pointer; }

/* ========== Header — mobile: logo + search only; desktop: full nav ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.header-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}
@media (min-width: 600px) {
  .header-inner { padding: 12px 20px; gap: 16px; flex-wrap: wrap; }
}
.logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  min-height: var(--touch);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.logo::before { content: '$ '; color: var(--text-dim); font-weight: 400; }
.logo span { color: var(--text); }
.header-nav {
  display: none;
}
@media (min-width: 769px) {
  .header-nav {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 13px;
  }
  .header-nav a {
    padding: 10px 14px;
    min-height: var(--touch);
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--text-dim);
    border: 1px solid transparent;
    transition: color .15s, border-color .15s;
  }
  .header-nav a:hover,
  .header-nav a.active {
    color: var(--accent);
    border-color: var(--border);
    background: var(--bg-card);
  }
}
.search-form {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
  max-width: 260px;
}
@media (max-width: 768px) {
  .search-form { max-width: none; }
}
.search-form input {
  flex: 1;
  min-width: 0;
  width: 0;
  padding: 10px 14px;
  min-height: var(--touch);
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
}
.search-form input::placeholder { color: var(--text-dim); }
.search-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.search-form button {
  flex-shrink: 0;
  padding: 10px 14px;
  min-height: var(--touch);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
}
.search-form button:hover { border-color: var(--accent); color: var(--accent); }

/* ========== Page intro — single line ========== */
.page-intro {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
@media (min-width: 600px) {
  .page-intro { padding: 16px 20px; }
}
.page-intro p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  overflow-wrap: break-word;
}
.page-intro p::before { content: '// '; color: var(--accent); }

/* ========== Ad 广告位 ========== */
.ad-banner {
  background: var(--bg-card);
  padding: 10px 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.ad-banner-inner { min-height: 50px; }
.ad-banner:empty { display: none; }

/* ========== Category — path style, touch scroll ========== */
.cat-bar {
  display: flex;
  gap: 8px;
  padding: 12px 12px 16px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  min-width: 0;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-bar a {
  flex-shrink: 0;
  padding: 10px 14px;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: color .15s, border-color .15s;
  scroll-snap-align: start;
}
.cat-bar a:hover,
.cat-bar a.active {
  color: var(--accent);
  border-color: var(--accent);
}
@media (min-width: 600px) {
  .cat-bar { padding: 12px 20px 20px; }
  .cat-bar a { padding: 8px 14px; min-height: 0; font-size: 12px; }
}

/* ========== Main — mobile padding & safe area ========== */
.main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 28px;
  min-width: 0;
}
@media (min-width: 600px) {
  .main { padding: 0 20px 48px; }
}
.section { margin-bottom: 28px; }
@media (min-width: 600px) { .section { margin-bottom: 36px; } }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-title::before { content: '// '; color: var(--accent); }
.section-link {
  font-size: 12px;
  color: var(--accent);
}
.section-link:hover { text-decoration: underline; }
.section-count {
  font-size: 12px;
  color: var(--text-dim);
}

/* ========== Scroll row — touch-friendly horizontal ========== */
.scroll-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  min-width: 0;
}
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row .game-card {
  flex: 0 0 min(160px, 42vw);
  min-width: 0;
  scroll-snap-align: start;
}
@media (min-width: 600px) {
  .scroll-row { margin: 0 -20px; padding-left: 20px; padding-right: 20px; gap: 16px; }
  .scroll-row .game-card { flex: 0 0 200px; }
}

/* ========== Game card — terminal frame ========== */
.game-card {
  background: var(--bg-card);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.game-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.game-card a { display: block; color: inherit; }
.game-card-thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.game-card-thumb img { width: 100%; height: 100%; object-fit: cover; max-width: 100%; }
.game-card-body { padding: 10px; }
@media (min-width: 600px) {
  .game-card-body { padding: 12px; }
}
.game-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text);
  word-break: break-word;
}
@media (min-width: 600px) {
  .game-card-title { font-size: 13px; }
}
.game-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.game-card-meta::before { content: '['; color: var(--accent); }
.game-card-meta::after { content: ']'; color: var(--accent); }
.game-card-play {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 10px 10px;
  padding: 12px;
  min-height: 44px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  transition: background .15s, color .15s;
}
.game-card-play::before { content: '> '; opacity: 0.8; }
.game-card-play:hover {
  background: transparent;
  color: var(--accent);
}
@media (min-width: 600px) {
  .game-card-play { margin: 0 12px 12px; padding: 10px; min-height: 0; font-size: 12px; }
}

/* ========== Game grid — mobile 2 col, touch-friendly ========== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  min-width: 0;
}
@media (min-width: 480px) {
  .game-grid { gap: 12px; }
}
@media (min-width: 600px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 900px) {
  .game-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
}

/* ========== Page header ========== */
.page-header {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 16px;
  padding: 16px 12px 0;
  min-width: 0;
}
@media (min-width: 600px) {
  .page-header { margin-bottom: 20px; padding: 20px 20px 0; }
}
.page-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}
.page-header h1::before { content: '$ '; color: var(--accent); }
.page-header p { font-size: 12px; color: var(--text-dim); }

/* ========== Detail ========== */
.detail-hero {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 24px;
  min-width: 0;
}
@media (min-width: 600px) {
  .detail-hero { padding: 0 20px 32px; }
}
.detail-hero .thumb {
  width: 100%;
  max-width: 100%;
  max-height: 200px;
  aspect-ratio: 16/9;
  object-fit: cover;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
@media (min-width: 600px) {
  .detail-hero .thumb { max-height: 340px; margin-bottom: 20px; }
}
.detail-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  word-break: break-word;
}
.detail-title::before { content: '> '; color: var(--accent); }
@media (min-width: 600px) {
  .detail-title { font-size: 1.25rem; }
}
.detail-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.detail-meta::before { content: '['; color: var(--accent); }
.detail-meta::after { content: ']'; color: var(--accent); }
.detail-desc {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 24px;
  color: var(--text-dim);
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 20px;
  min-height: var(--touch);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  transition: background .15s, color .15s;
}
@media (min-width: 600px) {
  .btn { padding: 10px 18px; min-height: 0; font-size: 12px; }
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary::before { content: '> '; opacity: 0.9; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline:hover { background: var(--accent-dim); }

/* ========== Content page ========== */
.content-page {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 12px 28px;
  min-width: 0;
}
@media (min-width: 600px) {
  .content-page { padding: 24px 20px 48px; }
}
.content-card {
  background: var(--bg-card);
  padding: 16px 12px;
  border: 1px solid var(--border);
}
@media (min-width: 600px) {
  .content-card { padding: 28px 24px; }
}
.content-card h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.content-card h1::before { content: '// '; color: var(--accent); }
.content-card h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.content-card h2::before { content: '> '; color: var(--accent); }
.content-card p { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 12px; }
.content-card a { color: var(--accent); }
.content-card a:hover { text-decoration: underline; }
.faq-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.faq-q::before { content: 'Q: '; color: var(--accent); }
.faq-a { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.faq-a::before { content: 'A: '; color: var(--text-dim); }

/* ========== Footer ========== */
.site-footer {
  margin-top: 32px;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}
@media (min-width: 600px) {
  .site-footer { margin-top: 48px; padding: 20px 20px; }
}
.footer-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; }
.footer-nav a { color: var(--text-dim); }
.footer-nav a:hover { color: var(--accent); }
.footer-copy { font-size: 11px; color: var(--text-dim); }

/* ========== Bottom nav — mobile only ========== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
@media (max-width: 768px) {
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
  }
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px 12px;
  min-height: 48px;
  font-size: 11px;
  color: var(--text-dim);
  transition: color .15s, background .15s;
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}
.bottom-nav-icon {
  font-size: 20px;
  line-height: 1;
}

/* ========== Empty ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 13px;
}
.empty-state p { margin-bottom: 8px; }
.empty-state p::before { content: '// '; color: var(--accent); }
.empty-state a { color: var(--accent); }
.empty-state a:hover { text-decoration: underline; }
