/* ===== CSS Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:    #0D1B19;
  --bg-dark:    #17332E;
  --bg-mid:     #2B5747;
  --accent:     #FFA500;
  --accent-soft:#FFD580;
  --text:       #FFFFFF;
  --text-muted: rgba(255,255,255,0.6);
  --card-bg:    rgba(255,255,255,0.08);
  --card-border:rgba(255,255,255,0.15);
  --radius:     12px;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== Header ===== */
.site-header {
  background: linear-gradient(180deg, var(--bg-dark) 0%, transparent 100%);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-img {
  height: 36px;
  width: auto;
}

.logo span { color: var(--accent); }

.site-nav { display: flex; gap: 8px; }

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--card-bg);
}

/* ===== Search & Filter ===== */
.search-section {
  padding: 6px 0;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--card-border);
}

.search-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  width: 160px;
  flex-shrink: 0;
}

.search-box input {
  width: 100%;
  padding: 4px 8px 4px 26px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 11px;
  outline: none;
  transition: border-color var(--transition);
}

.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { border-color: var(--accent); }

.search-box .search-icon {
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 11px;
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
}

.filter-tab:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }

.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

/* ===== Games Grid ===== */
.games-section { padding: 40px 0 80px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
}

.game-count {
  font-size: 13px;
  color: var(--text-muted);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

/* ===== Game Card ===== */
.game-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  display: block;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,165,0,0.4);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,165,0,0.1);
}

.game-thumb {
  aspect-ratio: 1/1;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.game-thumb .thumb-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  padding: 10%;
}

.game-thumb img { width: 100%; height: 100%; object-fit: cover; }

.game-thumb .thumb-placeholder { font-size: 48px; }

.badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-new { background: var(--accent); color: #000; }
.badge-featured { background: #7C3AED; color: #fff; }
.badge-online  { background: #0EA5E9; color: #fff; }   /* Online PvP — board games */
.badge-ai      { background: #8B5CF6; color: #fff; }   /* vs AI — card games */
.badge-solo    { background: #64748B; color: #fff; }   /* Solo — klondike etc */
.badge-pvp     { background: #E11D48; color: #fff; }   /* Local PvP */

.game-info { padding: 14px; }

.game-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.game-category {
  font-size: 12px;
  color: var(--text-muted);
}

.game-play-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), opacity var(--transition);
}

.game-play-btn:hover { background: var(--accent-soft); }

.game-play-btn.coming-soon {
  background: var(--card-bg);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  cursor: not-allowed;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand p { font-size: 13px; line-height: 1.7; max-width: 340px; color: var(--text-muted); }

.footer-col h4 { color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-muted); font-size: 13px; transition: color var(--transition); }
.footer-col a:hover { color: var(--text); }

/* Footer app cards */
.footer-apps h4 { color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.footer-app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.footer-app-card {
  display: flex;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px;
}
.footer-app-icon-img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  flex-shrink: 0;
  object-fit: cover;
}
.footer-app-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.footer-app-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px; }
.footer-app-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}
.store-badge:hover { opacity: 0.8; }
.android-badge { background: #01875f; color: #fff; }
.ios-badge { background: #0071e3; color: #fff; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--card-border);
  padding-top: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== Ad placeholder ===== */
.ad-banner {
  background: var(--card-bg);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 24px 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-app-grid { grid-template-columns: 1fr 1fr; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .site-nav { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-app-grid { grid-template-columns: 1fr; }
}

/* ===== Game Page Specific ===== */
.game-page-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  padding: 32px 0 64px;
  align-items: start;
}

.game-embed-container {
  aspect-ratio: 9/16;
  max-height: 80vh;
  background: var(--bg-dark);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
  position: relative;
  margin: 0 auto;
  width: fit-content;
}

.game-embed-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.game-sidebar { position: sticky; top: 80px; }


.game-sidebar h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.game-sidebar .category-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255,165,0,0.15);
  border: 1px solid rgba(255,165,0,0.3);
  border-radius: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.game-sidebar .description {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.android-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.android-cta:hover { border-color: rgba(255,165,0,0.4); }
.android-cta .cta-icon { font-size: 28px; flex-shrink: 0; }
.android-cta .cta-text strong { display: block; font-size: 14px; }
.android-cta .cta-text span { font-size: 12px; color: var(--text-muted); }

.ios-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  transition: border-color var(--transition);
}
.ios-cta:hover { border-color: rgba(100,180,255,0.4); }
.ios-cta .cta-icon { font-size: 28px; flex-shrink: 0; }
.ios-cta .cta-text strong { display: block; font-size: 14px; }
.ios-cta .cta-text span { font-size: 12px; color: var(--text-muted); }

.related-games h3 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.related-list { display: flex; flex-direction: column; gap: 10px; }

.related-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  transition: border-color var(--transition);
}

.related-item:hover { border-color: rgba(255,165,0,0.3); }
.related-item .rel-icon { font-size: 24px; flex-shrink: 0; }
.related-item .rel-name { font-size: 13px; font-weight: 500; }
.related-item .rel-cat { font-size: 11px; color: var(--text-muted); }

@media (max-width: 900px) {
  .game-page-layout { grid-template-columns: 1fr; }
  .game-sidebar { position: static; }
}
