/* App Landing Template — original design, configurable via config.json */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eceef2;
  --border: #e1e3e8;
  --text: #1f2328;
  --text-soft: #5a6270;
  --text-muted: #8a93a3;
  --accent: #0f766e;          /* configurable via JS */
  --accent-hover: #115e59;
  --on-accent: #ffffff;
  --amber: #f59e0b;
  --danger: #b42318;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
  --max: 1180px;
  --gap: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
img { max-width: 100%; display: block; }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 600; font-size: 17px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 6px;
  background: var(--on-accent);
  clip-path: polygon(35% 20%, 85% 50%, 35% 80%);
}
.topnav { display: flex; gap: 18px; margin-left: 12px; flex: 1; }
.topnav a { color: var(--text-soft); font-size: 14px; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.icon-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--text-soft); padding: 8px; border-radius: 50%;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }

/* ── Page layout ───────────────────────────────────────── */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 48px;
  align-items: start;
  margin-bottom: 40px;
}
.app-name {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.publisher {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.iap {
  margin: 4px 0 18px;
  color: var(--text-muted);
  font-size: 13px;
}
.stat-row {
  display: flex; gap: 28px;
  padding: 18px 0;
  margin: 4px 0 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat { min-width: 80px; }
.stat-value {
  font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 4px;
}
.star { color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.rating-badge {
  display: inline-flex; padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 6px; font-size: 12px;
}

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-primary {
  background: var(--accent); color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); }

.hero-media {
  justify-self: end;
  width: 220px;
  border-radius: 28px;
  background: var(--surface);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.hero-media img { width: 100%; height: 220px; object-fit: cover; display: block; }
/* When hero video is active, swap to a 9:16 phone-frame look. */
.hero-media.has-video { width: 240px; aspect-ratio: 9 / 16; height: auto; }
.hero-media.has-video img { display: none; }
.hero-media video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }

/* ── Screenshots ───────────────────────────────────────── */
.screens {
  margin-bottom: 48px;
  min-width: 0;         /* ensure flex/grid children don't grow this box */
  position: relative;   /* anchor for edge-fade hint */
}
.screens-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 14px;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;          /* iOS momentum scrolling */
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 55%, transparent) transparent;
}
.screens-track::-webkit-scrollbar { height: 10px; }
.screens-track::-webkit-scrollbar-track { background: transparent; }
.screens-track::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 55%, transparent);
  border-radius: 6px;
}
.screens-track::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text) 60%, transparent);
}

/* Edge fade hints — pure CSS, no JS. The right side suggests "more here". */
.screens::after {
  content: "";
  position: absolute;
  top: 0; bottom: 14px;
  right: 0;
  width: 36px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg));
}

.shot {
  flex: 0 0 auto;
  width: clamp(150px, 28vw, 200px);
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Grid: about + sidebar ─────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
}
.section-title {
  font-size: 20px; font-weight: 600;
  margin: 12px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.about-text {
  white-space: pre-wrap;
  color: var(--text);
  margin: 0 0 22px;
}
.meta-list {
  list-style: none; padding: 0; margin: 0 0 36px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px;
}
.meta-list li { display: flex; flex-direction: column; }
.meta-key { color: var(--text-muted); font-size: 12px; }

/* Ratings */
.ratings {
  display: grid; grid-template-columns: 200px 1fr; gap: 32px;
  margin-bottom: 28px; align-items: center;
}
.ratings-score { text-align: center; }
.big-score { font-size: 48px; font-weight: 600; line-height: 1; }
.big-stars { color: var(--amber); margin: 6px 0; font-size: 16px; letter-spacing: 1px; }
.big-count { color: var(--text-muted); font-size: 12px; }
.ratings-bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: center; font-size: 12px; color: var(--text-muted); }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.reviews { display: grid; gap: 14px; margin-bottom: 28px; }
.review {
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.review-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-soft);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.review-name { font-weight: 600; font-size: 13px; }
.review-stars { color: var(--amber); font-size: 11px; letter-spacing: 1px; }
.review-text { font-size: 14px; color: var(--text); margin: 0; }

/* ── Sidebar cards ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px 8px;
  margin-bottom: 18px;
}
.card-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.contact-list, .similar-list { list-style: none; padding: 0; margin: 0; }
.contact-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.contact-list li:first-child { border-top: 0; }
.contact-list .ico {
  width: 22px; height: 22px; color: var(--text-soft); flex: 0 0 22px;
}

.similar-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.similar-list li:first-child { border-top: 0; }
.similar-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2);
  overflow: hidden; flex: 0 0 44px;
}
.similar-meta { display: flex; flex-direction: column; min-width: 0; }
.similar-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.similar-dev { font-size: 12px; color: var(--text-muted); }
.similar-rating { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  background: var(--surface);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px;
  display: grid;
  gap: 16px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.footer-nav a { color: var(--text-soft); font-size: 13px; }
.footer-copy { color: var(--text-muted); font-size: 12px; margin: 0; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-icon { width: 140px; height: 140px; justify-self: start; border-radius: 22px; }
  .grid { grid-template-columns: 1fr; gap: 32px; }
  .ratings { grid-template-columns: 1fr; }
  .meta-list { grid-template-columns: 1fr; }
  .topnav { display: none; }
}
@media (max-width: 520px) {
  .stat-row { gap: 18px; }
  .shot { width: 154px; height: 274px; }
}

/* Hidden when not relevant */
[hidden] { display: none !important; }

/* ── Featured shows grid (short-drama covers) ──────────────── */
.shows { margin: 8px 0 48px; }
.shows-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.shows-head .section-title { margin: 0; }
.shows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.show-card {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
.show-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.show-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  overflow: hidden;
}
.show-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.show-meta { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.show-title {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.show-info { color: var(--text-muted); font-size: 12px; }
.show-rating { color: var(--amber); font-size: 12px; font-weight: 500; }

/* ── Mobile sticky install bar (hidden on desktop) ─────────── */
.install-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: none;
  align-items: center; gap: 12px;
  box-shadow: 0 -2px 12px rgba(15,23,42,.06);
}
.install-bar-icon {
  width: 40px; height: 40px; border-radius: 9px;
  flex: 0 0 40px; object-fit: cover; background: var(--surface);
}
.install-bar-text { min-width: 0; flex: 1; }
.install-bar-name {
  font-weight: 600; font-size: 14px; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.install-bar-sub { color: var(--text-muted); font-size: 12px; }
.install-bar-cta { padding: 10px 22px; font-size: 14px; flex: 0 0 auto; }

@media (max-width: 880px) {
  .install-bar { display: flex; }
  /* Make sure page content isn't hidden behind the bar */
  body { padding-bottom: 78px; }
}

/* ── Cookie consent banner ─────────────────────────────────── */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  z-index: 60;
  background: #1f2937; color: #f4f4f6;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  max-width: 980px; margin: 0 auto;
}
.cookie-text { margin: 0; font-size: 13px; line-height: 1.45; flex: 1 1 280px; }
.cookie-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.cookie-banner .btn-ghost {
  background: transparent; color: #e5e7eb; border-color: #4b5563;
}
.cookie-banner .btn-ghost:hover { background: #2a3441; }
.cookie-banner .btn-primary { padding: 8px 16px; font-size: 13px; }
@media (max-width: 880px) {
  /* When sticky install bar is visible, lift the cookie banner above it */
  .cookie-banner { bottom: 86px; }
}

/* ── Legal pages (privacy / terms / about) ─────────────────── */
.legal-page {
  max-width: 760px;
  padding-top: 48px;
  padding-bottom: 80px;
}
.legal-page h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 8px;
}
.legal-page .legal-meta { color: var(--text-muted); font-size: 13px; margin: 0 0 28px; }
.legal-body {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.legal-body h2 { font-size: 20px; font-weight: 600; margin: 28px 0 8px; }
.legal-body h3 { font-size: 16px; font-weight: 600; margin: 20px 0 6px; }
.legal-body p { margin: 0 0 14px; }
.legal-body ul, .legal-body ol { margin: 8px 0 16px 20px; }
.legal-body a { color: var(--accent); }

