/* ═══════════════════════════════════════════════════════════════
   FunOnWeb — Main Stylesheet  |  funonweb.com
   Colors: White + Sky Blue (#38bdf8)
   Fonts: Nunito (headings) + Lato (body)
═══════════════════════════════════════════════════════════════ */

:root {
  --sky: #38bdf8; --sky-deep: #0ea5e9; --sky-light: #e0f2fe; --sky-pale: #f0f9ff;
  --white: #ffffff; --dark: #0f172a; --mid: #475569; --muted: #94a3b8; --border: #e2e8f0;
  --radius: 16px; --shadow: 0 4px 24px rgba(14,165,233,.1);
  --font-head: 'Nunito', sans-serif; --font-body: 'Lato', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: #f8fafc; color: var(--dark); min-height: 100vh; overflow-x: hidden; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Bubbles */
.bubbles-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bubble { position: absolute; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(56,189,248,.15), rgba(56,189,248,.04)); animation: float-bubble linear infinite; }
@keyframes float-bubble { 0%{transform:translateY(110vh) scale(0);opacity:0} 10%{opacity:1} 90%{opacity:.5} 100%{transform:translateY(-20vh) scale(1);opacity:0} }

/* Header */
header { background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 16px rgba(14,165,233,.07); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.logo-wrap { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo-text { font-family: var(--font-head); font-weight: 900; font-size: 1.35rem; color: var(--sky-deep); letter-spacing: -.5px; }
nav { display: flex; gap: 4px; margin-left: auto; }
nav a { padding: 7px 14px; border-radius: 30px; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--mid); transition: .2s; font-family: var(--font-head); }
nav a:hover, nav a.active { background: var(--sky-light); color: var(--sky-deep); }

/* Hamburger */
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; margin-left: 8px; }
.hamburger span { display: block; width: 24px; height: 2.5px; background: var(--sky-deep); border-radius: 2px; transition: .3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
.mobile-menu { display: none; flex-direction: column; padding: 12px 20px 16px; background: var(--white); border-top: 1px solid var(--border); }
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: 11px 14px; font-weight: 700; text-decoration: none; color: var(--dark); font-family: var(--font-head); border-radius: 10px; transition: .15s; }
.mobile-menu a:hover { background: var(--sky-pale); color: var(--sky-deep); }

/* Ad Slots */
.ad-header { margin: 10px auto; max-width: 740px; }
.ad-footer-above { margin: 16px auto 0; max-width: 740px; }
.ad-sidebar { width: 170px; flex-shrink: 0; display: none; align-items: center; justify-content: center; background: var(--white); border: 1px dashed var(--border); border-radius: 12px; min-height: 400px; }

/* Hero */
.hero { padding: 52px 20px 0; text-align: center; background: linear-gradient(180deg,var(--sky-pale) 0%,transparent 100%); }
.hero h1 { font-family: var(--font-head); font-weight: 900; font-size: clamp(2rem,5vw,3.2rem); line-height: 1.15; margin-bottom: 14px; }
.hero h1 span { color: var(--sky-deep); }
.hero p { font-size: clamp(.9rem,2vw,1.05rem); color: var(--mid); max-width: 540px; margin: 0 auto 18px; line-height: 1.7; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }
.tag { padding: 6px 14px; background: var(--white); border: 1.5px solid var(--sky-light); border-radius: 30px; font-size: .84rem; font-weight: 700; font-family: var(--font-head); color: var(--sky-deep); }

/* Search */
.search-wrap { display: flex; max-width: 420px; margin: 0 auto 22px; }
.search-wrap input { flex: 1; padding: 12px 18px; border: 2px solid var(--sky-light); border-right: none; border-radius: 50px 0 0 50px; font-size: 1rem; outline: none; font-family: var(--font-body); background: var(--white); transition: .2s; }
.search-wrap input:focus { border-color: var(--sky); }
.search-wrap button { padding: 12px 24px; background: linear-gradient(135deg,var(--sky),var(--sky-deep)); color: var(--white); border: none; border-radius: 0 50px 50px 0; cursor: pointer; font-weight: 700; font-family: var(--font-head); font-size: .95rem; transition: .2s; }
.search-wrap button:hover { opacity: .9; }

/* Category Tabs */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 0 16px 20px; }
.cat-tab { padding: 9px 20px; border-radius: 30px; border: 2px solid var(--border); background: var(--white); font-weight: 800; font-family: var(--font-head); font-size: .87rem; cursor: pointer; transition: .2s; color: var(--mid); }
.cat-tab:hover { border-color: var(--sky); color: var(--sky-deep); }
.cat-tab.active { background: linear-gradient(135deg,var(--sky),var(--sky-deep)); color: var(--white); border-color: transparent; box-shadow: 0 4px 14px rgba(56,189,248,.35); }

/* Layout */
.page-with-sidebar { display: flex; align-items: flex-start; gap: 20px; max-width: 1200px; margin: 0 auto; padding: 16px 20px; }
.main-inner { width: 100%; min-width: 0; }
.cat-section { padding: 14px 0; }
.cat-section.hidden { display: none; }

/* Section Title */
.section-title { font-family: var(--font-head); font-weight: 900; font-size: 1.32rem; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--dark); padding-left: 2px; }
.section-title span { font-size: 1.45rem; }

/* Games Grid */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(172px,1fr)); gap: 14px; }

/* Game Card */
.game-card { background: var(--white); border-radius: var(--radius); padding: 20px 14px 16px; cursor: pointer; transition: transform .2s, box-shadow .2s; border: 1.5px solid var(--border); position: relative; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.game-card:hover { transform: translateY(-5px); box-shadow: 0 12px 32px rgba(14,165,233,.2); border-color: var(--sky); }
.game-card[hidden] { display: none; }
.game-icon { font-size: 2.4rem; display: block; margin-bottom: 8px; line-height: 1; }
.game-title { font-family: var(--font-head); font-weight: 800; font-size: .92rem; margin-bottom: 5px; color: var(--dark); }
.game-desc { font-size: .77rem; color: var(--muted); line-height: 1.5; }

/* Badges */
.game-badge { position: absolute; top: -8px; right: -6px; padding: 3px 9px; border-radius: 20px; font-size: .64rem; font-weight: 900; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .04em; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.badge-hot { background: linear-gradient(135deg,#f97316,#ef4444); color: #fff; }
.badge-new { background: linear-gradient(135deg,#22c55e,#16a34a); color: #fff; }
.badge-fun { background: linear-gradient(135deg,#a855f7,#7c3aed); color: #fff; }

/* Modal */
.game-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.72); backdrop-filter: blur(6px); z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; }
.game-overlay.open { display: flex; }
.game-modal { background: var(--white); border-radius: 24px; width: min(700px,100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.25); animation: pop-in .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop-in { from{transform:scale(.85);opacity:0} to{transform:scale(1);opacity:1} }
.game-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; border-bottom: 1px solid var(--border); font-family: var(--font-head); font-weight: 900; font-size: 1.15rem; flex-shrink: 0; }
.modal-close { background: var(--border); border: none; cursor: pointer; font-size: 1rem; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: .2s; color: var(--mid); font-weight: 700; }
.modal-close:hover { background: #fecdd3; color: #ef4444; }
.game-modal-body { padding: 18px 16px; overflow-y: auto; flex: 1; }

/* Popup Ad */
.ad-popup { position: fixed; bottom: 16px; right: 16px; z-index: 300; background: var(--white); border-radius: 16px; padding: 16px 20px; box-shadow: 0 8px 32px rgba(0,0,0,.18); border: 1px solid var(--border); min-width: 240px; max-width: 320px; }
.close-popup { position: absolute; top: 8px; right: 8px; background: var(--border); border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: .75rem; display: flex; align-items: center; justify-content: center; }

/* Footer */
footer { background: var(--dark); color: #e2e8f0; padding: 48px 20px 24px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 32px; margin-bottom: 32px; }
.footer-logo-text { font-family: var(--font-head); font-weight: 900; font-size: 1.3rem; color: var(--sky); margin-bottom: 10px; }
footer p { font-size: .85rem; color: #94a3b8; line-height: 1.7; }
footer h4 { font-family: var(--font-head); font-weight: 800; font-size: .88rem; color: #cbd5e1; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .06em; }
footer ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
footer ul li a { text-decoration: none; font-size: .85rem; color: #94a3b8; transition: .2s; }
footer ul li a:hover { color: var(--sky); }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 20px; text-align: center; font-size: .82rem; color: #64748b; }

/* Inner Pages */
.page-content { max-width: 760px; margin: 40px auto; padding: 0 20px 60px; }
.page-content h1 { font-family: var(--font-head); font-weight: 900; font-size: clamp(1.8rem,4vw,2.6rem); margin-bottom: 20px; }
.page-content h2 { font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; margin: 30px 0 10px; color: var(--sky-deep); }
.page-content p { color: var(--mid); line-height: 1.8; margin-bottom: 14px; }
.page-content ul { padding-left: 22px; margin-bottom: 14px; }
.page-content ul li { color: var(--mid); margin-bottom: 7px; line-height: 1.7; }
.page-content a { color: var(--sky-deep); }

/* Contact Form */
.contact-form { background: var(--white); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-top: 24px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; font-family: var(--font-head); margin-bottom: 6px; font-size: .9rem; color: var(--dark); }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; font-size: 1rem; font-family: var(--font-body); outline: none; transition: .2s; background: #f8fafc; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--sky); background: var(--white); }
.form-group textarea { min-height: 130px; resize: vertical; }
.form-submit { padding: 13px 36px; background: linear-gradient(135deg,var(--sky),var(--sky-deep)); color: var(--white); border: none; border-radius: 50px; font-weight: 900; font-family: var(--font-head); font-size: 1rem; cursor: pointer; transition: .2s; width: 100%; }
.form-submit:hover { opacity: .9; transform: translateY(-2px); }

/* Info boxes */
.info-box { background: var(--sky-pale); border-left: 4px solid var(--sky); border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 18px 0; font-size: .9rem; color: var(--mid); }
.info-box strong { color: var(--sky-deep); }

/* No results */
.no-results { text-align: center; padding: 60px 20px; color: var(--muted); font-family: var(--font-head); }

/* Responsive */
@media (min-width:900px) { .ad-sidebar { display: flex; } }
@media (max-width:768px) {
  nav { display: none; }
  .hamburger { display: flex; }
  .hero { padding: 36px 16px 0; }
  .cat-tab { padding: 7px 13px; font-size: .82rem; }
  .games-grid { grid-template-columns: repeat(auto-fill,minmax(148px,1fr)); gap: 10px; }
  .game-card { padding: 16px 10px 12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .page-with-sidebar { padding: 12px 14px; }
}
@media (max-width:480px) {
  .games-grid { grid-template-columns: repeat(2,1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
  .cat-tabs { gap: 5px; }
  .cat-tab { padding: 7px 11px; font-size: .78rem; }
  /* Popup: full-width bar at bottom on mobile */
  .ad-popup {
    left: 10px;
    right: 10px;
    bottom: 10px;
    min-width: unset;
    max-width: unset;
    width: auto;
    border-radius: 12px;
    padding: 12px 16px;
  }
}

/* ── Game card as anchor link ── */
a.game-card {
  text-decoration: none;
  display: block;
  color: inherit;
}
a.game-card:hover { color: inherit; }

/* ── Ad placeholder (shared) ── */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #94a3b8;
  font-size: .75rem;
  font-weight: 700;
  padding: 10px;
  min-height: 50px;
}
.ad-tall {
  min-height: 300px;
  writing-mode: vertical-lr;
  font-size: .7rem;
  line-height: 1.4;
}
.ad-strip { text-align: center; }

/* ── Cat section hidden ── */
.cat-section.hidden { display: none; }
