/* ============================================
   Top10Games — Dark Theme Stylesheet
   ============================================ */

/* ---------- Global Reset & Baseline ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0f0f14;
  --bg-secondary: #1a1a24;
  --bg-card: #1e1e2c;
  --bg-card-hover: #2a2a3c;
  --border-color: #2d2d40;
  --text-primary: #ffffff;
  --text-secondary: #b0b0c0;
  --text-muted: #70708a;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --rank-gold: #f59e0b;
  --rank-silver: #94a3b8;
  --rank-bronze: #d97706;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Scrollbar (Dark Theme) ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: #3a3a52;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #4a4a6a;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

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

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}
.logo:hover { color: var(--accent); }

.header-nav {
  display: flex;
  gap: 20px;
}
.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition);
  white-space: nowrap;
}
.header-nav a:hover { color: var(--accent-hover); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* ---------- Top 10 Sections ---------- */
.top10-section {
  margin-bottom: 48px;
  scroll-margin-top: 80px;
}

.section-header {
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ---------- Horizontal Scrolling Cards ---------- */
.top10-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 16px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #3a3a52 var(--bg-secondary);
}

.top10-scroll::-webkit-scrollbar {
  height: 8px;
}
.top10-scroll::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}
.top10-scroll::-webkit-scrollbar-thumb {
  background: #3a3a52;
  border-radius: 4px;
}
.top10-scroll::-webkit-scrollbar-thumb:hover {
  background: #4a4a6a;
}

/* ---------- Game Card ---------- */
.game-card {
  flex: 0 0 200px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.rank {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  z-index: 2;
  color: #fff;
  border: 2px solid transparent;
}
.game-card:nth-child(1) .rank { background: var(--rank-gold); color: #000; border-color: #fff; }
.game-card:nth-child(2) .rank { background: var(--rank-silver); color: #000; border-color: #fff; }
.game-card:nth-child(3) .rank { background: var(--rank-bronze); color: #000; border-color: #fff; }

.thumb-wrap {
  position: relative;
  width: 100%;
  height: 150px;
  overflow: hidden;
  background: #0a0a10;
}
.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.game-card:hover .thumb-wrap img {
  transform: scale(1.05);
}

.card-info {
  padding: 12px;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.card-category {
  font-size: 0.75rem;
  color: var(--accent-hover);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.empty {
  color: var(--text-muted);
  padding: 20px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  margin-top: 48px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.site-footer .footer-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  justify-content: center;
}
.site-footer .footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}
.site-footer .footer-links a:hover {
  color: var(--accent-hover);
}
.site-footer .footer-links .middot {
  color: var(--border-color);
}

/* ---------- Legal Pages ---------- */
.legal-page {
  max-width: 760px;
  padding: 40px 20px 60px;
}
.legal-page h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}
.legal-page h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.legal-page p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
}
.legal-page ul {
  color: var(--text-secondary);
  line-height: 1.75;
  padding-left: 20px;
  margin-bottom: 12px;
}
.legal-page ul li {
  margin-bottom: 4px;
}
.legal-page a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: color var(--transition);
}
.legal-page a:hover {
  text-decoration: underline;
}
.legal-page strong {
  color: var(--text-primary);
}

/* ============================================
   Game Detail Page
   ============================================ */
.game-detail {
  padding-top: 24px;
}

.breadcrumb {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: color var(--transition);
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; }

.game-detail h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ---------- Game iframe ---------- */
.game-frame-wrapper {
  width: 100%;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.game-frame-wrapper iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.play-fullscreen {
  display: block;
  margin: 0 auto 32px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.play-fullscreen:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.play-fullscreen:active {
  transform: translateY(0);
}

/* ---------- Walkthrough Video ---------- */
.video-ad-wrapper {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 32px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
}
.video-ad-wrapper iframe {
  display: block;
  width: 100%;
  height: 480px;
  border: 0;
}

/* Game Info Blocks */
.game-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.info-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}
.info-block h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.info-block p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}
.info-block h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-list {
  list-style: none;
  font-size: 0.92rem;
}
.detail-list li {
  color: var(--text-secondary);
  padding: 4px 0;
}
.detail-list li strong {
  color: var(--text-primary);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: border-color var(--transition), color var(--transition);
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* ---------- Related Games ---------- */
.related-section {
  margin-top: 32px;
}
.related-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.related-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  transition: transform var(--transition), border-color var(--transition);
}
.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.related-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.related-info {
  padding: 8px 10px;
}
.related-info h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-info span {
  font-size: 0.7rem;
  color: var(--accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .header-nav {
    display: none;
  }
  .game-card {
    flex: 0 0 160px;
  }
  .thumb-wrap {
    height: 110px;
  }
  .rank {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }
  .hero {
    padding: 32px 0 24px;
  }
  .section-header h2 {
    font-size: 1.15rem;
  }
  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  .game-info {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .game-card {
    flex: 0 0 140px;
  }
  .thumb-wrap {
    height: 95px;
  }
  .card-title {
    font-size: 0.85rem;
  }
}
