@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* UnblockPlay — mobile-first, performance-focused styles */

:root {
  --color-bg: #0b0f1a;
  --color-surface: #121829;
  --color-surface-2: #1a2238;
  --color-border: #2a3555;
  --color-text: #e8ecf4;
  --color-muted: #9aa5be;
  --color-accent: #4f8cff;
  --color-accent-hover: #6ba0ff;
  --color-success: #3dd68c;
  --color-warning: #f5b942;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --header-h: 64px;
  --max-w: 1200px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover, a:focus-visible { color: var(--color-accent-hover); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1rem;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus { top: 1rem; }

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

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  white-space: nowrap;
}

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

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-accent) 0%, #3a6fd8 100%);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.35);
}

.logo-text {
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: block;
  flex-shrink: 0;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-text);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: var(--transition);
}

.site-nav {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem;
  flex-direction: column;
  gap: 0.25rem;
}

.site-nav.is-open { display: flex; }

.site-nav a {
  padding: 0.75rem 1rem;
  color: var(--color-text);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--color-surface-2);
  color: var(--color-accent);
}

@media (min-width: 768px) {
  .nav-toggle { display: none; }

  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    background: none;
    border: none;
    padding: 0;
    gap: 0.25rem;
  }

  .site-nav a { padding: 0.5rem 0.85rem; }
}

/* Layout */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

.page-main { padding: 1.5rem 0 3rem; }

/* Hero */
.hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.hero h1 {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  line-height: 1.25;
  margin: 0 0 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--color-muted);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.55;
}

/* Ad slots */
.ad-slot {
  margin: 1rem auto;
  text-align: center;
  min-height: 50px;
  width: 100%;
  overflow: hidden;
}

.ad-slot:not(.ad-slot--live) {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot--live {
  background: transparent;
  border: none;
  min-height: 90px;
  min-width: 280px;
  width: 100%;
  display: block;
}

.ad-slot--live ins {
  display: block;
  min-height: 90px;
  width: 100%;
}

.ad-slot--leaderboard { min-height: 90px; max-width: 728px; width: 100%; }
.ad-slot--skyscraper { min-height: 250px; max-width: 300px; width: 100%; }
.ad-slot--in-content { min-height: 100px; width: 100%; }
.ad-slot--below-game { margin: 1.25rem 0; }
.ad-slot--above-game { margin: 0 0 1rem; }

/* Safe distance from playable area (AdSense policy) */
.game-player-wrap + .ad-slot--below-game,
.ad-slot--above-game + .game-player-wrap {
  margin-top: 0;
}

@media (min-width: 1024px) {
  .game-sidebar .ad-slot--sticky {
    position: sticky;
    top: 5.5rem;
    z-index: 2;
  }
}

.ad-slot ins { display: block; }

.ad-placeholder {
  color: var(--color-muted);
  font-size: 0.75rem;
  padding: 0.5rem;
}

/* Game grid */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.75rem 0 0.85rem;
  letter-spacing: -0.01em;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

.game-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

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

.game-card a { color: inherit; display: block; }

.game-card-thumb {
  aspect-ratio: 16 / 10;
  background: var(--color-surface-2);
  position: relative;
  overflow: hidden;
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.game-card:hover .game-card-thumb img {
  transform: scale(1.04);
}

.game-card-thumb .category {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.45rem;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 4px;
  color: #c8d0e0;
  font-weight: 600;
  z-index: 1;
}

.game-card-body { padding: 0.7rem 0.75rem 0.8rem; }

.game-card-body h3 {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.game-card-body p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Game page layout */
.game-layout {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr 300px;
    align-items: start;
  }
}

.game-player-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.08), var(--shadow);
}

.game-player-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, var(--color-surface-2) 0%, var(--color-surface) 100%);
}

.game-player-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.game-source-status {
  font-size: 0.75rem;
  color: var(--color-muted);
  padding: 0.5rem 1.15rem;
  margin: 0;
  background: rgba(79, 140, 255, 0.06);
  border-bottom: 1px solid var(--color-border);
  width: 100%;
  text-align: left;
}

.game-controls {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-family: inherit;
}

.btn:hover { background: var(--color-border); }

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.game-frame-container {
  position: relative;
  width: 100%;
  min-height: min(68vh, 620px);
  aspect-ratio: 16 / 10;
  background: #05070d;
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
}

.game-frame-container.portal-container {
  aspect-ratio: unset;
  min-height: auto;
  height: auto !important;
  background: linear-gradient(180deg, var(--color-surface-2) 0%, var(--color-surface) 100%);
  padding: 1.25rem;
  overflow: visible;
}

.portal-intro {
  text-align: center;
  margin-bottom: 1.25rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--color-border);
}

.portal-intro h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.portal-intro p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.portal-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.game-frame-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.game-frame-container.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9998;
  aspect-ratio: unset;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
}

.game-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 13, 0.92);
  color: var(--color-muted);
  font-size: 0.9rem;
  z-index: 3;
}

.game-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.game-loading[hidden] { display: none; }

.game-error-panel {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  background: rgba(5, 7, 13, 0.95);
}

.game-error-panel p {
  margin: 0 0 0.5rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.game-error-panel p strong { color: var(--color-text); }

.game-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.game-play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--color-surface-2) 0%, var(--color-bg) 100%);
  cursor: pointer;
  z-index: 2;
  border: 0;
  width: 100%;
  font-family: inherit;
  color: inherit;
  padding: 1rem;
}

.game-play-overlay[hidden] { display: none; }

.game-play-overlay-inner { text-align: center; max-width: 280px; }

.game-play-overlay .play-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--color-accent);
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  color: #fff;
  box-shadow: 0 8px 32px rgba(79, 140, 255, 0.4);
}

.game-play-overlay h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.game-play-overlay p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* Sidebar */
.game-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.sidebar-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-list li { border-bottom: 1px solid var(--color-border); }
.related-list li:last-child { border-bottom: none; }

.related-list a {
  display: block;
  padding: 0.6rem 0;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
}

.related-list a:hover { color: var(--color-accent); }

/* Content sections */
.content-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.content-section h2 {
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  font-weight: 600;
}

.content-section h3 {
  font-size: 0.95rem;
  margin: 1.25rem 0 0.6rem;
  font-weight: 600;
}

.content-section p,
.content-section li {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.content-section ul,
.content-section ol {
  padding-left: 1.25rem;
}

.content-section li { margin-bottom: 0.5rem; }

.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--color-text);
}

.faq-item p { margin: 0; }

/* Breadcrumb */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.breadcrumb li::after { content: '/'; margin-left: 0.35rem; color: var(--color-border); }
.breadcrumb li:last-child::after { content: ''; }
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-accent); }

/* Legal / static pages */
.legal-page h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 0.5rem;
}

.legal-meta {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.legal-page h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
  font-weight: 700;
}

.legal-page p,
.legal-page li {
  color: var(--color-muted);
}

.contact-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

.contact-form textarea { min-height: 140px; resize: vertical; }

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

.footer-brand p {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  max-width: 320px;
}

.footer-col h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.75rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li { margin-bottom: 0.4rem; }

.footer-col a {
  color: var(--color-text);
  font-size: 0.9rem;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* Category pills */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* Mobile — game player & layout */
@media (max-width: 767px) {
  .container {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .page-main { padding: 0.85rem 0 2rem; }

  .hero { padding: 1rem 0 0.85rem; }

  .game-layout {
    gap: 0.75rem;
    grid-template-columns: 1fr;
  }

  .game-sidebar .ad-slot {
    display: none;
  }

  .ad-slot--live {
    width: 100%;
    max-width: 100%;
    min-height: 100px;
    margin: 0.75rem auto;
  }

  .ad-slot--above-game {
    margin-bottom: 0.75rem;
  }

  .ad-slot--below-game {
    margin: 0.75rem 0;
  }

  .game-player-header {
    padding: 0.7rem 0.75rem;
    gap: 0.5rem;
  }

  .game-player-header h1 {
    font-size: 0.95rem;
    width: 100%;
  }

  .game-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .game-controls .btn {
    min-height: 44px;
    padding: 0.5rem 0.35rem;
    font-size: 0.75rem;
    justify-content: center;
    white-space: nowrap;
  }

  #btn-play { display: none; }

  .game-source-status {
    padding: 0.35rem 0.75rem;
    font-size: 0.68rem;
  }

  .game-frame-container:not(.portal-container) {
    aspect-ratio: unset;
    min-height: 280px;
    width: 100%;
    max-width: 100%;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-card-body { padding: 0.55rem 0.6rem 0.65rem; }

  .game-card-body h3 { font-size: 0.82rem; }

  .game-card-body p { font-size: 0.7rem; }

  .content-section {
    padding: 0.85rem;
    margin-top: 0.85rem;
  }

  .breadcrumb { font-size: 0.78rem; margin-bottom: 0.65rem; }

  .site-header {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }

  .game-frame-container.is-fullscreen {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

@media (max-width: 380px) {
  .game-controls .btn { font-size: 0.7rem; }
}

/* Utilities */
.text-center { text-align: center; }
