/* ============================================================
   MOKO GAMES — 共用樣式
   深色主題 (data-theme="dark") / 淺色主題 (data-theme="light")
   ============================================================ */

/* ── CSS 變數 ── */
[data-theme="dark"] {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface2:   #1c2128;
  --border:     #30363d;
  --border2:    #21262d;
  --text:       #e6edf3;
  --text2:      #8b949e;
  --text3:      #484f58;
  --accent:     #4ade80;
  --accent-bg:  rgba(74,222,128,.1);
  --accent-dim: #166534;
  --accent2:    #f59e0b;
  --header-bg:  rgba(13,17,23,.92);
  --shadow:     rgba(0,0,0,.5);
}
[data-theme="light"] {
  --bg:         #f6f8fa;
  --surface:    #ffffff;
  --surface2:   #f0f2f4;
  --border:     #d0d7de;
  --border2:    #e1e4e8;
  --text:       #1f2328;
  --text2:      #57606a;
  --text3:      #9ba3ac;
  --accent:     #1a7f37;
  --accent-bg:  rgba(26,127,55,.08);
  --accent-dim: #d1fae5;
  --accent2:    #b45309;
  --header-bg:  rgba(246,248,250,.95);
  --shadow:     rgba(0,0,0,.12);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border2);
  height: 54px;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: .05em;
  white-space: nowrap;
  text-decoration: none;
}
.logo span { color: var(--text2); }
.logo:hover { text-decoration: none; opacity: .85; }

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-links a {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .82rem;
  color: var(--text2);
  transition: all .18s;
  text-decoration: none;
}
.nav-links a:hover {
  background: var(--surface2);
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 主題切換按鈕 */
.theme-toggle {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  transition: all .18s;
  color: var(--text2);
}
.theme-toggle:hover { background: var(--surface2); border-color: var(--border); }
[data-theme="dark"]  .icon-light { display: none; }
[data-theme="light"] .icon-dark  { display: none; }

/* 遊戲積點 badge */
.points-badge {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  color: var(--accent2);
  cursor: default;
  white-space: nowrap;
}
.pts-label {
  font-size: .7rem;
  color: var(--text3);
  margin-left: 2px;
}

/* 今日積點進度條 */
.today-bar {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.today-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
  transition: width .4s;
}

.username {
  font-size: .8rem;
  color: var(--text2);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: .78rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: .75rem; }
.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { opacity: .88; color: #0d1117; }
.btn-lg { padding: 10px 24px; font-size: .9rem; }

/* ── Main content ── */
main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px;
  width: 100%;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border2);
  padding: 20px;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a { font-size: .8rem; color: var(--text2); }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-size: .75rem; color: var(--text3); }
.site-footer p { font-size: .82rem; color: var(--text2); }

/* ── 遊戲 Grid（首頁用）── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.game-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: all .22s;
  display: block;
}
.game-card:hover {
  border-color: var(--border);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
  text-decoration: none;
}
.game-card.coming { opacity: .4; pointer-events: none; }

.card-thumb {
  width: 100%; aspect-ratio: 16/10;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  position: relative;
}
.badge {
  position: absolute; top: 8px; right: 8px;
  font-size: .62rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px; border-radius: 4px;
}
.badge-hot { background: var(--accent2); color: #0d1117; }
.badge-new { background: var(--accent);  color: #0d1117; }
.badge-soon { background: var(--surface); color: var(--text2); border: 1px solid var(--border); }

.card-body { padding: 12px 14px 14px; }
.card-title { font-size: .9rem; font-weight: 700; margin-bottom: 4px; }
.card-desc  { font-size: .75rem; color: var(--text2); margin-bottom: 10px; line-height: 1.5; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-pts {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem; color: var(--accent2);
}
.card-cat {
  font-size: .68rem; color: var(--text3);
  background: var(--surface2);
  padding: 2px 8px; border-radius: 4px;
}

/* ── Tabs（分類篩選）── */
.tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.tab {
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text2);
  font-size: .8rem; cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
  transition: all .18s;
}
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.active {
  background: var(--accent); color: #0d1117;
  border-color: var(--accent); font-weight: 700;
}

/* ── 積點 Banner ── */
.pts-banner {
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.pts-banner-icon {
  width: 34px; height: 34px; min-width: 34px;
  background: var(--accent-bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.pts-banner-text { font-size: .83rem; color: var(--text2); }
.pts-banner-text strong { color: var(--accent); }

/* ── 遊戲頁面通用 ── */
.game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}
.game-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  letter-spacing: .06em;
}
.game-subtitle {
  font-size: .8rem;
  color: var(--text2);
  margin-bottom: 18px;
}

/* ── 積點獲得 Toast ── */
.pts-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  padding: 12px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
  color: var(--accent);
  box-shadow: 0 4px 16px var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all .35s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
.pts-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── RWD ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .username  { display: none; }
  .pts-label { display: none; }
  .header-inner { gap: 8px; }
  main { padding: 16px 14px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
