* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #00c853; --primary-dark: #00a844; --dark: #1a1a1a;
  --gray: #888; --light-gray: #f5f5f7; --border: #e5e5ea; --radius: 16px;
}
body { font-family: 'Cairo', sans-serif; background: var(--light-gray); color: var(--dark); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; width: 100%; }
main { flex: 1; }
.header { background: var(--dark); color: #fff; padding: 14px 0; position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap; }
.search-box { flex: 1; max-width: 400px; padding: 10px 18px; border-radius: 24px; border: none; font-family: inherit; font-size: 14px; outline: none; }
.hero { text-align: center; padding: 32px 0 16px; }
.hero h2 { font-size: 1.6rem; margin-bottom: 8px; }
.hero p { color: var(--gray); font-size: 15px; }
.categories { display: flex; gap: 8px; overflow-x: auto; padding: 20px 0; }
.cat-btn { padding: 8px 18px; border-radius: 20px; border: 2px solid var(--border); background: #fff; cursor: pointer; white-space: nowrap; font-family: inherit; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.section-title { margin: 24px 0 16px; font-size: 1.3rem; }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 48px; }
.app-card { background: #fff; border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform .2s, box-shadow .2s; }
.app-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.app-icon { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; margin-bottom: 12px; background: var(--light-gray); }
.app-info h3 { font-size: 15px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev { font-size: 12px; color: var(--gray); }
.meta { display: flex; gap: 10px; font-size: 12px; color: #666; margin-top: 8px; justify-content: center; }
#app-detail { padding: 24px 16px; max-width: 800px; margin: 0 auto; }
.app-header { display: flex; gap: 20px; align-items: center; background: #fff; padding: 24px; border-radius: var(--radius); margin-bottom: 20px; flex-wrap: wrap; }
.detail-icon { width: 100px; height: 100px; border-radius: 22px; object-fit: cover; }
.app-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.stats { display: flex; gap: 16px; margin-top: 10px; color: #666; font-size: 14px; flex-wrap: wrap; }
.download-btn { display: block; text-align: center; background: var(--primary); color: #fff; padding: 16px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 1.1rem; margin: 20px 0; transition: background .2s; }
.download-btn:hover { background: var(--primary-dark); }
.detail-section { background: #fff; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; }
.detail-section h2 { font-size: 1.1rem; margin-bottom: 12px; }
.screenshots { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.screenshots img { height: 220px; border-radius: 12px; flex-shrink: 0; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 10px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.info-table td:first-child { color: var(--gray); width: 45%; }
.info-table code { background: var(--light-gray); padding: 2px 8px; border-radius: 6px; font-size: 13px; direction: ltr; display: inline-block; }
.permissions { display: flex; flex-wrap: wrap; gap: 8px; }
.perm { background: #fff3cd; color: #856404; padding: 4px 12px; border-radius: 12px; font-size: 13px; }
.footer { text-align: center; padding: 24px; color: var(--gray); font-size: 14px; border-top: 1px solid var(--border); margin-top: 40px; }
.loading, .error, .empty { text-align: center; padding: 40px; color: var(--gray); grid-column: 1 / -1; }
.error { color: #dc3545; }
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .logo { text-align: center; }
  .search-box { max-width: 100%; }
  .apps-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .app-header { padding: 16px; }
  .detail-icon { width: 80px; height: 80px; }
}