:root {
  --primary-color: #01875F;
  --bg-color: #ffffff;
  --body-bg: #181818;
  /* Dark background outside the app container */
  --text-primary: #202124;
  /* Google's dark grey */
  --text-secondary: #5f6368;
  --star-color: #01875F;
  /* Green stars like reference */
  --divider-color: #dadce0;
  --modal-overlay: rgba(0, 0, 0, 0.6);
  --font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI", Arial, Roboto, sans-serif;
  --max-width: 506px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: var(--body-bg);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.app-container {
  width: 100%;
  max-width: var(--max-width);
  background-color: var(--bg-color);
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px;
  /* Space for tab bar */
  overflow-x: hidden;
}

/* --- Header Section --- */
.header-section {
  padding: 24px 24px 0 24px;
}

.app-header {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.app-icon {
  width: 92px;
  height: 92px;
  border-radius: 18px;
  /* Slightly more rounded like Play Store */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  object-fit: cover;
  flex-shrink: 0;
}

.app-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-title {
  font-size: 26px;
  /* Adjusted slightly for better fit */
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.dev-name {
  font-size: 14px;
  color: var(--primary-color);
  font-weight: 500;
  margin: 0 0 2px 0;
}

.verified-badge {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}

/* --- Stats Row --- */
.stats-row {
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  margin-bottom: 24px;
  align-items: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  width: 1px;
  background-color: var(--divider-color);
}

.stat-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.rating-star {
  width: 12px;
  height: 12px;
}

.age-rating-icon {
  height: 16px;
  width: auto;
}

/* --- Install Button --- */
.install-section {
  padding: 0 24px;
  margin-bottom: 24px;
}

.install-btn {
  width: 100%;
  height: 48px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}

.install-btn:active {
  transform: scale(0.98);
}

.install-btn-title {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.install-btn-subtitle {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.9;
}

.btn-flash {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: flash 2s infinite;
}

@keyframes flash {
  0% {
    left: -100%;
  }

  20% {
    left: 200%;
  }

  100% {
    left: 200%;
  }
}

/* --- Share Row --- */
.action-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--divider-color);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--primary-color);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.action-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* --- Screenshot Carousel --- */
.carousel-section {
  padding: 24px 0;
  overflow: hidden;
}

.carousel-container {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* smooth scroll iOS */
  scrollbar-width: none;
  /* Firefox */
}

.carousel-container::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

.screenshot-img {
  width: auto;
  /* Allow varied widths */
  height: 302px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  scroll-snap-align: start;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- Content Sections --- */
.content-section {
  padding: 0 24px 24px 24px;
  position: relative;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.section-arrow {
  width: 24px;
  height: 24px;
  fill: var(--text-secondary);
}

.text-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.updated-info {
  margin-top: 16px;
}

.updated-label {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 4px 0;
}

.updated-date {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* --- Data Safety --- */
.safety-card {
  border: 1px solid var(--divider-color);
  border-radius: 8px;
  padding: 16px;
  margin-top: 10px;
}

.safety-item {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.safety-item:last-child {
  margin-bottom: 0;
}

.safety-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: var(--text-secondary);
}

.safety-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* --- Review Section --- */
.review-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.review-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.rating-summary {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.rating-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.rating-number {
  font-size: 48px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.rating-stars-sm {
  color: var(--primary-color);
  font-size: 12px;
  margin-top: 4px;
}

.rating-total {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.rating-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  width: 10px;
}

.bar-track {
  flex: 1;
  height: 10px;
  background-color: #e8eaed;
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 5px;
}

.review-card {
  margin-bottom: 24px;
}

.review-user {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.review-stars {
  color: var(--primary-color);
  font-size: 12px;
}

.review-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.review-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 20px;
  margin-bottom: 12px;
}

.review-helpful {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.helpful-btns {
  display: flex;
  gap: 16px;
}

.helpful-btn {
  background: none;
  border: 1px solid #dadce0;
  /* More visible border */
  border-radius: 16px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.helpful-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: #9aa0a6;
  color: var(--text-primary);
}

/* --- Similar Games --- */
.similar-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
}

.similar-grid::-webkit-scrollbar {
  display: none;
}

.similar-item {
  width: 100px;
  flex-shrink: 0;
}

.similar-icon {
  width: 100px;
  height: 100px;
  border-radius: 20px;
  margin-bottom: 8px;
  display: block;
}

.similar-title {
  font-size: 12px;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 32px;
}

.similar-rating {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Footer --- */
.app-footer {
  padding: 24px;
  border-top: 1px solid var(--divider-color);
  margin-bottom: 50px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.footer-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}

.region-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 24px;
}

.region-flag {
  width: 24px;
  height: auto;
}

/* --- Tab Bar --- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: 56px;
  background-color: var(--bg-color);
  border-top: 1px solid var(--divider-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}

.tab-item.active {
  color: var(--primary-color);
}

.tab-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  margin-bottom: 2px;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
}

/* --- Modals/Overlays --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--modal-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.install-modal {
  background-color: white;
  width: 90%;
  max-width: 320px;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-overlay.active .install-modal {
  transform: translateY(0);
}

.modal-icon-wrapper {
  margin-bottom: 16px;
  position: relative;
}

.modal-icon {
  width: 64px;
  height: 64px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 14px;
  color: var(--primary-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 24px;
}

.progress-container {
  width: 100%;
  height: 6px;
  background-color: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
  display: none;
}

.progress-container.show {
  display: block;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--primary-color);
  transition: width 0.2s linear;
}

.modal-action-btn {
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  padding: 12px;
  border-radius: 24px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.modal-action-btn:disabled {
  background-color: #ccc;
  cursor: wait;
}

/* iOS Guide Modal specialized style */
.ios-guide-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--max-width);
  background-color: #f9f9f9;
  border-radius: 16px 16px 0 0;
  padding: 24px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  transition: transform 0.3s ease-out;
}

.ios-guide-modal.active {
  transform: translateX(-50%) translateY(0);
}

.ios-guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ios-guide-title {
  font-size: 18px;
  font-weight: 600;
}

.ios-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
}

.ios-step {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  background-color: white;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ios-step-icon {
  width: 32px;
  height: 32px;
}

.ios-step-text {
  font-size: 14px;
  color: #333;
}

.ios-step-hl {
  color: #0076FF;
  /* iOS Blue */
  font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}