/* Cosmo App Store — light theme, plain CSS */
:root {
  --bg: #ffffff;
  --card: #f9f9f9;
  --muted: #f4f4f4;
  --border: #e4e4e7;
  --fg: #1a1a1a;
  --body: #3f3f46;
  --sub: #6b7280;
  --primary: #1f9d55;
  --primary-ink: #ffffff;
  --rating: #f0a020;
  --danger: #dc2626;
  --rank1: #e0362c;
  --rank2: #ef7d22;
  --rank3: #f5c33b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Top loading bar */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: #2f6fed; z-index: 60; transition: width .25s ease, opacity .3s ease;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1040px; margin: 0 auto; height: 56px; display: flex; align-items: center;
  gap: 10px; padding: 0 12px;
}
.brand { margin-right: auto; display: flex; align-items: center; }
.brand img { height: 34px; width: auto; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px;
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--body);
}
.nav a:hover { background: var(--muted); }
.nav a.active { background: var(--muted); color: var(--fg); }
.nav a img, .nav a svg { width: 16px; height: 16px; }
.nav-label { display: none; }
@media (min-width: 640px) { .nav-label { display: inline; } .header-inner { padding: 0 20px; } }

/* Layout */
.frame { max-width: 1040px; margin: 0 auto; padding: 20px 12px 48px; min-height: calc(100vh - 56px); }
.frame.narrow { max-width: 900px; }
@media (min-width: 640px) { .frame { padding: 20px 20px 48px; } }
.page-heading h1 { margin: 0; font-size: 26px; font-weight: 800; }
.page-heading p { margin: 4px 0 0; color: var(--sub); font-size: 14px; max-width: 640px; }
.page-heading { margin-bottom: 20px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty { padding: 56px 16px; text-align: center; color: var(--sub); font-size: 14px; }
.section { padding: 26px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title h2 { margin: 0; font-size: 18px; font-weight: 800; }
.section-title a { color: var(--sub); font-size: 13px; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 8px; border: 1px solid transparent; background: var(--primary);
  color: var(--primary-ink); font-weight: 600; font-size: 14px; padding: 9px 16px; cursor: pointer;
}
.btn:hover { filter: brightness(.95); }
.btn.outline { background: #fff; color: var(--fg); border-color: var(--border); }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Hero carousel */
.hero { position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow); }
.hero-bg { position: absolute; inset: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(18px); transform: scale(1.15); }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, var(--card), rgba(249,249,249,.92), rgba(249,249,249,.6)); }
.hero-body { position: relative; display: flex; gap: 16px; align-items: center; min-height: 208px; padding: 24px 16px; }
@media (min-width: 640px) { .hero-body { padding: 32px; gap: 24px; } }
.hero-kicker { margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); }
.hero h1 { margin: 4px 0 0; font-size: 22px; font-weight: 800; }
@media (min-width: 640px) { .hero h1 { font-size: 30px; } }
.hero .meta { margin: 4px 0 0; color: var(--sub); font-size: 13px; }
.hero .desc { margin: 8px 0 0; color: var(--sub); font-size: 13px; max-width: 560px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-dots { position: relative; display: flex; justify-content: center; gap: 8px; padding-bottom: 16px; }
.hero-dots button { height: 6px; width: 6px; border: 0; border-radius: 999px; background: var(--border); cursor: pointer; padding: 0; }
.hero-dots button.active { width: 24px; background: var(--primary); }
.hero-arrow { position: absolute; top: 50%; transform: translateY(-50%); display: none; border: 1px solid var(--border); background: rgba(255,255,255,.9); border-radius: 999px; padding: 6px 10px; cursor: pointer; }
.hero-arrow.prev { left: 6px; } .hero-arrow.next { right: 6px; }
@media (min-width: 640px) { .hero-arrow { display: block; } }

/* Icons */
.app-icon { border-radius: 16px; border: 1px solid var(--border); background: #fff; object-fit: cover; box-shadow: var(--shadow); flex: none; }
.icon-fallback { display: grid; place-items: center; border-radius: 16px; border: 1px solid var(--border); background: var(--muted); font-weight: 800; flex: none; }
.size-popular { width: 88px; height: 88px; }
.size-grid { width: 56px; height: 56px; }
.size-update { width: 48px; height: 48px; }
.size-detail { width: 96px; height: 96px; font-size: 26px; }
.size-badge { width: 80px; height: 80px; margin: 0 auto; }

/* Popular strip */
.strip { display: flex; gap: 16px; overflow-x: auto; padding: 12px 0 8px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .item { width: 88px; flex: none; }
.rank-wrap { position: relative; display: block; }
.rank {
  position: absolute; left: 0; top: 0; min-width: 28px; height: 28px; display: grid; place-items: center;
  padding: 0 5px; font-size: 12px; font-weight: 800; color: #fff;
  border-top-left-radius: 16px; border-bottom-right-radius: 12px; background: var(--sub);
}
.rank.r1 { background: var(--rank1); } .rank.r2 { background: var(--rank2); } .rank.r3 { background: var(--rank3); color: #3a2a06; }
.strip .name { display: block; margin-top: 8px; font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .stars { display: block; font-size: 12px; font-weight: 700; color: var(--rating); }

/* Rows */
.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
@media (min-width: 640px) { .rows { gap: 16px; } }
.row-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); background: var(--card); border-radius: 12px; box-shadow: var(--shadow); min-width: 0; }
.row-card:hover { background: var(--muted); }
.row-card .text { min-width: 0; flex: 1; }
.row-card .title { display: block; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-card .sub { display: block; font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-card .date { display: block; font-size: 11px; color: var(--sub); }

/* Hot grid */
.hot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 8px; margin-top: 16px; }
@media (min-width: 640px) { .hot-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 16px; } }
.hot-grid .item { text-align: center; min-width: 0; }
.hot-grid .item .app-icon, .hot-grid .item .icon-fallback { margin: 0 auto; }
.hot-grid .name { display: block; margin-top: 8px; font-size: 11px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-grid .count { display: block; font-size: 10px; color: var(--sub); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.chip:hover { background: var(--muted); }

/* Category list */
.cat-list { display: grid; gap: 12px; }
@media (min-width: 640px) { .cat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cat-item { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.cat-item:hover { background: var(--muted); }
.cat-item .badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--muted); color: var(--primary); font-weight: 800; }
.cat-item strong { display: block; }
.cat-item span.sub { font-size: 12px; color: var(--sub); }

/* Search */
.search-bar { display: grid; gap: 8px; padding: 12px; }
@media (min-width: 640px) { .search-bar { grid-template-columns: minmax(0, 1fr) 140px 190px; } }
.search-bar input, .search-bar select { height: 40px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 0 12px; font-size: 14px; }
.search-bar input:focus, .search-bar select:focus, textarea:focus { outline: 2px solid #9ec5fe; outline-offset: 1px; }
.result-count { margin: 20px 0 8px; font-size: 12px; font-weight: 600; color: var(--sub); }

/* Detail page */
.detail-head { padding: 16px; }
@media (min-width: 640px) { .detail-head { padding: 24px; } }
.detail-top { display: flex; gap: 16px; align-items: flex-start; }
.detail-top h1 { margin: 0; font-size: 26px; font-weight: 800; }
.detail-top .dev { margin: 4px 0 0; font-size: 14px; color: var(--sub); }
.detail-meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--sub); }
.detail-meta .star { color: var(--rating); font-weight: 700; }
.download-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 12px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.stat { border-left: 2px solid var(--border); padding-left: 8px; min-width: 0; }
.stat b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: 10px; text-transform: uppercase; color: var(--sub); }
.about p { white-space: pre-line; font-size: 14px; line-height: 1.8; color: var(--body); margin: 0; }
.shots { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.shots::-webkit-scrollbar { display: none; }
.shots img { height: 300px; width: auto; flex: none; border: 1px solid var(--border); border-radius: 12px; background: #fff; object-fit: contain; box-shadow: var(--shadow); }
.review-grid { display: grid; gap: 20px; margin-top: 24px; }
@media (min-width: 1024px) { .review-grid { grid-template-columns: minmax(0, 360px) 1fr; } }
.stars-input { display: flex; gap: 4px; }
.stars-input button { background: none; border: 0; cursor: pointer; font-size: 26px; line-height: 1; color: var(--border); padding: 0 2px; }
.stars-input button.on { color: var(--rating); }
textarea { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 14px; background: #fff; }
.review { padding: 16px; margin-bottom: 8px; }
.review header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review .rate { font-size: 12px; font-weight: 700; color: var(--rating); }
.review p { margin: 8px 0 0; font-size: 14px; color: var(--body); }
.review time { display: block; margin-top: 8px; font-size: 11px; color: var(--sub); }
.note { font-size: 12px; margin-top: 8px; }
.note.ok { color: var(--primary); } .note.bad { color: var(--danger); }

/* Download wait page */
.wait { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; text-align: center; }
.wait h1 { margin: 16px 0 0; font-size: 24px; font-weight: 700; }
.wait .meta { margin: 4px 0 0; font-size: 14px; color: var(--sub); }
.ring { width: 96px; height: 96px; margin: 32px auto 0; display: grid; place-items: center; border: 4px solid var(--border); border-radius: 999px; font-size: 30px; font-weight: 800; }
.track { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; margin: 20px auto 0; max-width: 420px; }
.track > div { height: 100%; width: 0; background: var(--primary); transition: width 1s linear; }
.wait .status { margin: 16px 0 0; font-weight: 600; }
.wait .hint { margin: 4px 0 0; font-size: 12px; color: var(--sub); }
.verified { margin-top: 32px; font-size: 12px; color: var(--sub); }

/* Age gate */
.gate { max-width: 1040px; margin: 0 auto; display: grid; place-items: center; min-height: calc(100vh - 56px); padding: 40px 16px; }
.gate .box { width: 100%; max-width: 384px; text-align: center; padding: 24px; }
.gate .icon-wrap { position: relative; width: fit-content; margin: 0 auto; }
.gate .icon-wrap img { width: 80px; height: 80px; border-radius: 16px; border: 1px solid var(--border); object-fit: cover; }
.gate .badge18 { position: absolute; right: -8px; bottom: -8px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; border: 4px solid var(--card); background: var(--danger); color: #fff; font-size: 13px; font-weight: 800; }
.gate h1 { margin: 24px 0 0; font-size: 24px; font-weight: 800; }
.gate p { color: var(--sub); font-size: 14px; }

/* Skeleton */
.skeleton { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.sk-line { height: 14px; border-radius: 6px; background: var(--muted); }
.sk-box { border-radius: 16px; background: var(--muted); }

footer.site-footer { border-top: 1px solid var(--border); padding: 24px 12px; text-align: center; font-size: 12px; color: var(--sub); }
