/* v40 — Xiaomi GetApps Style
   Palette: Primary #ff6900 | Accent #ff8a00 | Surface #f8f8f8 | Text #333333
   Font: Inter 400/600
*/

:root {
  --primary: #ff6900;
  --primary-dark: #e05e00;
  --accent: #ff8a00;
  --surface: #f8f8f8;
  --bg: #ffffff;
  --text: #333333;
  --muted: #888888;
  --border: #eeeeee;
  --tag-bg: #fff3e0;
  --tag-text: #e65100;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-icon: 20%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* ── Shell ── */
.app-shell {
  width: min(100%, 480px);
  padding-bottom: 32px;
}

/* ── Top Bar ── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.avatar-btn {
  color: var(--muted);
}

/* ── App Card ── */
.app-card-section {
  padding: 20px 16px 12px;
}

.app-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.app-icon-wrap {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-icon);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.app-details {
  flex: 1;
  min-width: 0;
}

.app-name {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.app-category {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.app-rating {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stars {
  color: var(--primary);
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.rating-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Install Section ── */
.install-section {
  padding: 4px 16px 12px;
}

.install-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s, opacity 0.15s;
}

/* Fill animation on press */
.install-btn:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.install-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* ── Category Tags ── */
.tags-section {
  padding: 0 16px 20px;
}

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  min-height: 32px;
  line-height: 1.25;
}

/* ── Screenshots ── */
.screenshot-section {
  padding: 0 16px 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.screenshot-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.screenshot-track::-webkit-scrollbar {
  display: none;
}

.screenshot-card {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--border);
  scroll-snap-align: start;
  background: var(--surface);
}

/* ── Related Apps ── */
.related-section {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

.related-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 80px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.related-track::-webkit-scrollbar {
  display: none;
}

.related-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  scroll-snap-align: start;
  min-width: 0;
}

.related-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.related-name {
  font-size: 0.75rem;
  color: var(--text);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.related-rating {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

/* ── Description ── */
.description-section {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

.description-text {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.last-updated {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Ratings ── */
.ratings-section {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

.rating-overview {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.rating-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.score-number {
  margin: 0;
  font-size: 3.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.score-stars {
  color: var(--primary);
  font-size: 0.9rem;
  letter-spacing: 1px;
  margin: 4px 0;
}

.score-count {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.rating-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.bar-label {
  width: 10px;
  text-align: right;
  flex-shrink: 0;
}

.bar {
  flex: 1;
  height: 7px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}

/* ── Reviews ── */
.reviews-section {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

.review-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.reviewer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e67e22;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.reviewer-info {
  flex: 1;
}

.reviewer-info strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text);
}

.review-stars {
  color: var(--primary);
  font-size: 0.78rem;
}

.review-date {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

.review-text {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}

.feedback-btns {
  display: flex;
  gap: 8px;
}

.pill-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  min-height: 30px;
  transition: background 0.15s;
}

.pill-btn:active {
  background: var(--tag-bg);
}

/* ── Footer ── */
.app-footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.footer-links a {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-copy {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
  .install-btn {
    transition: none;
  }
}
