:root {
  /* Dark-only theme */
  --bg: #05060a;
  --bg-elev: #0d0f16;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1f2f7;
  --text-dim: #8b91a6;
  --accent: #8b5cff;
  --accent-2: #00d4b4;
  --radius: 18px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  --maxw: 1180px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  /* faint dot grid */
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
img { max-width: 100%; }

/* Ambient gradient glow behind the hero */
.glow {
  position: fixed;
  inset: -20vh -10vw auto -10vw;
  height: 70vh;
  background:
    radial-gradient(40% 60% at 20% 30%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    radial-gradient(35% 50% at 80% 20%, color-mix(in srgb, var(--accent-2) 25%, transparent), transparent 70%);
  filter: blur(50px);
  opacity: 0.7;
  pointer-events: none;
  z-index: -1;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; font-size: 1.05rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-size: 0.9rem;
}
.nav-links { display: flex; gap: 22px; font-size: 0.92rem; color: var(--text-dim); }
.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--text); }
.nav-links { align-items: center; }

/* Buy Me a Coffee (brand yellow) */
.bmc-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: #ffdd00; color: #0d0c22 !important; font-weight: 700; font-size: .85rem;
  text-decoration: none; white-space: nowrap; transition: transform .2s, box-shadow .2s;
}
.bmc-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -8px #ffdd00; }
.bmc-btn[hidden] { display: none; }
.panel.support .bmc-btn { margin-top: 14px; }
@media (max-width: 560px) {
  .nav-links { gap: 14px; }
  .nav .bmc-btn span { display: none; }
  /* Logo already links home and Privacy is in the footer; keep the site name on one line */
  .nav-links a[href$="#apps"], .nav-links a[href="/privacy"] { display: none; }
  .brand { white-space: nowrap; font-size: .98rem; }
}

/* Hero */
.hero { padding-top: 88px; padding-bottom: 40px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 0.8rem; color: var(--text-dim);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  line-height: 1.05; letter-spacing: -0.04em; margin: 20px 0 14px; font-weight: 800;
}
.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-dim); font-size: 1.12rem; max-width: 600px; margin: 0 auto; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 36px 0 22px; }
.search {
  flex: 1 1 280px; max-width: 420px; position: relative;
}
.search input {
  width: 100%; padding: 12px 16px 12px 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; outline: none; transition: border-color .2s, background .2s;
}
.search input:focus { border-color: var(--accent); background: var(--surface-hover); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .55; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 0.86rem; cursor: pointer;
  transition: all .2s;
}
.chip:hover { color: var(--text); background: var(--surface-hover); }
.chip.active { background: var(--text); color: var(--bg); border-color: transparent; }

/* Grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; padding-bottom: 60px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; overflow: hidden;
  transition: transform .25s ease, background .25s, border-color .25s, box-shadow .25s;
}
.card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .3s;
  background: radial-gradient(60% 80% at 0% 0%, color-mix(in srgb, var(--app-color, var(--accent)) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.card:hover { transform: translateY(-4px); background: var(--surface-hover); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--app-color, var(--accent)) 40%, var(--border)); }
.card:hover::before { opacity: 1; }
.card-head { display: flex; align-items: center; gap: 14px; }
.app-icon {
  width: 52px; height: 52px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.6rem;
  background: linear-gradient(140deg, color-mix(in srgb, var(--app-color, var(--accent)) 85%, #fff 0%), color-mix(in srgb, var(--app-color, var(--accent)) 55%, #000));
  box-shadow: 0 8px 20px -8px var(--app-color, var(--accent));
  overflow: hidden;
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { margin: 0; font-size: 1.08rem; letter-spacing: -0.01em; }
.card .cat { font-size: 0.78rem; color: var(--text-dim); }
.card p { margin: 0; color: var(--text-dim); font-size: 0.93rem; flex: 1; }
.card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: var(--text-dim); }
.badge { padding: 4px 10px; border-radius: 999px; background: var(--surface-hover); border: 1px solid var(--border); }
.badge.live { color: var(--accent-2); }
.arrow { transition: transform .25s; }
.card:hover .arrow { transform: translateX(4px); color: var(--text); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--text-dim); padding: 60px 0; }

/* Ads */
.ad-slot { display: none; }
.ad-slot.ad-on { display: block; }
.ad-slot .ad-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); opacity: .7; margin-bottom: 6px; }
.ad-banner { margin: 10px 0 0; min-height: 100px; }
.ad-card { border-radius: var(--radius); border: 1px dashed var(--border); padding: 14px; min-height: 250px; }
.ad-placeholder {
  display: grid; place-items: center; min-height: 90px; height: 100%;
  border-radius: 12px; background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, transparent 10px, transparent 20px);
  color: var(--text-dim); font-size: 0.8rem;
}

/* App detail page */
.detail { padding-top: 40px; padding-bottom: 60px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--text-dim); text-decoration: none; font-size: .9rem; margin-bottom: 26px; }
.back:hover { color: var(--text); }
.detail-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.detail-head .app-icon { width: 76px; height: 76px; border-radius: 20px; font-size: 2.3rem; }
.detail-head h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.03em; }
.detail-head .tagline { margin: 4px 0 0; color: var(--text-dim); }
.detail-head .dl-total { margin: 6px 0 0; font-size: .85rem; font-weight: 600; color: var(--accent-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; font: inherit; font-weight: 600; font-size: .92rem;
  text-decoration: none; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); transition: all .2s;
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; margin-top: 30px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.frame-wrap {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: var(--bg-elev); box-shadow: var(--shadow);
}
.frame-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .8rem; color: var(--text-dim); }
.frame-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); display: inline-block; }
.frame-bar span { margin-left: 8px; }
.frame-wrap iframe { display: block; width: 100%; height: min(72vh, 760px); border: 0; background: var(--bg-elev); }
.panel { padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.panel h2 { font-size: 1rem; margin: 0 0 10px; }
.panel p { color: var(--text-dim); margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.side { display: flex; flex-direction: column; gap: 18px; }
.dl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dl-list a {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  text-decoration: none; font-size: .9rem; transition: background .2s;
}
.dl-list a:hover { background: var(--surface-hover); }
.dl-meta { color: var(--text-dim); font-size: .78rem; white-space: nowrap; }

/* Comments */
.comments { margin-top: 24px; }
.comment-count { color: var(--text-dim); font-weight: 500; }
.comment-list { list-style: none; margin: 14px 0 22px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); }
.comment-head { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.comment-head time { margin-left: auto; color: var(--text-dim); font-size: .78rem; }
.comment p { margin: 8px 0 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: .8rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--app-color, var(--accent)), color-mix(in srgb, var(--app-color, var(--accent)) 50%, #000));
}
.comment-empty { color: var(--text-dim); font-size: .9rem; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text); font: inherit; font-size: .93rem; outline: none; resize: vertical;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--app-color, var(--accent)); }
.comment-form input[name="name"] { max-width: 280px; }
.comment-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-foot .hint { color: var(--text-dim); font-size: .8rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.form-msg { margin: 0; font-size: .88rem; min-height: 1.2em; }
.form-msg.ok { color: var(--accent-2); }
.form-msg.error { color: #ff6b6b; }

/* Prose pages */
.prose { max-width: 760px; padding: 50px 20px 70px; }
.prose h1 { letter-spacing: -0.03em; }
.prose p, .prose li { color: var(--text-dim); }

footer { margin-top: auto; border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-dim); font-size: .86rem; }
footer .container { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
footer a { text-decoration: none; }
footer .disclaimer { flex-basis: 100%; margin: 4px 0 0; font-size: .76rem; opacity: .75; }
footer a:hover { color: var(--text); }

.fade-in { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
