* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-light: #80868b;
  --divider: #e0e0e0;
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --badge-bg: #e8eaed;
  --green: #34a853;
  --font: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ===== STATUS BAR ===== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px 4px;
  background: var(--bg);
  height: 28px;
}

.status-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
}

.signal-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ===== NAV BAR ===== */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  background: var(--bg);
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
}

.nav-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.nav-icon-btn:active {
  background: rgba(0,0,0,0.08);
}

.nav-actions {
  display: flex;
  gap: 2px;
}

/* ===== PAGE CONTENT ===== */
.page-content {
  padding-bottom: 80px;
}

/* ===== APP HEADER ===== */
.app-header {
  display: flex;
  gap: 16px;
  padding: 12px 16px 16px;
  align-items: flex-start;
}

.app-icon-wrap {
  position: relative;
  flex-shrink: 0;
}

.app-icon {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.08);
  background: #f0f0f0;
  display: block;
}

.live-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  border: 2px solid white;
}

.app-title-block {
  flex: 1;
  padding-top: 2px;
  min-width: 0;
}

.app-name {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 4px;
  word-wrap: break-word;
}

.developer-link {
  display: block;
  font-size: 13.5px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 4px;
  text-decoration: none;
  cursor: pointer;
}

.developer-link:active { opacity: 0.7; }

.app-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ===== STATS ROW ===== */
.stats-row {
  display: flex;
  align-items: center;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.stats-row::-webkit-scrollbar { display: none; }

.stat-item {
  flex: 1;
  text-align: center;
  min-width: 60px;
}

.stat-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  height: 28px;
  margin-bottom: 2px;
}

.stat-downloads {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.content-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--badge-bg);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid #d0d0d0;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--divider);
  flex-shrink: 0;
}

/* ===== INSTALL BUTTON ===== */
.install-wrap {
  padding: 16px;
}

.install-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  color: white;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: var(--font);
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.4);
}

.install-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}

.install-btn:active::after {
  background: rgba(255,255,255,0.15);
}

.install-btn:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(26, 115, 232, 0.3);
}

.install-btn.installing {
  background: linear-gradient(135deg, #12963e, #0d7a32);
  box-shadow: 0 2px 8px rgba(18, 150, 62, 0.4);
  pointer-events: none;
}

.apk-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== SCREENSHOTS ===== */
.screenshots-section {
  padding: 0 0 16px;
  border-top: 1px solid var(--divider);
  padding-top: 16px;
}

.screenshots-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 16px;
  -ms-overflow-style: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.screenshots-scroll::-webkit-scrollbar { display: none; }

.screenshot-img {
  height: 260px;
  width: auto;
  max-width: 160px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
  scroll-snap-align: start;
  border: 1px solid rgba(0,0,0,0.08);
  background: #f0f0f0;
  cursor: pointer;
  transition: transform 0.15s;
}

.screenshot-img:active {
  transform: scale(0.97);
}

/* Screenshot lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 12px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== ABOUT SECTION ===== */
.about-section {
  padding: 16px 16px 8px;
  border-top: 1px solid var(--divider);
}

.about-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin-bottom: 8px;
}

.about-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.about-arrow {
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.app-tagline {
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.5;
}

.description-wrap {
  position: relative;
  max-height: 80px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.description-wrap.expanded {
  max-height: 1000px;
}

.description-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-line;
}

.desc-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, white);
  pointer-events: none;
  transition: opacity 0.3s;
}

.desc-fade.hidden { opacity: 0; }

.read-more-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0 8px;
  font-family: var(--font);
  display: block;
}
.read-more-btn:active { opacity: 0.7; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 62px;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px 4px;
  font-family: var(--font);
  transition: color 0.15s;
}

.bottom-nav-item span {
  font-size: 10.5px;
  font-weight: 400;
}

.bottom-nav-item.active {
  color: var(--primary);
}

/* ===== INSTALL BUTTON STATES ===== */
.install-btn.downloaded {
  background: linear-gradient(135deg, #34a853, #1e7e34);
  box-shadow: 0 2px 8px rgba(52, 168, 83, 0.45);
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.btn-check {
  font-size: 18px;
  vertical-align: middle;
  margin-right: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== INSTALL GUIDE OVERLAY ===== */
.install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.install-guide {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.guide-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.install-guide h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  margin-bottom: 24px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-secondary);
  padding: 12px 14px;
  border-radius: 12px;
}

.step-num {
  background: var(--primary);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-step span:last-child {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  padding-top: 2px;
}

.guide-close {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  margin-bottom: 10px;
}

.guide-redownload {
  width: 100%;
  padding: 12px;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--divider);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== LOADING SHIMMER ===== */
.shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== NO APK STATE ===== */
.no-apk-note {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  margin-top: 6px;
}

/* ===== REVIEWS SECTION ===== */
.reviews-section {
  padding: 16px 16px 8px;
  border-top: 8px solid var(--bg-secondary);
}

.reviews-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.reviews-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.reviews-note {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
}

.reviews-note::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%235f6368'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Rating Summary */
.rating-summary {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}

.rating-big {
  text-align: center;
  flex-shrink: 0;
}

.rating-number {
  display: block;
  font-size: 52px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.rating-stars-row {
  color: #f0a500;
  font-size: 16px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.rating-total {
  font-size: 12px;
  color: var(--text-secondary);
}

.rating-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.bar-num {
  font-size: 12px;
  color: var(--text-secondary);
  width: 8px;
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: var(--badge-bg);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #1a73e8;
  border-radius: 4px;
}

/* Review Cards */
.review-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

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

.reviewer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reviewer-info {
  flex: 1;
}

.reviewer-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

.review-stars {
  font-size: 13px;
  color: #f0a500;
  letter-spacing: 1px;
}

.review-date {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.review-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.review-helpful {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.helpful-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.helpful-btns {
  display: flex;
  gap: 6px;
}

.helpful-btn {
  background: none;
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, color 0.15s;
}

.helpful-btn:active { background: var(--bg-secondary); }
.helpful-btn.active { color: var(--primary); border-color: var(--primary); background: rgba(26,115,232,0.06); }

.see-all-reviews {
  background: none;
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  font-family: var(--font);
  width: 100%;
  margin-top: 16px;
  transition: background 0.15s;
}

.see-all-reviews:active { background: rgba(26,115,232,0.06); }

/* ===== WHAT'S NEW SECTION ===== */
.dev-section {
  padding: 16px;
  border-top: 8px solid var(--bg-secondary);
}

.dev-section-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.dev-section-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
}

.dev-section-date {
  font-size: 12px;
  color: var(--text-light);
}

/* ===== RESPONSIVE / SAFE AREA ===== */
@media (max-width: 360px) {
  .app-icon { width: 70px; height: 70px; }
  .app-name { font-size: 18px; }
  .install-btn { font-size: 15px; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .install-guide {
    background: #1c1c1e;
  }
  .guide-close { background: #2196f3; }

  :root {
    --bg: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --text: #f2f2f7;
    --text-secondary: #aeaeb2;
    --text-light: #636366;
    --divider: #38383a;
    --badge-bg: #3a3a3c;
  }
  .desc-fade {
    background: linear-gradient(transparent, #1c1c1e);
  }
  .app-icon {
    border-color: rgba(255,255,255,0.08);
  }
  .install-btn {
    background: linear-gradient(135deg, #2196f3, #1565c0);
  }
}
