/* ====== WatchFace Directory – main stylesheet (mobile-first) ====== */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #111318; --muted: #6b7280; --line: #e5e7eb;
  --accent: #0071e3; --accent-text: #fff; --chip: #eef1f5; --chip-on: #0071e3; --shadow: 0 1px 3px rgba(0,0,0,.08);
  --ok: #16a34a; --err: #dc2626; --star: #f59e0b; --deal: #e11d48;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #161b22; --text: #e6e8eb; --muted: #9aa4b2; --line: #262d37;
    --chip: #1f2630; --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #161b22; --text: #e6e8eb; --muted: #9aa4b2; --line: #262d37;
  --chip: #1f2630; --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 1.2em 0 .6em; }
h3 { font-size: 1rem; margin: 1em 0 .5em; }
code { background: var(--chip); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.danger { color: var(--err); }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.1rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.burger { display: block; background: none; border: 1px solid var(--line); color: var(--text); font-size: 1.2rem; padding: 4px 10px; border-radius: 8px; }
.nav { display: none; width: 100%; flex-direction: column; gap: 4px; padding-bottom: 10px; }
.nav.open { display: flex; }
.nav a { padding: 8px 10px; color: var(--text); border-radius: 8px; }
.nav a:hover { background: var(--chip); text-decoration: none; }
.nav-cta { background: var(--accent); color: var(--accent-text) !important; font-weight: 600; }
.theme-btn { background: var(--chip); border: 0; color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }
@media (min-width: 760px) {
  .burger { display: none; }
  .nav { display: flex !important; width: auto; flex-direction: row; align-items: center; padding: 0; }
}

/* ---- hero & stats ---- */
.hero { text-align: center; padding: 28px 0 12px; }
.hero h1 { font-size: 1.9rem; }
.hero-small { text-align: left; padding: 14px 0 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; color: var(--text); box-shadow: var(--shadow); }
.stat b { font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat small { color: var(--ok); font-size: .75rem; }
.stat:hover { text-decoration: none; border-color: var(--accent); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.section-head h2 { margin: .4em 0; }
.promo { background: var(--surface); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 12px 16px; margin: 14px 0; text-align: center; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 10px 0; }

/* ---- search / filters ---- */
.search { display: flex; gap: 6px; width: 100%; }
.search input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 15px; }
.search button, .btn { background: var(--accent); color: var(--accent-text); border: 0; padding: 10px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; display: inline-block; font-size: 14px; }
.btn:hover { opacity: .9; text-decoration: none; }
.btn-ghost { background: var(--chip); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-play { background: #01875f; margin-top: 8px; }
@media (min-width: 760px) { .search { width: auto; min-width: 340px; } }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin: 12px 0; }
.filters summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.filter-row label { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.filter-row select, .filter-row input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; align-items: center; }
.chip-label { font-size: .8rem; color: var(--muted); width: 60px; }
.chip { background: var(--chip); color: var(--text); padding: 5px 10px; border-radius: 999px; font-size: .82rem; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.chip small { color: var(--muted); font-size: .72rem; }
.chip.on { background: var(--chip-on); color: #fff; }
.chip.on small { color: #e0ecff; }
.chip:hover { text-decoration: none; filter: brightness(.95); }
.chip input { display: none; }
.clear { font-size: .85rem; display: inline-block; margin: 6px 0; }
.empty { text-align: center; padding: 40px; color: var(--muted); }

/* ---- grid & cards ---- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 0; }
@media (min-width: 540px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 16px; } }
.grid-featured { grid-auto-flow: column; grid-auto-columns: 46%; grid-template-columns: unset; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.grid-featured .card { scroll-snap-align: start; }
@media (min-width: 540px) { .grid-featured { grid-auto-columns: 30%; } }
@media (min-width: 760px) { .grid-featured { grid-auto-columns: 23%; } }
@media (min-width: 1000px) { .grid-featured { grid-auto-columns: 15.5%; } }
.grid-small { grid-template-columns: repeat(2, 1fr) !important; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-img { position: relative; aspect-ratio: 1; background: #0b0f14; display: block; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 8px; left: 8px; font-size: .68rem; font-weight: 700; padding: 3px 7px; border-radius: 6px; color: #fff; background: var(--accent); }
.badge-free { background: var(--ok); }
.badge-star { background: var(--star); }
.badge-deal { background: var(--deal); }
.card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; }
.card-title { color: var(--text); font-weight: 600; font-size: .9rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; gap: 6px; }
.card-meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price { font-weight: 600; white-space: nowrap; }
.price s { color: var(--muted); font-weight: 400; margin-right: 3px; }
.play-link { font-size: .78rem; margin-top: 2px; }
.card-ad { grid-column: span 2; }
@media (min-width: 760px) { .card-ad { grid-column: span 2; } }

/* ---- ads ---- */
.ad-wrap, .ad-box { margin: 14px auto; text-align: center; max-width: 100%; }
.ad-box { background: repeating-linear-gradient(45deg, var(--chip), var(--chip) 10px, var(--surface) 10px, var(--surface) 20px); border: 1px dashed var(--muted); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: .8rem; border-radius: 10px; }
.ad-horizontal { min-height: 90px; }
.ad-rectangle { min-height: 250px; max-width: 336px; }
.ad-fluid { min-height: 120px; }
.ad-auto { min-height: 100px; }
.card-ad.ad-rectangle, .card-ad.ad-wrap { max-width: none; min-height: 250px; margin: 0; }

/* ---- pagination ---- */
.pager { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 22px 0; }
.pager a, .pager span { padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: .85rem; color: var(--text); }
.pager span { color: var(--muted); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager-info { font-weight: 600; }

/* ---- detail page ---- */
.detail { display: grid; gap: 20px; margin: 10px 0 30px; }
@media (min-width: 900px) { .detail { grid-template-columns: 1fr 336px; } }
.detail-top { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.detail-icon { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); box-shadow: var(--shadow); background: #000; }
@media (min-width: 540px) { .detail-icon { width: 200px; height: 200px; } }
.detail-top > div { flex: 1; min-width: 200px; }
.detail-top h1 { margin-top: 0; }
.price-big { font-size: 1.3rem; font-weight: 700; margin: 4px 0; }
.coupon { margin-top: 10px; background: var(--chip); padding: 8px 12px; border-radius: 10px; display: inline-block; }
.desc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.specs { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.specs dt { color: var(--muted); } .specs dd { margin: 0; word-break: break-all; }
.detail-side h3 { margin-top: 0; }

/* ---- developers list ---- */
.dev-list { display: grid; gap: 8px; grid-template-columns: 1fr; margin: 12px 0; }
@media (min-width: 640px) { .dev-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .dev-list { grid-template-columns: 1fr 1fr 1fr; } }
.dev-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--text); flex-wrap: wrap; }
.dev-row:hover { border-color: var(--accent); text-decoration: none; }
.dev-name { font-weight: 600; flex: 1; }

/* ---- forms ---- */
.form-wrap { max-width: 640px; margin: 0 auto 30px; }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; font-weight: 600; }
.form input, .form select, .form textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-weight: 400; width: 100%; }
.form textarea { resize: vertical; }
.form .check { flex-direction: row; align-items: center; }
.form .check input { width: auto; }
.form .inline { display: flex; gap: 10px; flex-wrap: wrap; }
.form .inline > label { flex: 1; min-width: 140px; }
.hp { position: absolute; left: -9999px; }
.flash { padding: 10px 14px; border-radius: 10px; margin: 12px 0; background: #dcfce7; color: #166534; }
.flash-err { background: #fee2e2; color: #991b1b; }
.page { max-width: 760px; margin: 0 auto 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.page-body h2 { margin-top: 1.4em; }

/* ---- footer / cookie ---- */
.site-footer { border-top: 1px solid var(--line); margin-top: 30px; padding: 22px 0 90px; font-size: .85rem; text-align: center; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 10px; }
.cookie-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 20px rgba(0,0,0,.2); border-radius: 12px; padding: 12px 14px; font-size: .85rem; display: none; z-index: 60; align-items: center; gap: 10px; flex-wrap: wrap; }
.cookie-bar.show { display: flex; }
.cookie-bar button { margin-left: auto; background: var(--accent); color: #fff; border: 0; padding: 7px 14px; border-radius: 8px; font-weight: 600; }
@media (min-width: 760px) { .cookie-bar { left: auto; max-width: 480px; } }
