/* SpyZap — Google Play app page (clone) | mobile-first */

:root {
  --gp-green: #01875f;
  --gp-green-soft: #e2f3ea;
  --gp-border: #e8eaed;
  --text-primary: #202124;
  --text-secondary: #3c4043;
  --text-muted: #5f6368;
  --nav-height: 60px;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: #f1f3f4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, p {
  margin: 0;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-xs {
  width: 12px;
  height: 12px;
}

.icon-white {
  color: #fff;
}

.icon-muted {
  color: var(--text-muted);
  margin-top: 2px;
}

.underline {
  text-decoration: underline;
}

/* ---------- App shell ---------- */
/* Mobile-first: full width, edge to edge, like the real Google Play mobile page. */

.app-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.1);
}

main {
  flex: 1 0 auto;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Header ---------- */

.gp-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--gp-border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.gp-logo {
  height: 34px;
  width: auto;
}

.gp-header-icons {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-muted);
}

.gp-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

/* ---------- App info ---------- */

.app-info {
  padding: 24px 16px 0;
}

.app-info-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  flex-shrink: 0;
}

.app-title-wrap {
  padding-top: 4px;
}

.app-title {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 400;
  color: var(--text-primary);
}

.app-dev {
  font-size: 14px;
  color: var(--gp-green);
  margin-top: 2px;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 24px;
  text-align: center;
}

.metric {
  padding: 0 8px;
}

.metric-border {
  border-left: 1px solid var(--gp-border);
  border-right: 1px solid var(--gp-border);
}

.metric-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 15px;
  color: var(--text-primary);
}

.metric-rating .icon-xs {
  color: var(--text-muted);
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.rating-badge {
  width: 24px;
  height: 24px;
  margin: 0 auto;
}

.metric-flex {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.install-btn {
  display: block;
  width: 100%;
  margin-top: 24px;
  border-radius: 999px;
  background: var(--gp-green);
  color: #fff;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
}

.app-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
  font-size: 14px;
  color: var(--gp-green);
}

.app-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 4px;
}

/* ---------- Screenshots ---------- */

.screenshots {
  margin-top: 24px;
  padding-left: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.screenshots::-webkit-scrollbar {
  display: none;
}

.screenshots-track {
  display: flex;
  gap: 12px;
  padding-right: 16px;
}

.screenshot-btn {
  flex-shrink: 0;
  width: 160px;
  height: 288px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.screenshot-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ---------- About expandable ---------- */

.about-toggle {
  cursor: pointer;
}

.about-arrow {
  transition: transform .2s ease;
}

.about-toggle.expanded .about-arrow {
  transform: rotate(90deg);
}

.about-description {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.about-description.collapsed {
  max-height: 112px;
}

.about-description.collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 85%);
  pointer-events: none;
}

.about-description.expanded {
  max-height: none;
  cursor: default;
}

.about-more {
  margin-top: 6px;
  color: var(--gp-green);
  font-size: 14px;
  font-weight: 500;
}

/* ---------- Generic sections ---------- */

section {
  padding: 0 16px;
  margin-top: 32px;
}

.section-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.section-head h2,
h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.section-head .icon,
.section-head > .icon {
  color: var(--text-muted);
}

.body-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 12px;
}

.about .body-text:first-of-type {
  margin-top: 12px;
}

.sub-head {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 20px;
}

.muted-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.muted-text.small {
  font-size: 12px;
}

.tag {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--gp-border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- Data safety ---------- */

.safety-card {
  margin-top: 20px;
  border: 1px solid var(--gp-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.safety-row {
  display: flex;
  gap: 16px;
}

.link-btn {
  font-size: 14px;
  font-weight: 500;
  color: var(--gp-green);
  text-align: left;
}

/* ---------- Ratings ---------- */

.verified-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.device-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--gp-border);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.chip-active {
  background: var(--gp-green-soft);
  color: var(--gp-green);
  border-color: transparent;
}

.rating-summary {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-top: 24px;
}

.score-big {
  font-size: 56px;
  line-height: 1;
  font-weight: 300;
  color: var(--text-primary);
}

.stars {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  color: var(--gp-green);
}

.stars svg {
  width: 14px;
  height: 14px;
}

.rating-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
}

.rating-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rating-bar-row span {
  font-size: 11px;
  color: var(--text-muted);
  width: 8px;
}

.bar-track {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--gp-green);
  border-radius: 999px;
}

.reviews-preview {
  margin-top: 24px;
  border-top: 1px solid var(--gp-border);
}

.review-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--gp-border);
}

.review-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.review-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
}

.review-name {
  font-size: 14px;
  color: var(--text-primary);
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.review-date {
  font-size: 12px;
  color: var(--text-muted);
}

.review-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.review-helpful {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.review-vote {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.review-vote span {
  font-size: 12px;
  color: var(--text-muted);
}

.vote-btn {
  padding: 4px 16px;
  border-radius: 999px;
  border: 1px solid var(--gp-border);
  font-size: 12px;
}

/* ---------- Similar apps ---------- */

.similar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.similar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-width: 0;
}

.similar-item img,
.similar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--gp-border);
  flex-shrink: 0;
}

.similar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef3f8;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 14px;
}

.similar-text {
  min-width: 0;
}

.similar-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.similar-dev {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flag-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.flag-btn .icon {
  color: var(--text-muted);
}

/* ---------- Footer ---------- */

.footer {
  padding: 24px 16px 0;
  margin-top: 32px;
  border-top: 1px solid var(--gp-border);
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.footer h3 {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-size: 14px;
}

.footer ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 13px;
}

.footer-small {
  font-size: 13px;
}

.footer-locale {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 30;
  background: #fff;
  border-top: 1px solid var(--gp-border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.nav-item .icon {
  width: 22px;
  height: 22px;
}

.nav-selected {
  color: var(--gp-green);
  font-weight: 600;
}

.nav-selected .icon {
  color: var(--gp-green);
}

.nav-item:not(.nav-selected) .icon {
  fill: none;
}

/* ---------- Lightbox / fullscreen gallery ---------- */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.96);
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  transform: none;
  max-width: none;
}

.lightbox.open {
  display: flex;
}

.lightbox-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(58px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 14px 0;
  display: flex;
  align-items: center;
  z-index: 3;
  background: linear-gradient(to bottom, rgba(0,0,0,.72), rgba(0,0,0,0));
}

.lightbox-top button {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
}

.lightbox-body {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #202124;
  z-index: 4;
}

.lightbox-prev { left: max(10px, env(safe-area-inset-left, 0px)); }
.lightbox-next { right: max(10px, env(safe-area-inset-right, 0px)); }

.lightbox-counter {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  min-width: 58px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  text-align: center;
  font-size: 13px;
  z-index: 4;
}

@media (max-width: 640px) {
  .lightbox-nav {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.84);
  }
}

/* ---------- Reviews modal ---------- */

.reviews-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  align-items: flex-end;
  justify-content: center;
}

.reviews-modal.open {
  display: flex;
}

.reviews-sheet {
  background: #fff;
  width: 100%;
  max-height: 88vh;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.reviews-sheet-header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--gp-border);
}

.reviews-sheet-header img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.reviews-sheet-title {
  flex: 1;
}

.reviews-sheet-app {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.reviews-sheet-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.reviews-sheet-filters {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--gp-border);
}

.reviews-sheet-filters .chip {
  padding: 6px 12px;
}

.reviews-sheet-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px;
}

.reviews-sheet {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ================================================================
   This is always a mobile-shaped app screen (max 480px wide), never
   a separate "desktop layout". On any real phone (which is always
   narrower than 480px) it simply fills the screen edge to edge. On
   a wider screen (tablet/desktop) it is centered instead of being
   stretched full-bleed. There is no width breakpoint switch here on
   purpose: some Android phones report a CSS viewport wider than
   typical (large phones, landscape, or a reduced display-size/zoom
   accessibility setting) and a hard breakpoint made those phones
   flip into a shrunken "boxed" look. max-width alone degrades
   gracefully at every size instead.
   ================================================================ */

.reviews-modal {
  max-width: 480px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

/* ===== Mobile fidelity fixes: gallery + reviews ===== */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Google Play-like mobile screenshot viewer */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  background: rgba(32, 33, 36, .72);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
}

.lightbox.open { display: flex; }

.lightbox-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(86px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 18px 0;
  display: flex;
  align-items: center;
  z-index: 10;
  background: #000;
}

.lightbox-top button {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.lightbox-body {
  position: absolute;
  inset: calc(86px + env(safe-area-inset-top, 0px)) 0 0;
  width: 100%;
  height: auto;
  padding: 42px 36px calc(78px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-body img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: min(100%, 590px) !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center;
  border-radius: 0;
  flex: 0 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 1px 4px rgba(0,0,0,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #202124;
  z-index: 12;
}

.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }

.lightbox-counter {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  z-index: 12;
  min-width: 0;
  padding: 0;
}

/* Reviews should occupy the whole phone viewport, never a narrow centered card */
.reviews-modal {
  display: none;
  position: fixed;
  inset: 0 !important;
  width: 100% !important;
  max-width: none !important;
  height: 100vh;
  height: 100dvh;
  transform: none !important;
  z-index: 10000;
  background: rgba(32,33,36,.55);
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.reviews-modal.open { display: flex; }

.reviews-sheet {
  width: 100% !important;
  max-width: 100% !important;
  height: calc(100dvh - env(safe-area-inset-top, 0px));
  max-height: none !important;
  margin: env(safe-area-inset-top, 0px) 0 0;
  border-radius: 0 !important;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.reviews-sheet-header {
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  align-items: center;
  background: #fff;
}

.reviews-sheet-header img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
}

.reviews-sheet-filters {
  flex: 0 0 auto;
  padding: 14px 20px;
  gap: 10px;
  background: #fff;
}

.reviews-sheet-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 20px 24px;
  background: #fff;
}

@media (max-width: 480px) {
  .lightbox-body {
    padding-left: 36px;
    padding-right: 36px;
  }

  .lightbox-nav {
    width: 50px;
    height: 50px;
  }

  .lightbox-prev { left: 14px; }
  .lightbox-next { right: 14px; }
}
