:root {
  --bg:#0f1115; --panel:#171a21; --ink:#e9eef3; --muted:#aeb6bf;
  --accent:#6ee7ff; --accent-2:#8b5cf6; --line:#232838;
  --radius:18px; --shadow:0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing:border-box }
html, body { margin:0; padding:0; background:var(--bg); color:var(--ink); font-family:system-ui,Segoe UI,Roboto,Arial,sans-serif }
a { color:inherit; text-decoration:none }
.container { max-width:1200px; margin:0 auto; padding:14px 18px }

/* Header */
.topbar { display:flex; align-items:center; justify-content:center; position:relative }
.brand a { font-weight:900; letter-spacing:.6px; font-size:1.05rem; text-transform:uppercase }
.brand a:hover { color:var(--accent) }
.utility { position:absolute; right:18px; top:10px; display:flex; gap:12px; align-items:center }
.utility a.link { color:var(--muted) } 
.utility a.link:hover { color:var(--accent) }
.btn { display:inline-block; padding:8px 14px; border:1px solid var(--line); background:var(--panel); text-decoration:none; font-weight:700 }
.btn-pill { border-radius:999px }
.btn:hover { border-color:var(--accent); box-shadow:0 0 0 2px rgba(110,231,255,.1) }

/* Search */
.search-wrap { display: flex; justify-content: center; margin: 20px 0 10px; }
.search {
  width:min(560px,92vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:999px;
  overflow:visible;
  position: relative;
  z-index: 100;
}
.search input { flex:1; padding:12px 16px; background:transparent; border:0; color:var(--ink); outline: none; }

/* Strong, visible focus ring for keyboard users */
.search input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Optional: halo on the pill container when the input has keyboard focus */
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,231,255,.25); }

.search button { padding:12px 16px; border:0; background:transparent; color:var(--muted); cursor:pointer }

/* Keyboard-visible ring for the search button */
.search button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* Nav bar (no dropdowns) */
.catbar { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:0 }
.nav { display:flex; flex-wrap:wrap }
.nav > li {
  list-style: none;
  position: relative;
  flex: 1;
  min-width: 140px;
  border-right: 1px solid var(--line);
}
.nav > li:last-child { border-right:0 }
.nav > li > a { display: block; padding: 16px 14px; text-align: center; font-weight: 800; }

/* Keyboard-visible ring for main nav items */
.nav > li > a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }

.nav > li:hover { background: linear-gradient(160deg, rgba(255,255,255,.03), transparent 60%); }

/* Layout with right ad */
.wrapper{
  display:flex;
  flex-direction:row;
  align-items:flex-start;
  gap:22px;
  width:100%;
  max-width:1200px;
  margin:0 auto;
  overflow:visible; /* IMPORTANT: sticky breaks if parent clips */
}

.panel {
  background: rgba(15, 17, 21, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(2px);
  margin-top: 12px;
}
.welcome { padding: 24px 24px 16px; min-height: auto; display: block; }
.ad { padding:18px; min-height:260px; display:flex; align-items:center; justify-content:center }
.ad .box { border:2px dashed var(--line); border-radius:12px; padding:22px; text-align:center; color:var(--muted) }

footer { text-align:center; color:var(--muted); padding:20px 0 40px }
.breadcrumb { color:var(--muted); margin:8px 0 12px }
.intro { margin-bottom: 12px; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px,1fr)); gap:14px }
.card{
  padding:16px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:linear-gradient(160deg,var(--panel),#12141a 60%);
}
.card h3 { margin:0 0 6px; font-size:1.05rem }
.card p { margin:0; color:var(--muted); font-size:.95rem; line-height:1.35 }

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: none;
  z-index: 9999;
  max-height: 300px;
  overflow-y: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}
.search-dropdown.show { opacity: 1; transform: translateY(0); pointer-events: auto; display: block; }
.search-item { padding: 10px 14px; cursor: pointer; border-top: 1px solid var(--line); }
.search-item:hover { background: rgba(255,255,255,0.04); }

.center-title { margin: 0 auto; text-align: center; }
.wrapper .welcome { flex: 2; max-width: 100%; }
.wrapper .ad { width: 275px; min-height: 275px; margin-top: 10px; }

body.office-vibe { background: url("../img/office-bg.jpg") no-repeat center center fixed; background-size: 100% 100%; background-color: #0f1115; min-height: 100vh; }
body.online-games-vibe { background: url("../img/games-bg.png") no-repeat center center fixed; background-size: 100% 100%; background-color: #0f1115; min-height: 100vh; }

@media (max-width: 980px) { .wrapper { flex-direction: column; } }

/* Office-specific styling */
.office-vibe .welcome { margin-top: 0; padding-top: 16px; }
.office-vibe .tight-header { margin-top: 8px; padding-top: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.search-item.active { background: rgba(255,255,255,0.12) !important; outline: 2px solid var(--accent); color: var(--accent); }

nav.utility a.link { display: inline-block; line-height: 1.4; padding: 6px 4px; position: relative; z-index: 2; }
nav.utility { display: flex; align-items: center; gap: 16px; position: relative; z-index: 10; }

#bottomControls{
  position:absolute;
  bottom:0;
  left:0;
  width:100%;
  z-index:20;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 16px;
  background:var(--panel);
  border-top:1px solid var(--line);
  box-shadow:var(--shadow);
}

canvas { display: block; width: 100%; height: auto; background: transparent; }

/* =========================
   STICKY RIGHT AD RAIL FIX
   Works for: .ad-rail, #ad-rail, .rail-300x250
   ========================= */

/* Rail container base */
.ad-rail, #ad-rail, .rail-300x250{
  padding:0;
  min-height:0;
  align-items:stretch;
  justify-content:flex-start;

  position: sticky;
  top: 12px;
  z-index: 20;

  display:flex;
  flex-direction:column;
  gap:18px;

  /* prevent rail from becoming taller than viewport */
  max-height: calc(100vh - 24px);
}

/* 🔒 FORCE sticky even if a page sets #ad-rail { position: relative; } */
#ad-rail{
  position: sticky !important;
  top: 12px !important;
  align-self: start !important;
  z-index: 20 !important;
}


/* Rail width inside wrapper */
.wrapper .ad-rail, .wrapper #ad-rail, .wrapper .rail-300x250{
  width:275px;
  flex:0 0 275px;
  align-self:flex-start;
}

/* Make children fill the rail width */
.ad-rail > *, #ad-rail > *, .rail-300x250 > * { width:100%; }

/* If page uses an <aside id="ad-rail">, ensure it doesn't inherit .ad padding */
#ad-rail.ad, #ad-rail.panel { padding:0; min-height:0; }

/* =========================
   Mobile Ad Overlay (global)
   ========================= */
.ad-overlay{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: min(92vw, 520px);
  background: rgba(15,17,21,0.98);
  border: 1px solid #313745;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  z-index: 99999;
  padding: 10px 12px 12px;
  display: none;
  backdrop-filter: blur(4px);
}
.ad-overlay .ad-close{
  position:absolute; top:6px; right:8px;
  border:0; border-radius:8px; cursor:pointer;
  font-size:1rem; line-height:1; padding:4px 8px;
  background:#ff91f2; color:#000;
}
.ad-overlay .ad-close:focus-visible{
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(255,145,242,0.45);
}
.ad-slot a:focus-visible,
.ad a:focus-visible,
.ad-overlay a:focus-visible{
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}
.ad-overlay .ad-content{ display:grid; grid-template-columns: 72px 1fr; gap:10px; align-items:center; }
.ad-overlay img{ width:72px; height:72px; object-fit:cover; border-radius:8px; }
.ad-overlay .ad-copy{ margin:0; color:#e5e7eb; font-size:.95rem; }
.ad-overlay .ad-cta{
  display:inline-block; margin-top:6px; padding:8px 12px; border-radius:8px;
  background:#0ea5e9; color:#001018; text-decoration:none; font-weight:600;
}
.ad-overlay .ad-badge{
  position:absolute; top:-10px; left:10px; font-size:.7rem; background:#223; color:#9ca3af;
  padding:2px 6px; border-radius:999px; border:1px solid #3a4252;
}
@keyframes adPopIn { from{ transform: translate(-50%, 16px); opacity:0; } to{ transform: translate(-50%, 0); opacity:1; } }
.ad-overlay.showing { animation: adPopIn .22s ease-out; }
@media (max-width: 768px){ .ad-overlay{ display:block; } }
.ad-overlay.is-hidden{ display:none !important; }

/* Disclosure badge */
.disclosure{
  font: 600 .95rem/1.35 system-ui, sans-serif;
  padding: .45rem .7rem;
  border: 1px solid #d0d7de;
  border-radius: .5rem;
  display: inline-block;
  margin: .25rem 0 .75rem;
  color: #111;
  background-clip: padding-box;
}
.disclosure a{ color: inherit; text-decoration: underline; font-weight: 600; }
.disclosure[data-disclosure="ad"],
.disclosure[data-disclosure="advertorial"]{ background: #fff1f2; }
.disclosure[data-disclosure="paid-partnership"]{ background: #e6f4ff; }
.disclosure[data-disclosure="affiliate"]{ background: #fff8e6; }
.disclosure[data-disclosure="info"]{ background: #f3f4f6; }

/* Clear ring for topbar links and buttons */
nav.utility a.link:focus-visible,
.btn:focus-visible{
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

/* --- sticky-safe footer baseline --- */
html, body { height: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; }
.wrapper { flex: 1 0 auto; }
#api-site-footer{
  flex-shrink:0;
  position:relative;
  z-index:10;
  margin-top:16px;
}
