*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: light dark;

  --page-bg:           #e8eaed;
  --bg:                #FFFFFF;
  --text-primary:      #202124;
  --text-secondary:    #5F6368;
  --text-muted:        #898989;
  --install-btn-bg:    #01875F;
  --install-btn-fg:    #FFFFFF;
  --border:            #DADCE0;
  --divider:           #EAEAEA;
  --progress-track:    #C2E0D6;
  --accent:            #047A56;
  --modal-scrim:       rgba(0, 0, 0, 0.85);
}

@media (min-width: 840px) {
  :root { --page-bg: #eee; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg:         #1F1F1F;
    --bg:              #1F1F1F;
    --text-primary:    #E8EAED;
    --text-secondary:  #BDC1C6;
    --text-muted:      #9AA0A6;
    --install-btn-bg:  #A8DAB5;
    --install-btn-fg:  #000000;
    --border:          #3C4043;
    --divider:         #2D2D2D;
    --progress-track:  #29402F;
    --accent:          #6FD3A0;
    --modal-scrim:     rgba(0, 0, 0, 0.92);
  }

  .rating-stars img[src$="green.png"],
  .review-stars-row img[src$="green.png"] {
    filter: brightness(1.1);
  }
}

body, html {
  background-color: var(--page-bg);
  color: var(--text-primary);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

/* ── Container ── */
.container {
  max-width: 100%;
  margin: 0 auto;
  background-color: var(--bg);
  min-height: 100vh;
  padding: 16px 20px 30px;
  text-align: left;
}

@media (min-width: 840px) {
  .container {
    max-width: 720px;
    min-height: auto;
    margin: 20px auto;
    box-shadow: 0 3px 4px 0 rgba(0,0,0,.14), 0 3px 3px -2px rgba(0,0,0,.12), 0 1px 8px 0 rgba(0,0,0,.2);
    padding: 25px;
    border-radius: 4px;
  }
}

/* ── App Header ── */
.app-header {
  display: flex;
  align-items: flex-start;
}

.app-icon {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  flex-shrink: 0;
  object-fit: cover;
}

.app-header-info {
  margin-left: 16px;
  flex: 1;
  min-width: 0;
}

.app-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 26px;
  word-break: break-word;
}

.app-subtitle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 5px;
}

.app-developer,
.app-category {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

/* ── Info Bar ── */
.info-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 14px 0 10px;
  width: calc(100% + 40px);
  margin-left: -20px;
  padding: 0;
  overflow-x: auto;
}

.info-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 25%;
  min-width: 70px;
  height: 40px;
  border-right: 1px solid var(--border);
  padding-top: 2px;
}

.info-bar-item:last-child {
  border-right: none;
}

.info-bar-value {
  display: flex;
  align-items: center;
  height: 20px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}

.info-bar-value svg {
  width: 16px;
  height: 16px;
  fill: var(--text-primary);
  flex-shrink: 0;
}

.info-bar-label {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 4px;
}

.info-bar-age {
  border: 1px solid var(--text-primary);
  font-size: 12px;
  padding: 0 3px;
  line-height: 1.3;
}

.info-bar-icon svg {
  width: 18px;
  height: 18px;
}

/* ── Install Button & Progress ── */
.install-wrapper {
  margin: 12px 0 16px;
}

.install-btn {
  display: block;
  width: 100%;
  height: 48px;
  background-color: var(--install-btn-bg);
  color: var(--install-btn-fg);
  font-size: 14px;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  letter-spacing: .25px;
}

.install-btn:active {
  opacity: .9;
}

.offer-disclaimer {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
}

.progress-container {
  display: none;
  flex-direction: column;
  width: 100%;
}

.progress-container.active {
  display: flex;
}

.progress-word {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.progress-graph {
  height: 5px;
  border-radius: 30px;
  background: var(--progress-track);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 5px;
  background: var(--install-btn-bg);
  border-radius: 30px;
  transition: width 0.1s linear;
}

/* ── Screenshot Gallery ── */
.gallery {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

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

.gallery-img {
  flex-shrink: 0;
  scroll-snap-align: start;
  cursor: pointer;
}

.gallery-img img {
  border-radius: 16px;
  height: 210px;
  width: auto;
  display: block;
}

/* ── Section Dividers ── */
.divider {
  height: 1px;
  background-color: var(--divider);
  margin: 16px 0;
}

/* ── About Section ── */
.section-title {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.description-text {
  font-size: 14px;
  line-height: 22px;
  color: var(--text-secondary);
  position: relative;
}

.description-text.collapsed {
  max-height: 90px;
  overflow: hidden;
}

.description-shadow {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.description-text.collapsed + .description-shadow {
  display: block;
}

.description-text:not(.collapsed) + .description-shadow {
  display: none;
}

.expand-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  font-family: 'Roboto', sans-serif;
}

/* ── Rating Section ── */
.rating-header {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.rating-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.rating-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding-right: 16px;
}

.rating-number {
  font-size: 56px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1;
}

.rating-stars {
  display: flex;
  gap: 2px;
  margin: 4px 0;
}

.rating-stars img {
  width: 12px;
  height: 12px;
}

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

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

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

.rating-bar-label {
  width: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

.rating-bar-track {
  flex: 1;
  height: 10px;
  background: var(--progress-track);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  background: var(--install-btn-bg);
  border-radius: 10px;
}

/* ── Reviews ── */
.review-card {
  display: flex;
  padding: 12px 0;
}

.review-card.hidden {
  display: none;
}

.review-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.review-content {
  flex: 1;
  padding-left: 12px;
}

.review-header {
  display: flex;
  align-items: center;
}

.review-info {
  flex: 1;
}

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

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

.review-stars-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px;
  min-width: 80px;
}

.review-stars-row img {
  width: 12px;
  height: 12px;
}

.review-thumbs {
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding-left: 8px;
}

.review-thumbs .material-icons {
  font-size: 20px;
  color: var(--text-muted);
}

.review-text {
  font-size: 14px;
  line-height: 22px;
  color: var(--text-secondary);
  padding-top: 8px;
  word-wrap: break-word;
}

.reviews-toggle-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  font-family: 'Roboto', sans-serif;
}

/* ── What's New ── */
.whats-new-text {
  font-size: 14px;
  line-height: 22px;
  color: var(--text-secondary);
  padding-top: 8px;
}

/* ── Additional Info ── */
.additional-info {
  margin-top: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  padding: 16px 0;
}

.info-item-label {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.info-item-value {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
}

/* ── Image Modal ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-scrim);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-overlay img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  filter: invert(1);
  transform: scaleX(-1);
}
