*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1115;
  --surface: #1a1d23;
  --surface-2: #232730;
  --border: #2d323c;
  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --green: #01875f;
  --green-hover: #026e4d;
  --blue: #8ab4f8;
  --star: #ffc107;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  background: #000;
  font-family: 'Google Sans Text', 'Roboto', -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 460px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ===== 顶部栏 ===== */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  display: flex;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
}

.icon-btn:active { background: var(--surface-2); }

.topbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 24px;
  padding: 9px 14px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== 主体滚动区 ===== */
.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.scroll::-webkit-scrollbar { display: none; }

/* ===== 应用信息 ===== */
.app-info {
  display: flex;
  gap: 16px;
  padding: 20px 16px 12px;
}

.app-icon {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ff9000 0%, #ff5500 55%, #c9184a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(255, 100, 0, 0.35);
}

.app-icon span {
  font-size: 38px;
  font-weight: 700;
  color: #fff;
}

.app-icon.small {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.app-icon.small span { font-size: 18px; }

.app-meta {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.app-name {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
}

.app-dev {
  display: inline-block;
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
  margin-bottom: 10px;
}

.app-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: 6px;
  padding: 3px 8px;
}

/* ===== 统计行 ===== */
.stat-row {
  display: flex;
  align-items: center;
  padding: 4px 16px 16px;
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.stat strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 2px;
}

.star-mini {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat svg {
  color: var(--text-secondary);
}

.age-badge {
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--text-secondary);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
}

.stat-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* ===== 安装按钮 ===== */
.install-row {
  padding: 0 16px 20px;
}

.install-btn {
  width: 100%;
  background: var(--green);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 13px;
  border-radius: 24px;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s;
}

.install-btn:active {
  background: var(--green-hover);
  transform: scale(0.98);
}

.install-btn.small {
  width: auto;
  padding: 9px 24px;
  font-size: 13px;
}

/* ===== 截图轮播 ===== */
.screens {
  padding: 4px 0 24px 16px;
  overflow: hidden;
}

.screens-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-right: 16px;
}

.screens-track::-webkit-scrollbar { display: none; }

.screen-item {
  flex: 0 0 auto;
  width: 150px;
  height: 267px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  scroll-snap-align: start;
  position: relative;
}

.screen-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

/* ===== 关于 ===== */
.about {
  padding: 4px 16px 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
}

.about-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  position: relative;
}

.readmore-btn {
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

/* ===== 评分详情 ===== */
.rating-detail {
  padding: 4px 16px 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.rating-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

.rating-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.rating-big strong {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

.stars-row {
  color: var(--star);
  font-size: 13px;
  letter-spacing: 1px;
  margin: 4px 0 2px;
}

.rating-big span {
  font-size: 11px;
  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-row span {
  font-size: 11px;
  color: var(--text-secondary);
  width: 8px;
}

.bar {
  flex: 1;
  height: 5px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--text-secondary);
  border-radius: 4px;
}

.review-card {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.review-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.review-name {
  font-size: 13px;
  font-weight: 500;
}

.review-stars {
  color: var(--star);
  font-size: 11px;
  letter-spacing: 1px;
}

.review-date {
  color: var(--text-secondary);
  letter-spacing: 0;
  margin-left: 4px;
}

.review-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.bottom-spacer { height: 8px; }

/* ===== 底部固定安装栏 ===== */
.sticky-install {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.sticky-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sticky-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sticky-text strong {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-text span {
  font-size: 11px;
  color: var(--text-secondary);
}

@media (min-width: 500px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
  }
  .app {
    height: calc(100vh - 40px);
    max-height: 900px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  }
}

/* ===== RTL（阿拉伯语） ===== */
[dir="rtl"] .topbar-search {
  flex-direction: row-reverse;
}

[dir="rtl"] .app-info {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .app-badges {
  justify-content: flex-end;
}

[dir="rtl"] .review-head {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .review-date {
  margin-left: 0;
  margin-right: 4px;
}

[dir="rtl"] .sticky-left {
  flex-direction: row-reverse;
}

[dir="rtl"] .sticky-text {
  text-align: right;
}

[dir="rtl"] .back-btn svg {
  transform: scaleX(-1);
}

[dir="rtl"] .screens {
  padding: 4px 16px 24px 0;
}

[dir="rtl"] .screens-track {
  padding-right: 0;
  padding-left: 16px;
}
