:root {
  --bg: #0b0f14;
  --bg-elevated: #121821;
  --bg-card: #151d28;
  --bg-soft: #1a2431;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #9fb0c3;
  --accent: #38d39f;
  --accent-hover: #2cbc8a;
  --danger: #ff5f5f;
  --danger-hover: #e04a4a;
  --warning: #ffa500;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: 1320px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #0b0f14;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(56, 211, 159, 0.08), transparent 30%),
    linear-gradient(180deg, #0b0f14 0%, #0d1219 100%);
  background-color: #0b0f14;
  color: var(--text);
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  font-family: inherit;
}

main {
  display: block;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #0f141c;
}

::-webkit-scrollbar-thumb {
  background: #233041;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2b3b50;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
}

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

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 78px;
}

.logo a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
}

.search-wrap {
  display: flex;
  justify-content: center;
}

.search-bar {
  width: 100%;
  max-width: 620px;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 18px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.search-bar::placeholder {
  color: #7f90a4;
}

.search-bar:focus {
  border-color: rgba(56, 211, 159, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.browse-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  transition: 0.2s ease;
}

.browse-link:hover {
  background: rgba(255, 255, 255, 0.09);
}

.dropdown {
  position: relative;
}

.menu-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  transition: 0.2s ease;
}

.menu-button:hover {
  background: rgba(255, 255, 255, 0.09);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 220px;
  background: #111923;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  transition: 0.2s ease;
}

.dropdown-menu a:hover {
  background: rgba(56, 211, 159, 0.12);
  color: #dffaf1;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Hero */
.hero {
  padding: 34px 0 22px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}

.hero-grid-single {
  grid-template-columns: 1fr;
}

.hero-main {
  padding: 32px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(56, 211, 159, 0.12), rgba(56, 211, 159, 0) 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(56, 211, 159, 0.12);
  border: 1px solid rgba(56, 211, 159, 0.18);
  color: #c8f6e6;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero p {
  margin: 0;
  max-width: 700px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  transition: 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #07110d;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
}

/* Ads */
.ad-slot {
  width: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
}

.ad-ready {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
}

.ad-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ea0b4;
  font-weight: 700;
  z-index: 2;
}

.ad-inner {
  width: 100%;
  min-height: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7e8da0;
  text-align: center;
  font-size: 0.85rem;
  padding-top: 18px;
}

.top-banner {
  min-height: 110px;
  margin: 18px 0 26px;
}

.inline-banner {
  min-height: 120px;
  margin: 8px 0 28px;
}

.sidebar-ad {
  min-height: 280px;
}

.sidebar-ad-small {
  min-height: 180px;
}

/* Main layout */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
  padding-bottom: 50px;
}

.content-column {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 98px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.sidebar-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.sidebar-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

/* Sections */
.game-section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.section-link {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  transition: 0.2s ease;
}

.section-link:hover {
  color: var(--text);
}

.section-toggle-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.game-card {
  position: relative;
  min-height: 250px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease;
  isolation: isolate;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 211, 159, 0.22);
}

.game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
}

.game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 8, 12, 0.12) 0%, rgba(5, 8, 12, 0.4) 42%, rgba(5, 8, 12, 0.92) 100%);
  z-index: 1;
}

.game-card-content {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.game-description {
  margin: 0;
  color: #c0ccda;
  font-size: 0.93rem;
  line-height: 1.5;
  max-width: 92%;
}

.play-button {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: 0.2s ease;
  cursor: pointer;
}

.play-button:hover {
  background: var(--accent);
  color: #07110d;
}

.see-more-card {
  min-height: 250px;
  border-radius: 20px;
  border: 1px dashed rgba(56, 211, 159, 0.28);
  background:
    linear-gradient(180deg, rgba(56, 211, 159, 0.08), rgba(255, 255, 255, 0.02));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 22px;
  transition: 0.25s ease;
  box-shadow: var(--shadow);
}

.see-more-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 211, 159, 0.45);
  background:
    linear-gradient(180deg, rgba(56, 211, 159, 0.12), rgba(255, 255, 255, 0.03));
}

.see-more-label {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.see-more-subtext {
  font-size: 0.95rem;
  color: var(--muted);
}

.see-more-button {
  cursor: pointer;
  text-align: left;
  color: inherit;
}

/* Page intro */
.page-top {
  padding-top: 28px;
  padding-bottom: 22px;
}

.page-intro-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}

.page-intro-card h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.page-intro-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 780px;
}

/* All games */
.all-games-grid .game-card {
  min-height: 220px;
}

/* Settings pages */
.settings-page {
  padding-bottom: 50px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
  padding-bottom: 40px;
}

.settings-main {
  min-width: 0;
}

.settings-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 98px;
}

.modern-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.settings-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
}

.settings-section {
  padding: 22px;
  margin-bottom: 20px;
}

.settings-section h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.settings-section .description {
  margin: 0 0 18px;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

.input-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.input-group input {
  flex: 1 1 220px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: white;
  font-size: 1rem;
  outline: none;
  transition: 0.2s ease;
}

.input-group input::placeholder {
  color: #7f90a4;
}

.input-group input:focus {
  border-color: rgba(56, 211, 159, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.buttons {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.save-button,
.reset-button {
  min-height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.save-button {
  background: var(--accent);
  color: #07110d;
}

.save-button:hover {
  background: var(--accent-hover);
}

.reset-button {
  background: rgba(255, 95, 95, 0.14);
  color: #ffd8d8;
  border: 1px solid rgba(255, 95, 95, 0.2);
}

.reset-button:hover {
  background: rgba(255, 95, 95, 0.2);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.preset-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: 0.2s ease;
  color: white;
}

.preset-button:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.preset-button img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
}

.preset-button span {
  font-size: 0.95rem;
  color: white;
  font-weight: 600;
}

/* Notification popups */
.custom-popup,
.notification-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  color: black;
  padding: 12px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1001;
  max-width: min(420px, calc(100% - 32px));
}

.custom-popup {
  background: #00ff88;
}

.notification-popup {
  background: #ffa500;
}

.custom-popup.show,
.notification-popup.show {
  opacity: 1;
  transform: translateY(0);
}

.custom-popup svg,
.notification-popup svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Legacy helpers */
.settings-button-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-button {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-button img {
  width: 24px;
  height: 24px;
}

/* Responsive */
@media (max-width: 1200px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .settings-side {
    position: static;
  }
}

@media (max-width: 900px) {
  .hero-grid,
  .hero-grid-single {
    grid-template-columns: 1fr;
  }

  .header-inner {
    grid-template-columns: 1fr;
    padding: 14px 0;
  }

  .search-wrap {
    order: 3;
  }

  .header-actions {
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-section {
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .container {
    width: min(var(--container), calc(100% - 20px));
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .hero-main {
    padding: 24px;
  }

  .page-intro-card {
    padding: 22px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .browse-link {
    display: none;
  }

  .buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .save-button,
  .reset-button {
    width: 100%;
  }
}


/* Play page */
.play-page {
  padding-bottom: 50px;
}

.play-intro-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.play-intro-left {
  min-width: 0;
}

.play-top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.play-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  gap: 20px;
  align-items: start;
  padding-bottom: 40px;
}

.play-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 98px;
}

.play-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.play-frame-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.play-frame-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.play-frame-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  min-width: 0;
}

.play-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(56, 211, 159, 0.5);
  flex-shrink: 0;
}

.play-toolbar-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: 0.2s ease;
}

.toolbar-button:hover {
  background: rgba(255, 255, 255, 0.09);
}

.play-frame-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #05080c;
}

.game-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #05080c;
}

.play-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1200px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .play-side {
    position: static;
  }
}

@media (max-width: 900px) {
  .play-intro-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .play-frame-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .play-info-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   AUTH (Login / Account UI)
========================= */
#authSection {
  display: flex;
  align-items: center;
  gap: 10px;
}

#authSection button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

#authSection button:hover {
  background: rgba(255,255,255,0.09);
}

/* =========================
   FAVORITE BUTTON
========================= */
.fav-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #ffd966;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s ease;
  z-index: 3;
}

.fav-btn:hover {
  background: var(--accent);
  color: #07110d;
}

/* =========================
   RELATED SECTION (Play page)
========================= */
.related-section {
  margin-top: 30px;
}

.related-section h2 {
  margin-bottom: 12px;
  font-size: 1.3rem;
}

/* =========================
   SMALL UX IMPROVEMENTS
========================= */

/* smoother hover glow on cards */
.game-card:hover {
  box-shadow: 0 16px 45px rgba(0,0,0,0.45);
}

/* prevent iframe flash */
iframe {
  background: #05080c;
}

/* fix potential white overscroll on mobile */
body {
  overscroll-behavior-y: none;
}

/* =========================
   RECENT / FUTURE SECTIONS
========================= */
#recentSection {
  margin-bottom: 30px;
}
