/* ============================================================
   FunGames — portal styles
   Dark, modern games-portal look. No build step, no deps.
   ============================================================ */

:root {
  --bg:        #0d0f1a;
  --bg-2:      #141726;
  --panel:     #1a1e30;
  --panel-2:   #222741;
  --line:      #2a2f4a;
  --text:      #eef1ff;
  --muted:     #9aa2c4;
  --brand:     #6c7bff;
  --brand-2:   #a06cff;
  --accent:    #ffb43f;
  --hot:       #ff4d6d;
  --new:       #35d07f;
  --updated:   #4aa9f6;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --sidebar-w: 240px;
  --header-h:  64px;
  --font:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display:   'Space Grotesk', var(--font);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108,123,255,.16), transparent 60%),
    radial-gradient(1000px 500px at 0% 0%, rgba(160,108,255,.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---------- Layout shell ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  grid-column: 1 / -1;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: rgba(13,15,26,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.brand .logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.brand .fun { color: #fff; }
.brand .games { color: var(--accent); }

.search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 42px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within {
  border-color: var(--brand);
}
.search svg { flex: none; opacity: .6; }
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: .95rem;
  outline: none;
}
.search input::placeholder { color: var(--muted); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.btn {
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: .9rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 999px;
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--brand); }
.btn.primary {
  border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.btn.ghost { background: transparent; }

.menu-toggle {
  display: none;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  width: 42px; height: 42px;
  border-radius: 12px;
  font-size: 1.1rem;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 16px 12px 40px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20,23,38,.5), transparent);
}
.sidebar h4 {
  margin: 18px 12px 8px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item .ic { width: 22px; text-align: center; font-size: 1.05rem; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--panel-2);
  color: #fff;
}

/* ---------- Main ---------- */
.main { padding: 26px 30px 70px; min-width: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 40px 44px;
  margin-bottom: 34px;
  background:
    radial-gradient(600px 300px at 90% 20%, rgba(255,180,63,.22), transparent 60%),
    linear-gradient(120deg, #232a52, #1a1e35 60%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero .eyebrow {
  font-size: .78rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05;
  margin: 10px 0 12px;
  letter-spacing: -.02em;
  max-width: 16ch;
}
.hero p { color: var(--muted); max-width: 52ch; margin: 0 0 22px; font-size: 1.02rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .art {
  position: absolute; right: 34px; bottom: -10px;
  font-size: 9rem; filter: drop-shadow(0 12px 24px rgba(0,0,0,.4));
  opacity: .9; pointer-events: none;
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }

/* ---------- Sections ---------- */
.section { margin-bottom: 40px; }
.section-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.section-head h2 {
  font-family: var(--display);
  font-size: 1.3rem; letter-spacing: -.01em; margin: 0;
}
.section-head .count { color: var(--muted); font-size: .9rem; }
.section-head .spacer { flex: 1; }

/* ---------- Game grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: 0 16px 34px rgba(0,0,0,.45);
}
.card .thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  font-size: 3.4rem;
  overflow: hidden;
}
.card .thumb::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.35));
}
.card .thumb .emoji {
  position: relative; z-index: 1;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.35));
  transition: transform .2s;
}
.card:hover .thumb .emoji { transform: scale(1.12) rotate(-4deg); }
.card .body { padding: 12px 14px 14px; }
.card .title { font-weight: 600; font-size: .98rem; letter-spacing: -.01em; }
.card .meta { margin-top: 4px; color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 6px; }

.badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
  color: #0d0f1a;
}
.badge.hot     { background: var(--hot); color: #fff; }
.badge.new     { background: var(--new); }
.badge.updated { background: var(--updated); color: #fff; }

.card .play-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center;
  background: rgba(13,15,26,.45);
  opacity: 0; transition: opacity .16s;
}
.card:hover .play-overlay { opacity: 1; }
.play-overlay .play-btn {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: .92rem;
  padding: 10px 18px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.card.soon { cursor: default; }
.card.soon:hover { transform: none; border-color: var(--line); box-shadow: none; }
.card.soon .thumb { filter: grayscale(.35) brightness(.8); }
.card.soon .play-overlay { background: rgba(13,15,26,.6); }
.card.soon .play-overlay .soon-tag {
  font-weight: 700; font-size: .85rem; color: var(--text);
  padding: 8px 16px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
}

/* ---------- Empty state ---------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}
.empty .big { font-size: 3rem; margin-bottom: 10px; }

/* ---------- SEO intro ---------- */
.about {
  margin: 8px 0 10px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.about h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0 0 10px;
}
.about p { color: var(--muted); font-size: .95rem; line-height: 1.65; margin: 0; }
.about strong { color: var(--text); font-weight: 600; }

/* ---------- Footer ---------- */
.footer {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding: 26px 30px;
  color: var(--muted);
  font-size: .88rem;
  display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center;
}
.footer .spacer { flex: 1; }
.footer-link {
  cursor: pointer;
  font-family: var(--font);
  font-size: .88rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0;
}
.footer-link:hover { color: var(--text); }

/* ---------- Suggest-a-game modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}
.modal-backdrop.show { display: flex; }
.modal {
  position: relative;
  width: 100%; max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 24px;
}
.modal h2 {
  font-family: var(--display);
  font-size: 1.4rem; margin: 0 0 6px; letter-spacing: -.01em;
}
.modal .modal-sub { color: var(--muted); font-size: .92rem; margin: 0 0 18px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: .9rem;
}
.modal-close:hover { color: var(--text); border-color: var(--muted); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.field > span em { color: var(--muted); font-weight: 400; font-style: normal; }
.field textarea, .field input {
  width: 100%;
  font-family: var(--font); font-size: .95rem;
  color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none; resize: vertical;
  transition: border-color .15s;
}
.field textarea:focus, .field input:focus { border-color: var(--brand); }
.field textarea::placeholder, .field input::placeholder { color: var(--muted); }

.modal .btn.primary { width: 100%; margin-top: 4px; padding: 12px; }
.form-status { font-size: .88rem; margin: 12px 0 0; min-height: 1.1em; text-align: center; }
.form-status.ok  { color: var(--new); }
.form-status.err { color: var(--hot); }

/* ---------- Sidebar mobile backdrop ---------- */
.backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 45;
  background: rgba(0,0,0,.5);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    height: 100vh; width: 260px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    background: var(--bg-2);
  }
  .sidebar.open { transform: translateX(0); }
  .backdrop.show { display: block; }
  .header .brand .txt { display: none; }
}
@media (max-width: 560px) {
  .main { padding: 18px 16px 60px; }
  .hero { padding: 28px 24px; }
  .hero .art { display: none; }
  .header-actions .btn.ghost { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}
