/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:          #0d1117;
  --bg-nav:      #0d1117ee;
  --bg-card:     #161b27;
  --bg-card-hover: #1a2030;
  --bg-pill:     #1c2235;
  --bg-pill-active: #252d45;
  --border:      rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --accent:      #4a7cf4;
  --text-primary:   #e6eaf4;
  --text-secondary: #6c7a99;
  --text-muted:     #3a4460;
  --card-radius: 14px;
  --nav-h: 60px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================================
   PASSWORD GATE
   ============================================================ */
#password-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2.25rem 2.5rem 2.5rem;
  width: min(400px, 92vw);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: gateIn 0.4s cubic-bezier(.22,1,.36,1) both;
}

@keyframes gateIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gate-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.gate-logo svg {
  opacity: 0.9;
}

.gate-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.gate-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1.75rem;
}

.gate-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #111623;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.2rem 0.2rem 0.2rem 0.9rem;
  transition: border-color 0.2s;
}

.gate-input-wrap:focus-within {
  border-color: rgba(255,255,255,0.2);
}

.gate-input-wrap.shake {
  animation: shake 0.4s ease both;
  border-color: #e05555;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-5px); }
  40%,80%  { transform: translateX(5px); }
}

#gate-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  padding: 0.55rem 0;
}

#gate-input::placeholder { color: var(--text-muted); letter-spacing: 0.02em; }

#gate-btn {
  background: #1e2940;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-radius: 7px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#gate-btn:hover { background: #28375a; }

.gate-error {
  font-size: 0.8rem;
  color: #e05555;
  text-align: center;
  margin-top: 0.75rem;
  min-height: 1.1em;
}

.gate-fade-out {
  animation: gateFadeOut 0.4s ease forwards;
}
@keyframes gateFadeOut {
  to { opacity: 0; }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main-content {
  position: relative;
  min-height: 100vh;
}

.main-fade-in {
  animation: mainFadeIn 0.4s ease both;
}
@keyframes mainFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg-nav);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-dot { color: var(--text-secondary); }

.nav-links { flex: 1; }

.nav-logout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.nav-logout:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 3.5rem 1.5rem 1.75rem;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, #6ea8fe 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-bar-wrap {
  padding: 1.25rem 1.5rem 0;
  max-width: 480px;
  margin: 0 auto;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  transition: border-color 0.2s;
}

.search-bar:focus-within { border-color: var(--border-hover); }

.search-icon { color: var(--text-muted); flex-shrink: 0; }

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
}
#search-input::placeholder { color: var(--text-muted); }

/* ============================================================
   FILTER PILLS  (matching the reference image)
   ============================================================ */
.filter-wrap {
  max-width: 1160px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-pill);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.38rem 0.85rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.filter-btn .pill-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.filter-btn:hover {
  background: var(--bg-pill-active);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--bg-pill-active);
  border-color: rgba(255,255,255,0.16);
  color: var(--text-primary);
}

.filter-btn.active .pill-count {
  color: var(--text-secondary);
}

/* ============================================================
   GAMES SECTION
   ============================================================ */
.games-section {
  max-width: 1160px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem 4rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ============================================================
   GAME CARDS
   ============================================================ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, background 0.2s, transform 0.25s cubic-bezier(.22,1,.36,1);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
}

.game-card.card-visible {
  animation: cardIn 0.4s cubic-bezier(.22,1,.36,1) forwards;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.game-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.card-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: #0d1117;
}

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

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

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(22,27,39,0.7) 100%);
  pointer-events: none;
}

.card-tag-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: rgba(13,17,23,0.75);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
}

.card-body {
  padding: 0.8rem 0.9rem 0.65rem;
  flex: 1;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0.75rem 0.75rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--bg-pill);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.card-play-btn:hover {
  background: var(--bg-pill-active);
  border-color: rgba(255,255,255,0.16);
  color: var(--text-primary);
}

/* No results */
.no-results {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 3rem 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.schoolwork-strip {
  max-width: 1160px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

.sw-strip-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sw-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.sw-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
  flex-shrink: 0;
}

.sw-label {
  color: var(--text-primary);
  font-weight: 600;
}

.sw-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.schoolwork-info {
  max-width: 1160px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
}

.sw-info-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.sw-info-block {
  padding: 0.25rem 0;
}

.sw-info-block h3 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.sw-info-block p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.site-footer {
  text-align: center;
  padding: 1.75rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  margin-top: 2rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .hero { padding: 2.5rem 1rem 1rem; }
  .games-section { padding: 0 1rem 3rem; }
  .search-bar-wrap, .filter-wrap { padding-left: 1rem; padding-right: 1rem; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
  .gate-card { padding: 1.75rem 1.25rem 2rem; }
}
