:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --sub: #86868b;
  --blue: #007aff;
  --green: #34c759;
  --border: #e5e5ea;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.top-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar .tab {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--sub);
}

.top-bar .tab.active {
  background: var(--text);
  color: #fff;
}

.main {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
}

.stock-tip {
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 16px;
}

.app-list { display: flex; flex-direction: column; gap: 12px; }

.app-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.app-row .icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: #ddd;
  flex-shrink: 0;
}

.app-row .info { flex: 1; min-width: 0; }
.app-row .name { font-size: 17px; font-weight: 600; }
.app-row .meta { font-size: 13px; color: var(--sub); margin-top: 4px; }

.app-row .get-btn {
  background: #f2f2f7;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 16px;
  flex-shrink: 0;
}

/* 详情页 */
.detail-header {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
}

.detail-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.detail-top .icon {
  width: 100px;
  height: 100px;
  border-radius: 22px;
  object-fit: cover;
  background: #ddd;
}

.detail-top .title-block { flex: 1; }
.detail-top .name { font-size: 22px; font-weight: 700; line-height: 1.2; }
.detail-top .developer { color: var(--blue); font-size: 14px; margin-top: 6px; }

.install-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 22px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.install-btn:disabled {
  background: #b0b0b5;
  cursor: not-allowed;
}

.install-btn.done {
  background: var(--green);
}

.install-status {
  text-align: center;
  font-size: 13px;
  color: var(--sub);
  margin-top: 10px;
  min-height: 18px;
}

.reset-cert-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: none;
  background: transparent;
  color: #ff3b30;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.reset-cert-btn:disabled {
  color: #b0b0b5;
  cursor: not-allowed;
}

.udid-help-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f9f9fb;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: #333;
  line-height: 1.6;
}

.udid-help-box p { margin: 0 0 6px; }

.udid-help-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px !important;
}

.udid-help-note {
  margin-top: 10px !important;
  font-size: 12px;
  color: var(--sub);
}

.open-settings-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: none;
  border-radius: 20px;
  background: #34c759;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.udid-manual-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: var(--blue);
  text-decoration: underline;
}

.section {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.section h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.section p {
  font-size: 15px;
  line-height: 1.5;
  color: #333;
}

.stats {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}

.stat {
  flex: 1;
  text-align: center;
  border-right: 1px solid var(--border);
  padding: 4px 8px;
}

.stat:last-child { border-right: none; }
.stat .val { font-size: 16px; font-weight: 600; color: var(--sub); }
.stat .lbl { font-size: 11px; color: var(--sub); margin-top: 4px; }

.empty {
  text-align: center;
  color: var(--sub);
  padding: 40px 20px;
}

.screenshots {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.screenshots img {
  height: 280px;
  border-radius: 12px;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 999;
  display: none;
}
