:root {
  --bg: #0b0d12;
  --surface: #141821;
  --surface-2: #1c2230;
  --border: #262d3d;
  --text: #eef1f7;
  --muted: #9aa4b8;
  --accent: #7c5cff;
  --accent-2: #00d4b3;
  --grad: linear-gradient(100deg, #8b6dff 0%, #4f8bff 50%, #00d4b3 100%);
  --radius: 16px;
  --max: 1160px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font-head: "Outfit", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, .logo { font-family: var(--font-head); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(124, 92, 255, .45); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Page enter */
#main { animation: pageIn .5s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Scroll reveal (transform + opacity only = smooth on phones) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 18, .94);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
.site-header.scrolled { border-color: var(--border); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.nav { display: flex; align-items: center; gap: 20px; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.22rem; letter-spacing: -.01em; white-space: nowrap; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: .95rem; letter-spacing: 0;
  box-shadow: 0 4px 14px rgba(124, 92, 255, .4);
  transition: transform .3s var(--ease);
}
.logo:hover .logo-badge { transform: rotate(-8deg) scale(1.06); }
.logo-first { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-rest { font-weight: 600; color: var(--text); }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { position: relative; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; transition: color .2s, background-color .2s; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--grad); }
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; margin-left: auto; padding: 0; }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; margin: 4px auto; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Forms & buttons */
.code-form { display: flex; gap: 8px; }
.code-form input {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: 12px; font: inherit; font-size: 1rem; min-width: 0; flex: 1;
  text-transform: uppercase; transition: border-color .2s, box-shadow .2s;
}
.code-form input::placeholder { text-transform: none; color: var(--muted); }
.code-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124, 92, 255, .2); }
.code-form.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 12px; font: inherit; font-weight: 600; font-size: 1rem;
  transition: transform .15s var(--ease), box-shadow .25s, background-color .25s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn.grad { background: var(--grad); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.big { padding: 14px 24px; font-size: 1.05rem; }
.btn.done { background: var(--accent-2); color: #002b24; }

/* Hero */
.hero { position: relative; padding: 72px 0 44px; text-align: center; isolation: isolate; }
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .35;
  will-change: transform; pointer-events: none;
}
.hero::before { width: 340px; height: 340px; background: #7c5cff; top: -40px; left: 8%; animation: float1 14s ease-in-out infinite; }
.hero::after { width: 300px; height: 300px; background: #00d4b3; top: 40px; right: 6%; opacity: .22; animation: float2 16s ease-in-out infinite; }
@keyframes float1 { 50% { transform: translate(60px, 40px) scale(1.1); } }
@keyframes float2 { 50% { transform: translate(-50px, 30px) scale(.92); } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .88rem; font-weight: 500; margin-bottom: 20px; }
.eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(0, 212, 179, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(0, 212, 179, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 212, 179, 0); } }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.03em; font-weight: 800; }
.hero h1 em { font-style: normal; background: var(--grad); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 auto 28px; max-width: 620px; }
.hero .code-form { max-width: 480px; margin: 0 auto; }
.hero .code-form input { padding: 14px 18px; font-size: 1.1rem; }
.lookup-msg { min-height: 1.5em; margin-top: 10px; color: #ff8a8a; font-size: .95rem; }
.page-head { padding: 44px 0 20px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); }

/* Sections & grid */
section { margin: 40px 0; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.01em; }
.section-title a { color: var(--accent); font-weight: 600; font-size: .95rem; transition: opacity .2s; }
.section-title a:hover { opacity: .8; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .6s var(--ease) var(--d, 0ms), transform .6s var(--ease) var(--d, 0ms), translate .35s var(--ease), border-color .3s, box-shadow .35s;
}
.card:active { translate: 0 1px; }
.thumb { aspect-ratio: 16 / 10; background: var(--surface-2); position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), opacity .4s; }
.thumb img.loading { opacity: 0; }
.thumb.ph { display: grid; place-items: center; }
.ph-letter { font-family: var(--font-head); font-size: 2.6rem; font-weight: 800; color: rgba(255, 255, 255, .9); transition: transform .6s var(--ease); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.card-body h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; font-weight: 600; }
.card-body p { margin: 0; color: var(--muted); font-size: .9rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge.code { background: rgba(124, 92, 255, .18); color: #c3b5ff; }
.badge.prompt { color: #ffd166; }
.badge.app { color: var(--accent-2); }
.badge.video { color: #ff6b81; }
.filter { margin-bottom: 20px; max-width: 420px; }
.filter input { text-transform: none; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* Item detail */
.detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; padding: 32px 0; align-items: start; }
.detail .media { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.detail .media .thumb { aspect-ratio: 4 / 3; }
.detail h1 { margin: 12px 0 8px; font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.2; letter-spacing: -.02em; }
.detail .desc { color: var(--muted); }
.prompt-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.prompt-box pre { margin: 0 0 14px; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92rem; line-height: 1.65; color: #d8deea; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; color: var(--muted); font-size: .92rem; margin: 16px 0; }
.meta b { color: var(--text); font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--border); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Ads */
.ad-slot { margin: 28px 0; text-align: center; min-height: 90px; }
.ad-placeholder { border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: .78rem; padding: 32px 12px; letter-spacing: .1em; text-transform: uppercase; }

/* Text pages */
.prose { max-width: 760px; padding: 36px 16px 48px; }
.prose h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -.02em; margin-top: 0; }
.prose h2 { font-size: 1.3rem; margin-top: 30px; }
.prose p, .prose li { color: #c7cedc; }
.prose a { color: #a48dff; text-decoration: underline; text-underline-offset: 3px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 56px; padding: 28px 0; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { transition: color .2s; }
.site-footer a:hover { color: var(--text); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 100px); opacity: 0;
  background: var(--accent-2); color: #002b24; padding: 10px 20px; border-radius: 12px;
  font-weight: 700; transition: transform .35s var(--ease), opacity .35s; z-index: 50; pointer-events: none;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.menu-lookup { display: none; }

/* Hover effects only on devices with a real mouse (no "stuck" hover on phones) */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(124, 92, 255, .4); }
  .btn.ghost:hover { box-shadow: none; border-color: var(--accent); }
  .card.in:hover { translate: 0 -5px; border-color: rgba(124, 92, 255, .7); box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
  .card:hover .thumb img, .card:hover .thumb .ph-letter { transform: scale(1.06); }
}

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; gap: 20px; }
  .header-lookup { display: none; }
}
@media (max-width: 640px) {
  .menu-btn { display: block; }
  .menu-lookup { display: flex; margin-top: 8px; }
  .menu-lookup input { padding: 12px 14px; }
  .btn { min-height: 44px; }
  .detail .actions .btn { flex: 1; }
  .prompt-box .btn { width: 100%; }
  .nav-links {
    position: absolute; top: 66px; left: 0; right: 0; flex-direction: column;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .65);
    opacity: 0; transform: translateY(-8px); visibility: hidden; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s .25s;
  }
  .nav-links.open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .nav-links a { padding: 12px; }
  .nav-links a.active::after { left: 12px; right: auto; width: 24px; bottom: 6px; }
  .hero { padding: 44px 0 24px; }
  .hero::before { width: 220px; height: 220px; }
  .hero::after { width: 200px; height: 200px; }
  .hero .code-form { flex-direction: column; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card-body { padding: 10px 12px 12px; }
  .card-body h3 { font-size: .95rem; }
  .card-body p { display: none; }
  .logo { font-size: 1.1rem; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
