/* Teen Patti All Game - Branded CSS - Mobile First */
:root {
  --tp-green: #0d3b2c;
  --tp-green-light: #1a5c44;
  --tp-gold: #c9a227;
  --tp-gold-light: #e8c547;
  --tp-cream: #f5f0e1;
  --tp-white: #fff;
  --tp-shadow: 0 4px 14px rgba(0,0,0,0.2);
  --tp-radius: 12px;
  --tp-font: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--tp-font);
  background: var(--tp-cream);
  color: #2c2c2c;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--tp-green) 0%, var(--tp-green-light) 100%);
  color: var(--tp-white);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--tp-shadow);
}
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--tp-gold-light);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.logo:hover { color: var(--tp-white); }
.header-search { flex: 1; min-width: 180px; display: flex; gap: 8px; }
.header-search input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
}
.header-search button {
  padding: 10px 18px;
  background: var(--tp-gold);
  color: var(--tp-green);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.header-search button:hover { background: var(--tp-gold-light); }
.main-nav { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.main-nav a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
}
.main-nav a:hover { background: rgba(255,255,255,0.15); color: var(--tp-white); }

/* Main */
.main-content { flex: 1; padding: 24px 0; }

/* Page title */
.page-title { font-size: 1.75rem; color: var(--tp-green); margin: 0 0 20px; }

/* Game grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}
.game-card {
  background: var(--tp-white);
  border-radius: var(--tp-radius);
  overflow: hidden;
  box-shadow: var(--tp-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.game-card-icon {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
  background: var(--tp-green-light);
}
.game-card-name { padding: 12px; font-weight: 600; font-size: 1rem; color: var(--tp-green); }

/* Banners on home */
.banners-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.banners-row .ad-slot { min-height: 90px; display: flex; align-items: center; justify-content: center; background: #eee; border-radius: var(--tp-radius); overflow: hidden; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 28px 0; }
.pagination a, .pagination span {
  padding: 10px 16px;
  background: var(--tp-white);
  border-radius: 8px;
  text-decoration: none;
  color: var(--tp-green);
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.pagination a:hover { background: var(--tp-green); color: var(--tp-white); }
.pagination .current { background: var(--tp-gold); color: var(--tp-green); pointer-events: none; }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* Game single page */
.game-single .container { max-width: 900px; }
.game-header { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.game-header-icon { width: 120px; height: 120px; object-fit: cover; border-radius: var(--tp-radius); box-shadow: var(--tp-shadow); flex-shrink: 0; }
.game-header-text h1 { margin: 0 0 8px; font-size: 1.75rem; color: var(--tp-green); }
.game-header-text .game-meta { color: #666; font-size: 0.9rem; }
.game-article { background: var(--tp-white); padding: 24px; border-radius: var(--tp-radius); margin-bottom: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.game-article h2 { font-size: 1.25rem; color: var(--tp-green); margin-top: 1.5em; margin-bottom: 0.5em; }
.game-article p { margin: 0 0 1em; }
.game-article img { max-width: 100%; height: auto; border-radius: 8px; }

/* Generate link / Download */
.link-box {
  background: linear-gradient(135deg, var(--tp-green) 0%, var(--tp-green-light) 100%);
  color: var(--tp-white);
  padding: 24px;
  border-radius: var(--tp-radius);
  margin-bottom: 24px;
  text-align: center;
}
.link-box .timer-msg { font-size: 1.1rem; margin-bottom: 12px; }
.link-box .btn-download {
  display: inline-block;
  padding: 14px 32px;
  background: var(--tp-gold);
  color: var(--tp-green);
  text-decoration: none;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}
.link-box .btn-download:hover { background: var(--tp-gold-light); }
.link-box .btn-download.hidden { display: none; }
.link-box .btn-generate { display: inline-block; padding: 14px 32px; background: var(--tp-gold); color: var(--tp-green); border: none; border-radius: 8px; font-weight: 700; font-size: 1.1rem; cursor: pointer; transition: background 0.2s; }
.link-box .btn-generate:hover { background: var(--tp-gold-light); }
.link-box .btn-generate.hidden { display: none; }
.link-box .timer-count { font-size: 1.5rem; font-weight: 700; color: var(--tp-gold-light); }

/* Comments */
.comments-section { margin-top: 32px; }
.comments-section h2 { font-size: 1.35rem; color: var(--tp-green); margin-bottom: 16px; }
.comment-form { background: var(--tp-white); padding: 20px; border-radius: var(--tp-radius); margin-bottom: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.comment-form label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--tp-green); }
.comment-form input[type="text"] { width: 100%; max-width: 320px; padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 12px; }
.comment-form textarea { width: 100%; min-height: 100px; padding: 12px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 12px; resize: vertical; }
.comment-form button { padding: 10px 24px; background: var(--tp-green); color: var(--tp-white); border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.comment-form button:hover { background: var(--tp-green-light); }
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item {
  background: var(--tp-white);
  padding: 16px;
  border-radius: var(--tp-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid var(--tp-gold);
}
.comment-item .comment-name { font-weight: 700; color: var(--tp-green); margin-bottom: 4px; }
.comment-item .comment-date { font-size: 0.85rem; color: #888; margin-bottom: 8px; }
.comment-item .comment-text { margin: 0; }

/* Related games */
.related-games { margin-top: 32px; }
.related-games h2 { font-size: 1.35rem; color: var(--tp-green); margin-bottom: 16px; }
.related-games .games-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* Footer */
.site-footer { background: var(--tp-green); color: var(--tp-white); padding: 32px 0 20px; margin-top: auto; }
.site-footer a { color: var(--tp-gold-light); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-ads { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.footer-ads .ad-slot { min-height: 80px; background: rgba(255,255,255,0.08); border-radius: 8px; overflow: hidden; }
.footer-search h3 { font-size: 1.1rem; margin-bottom: 12px; color: var(--tp-gold-light); }
.last-searches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.last-searches a { padding: 6px 12px; background: rgba(255,255,255,0.1); border-radius: 6px; font-size: 0.9rem; }
.last-searches a:hover { background: rgba(255,255,255,0.2); }
.no-searches { opacity: 0.8; font-size: 0.9rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.footer-nav a { font-size: 0.95rem; }
.copyright { margin: 0; font-size: 0.9rem; opacity: 0.9; }

/* Popup ad */
.popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; transition: opacity 0.3s; }
.popup-overlay[aria-hidden="true"] { opacity: 0; pointer-events: none; }
.popup-ad-box { background: var(--tp-white); border-radius: var(--tp-radius); max-width: 480px; width: 100%; position: relative; padding: 16px; }
.popup-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #666; line-height: 1; }
.popup-close:hover { color: #000; }
.popup-ad-content { min-height: 60px; }

/* Category page */
.cat-desc { background: var(--tp-white); padding: 16px 20px; border-radius: var(--tp-radius); margin-bottom: 24px; color: #444; }

/* Search page */
.search-query { font-size: 1.1rem; color: #666; margin-bottom: 16px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: #666; }
.empty-state a { color: var(--tp-green); font-weight: 600; }

/* Tablet+ */
@media (min-width: 768px) {
  .site-header .container { flex-wrap: nowrap; }
  .main-nav { width: auto; margin-top: 0; margin-left: auto; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .game-header-icon { width: 160px; height: 160px; }
  .game-header-text h1 { font-size: 2rem; }
}

/* Desktop */
@media (min-width: 1024px) {
  .container { padding: 0 24px; }
  .main-content { padding: 32px 0; }
}
