/* ============================================
   Casivu.top - H5 Game Portal Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
  --clr-bg-primary: #0f1117;
  --clr-bg-secondary: #1a1d27;
  --clr-bg-card: #22263a;
  --clr-bg-card-hover: #2a2f45;
  --clr-accent: #6c5ce7;
  --clr-accent-light: #a29bfe;
  --clr-accent-glow: rgba(108, 92, 231, 0.35);
  --clr-text-primary: #eef0f6;
  --clr-text-secondary: #9ca3b8;
  --clr-text-muted: #6b7280;
  --clr-border: #2d3148;
  --clr-success: #00b894;
  --clr-warning: #fdcb6e;
  --clr-danger: #e17055;
  --clr-header-bg: rgba(15, 17, 23, 0.92);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px var(--clr-accent-glow);
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max-width: 1280px;
  --header-height: 68px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--clr-bg-primary);
  color: var(--clr-text-primary);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--clr-accent-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: #fff; }

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

/* --- Layout Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--clr-header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--clr-border);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--clr-accent);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--clr-text-primary);
  letter-spacing: -0.5px;
}
.brand-title span { color: var(--clr-accent-light); }

/* Navigation */
.main-nav { display: flex; align-items: center; gap: 6px; }

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--clr-text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: var(--clr-bg-card);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--clr-text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 6px;
}

/* --- Search Bar --- */
.search-wrapper {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border-radius: 50px;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-secondary);
  color: var(--clr-text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-input:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px var(--clr-accent-glow);
}
.search-input::placeholder { color: var(--clr-text-muted); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

/* --- Hero Section --- */
.hero-section {
  padding: 60px 0 40px;
  text-align: center;
  background: linear-gradient(180deg, var(--clr-bg-secondary) 0%, var(--clr-bg-primary) 100%);
}

.hero-heading {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}
.hero-heading .highlight { color: var(--clr-accent-light); }

.hero-subtext {
  font-size: 1.05rem;
  color: var(--clr-text-secondary);
  max-width: 600px;
  margin: 0 auto 28px;
}

/* --- Category Pills --- */
.category-bar {
  padding: 20px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }

.category-pills {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.cat-pill {
  padding: 8px 20px;
  border-radius: 50px;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-secondary);
  color: var(--clr-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}
.cat-pill:hover,
.cat-pill.active {
  background: var(--clr-accent);
  color: #fff;
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-glow);
}

/* --- Section Titles --- */
.section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading .icon { font-size: 1.3rem; }

/* --- Game Grid --- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.game-card {
  background: var(--clr-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  border: 1px solid transparent;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--clr-accent);
}

.game-card-thumb {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--clr-bg-secondary);
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}
.game-card:hover .game-card-thumb img {
  transform: scale(1.06);
}

.game-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 50px;
  background: var(--clr-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-card-body { padding: 14px; }

.game-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card-title a { color: var(--clr-text-primary); }
.game-card-title a:hover { color: var(--clr-accent-light); }

.game-card-desc {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.game-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--clr-border);
  font-size: 0.72rem;
  color: var(--clr-text-muted);
}

/* --- Game Detail Page --- */
.game-detail-hero {
  padding: 40px 0 30px;
}

.game-detail-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Game embed styles are defined in the Fullscreen section above */

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-info-card {
  background: var(--clr-bg-card);
  border-radius: var(--radius-md);
  padding: 22px;
  border: 1px solid var(--clr-border);
}

.game-info-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.game-info-list { display: flex; flex-direction: column; gap: 10px; }

.game-info-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}
.game-info-label { color: var(--clr-text-muted); }
.game-info-value { color: var(--clr-text-primary); font-weight: 500; }

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.game-tag {
  padding: 4px 12px;
  border-radius: 50px;
  background: var(--clr-bg-secondary);
  color: var(--clr-text-secondary);
  font-size: 0.78rem;
  border: 1px solid var(--clr-border);
}

/* Game Content Area */
.game-content-section {
  padding: 30px 0 50px;
}

.game-content-block {
  background: var(--clr-bg-card);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid var(--clr-border);
}

.game-content-block h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--clr-border);
}

.game-content-block p {
  color: var(--clr-text-secondary);
  font-size: 0.92rem;
  line-height: 1.75;
  margin-bottom: 14px;
}
.game-content-block p:last-child { margin-bottom: 0; }

.game-content-block ul,
.game-content-block ol {
  padding-left: 22px;
  margin-bottom: 14px;
}
.game-content-block li {
  color: var(--clr-text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 6px;
  list-style: disc;
}

/* --- Breadcrumb --- */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  padding: 16px 0;
  flex-wrap: wrap;
}
.breadcrumb-nav a { color: var(--clr-text-secondary); }
.breadcrumb-nav a:hover { color: var(--clr-accent-light); }
.breadcrumb-sep { color: var(--clr-text-muted); }

/* --- Category Page --- */
.category-hero {
  padding: 40px 0 20px;
  text-align: center;
}
.category-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.category-hero p {
  color: var(--clr-text-secondary);
  font-size: 1rem;
}

/* --- Static Pages --- */
.static-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.static-page h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--clr-border);
}

.static-page h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 30px 0 14px;
  color: var(--clr-text-primary);
}

.static-page h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 20px 0 10px;
}

.static-page p {
  color: var(--clr-text-secondary);
  font-size: 0.92rem;
  line-height: 1.8;
  margin-bottom: 16px;
}

.static-page ul,
.static-page ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.static-page li {
  color: var(--clr-text-secondary);
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 8px;
  list-style: disc;
}

.static-page a { color: var(--clr-accent-light); }
.static-page a:hover { color: #fff; }

/* --- FAQ --- */
.faq-list { display: flex; flex-direction: column; gap: 12px; }

.faq-item {
  background: var(--clr-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 18px 22px;
  background: none;
  border: none;
  color: var(--clr-text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition-fast);
}
.faq-question:hover { background: var(--clr-bg-card-hover); }
.faq-question .arrow {
  transition: transform var(--transition-fast);
  font-size: 0.8rem;
}
.faq-item.open .faq-question .arrow { transform: rotate(180deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 22px 18px;
}
.faq-answer p {
  color: var(--clr-text-secondary);
  font-size: 0.88rem;
  line-height: 1.75;
}

/* --- 404 Page --- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  padding: 40px 20px;
}

.error-code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--clr-accent);
  line-height: 1;
  margin-bottom: 10px;
}

.error-message {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.error-subtext {
  color: var(--clr-text-secondary);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.btn-primary {
  display: inline-block;
  padding: 12px 32px;
  border-radius: 50px;
  background: var(--clr-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--clr-accent-light);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* --- Footer --- */
.site-footer {
  background: var(--clr-bg-secondary);
  border-top: 1px solid var(--clr-border);
  padding: 40px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 30px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.footer-brand-desc {
  color: var(--clr-text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
  margin-top: 12px;
}

.footer-col-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--clr-text-primary);
}

.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a {
  color: var(--clr-text-muted);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}
.footer-links a:hover { color: var(--clr-accent-light); }

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  margin-top: 30px;
  border-top: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  font-size: 0.8rem;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 30px 0 50px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-card);
  color: var(--clr-text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}
.page-btn:hover,
.page-btn.active {
  background: var(--clr-accent);
  color: #fff;
  border-color: var(--clr-accent);
}

/* --- Fullscreen Button --- */
.game-fullscreen-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--clr-bg-secondary);
  border: 1px solid var(--clr-border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 16px;
}

.game-fullscreen-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--clr-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.btn-fullscreen {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-card);
  color: var(--clr-text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-fullscreen:hover {
  background: var(--clr-accent);
  color: #fff;
  border-color: var(--clr-accent);
}
.btn-fullscreen .fs-icon { font-size: 1rem; }

.game-embed-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 75vh;
  background: #000;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--clr-border);
  border-top: none;
}

.game-embed-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Fullscreen mode */
.game-embed-wrapper.fs-active {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  border-radius: 0;
  border: none;
  aspect-ratio: unset;
}

.fs-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99998;
  background: rgba(0,0,0,0.85);
}
.fs-overlay.visible { display: block; }

.btn-fs-exit {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100000;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--clr-accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-fs-exit.visible { display: block; }
.btn-fs-exit:hover { background: var(--clr-accent-light); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--clr-bg-secondary);
    border-bottom: 1px solid var(--clr-border);
    padding: 12px 20px;
    gap: 4px;
    z-index: 1001;
  }
  .nav-toggle { display: block; }
  .search-wrapper { max-width: 180px; }
  .hero-heading { font-size: 1.6rem; }
  .hero-subtext { font-size: 0.92rem; }
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .game-fullscreen-bar { padding: 8px 12px; }
  .game-fullscreen-title { font-size: 0.82rem; }
  .btn-fullscreen { padding: 6px 10px; font-size: 0.75rem; }
  .game-embed-wrapper { aspect-ratio: 4/3; max-height: 65vh; }
  .static-page { padding: 24px 16px 40px; }
  .static-page h1 { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  :root { --header-height: 56px; }
  .brand-icon { width: 34px; height: 34px; border-radius: 8px; }
  .brand-title { font-size: 1.15rem; }
  .header-inner { padding: 0 12px; }
  .search-wrapper { display: none; }
  .hero-section { padding: 36px 0 24px; }
  .hero-heading { font-size: 1.3rem; }
  .hero-subtext { font-size: 0.85rem; padding: 0 8px; }
  .category-pills { justify-content: flex-start; flex-wrap: nowrap; }
  .cat-pill { padding: 6px 14px; font-size: 0.78rem; }
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .game-card-thumb { aspect-ratio: 4/3; }
  .game-card-body { padding: 8px; }
  .game-card-title { font-size: 0.78rem; }
  .game-card-desc { font-size: 0.68rem; -webkit-line-clamp: 2; }
  .game-card-meta { font-size: 0.65rem; }
  .game-card-badge { font-size: 0.62rem; padding: 2px 7px; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
  .section-heading { font-size: 1.2rem; }
  .game-detail-hero { padding: 20px 0 16px; }
  .game-embed-wrapper { aspect-ratio: 4/3; max-height: 50vh; }
  .game-content-block { padding: 18px; }
  .game-content-block h2 { font-size: 1.05rem; }
  .game-content-block p { font-size: 0.85rem; }
  .btn-fs-exit { top: 10px; right: 10px; padding: 8px 14px; font-size: 0.8rem; }
  .error-code { font-size: 4rem; }
  .error-message { font-size: 1.1rem; }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
